Suggestion: !reset and !oreset #181


  • New
  • Enhancment
Open
  • _ForgeUser5299679 created this issue Apr 2, 2014

    !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
    "

  • _ForgeUser5299679 added the tags New Enhancment Apr 2, 2014
  • _ForgeUser5299679 edited description Apr 2, 2014
  • _ForgeUser5299679 posted a comment Apr 2, 2014

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

  • _ForgeUser5299679 edited description Apr 2, 2014
  • _ForgeUser5299679 edited description Apr 3, 2014
  • _ForgeUser5299679 posted a comment Apr 3, 2014

    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.

  • _ForgeUser5299679 edited description Apr 3, 2014
  • _ForgeUser5299679 edited description Apr 5, 2014

To post a comment, please login or register a new account.