From 9179ef5f16fe760fbe7a0d768380666332ff7982 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 30 May 2012 20:34:35 +0300 Subject: Reset kill counters on levelup. --- src/gui/killstats.cpp | 51 +++++++++++++++++++++++++++++++++------------------ src/gui/killstats.h | 2 ++ 2 files changed, 35 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index faf25f27f..f46d17bdf 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -144,15 +144,7 @@ void KillStats::action(const gcn::ActionEvent &event) mLine6->setCaption(strprintf( _("No. of avg mob to next level: %s"), "?")); - m1minExpTime = 0; - m1minExpNum = 0; - m1minSpeed = 0; - m5minExpTime = 0; - m5minExpNum = 0; - m5minSpeed = 0; - m15minExpTime = 0; - m15minExpNum = 0; - m15minSpeed = 0; + resetTimes(); } else if (event.getId() == "timer") { @@ -162,18 +154,23 @@ void KillStats::action(const gcn::ActionEvent &event) mLine7->setCaption(strprintf( _("Kills/Min: %s, Exp/Min: %s"), "?", "?")); - m1minExpTime = 0; - m1minExpNum = 0; - m1minSpeed = 0; - m5minExpTime = 0; - m5minExpNum = 0; - m5minSpeed = 0; - m15minExpTime = 0; - m15minExpNum = 0; - m15minSpeed = 0; + resetTimes(); } } +void KillStats::resetTimes() +{ + m1minExpTime = 0; + m1minExpNum = 0; + m1minSpeed = 0; + m5minExpTime = 0; + m5minExpNum = 0; + m5minSpeed = 0; + m15minExpTime = 0; + m15minExpNum = 0; + m15minSpeed = 0; +} + void KillStats::gainXp(int xp) { if (xp == PlayerInfo::getAttribute(EXP_NEEDED)) @@ -451,5 +448,23 @@ void KillStats::processEvent(Channels channel A_UNUSED, gainXp(event.getInt("newValue") - event.getInt("oldValue")); // update(); } + else if (id == LEVEL) + { + mKillCounter = 0; + mKillTCounter = 0; + mExpCounter = 0; + mExpTCounter = 0; + mLine3->setCaption(strprintf("1%% = %d exp, avg mob for 1%%: %s", + PlayerInfo::getAttribute(EXP_NEEDED) / 100, "?")); + mLine4->setCaption(strprintf(_( + "Kills: %s, total exp: %s"), "?", "?")); + mLine5->setCaption(strprintf(_("Avg Exp: %s"), "?")); + mLine6->setCaption(strprintf( + _("No. of avg mob to next level: %s"), "?")); + mLine7->setCaption(strprintf( + _("Kills/Min: %s, Exp/Min: %s"), "?", "?")); + + resetTimes(); + } } } diff --git a/src/gui/killstats.h b/src/gui/killstats.h index af4891afe..64aef4585 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -85,6 +85,8 @@ class KillStats : public Window, gcn::ActionListener, public Listener void processEvent(Channels channel A_UNUSED, const DepricatedEvent &event); + void resetTimes(); + private: void validateJacko(); -- cgit v1.2.3-70-g09d2