GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/windows/statuswindow.cpp Lines: 155 316 49.1 %
Date: 2021-03-17 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-2019  The ManaPlus Developers
6
 *  Copyright (C) 2019-2021  Andrei Karas
7
 *
8
 *  This file is part of The ManaPlus Client.
9
 *
10
 *  This program is free software; you can redistribute it and/or modify
11
 *  it under the terms of the GNU General Public License as published by
12
 *  the Free Software Foundation; either version 2 of the License, or
13
 *  any later version.
14
 *
15
 *  This program is distributed in the hope that it will be useful,
16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 *  GNU General Public License for more details.
19
 *
20
 *  You should have received a copy of the GNU General Public License
21
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 */
23
24
#include "gui/windows/statuswindow.h"
25
26
#include "configuration.h"
27
#include "gamemodifiers.h"
28
#include "settings.h"
29
30
#include "being/localplayer.h"
31
#include "being/playerinfo.h"
32
33
#include "enums/gui/layouttype.h"
34
35
#include "gui/windows/chatwindow.h"
36
37
#include "gui/windows/equipmentwindow.h"
38
#include "gui/windows/setupwindow.h"
39
40
#include "gui/widgets/button.h"
41
#include "gui/widgets/createwidget.h"
42
#include "gui/widgets/layout.h"
43
#include "gui/widgets/progressbar.h"
44
#include "gui/widgets/statspage.h"
45
#include "gui/widgets/statspagebasic.h"
46
#include "gui/widgets/tabbedarea.h"
47
#include "gui/widgets/windowcontainer.h"
48
49
#include "net/inventoryhandler.h"
50
#include "net/playerhandler.h"
51
52
#include "resources/db/groupdb.h"
53
#include "resources/db/unitsdb.h"
54
#include "resources/db/statdb.h"
55
56
#include "resources/item/item.h"
57
58
#include "utils/delete2.h"
59
#include "utils/dtor.h"
60
#include "utils/foreach.h"
61
#include "utils/gettext.h"
62
63
#include "debug.h"
64
65
StatusWindow *statusWindow = nullptr;
66
67
1
StatusWindow::StatusWindow() :
68

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


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

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

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

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

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

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




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


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


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


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

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

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

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



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

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

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


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

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

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

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

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

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

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

3
}