GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/windows/statuswindow.cpp Lines: 155 316 49.1 %
Date: 2018-09-09 Branches: 142 459 30.9 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2004-2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  The Mana Developers
5
 *  Copyright (C) 2011-2018  The ManaPlus Developers
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
#include "gui/windows/statuswindow.h"
24
25
#include "configuration.h"
26
#include "gamemodifiers.h"
27
#include "settings.h"
28
29
#include "being/localplayer.h"
30
#include "being/playerinfo.h"
31
32
#include "enums/gui/layouttype.h"
33
34
#include "gui/windows/chatwindow.h"
35
36
#include "gui/windows/equipmentwindow.h"
37
#include "gui/windows/setupwindow.h"
38
39
#include "gui/widgets/button.h"
40
#include "gui/widgets/createwidget.h"
41
#include "gui/widgets/layout.h"
42
#include "gui/widgets/progressbar.h"
43
#include "gui/widgets/statspage.h"
44
#include "gui/widgets/statspagebasic.h"
45
#include "gui/widgets/tabbedarea.h"
46
#include "gui/widgets/windowcontainer.h"
47
48
#include "net/inventoryhandler.h"
49
#include "net/playerhandler.h"
50
51
#include "resources/db/groupdb.h"
52
#include "resources/db/unitsdb.h"
53
#include "resources/db/statdb.h"
54
55
#include "resources/item/item.h"
56
57
#include "utils/delete2.h"
58
#include "utils/dtor.h"
59
#include "utils/foreach.h"
60
#include "utils/gettext.h"
61
62
#include "debug.h"
63
64
StatusWindow *statusWindow = nullptr;
65
66
1
StatusWindow::StatusWindow() :
67

2
    Window(localPlayer != nullptr ? localPlayer->getName() :
68
        "?", Modal_false, nullptr, "status.xml"),
69
    ActionListener(),
70
    AttributeListener(),
71
    mPages(),
72


1
    mTabs(CREATEWIDGETR(TabbedArea, this)),
73
    // TRANSLATORS: status window label
74

2
    mLvlLabel(new Label(this, strprintf(_("Level: %d"), 0))),
75
    // TRANSLATORS: status window label
76

2
    mMoneyLabel(new Label(this, strprintf(_("Money: %s"), ""))),
77
    // TRANSLATORS: status window label
78

2
    mHpLabel(new Label(this, _("HP:"))),
79
    mMpLabel(nullptr),
80
    // TRANSLATORS: status window label
81

2
    mXpLabel(new Label(this, _("Exp:"))),
82
    mHpBar(nullptr),
83
    mMpBar(nullptr),
84
    mXpBar(nullptr),
85
    mJobLvlLabel(nullptr),
86
    mJobLabel(nullptr),
87
    mJobBar(nullptr),
88

1
    mBasicStatsPage(new StatsPageBasic(this)),
89
    // TRANSLATORS: status window button
90




26
    mCopyButton(new Button(this, _("Copy to chat"), "copy", BUTTON_SKIN, this))
91
{
92
5
    setWindowName("Status");
93
1
    if (setupWindow != nullptr)
94
        setupWindow->registerWindowForReset(this);
95
1
    setResizable(true);
96
1
    setCloseButton(true);
97
2
    setSaveVisible(true);
98
1
    setStickyButtonLock(true);
99
2
    setDefaultSize((windowContainer->getWidth() - 480) / 2,
100
2
        (windowContainer->getHeight() - 500) / 2,
101
        480,
102
1
        500);
103
104
2
    mTabs->setSelectable(false);
105
3
    mTabs->getWidgetContainer()->setSelectable(false);
106
3
    mTabs->getTabContainer()->setSelectable(false);
107
108


4
    if ((localPlayer != nullptr) && !localPlayer->getRaceName().empty())
109
    {
110
        setCaption(strprintf("%s (%s)", localPlayer->getName().c_str(),
111
            localPlayer->getRaceName().c_str()));
112
    }
113
114
1
    int max = PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP);
115
1
    if (max == 0)
116
1
        max = 1;
117
118
1
    mHpBar = new ProgressBar(this,
119
1
        static_cast<float>(PlayerInfo::getAttribute(Attributes::PLAYER_HP))
120
1
        / static_cast<float>(max),
121
        80,
122
        0,
123
        ProgressColorId::PROG_HP,
124


7
        "hpprogressbar.xml", "hpprogressbar_fill.xml");
