EnsidiaFails

181 - Suggestion: !reset and !oreset

!stats and !ostats are working very well and are very handy. Can also get the same functionality by open the interface menu and click the button, but that takes time and many clicks. So writing !ostats is more convenient.

But what about !reset? It doesn't exist. Have to go all the way into the interface menu and click it there.

(Hmm, while I'm writing this I start to think: Why can't it also react to "/efreset" or "/ef reset"? That way it's easier to to access these functions from other addons and macros.)

What I have done and will show you is how it could be done by adding some lines in EnsidiaFails.lua
.
.
.
.
.
EnsidiaFails.lua

Changes to make it reset stats and ostats with chat commands.

Row 441:
--------

Insert the following to allow for /ef reset and /ef oreset.

"
        self:RegisterChatCommand("ef reset", "reset")
        self:RegisterChatCommand("ef oreset", "oreset")
"

Row 497:
--------

Insert the following in row 495 or after:
"
elseif msg:find("!ostats") then
"

"
        elseif msg:find("!reset") then
            target = event:sub(10)
            local Time = GetTime()
            if not LastTime then
                LastTime = Time
                addon:reset(target,channelnum)
            elseif LastTime+10.000 < Time then
                addon:reset(target,channelnum)
                LastTime=nil
            end
        elseif msg:find("!oreset") then
            target = event:sub(10)
            local Time = GetTime()
            if not LastTime then
                LastTime = Time
                addon:oreset(target,channelnum)
            elseif LastTime+10.000 < Time then
                addon:oreset(target,channelnum)
                LastTime=nil
            end
"
            
            
            
            
Row 894 (when !reset and !oreset are added):
--------------------------------------------
Switch out the whole function "function addon:reset" with:

"
function addon:reset(target,channelnum)
    EnsidiaFails_FailCount = {}
    if not channelnum then
        DEFAULT_CHAT_FRAME:AddMessage(L["Fails are reseted."]);
    else
        addon:SendChatMessage("Fails are reseted.", target, channelnum)
    end
end
"

Row 903 (when all previous is added):
-------------------------------------
Switch out the whole function "function addon:oreset" with:

"
function addon:oreset(target,channelnum)
    EnsidiaFails_FailCount = {}
    EnsidiaFails_OFailCount = {}
    if not target or channelnum then
        DEFAULT_CHAT_FRAME:AddMessage(L["All and overall fails are reseted."]);
    else
        addon:SendChatMessage("All and overall fails are reseted.", target, channelnum)
    end
end
"

User When Change
afkish Apr 05, 2014 at 16:17 UTC Changed description:
  "
  function addon:reset(target,channelnum)
  	EnsidiaFails_FailCount = {}
- 	if not target or channelnum then
+ 	if not channelnum then
  		DEFAULT_CHAT_FRAME:AddMessage(L["Fails are reseted."]);
  	else
  		addon:SendChatMessage("Fails are reseted.", target, channelnum)
afkish Apr 03, 2014 at 22:55 UTC Changed description:
+ Row 441:
+ --------
+
+ Insert the following to allow for /ef reset and /ef oreset.
+
+ "
+ 		self:RegisterChatCommand("ef reset", "reset")
+ 		self:RegisterChatCommand("ef oreset", "oreset")
+ "
+
+
+
- Row 495:
+ Row 497:
  --------
  Insert the following in row 495 or after:
----------------------------------------
- Row 892 (when !reset and !oreset are added):
+ Row 894 (when !reset and !oreset are added):
  --------------------------------------------
  Switch out the whole function "function addon:reset" with:
----------------------------------------
- Row 901 (when all previous is added):
+ Row 903 (when all previous is added):
  -------------------------------------
  Switch out the whole function "function addon:oreset" with:
afkish Apr 03, 2014 at 22:17 UTC Changed description:
  "
  function addon:reset(target,channelnum)
  	EnsidiaFails_FailCount = {}
+ 	if not target or channelnum then
+ 		DEFAULT_CHAT_FRAME:AddMessage(L["Fails are reseted."]);
+ 	else
- 	addon:SendChatMessage("Fails are reseted.", target, channelnum)
+ 		addon:SendChatMessage("Fails are reseted.", target, channelnum)
- 	--DEFAULT_CHAT_FRAME:AddMessage(L["reseted"]);
+ 	end
  end
  "
- Row 898 (when all previous is added):
+ Row 901 (when all previous is added):
  -------------------------------------
  Switch out the whole function "function addon:oreset" with:
  "
  function addon:oreset(target,channelnum)
  	EnsidiaFails_FailCount = {}
  	EnsidiaFails_OFailCount = {}
+ 	if not target or channelnum then
+ 		DEFAULT_CHAT_FRAME:AddMessage(L["All and overall fails are reseted."]);
+ 	else
- 	addon:SendChatMessage("All and overall fails are reseted.", target, channelnum)
+ 		addon:SendChatMessage("All and overall fails are reseted.", target, channelnum)
- 	--DEFAULT_CHAT_FRAME:AddMessage(L["oreseted"]);
+ 	end
  end
  "
afkish Apr 02, 2014 at 18:02 UTC Changed description:
  			local Time = GetTime()
  			if not LastTime then
  				LastTime = Time
- 				addon:reset()
+ 				addon:reset(target,channelnum)
  			elseif LastTime+10.000 < Time then
- 				addon:reset()
+ 				addon:reset(target,channelnum)
  				LastTime=nil
  			end
  		elseif msg:find("!oreset") then
  			target = event:sub(10)
  			local Time = GetTime()
  			if not LastTime then
  				LastTime = Time
- 				addon:oreset()
+ 				addon:oreset(target,channelnum)
  			elseif LastTime+10.000 < Time then
- 				addon:oreset()
+ 				addon:oreset(target,channelnum)
  				LastTime=nil
  			end
  "
----------------------------------------
  Switch out the whole function "function addon:oreset" with:

  "
- function addon:oreset()
+ function addon:oreset(target,channelnum)
  	EnsidiaFails_FailCount = {}
  	EnsidiaFails_OFailCount = {}
  	addon:SendChatMessage("All and overall fails are reseted.", target, channelnum)
afkish Apr 02, 2014 at 17:54 UTC Changed description:
  function addon:oreset()
  	EnsidiaFails_FailCount = {}
  	EnsidiaFails_OFailCount = {}
- 	addon:SendChatMessage("Fails are reseted.", target, channelnum)
+ 	addon:SendChatMessage("All and overall fails are reseted.", target, channelnum)
  	--DEFAULT_CHAT_FRAME:AddMessage(L["oreseted"]);
  end
  "
afkish Apr 02, 2014 at 17:50 UTC Changed description:
  "
  function addon:reset(target,channelnum)
  	EnsidiaFails_FailCount = {}
- 	addon:SendChatMessage("Reseted.", target, channelnum)
+ 	addon:SendChatMessage("Fails are reseted.", target, channelnum)
  	--DEFAULT_CHAT_FRAME:AddMessage(L["reseted"]);
  end
  "
----------------------------------------
  function addon:oreset()
  	EnsidiaFails_FailCount = {}
  	EnsidiaFails_OFailCount = {}
- 	addon:SendChatMessage("Reseted.", target, channelnum)
+ 	addon:SendChatMessage("Fails are reseted.", target, channelnum)
  	--DEFAULT_CHAT_FRAME:AddMessage(L["oreseted"]);
  end
  "
afkish Apr 02, 2014 at 17:21 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 2 comments
  • Avatar of afkish afkish Apr 03, 2014 at 22:17 UTC - 0 likes

    if not target or channelnum then

    is used to give the feedback as Print() instead of the addon:SendChatMessage tells it as /say when no target/channel is predefined.

    Also better to give some kind of feedback of what happened than nothing at all if that is the other solution than /say.

  • Avatar of afkish afkish Apr 02, 2014 at 17:54 UTC - 0 likes

    Just changed the chat output so it's more clear which addon and which function they are related to.

  • 2 comments

Facts

Last updated
Apr 05, 2014
Reported
Apr 02, 2014
Status
New - Issue has not had initial review yet.
Type
Enhancement - A change which is intended to better the project in some way
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees