Mana
Loading...
Searching...
No Matches
emoteshortcut.cpp
Go to the documentation of this file.
1/*
2 * Extended support for activating emotes
3 * Copyright (C) 2009 Aethyra Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include "emoteshortcut.h"
23
24#include "configuration.h"
25#include "localplayer.h"
26
28
33
38
40{
41 for (int i = 0; i < SHORTCUT_EMOTES; i++)
42 mEmotes[i] = i + 1;
43
44 for (auto &shortcut : config.emoteShortcuts)
45 {
46 if (shortcut.index >= 0 && shortcut.index < SHORTCUT_EMOTES)
47 mEmotes[shortcut.index] = shortcut.emoteId;
48 }
49}
50
52{
53 config.emoteShortcuts.clear();
54
55 for (int i = 0; i < SHORTCUT_EMOTES; i++)
56 {
57 if (mEmotes[i] != i + 1)
58 config.emoteShortcuts.push_back({ i, mEmotes[i] });
59 }
60}
61
63{
64 if (index >= 0 && index < SHORTCUT_EMOTES)
65 {
66 if (mEmotes[index] > 0)
67 {
68 local_player->emote(mEmotes[index] - 1);
69 }
70 }
71}
The class which keeps track of the emote shortcuts.
int mEmotes[SHORTCUT_EMOTES]
The emote stored.
void useEmote(int index)
Try to use the Emote specified by the index.
void load()
Load the configuration information.
void save()
Save the configuration information.
void emote(int emoteId)
Config config
Global settings (config.xml)
Definition client.cpp:97
EmoteShortcut * emoteShortcut
#define SHORTCUT_EMOTES
LocalPlayer * local_player
std::vector< EmoteShortcutEntry > emoteShortcuts