125
3
    mHpBar->setColor(getThemeColor(ThemeColorId::HP_BAR, 255U),
126
1
        getThemeColor(ThemeColorId::HP_BAR_OUTLINE, 255U));
127
2
    mHpBar->setSelectable(false);
128
129
    const int64_t maxExp = PlayerInfo::getAttribute64(
130
1
        Attributes::PLAYER_EXP_NEEDED);
131
1
    mXpBar = new ProgressBar(this,
132
1
        maxExp != 0 ?
133
        static_cast<float>(PlayerInfo::getAttribute64(
134
        Attributes::PLAYER_EXP)) /
135
        static_cast<float>(maxExp) : static_cast<float>(0),
136
        80,
137
        0,
138
        ProgressColorId::PROG_EXP,
139


5
        "xpprogressbar.xml", "xpprogressbar_fill.xml");
140
3
    mXpBar->setColor(getThemeColor(ThemeColorId::XP_BAR, 255U),
141
1
        getThemeColor(ThemeColorId::XP_BAR_OUTLINE, 255U));
142
2
    mXpBar->setSelectable(false);
143
144

4
    const bool job = serverConfig.getValueBool("showJob", true);
145
146
1
    max = PlayerInfo::getAttribute(Attributes::PLAYER_MAX_MP);
147
    // TRANSLATORS: status window label
148

4
    mMpLabel = new Label(this, _("MP:"));
149
1
    const bool useMagic = playerHandler->canUseMagic();
