GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/windows/killstats.h Lines: 1 1 100.0 %
Date: 2021-03-17 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2009  The Mana World Development Team
4
 *  Copyright (C) 2011-2019  The ManaPlus Developers
5
 *  Copyright (C) 2009-2021  Andrei Karas
6
 *
7
 *  This file is part of The ManaPlus Client.
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  any later version.
13
 *
14
 *  This program is distributed in the hope that it will be useful,
15
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 *  GNU General Public License for more details.
18
 *
19
 *  You should have received a copy of the GNU General Public License
20
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 */
22
23
#ifndef GUI_WINDOWS_KILLSTATS_H
24
#define GUI_WINDOWS_KILLSTATS_H
25
26
#include "listeners/actionlistener.h"
27
#include "listeners/attributelistener.h"
28
29
#include "gui/widgets/window.h"
30
31
class Label;
32
class Button;
33
34
3
class KillStats final : public Window,
35
                        public ActionListener,
36
                        public AttributeListener
37
{
38
    public:
39
        /**
40
         * Constructor.
41
         */
42
        KillStats();
43
44
        A_DELETE_COPY(KillStats)
45
46
        /**
47
         * Stuff.
48
         */
49
        void action(const ActionEvent &event) override final;
50
51
        void gainXp(int64_t Xp);
52
53
        /**
54
         * Recalc stats if needed
55
         */
56
        void recalcStats();
57
58
        /**
59
         * Updates this dialog
60
         */
61
        void update();
62
63
        void resetTimes();
64
65
        void attributeChanged(const AttributesT id,
66
                              const int64_t oldVal,
67
                              const int64_t newVal) override final;
68
69
    private:
70
        time_t mKillTimer;  /**< Timer for kill stats. */
71
        Button *mResetButton A_NONNULLPOINTER;
72
        Button *mTimerButton A_NONNULLPOINTER;
73
        Label *mLine1;
74
        Label *mLine2;
75
        Label *mLine3;
76
        Label *mLine4 A_NONNULLPOINTER;
77
        Label *mLine5 A_NONNULLPOINTER;
78
        Label *mLine6 A_NONNULLPOINTER;
79
        Label *mLine7 A_NONNULLPOINTER;
80
81
        Label *mExpSpeed1Label A_NONNULLPOINTER;
82
        Label *mExpTime1Label A_NONNULLPOINTER;
83
        Label *mExpSpeed5Label A_NONNULLPOINTER;
84
        Label *mExpTime5Label A_NONNULLPOINTER;
85
        Label *mExpSpeed15Label A_NONNULLPOINTER;
86
        Label *mExpTime15Label A_NONNULLPOINTER;
87
88
        Label *mLastKillExpLabel A_NONNULLPOINTER;
89
90
        int mKillCounter;   /**< Session Kill counter. */
91
        int64_t mExpCounter;  /**< Session Exp counter. */
92
        int mKillTCounter;   /**< Timer Kill counter. */
93
        int64_t mExpTCounter;    /**< Timer Exp counter. */
94
95
        time_t m1minExpTime;
96
        int64_t m1minExpNum;
97
        int m1minSpeed;
98
99
        time_t m5minExpTime;
100
        int64_t m5minExpNum;
101
        int m5minSpeed;
102
103
        time_t m15minExpTime;
104
        int64_t m15minExpNum;
105
        int m15minSpeed;
106
};
107
108
extern KillStats *killStats;
109
110
#endif  // GUI_WINDOWS_KILLSTATS_H