150
1
    mMpBar = new ProgressBar(this,
151

1
        max != 0 ? static_cast<float>(PlayerInfo::getAttribute(
152
        Attributes::PLAYER_MAX_MP)) / static_cast<float>(max)
153
        : static_cast<float>(0),
154
        80,
155
        0,
156
        useMagic ? ProgressColorId::PROG_MP : ProgressColorId::PROG_NO_MP,
157
        useMagic ? "mpprogressbar.xml" : "nompprogressbar.xml",
158



7
        useMagic ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml");
159
2
    mMpBar->setSelectable(false);
160
1
    if (useMagic)
161
    {
162
        mMpBar->setColor(getThemeColor(ThemeColorId::MP_BAR, 255U),
163
            getThemeColor(ThemeColorId::MP_BAR_OUTLINE, 255U));
164
    }
165
    else
166
    {
167
3
        mMpBar->setColor(getThemeColor(ThemeColorId::NO_MP_BAR, 255U),
168
1
            getThemeColor(ThemeColorId::NO_MP_BAR_OUTLINE, 255U));
169
    }
170
171
1
    place(0, 0, mLvlLabel, 3, 1);
172
2
    place(0, 1, mHpLabel, 1, 1).setPadding(3);
173
1
    place(1, 1, mHpBar, 4, 1);
174
2
    place(5, 1, mXpLabel, 1, 1).setPadding(3);
175
1
    place(6, 1, mXpBar, 5, 1);
176
2
    place(0, 2, mMpLabel, 1, 1).setPadding(3);
177
    // 5, 2 and 6, 2 Job Progress Bar
178
1
    if (job)
179
1
        place(1, 2, mMpBar, 4, 1);
180
    else
181
        place(1, 2, mMpBar, 10, 1);
182
183
1
    if (job)
184
    {
185
        // TRANSLATORS: status window label
186

2
        mJobLvlLabel = new Label(this, strprintf(_("Job: %d"), 0));
187
        // TRANSLATORS: status window label
188

4
        mJobLabel = new Label(this, _("Job:"));
189
1
        mJobBar = new ProgressBar(this, 0.0F, 80, 0, ProgressColorId::PROG_JOB,
190


7
            "jobprogressbar.xml", "jobprogressbar_fill.xml");
191
3
        mJobBar->setColor(getThemeColor(ThemeColorId::JOB_BAR, 255U),
192
1
            getThemeColor(ThemeColorId::JOB_BAR_OUTLINE, 255U));
193
2
        mJobBar->setSelectable(false);
194
195
1
        place(3, 0, mJobLvlLabel, 3, 1);
196
2
        place(5, 2, mJobLabel, 1, 1).setPadding(3);
197
1
        place(6, 2, mJobBar, 5, 1);
198
1
        place(6, 0, mMoneyLabel, 3, 1);
199
    }
200
    else
201
    {
202
        mJobLvlLabel = nullptr;
203
        mJobLabel = nullptr;
204
        mJobBar = nullptr;
205
        place(3, 0, mMoneyLabel, 3, 1);
206
    }
207
208

1
    place(0, 3, mTabs, 11, 3);
209
210

1
    getLayout().setRowHeight(3, LayoutType::SET);
211
212
1
    place(0, 5, mCopyButton, 1, 1);
213
214
1
    loadWindowState();
215
2
    enableVisibleSound(true);
216
217
    // Update bars
218
1
    updateHPBar(mHpBar, true);
219
1
    updateMPBar(mMpBar, true);
220
1
    updateXPBar(mXpBar, false);
221
222
    // TRANSLATORS: status window label
223
2
    mMoneyLabel->setCaption(strprintf(_("Money: %s"),
224

2
        UnitsDb::formatCurrency(PlayerInfo::getAttribute(
225
1
        Attributes::MONEY)).c_str()));
226
1
    mMoneyLabel->adjustSize();
227
228
1
    updateLevelLabel();
229
1
    addTabs();
230
1
}
231
232
5
StatusWindow::~StatusWindow()
233
{
234
2
    delete2(mBasicStatsPage);
235
2
    delete_all(mPages);
236
2
}
237
238
1
void StatusWindow::addTabs()
239
{
240
    // TRANSLATORS: status window tab name
241
5
    addTabBasic(_("Basic"));
242
1
    const STD_VECTOR<std::string> &pages = StatDb::getPages();
243
4
    FOR_EACH(STD_VECTOR<std::string>::const_iterator, it, pages)
244
    {
245
        addTab(*it);
246
    }
247
1
    mTabs->adjustSize();
248
1
}
249
250
void StatusWindow::addTab(const std::string &name)
251
{
252
    StatsPage *const page = new StatsPage(this, name);
253
    mTabs->addTab(name,
254
        page);
255
    mPages.push_back(page);
256
}
257
258
void StatusWindow::addTabBasic(const std::string &name)
259
{
260
1
    mTabs->addTab(name,
261
2
        mBasicStatsPage);
262
}
263
264
1
void StatusWindow::updateLevelLabel()
265
{
266
1
    if (localPlayer == nullptr)
267
        return;
268
269
2
    const int groupId = localPlayer->getGroupId();
270
1
    const std::string &name = GroupDb::getName(groupId);
271
1
    if (!name.empty())
272
    {
273
        // TRANSLATORS: status window label
274
        mLvlLabel->setCaption(strprintf(_("Level: %d (%s %d)"),
275
            PlayerInfo::getAttribute(Attributes::PLAYER_BASE_LEVEL),
276
            name.c_str(),
277
            groupId));
278
    }
279
    else
280
    {
281
        // TRANSLATORS: status window label
282
2
        mLvlLabel->setCaption(strprintf(_("Level: %d"),
283
1
            PlayerInfo::getAttribute(Attributes::PLAYER_BASE_LEVEL)));
284
    }
285
1
    mLvlLabel->adjustSize();
286
}
287
288
void StatusWindow::attributeChanged(const AttributesT id,
289
                                    const int64_t oldVal,
290
                                    const int64_t newVal)
291
{
292
    static bool blocked = false;
293
294
    PRAGMA45(GCC diagnostic push)
295
    PRAGMA45(GCC diagnostic ignored "-Wswitch-enum")
296
    switch (id)
297
    {
298
        case Attributes::PLAYER_HP:
299
        case Attributes::PLAYER_MAX_HP:
300
            updateHPBar(mHpBar, true);
301
            break;
302
303
        case Attributes::PLAYER_MP:
304
        case Attributes::PLAYER_MAX_MP:
305
            updateMPBar(mMpBar, true);
306
            break;
307
308
        case Attributes::PLAYER_EXP:
309
        case Attributes::PLAYER_EXP_NEEDED:
310
            updateXPBar(mXpBar, false);
311
            break;
312
313
        case Attributes::MONEY:
314
            // TRANSLATORS: status window label
315
            mMoneyLabel->setCaption(strprintf(_("Money: %s"),
316
                UnitsDb::formatCurrency64(newVal).c_str()));
317
            mMoneyLabel->adjustSize();
318
            break;
319
320
        case Attributes::PLAYER_BASE_LEVEL:
321
            // TRANSLATORS: status window label
322
            mLvlLabel->setCaption(strprintf(_("Level: %d"),
323
                CAST_S32(newVal)));
324
            mLvlLabel->adjustSize();
325
            break;
326
327
        // +++ probable need use only some attributes here
328
        case Attributes::PLAYER_JOB_LEVEL:
329
        case Attributes::PLAYER_JOB_EXP:
330
        case Attributes::PLAYER_JOB_EXP_NEEDED:
331
            if (blocked)
332
                return;
333
            if (mJobLvlLabel != nullptr)
334
            {
335
                int lvl = PlayerInfo::getAttribute(
336
                    Attributes::PLAYER_JOB_LEVEL);
337
                const int64_t exp = PlayerInfo::getAttribute(
338
                    Attributes::PLAYER_JOB_EXP);
339
                const int64_t expNeed = PlayerInfo::getAttribute(
340
                    Attributes::PLAYER_JOB_EXP_NEEDED);
341
342
                if (lvl == 0)
343
                {
344
                    // possible server broken and don't send job level,
345
                    // then we fixing it.
346
                    if (expNeed < 20000)
347
                    {
348
                        lvl = 0;
349
                    }
350
                    else
351
                    {
352
                        lvl = CAST_S32((expNeed - 20000) / 150);
353
                        blocked = true;
354
                        PlayerInfo::setAttribute(Attributes::PLAYER_JOB_LEVEL,
355
                            lvl,
356
                            Notify_true);
357
                        blocked = false;
358
                    }
359
                }
360
361
                if (id == Attributes::PLAYER_JOB_EXP &&
362
                    exp < oldVal &&
363
                    expNeed >= 20000)
364
                {   // possible job level up. but server broken and don't send
365
                    // new job exp limit, we fixing it
366
                    lvl ++;
367
                    blocked = true;
368
                    PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP_NEEDED,
369
                        20000 + lvl * 150,
370
                        Notify_true);
371
                    PlayerInfo::setAttribute(Attributes::PLAYER_JOB_LEVEL,
372
                        lvl,
373
                        Notify_true);
374
                    blocked = false;
375
                }
376
377
                // TRANSLATORS: status window label
378
                mJobLvlLabel->setCaption(strprintf(_("Job: %d"), lvl));
379
                mJobLvlLabel->adjustSize();
380
381
                updateJobBar(mJobBar, false);
382
            }
383
            break;
384
385
        default:
386
            break;
387
    }
388
    PRAGMA45(GCC diagnostic pop)
389
}
390
391
void StatusWindow::setPointsNeeded(const AttributesT id,
392
                                   const int needed)
393
{
394
    mBasicStatsPage->setPointsNeeded(id, needed);
395
}
396
397
2
void StatusWindow::updateHPBar(ProgressBar *const bar, const bool showMax)
398
{
399
2
    if (bar == nullptr)
400
        return;
401
402
2
    const int hp = PlayerInfo::getAttribute(Attributes::PLAYER_HP);
403
2
    const int maxHp = PlayerInfo::getAttribute(Attributes::PLAYER_MAX_HP);
404
2
    if (showMax)
405

4
        bar->setText(toString(hp).append("/").append(toString(maxHp)));
406
    else
407
2
        bar->setText(toString(hp));
408
409
2
    float prog = 1.0;
410
2
    if (maxHp > 0)
411
        prog = static_cast<float>(hp) / static_cast<float>(maxHp);
412
2
    bar->setProgress(prog);
413
}
414
415
1
void StatusWindow::updateMPBar(ProgressBar *const bar,
416
                               const bool showMax) const
417
{
418
1
    if (bar == nullptr)
419
        return;
420
421
1
    const int mp = PlayerInfo::getAttribute(Attributes::PLAYER_MP);
422
1
    const int maxMp = PlayerInfo::getAttribute(Attributes::PLAYER_MAX_MP);
423
1
    if (showMax)
424

4
        bar->setText(toString(mp).append("/").append(toString(maxMp)));
425
    else
426
        bar->setText(toString(mp));
427
428
1
    float prog = 1.0F;
429
1
    if (maxMp > 0)
430
        prog = static_cast<float>(mp) / static_cast<float>(maxMp);
431
432
1
    if (playerHandler->canUseMagic())
433
    {
434
        bar->setColor(getThemeColor(ThemeColorId::MP_BAR, 255U),
435
            getThemeColor(ThemeColorId::MP_BAR_OUTLINE, 255U));
436
        bar->setProgressPalette(ProgressColorId::PROG_MP);
437
    }
438
    else
439
    {
440
3
        bar->setColor(getThemeColor(ThemeColorId::NO_MP_BAR, 255U),
441
1
            getThemeColor(ThemeColorId::NO_MP_BAR_OUTLINE, 255U));
442
1
        bar->setProgressPalette(ProgressColorId::PROG_NO_MP);
443
    }
444
445
1
    bar->setProgress(prog);
446
}
447
448
3
void StatusWindow::updateProgressBar(ProgressBar *const bar,
449
                                     const int64_t value,
450
                                     const int64_t max,
451
                                     const bool percent)
452
{
453
3
    if (bar == nullptr)
454
        return;
455
456
3
    if (max == 0)
457
    {
458
        // TRANSLATORS: status bar label
459
12
        bar->setText(_("Max"));
460
3
        bar->setProgress(1);
461
6
        bar->setText(toString(CAST_U64(value)));
462
    }
463
    else
464
    {
465
        const float progress = static_cast<float>(value)
466
            / static_cast<float>(max);
467
        if (percent)
468
        {
469
            bar->setText(strprintf("%2.5f%%",
470
                static_cast<double>(100 * progress)));
471
        }
472
        else
473
        {
474
            bar->setText(toString(
475
                CAST_U64(value)).append(
476
                "/").append(toString(
477
                CAST_U64(max))));
478
        }
479
        bar->setProgress(progress);
480
    }
481
}
482
483
2
void StatusWindow::updateXPBar(ProgressBar *const bar, const bool percent)
484
{
485
2
    if (bar == nullptr)
486
        return;
487
488
6
    updateProgressBar(bar,
489
2
        PlayerInfo::getAttribute(Attributes::PLAYER_EXP),
490
2
        PlayerInfo::getAttribute(Attributes::PLAYER_EXP_NEEDED),
491
2
        percent);
492
}
493
494
1
void StatusWindow::updateJobBar(ProgressBar *const bar,
495
                                const bool percent)
496
{
497
1
    if (bar == nullptr)
498
        return;
499
500
3
    updateProgressBar(bar,
501
1
        PlayerInfo::getAttribute(Attributes::PLAYER_JOB_EXP),
502
1
        PlayerInfo::getAttribute(Attributes::PLAYER_JOB_EXP_NEEDED),
503
1
        percent);
504
}
505
506
void StatusWindow::updateProgressBar(ProgressBar *const bar,
507
                                     const AttributesT id,
508
                                     const bool percent)
509
{
510
    const std::pair<int, int> exp =  PlayerInfo::getStatExperience(id);
511
    updateProgressBar(bar, exp.first, exp.second, percent);
512
}
513
514
void StatusWindow::updateWeightBar(ProgressBar *const bar)
515
{
516
    if (bar == nullptr)
517
        return;
518
519
    if (PlayerInfo::getAttribute(Attributes::MAX_WEIGHT) == 0)
520
    {
521
        // TRANSLATORS: status bar label
522
        bar->setText(_("Max"));
523
        bar->setProgress(1.0);
524
    }
525
    else
526
    {
527
        const int totalWeight = PlayerInfo::getAttribute(
528
            Attributes::TOTAL_WEIGHT);
529
        const int maxWeight = PlayerInfo::getAttribute(Attributes::MAX_WEIGHT);
530
        float progress = 1.0F;
531
        if (maxWeight != 0)
532
        {
533
            progress = static_cast<float>(totalWeight)
534
                / static_cast<float>(maxWeight);
535
        }
536
        bar->setText(strprintf("%s/%s",
537
            UnitsDb::formatWeight(totalWeight).c_str(),
538
            UnitsDb::formatWeight(maxWeight).c_str()));
539
        bar->setProgress(progress);
540
    }
541
}
542
543
1
void StatusWindow::updateMoneyBar(ProgressBar *const bar)
544
{
545
1
    if (bar == nullptr)
546
        return;
547
548
1
    const int money = PlayerInfo::getAttribute(Attributes::MONEY);
549
2
    bar->setText(UnitsDb::formatCurrency(money));
550
1
    if (money > 0)
551
    {
552
        const float progress = static_cast<float>(money)
553
            / static_cast<float>(1000000000);
554
        bar->setProgress(progress);
555
    }
556
    else
557
    {
558
1
        bar->setProgress(1.0);
559
    }
560
}
561
562
1
void StatusWindow::updateArrowsBar(ProgressBar *const bar)
563
{
564

1
    if ((bar == nullptr) || (equipmentWindow == nullptr))
565
        return;
566
567
    const Item *const item = equipmentWindow->getEquipment(
568
        inventoryHandler->getProjectileSlot());
569
570
    if ((item != nullptr) && item->getQuantity() > 0)
571
        bar->setText(toString(item->getQuantity()));
572
    else
573
        bar->setText("0");
574
}
575
576
void StatusWindow::updateInvSlotsBar(ProgressBar *const bar)
577
{
578
    if (bar == nullptr)
579
        return;
580
581
    const Inventory *const inv = PlayerInfo::getInventory();
582
    if (inv == nullptr)
583
        return;
584
585
    const int usedSlots = inv->getNumberOfSlotsUsed();
586
    const int maxSlots = inv->getSize();
587
588
    if (maxSlots != 0)
589
    {
590
        bar->setProgress(static_cast<float>(usedSlots)
591
            / static_cast<float>(maxSlots));
592
    }
593
594
    bar->setText(strprintf("%d", usedSlots));
595
}
596
597
std::string StatusWindow::translateLetter(const char *const letters)
598
{
599
    char buf[2];
600
    char *const str = gettext(letters);
601
    if ((str == nullptr) || strlen(str) != 3)
602
        return letters;
603
604
    buf[0] = str[1];
605
    buf[1] = 0;
606
    return std::string(buf);
607
}
608
609
std::string StatusWindow::translateLetter2(const std::string &letters)
610
{
611
    if (letters.size() < 5)
612
        return "";
613
614
    return std::string(gettext(letters.substr(1, 1).c_str()));
615
}
616
617
void StatusWindow::updateStatusBar(ProgressBar *const bar,
618
                                   const bool percent A_UNUSED) const
619
{
620
    if (bar == nullptr)
621
        return;
622
    bar->setText(translateLetter2(GameModifiers::getMoveTypeString())
623
        .append(translateLetter2(GameModifiers::getCrazyMoveTypeString()))
624
        .append(translateLetter2(GameModifiers::getMoveToTargetTypeString()))
625
        .append(translateLetter2(GameModifiers::getFollowModeString()))
626
        .append(" ").append(translateLetter2(
627
        GameModifiers::getAttackWeaponTypeString()))
628
        .append(translateLetter2(GameModifiers::getAttackTypeString()))
629
        .append(translateLetter2(GameModifiers::getMagicAttackTypeString()))
630
        .append(translateLetter2(GameModifiers::getPvpAttackTypeString()))
631
        .append(" ").append(translateLetter2(
632
        GameModifiers::getQuickDropCounterString()))
633
        .append(translateLetter2(GameModifiers::getPickUpTypeString()))
634
        .append(" ").append(translateLetter2(
635
        GameModifiers::getMapDrawTypeString()))
636
        .append(" ").append(translateLetter2(
637
        GameModifiers::getImitationModeString()))
638
        .append(translateLetter2(GameModifiers::getCameraModeString()))
639
        .append(translateLetter2(GameModifiers::getAwayModeString()))
640
        .append(translateLetter2(GameModifiers::getTargetingTypeString())));
641
642
    bar->setProgress(50);
643
    if (settings.disableGameModifiers)
644
    {
645
        bar->setBackgroundColor(getThemeColor(ThemeColorId::STATUSBAR_ON,
646
            255U));
647
    }
648
    else
649
    {
650
        bar->setBackgroundColor(getThemeColor(ThemeColorId::STATUSBAR_OFF,
651
            255U));
652
    }
653
}
654
655
void StatusWindow::action(const ActionEvent &event)
656
{
657
    if (chatWindow == nullptr)
658
        return;
659
660
    if (event.getId() == "copy")
661
    {
662
        chatWindow->addInputText(mBasicStatsPage->getStatsStr(),
663
            true);
664
    }
665

3
}