forked from AttorneyOnline/AO2-Client
-
Notifications
You must be signed in to change notification settings - Fork 3
/
aoapplication.h
264 lines (184 loc) · 7.6 KB
/
aoapplication.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#ifndef AOAPPLICATION_H
#define AOAPPLICATION_H
#include "aopacket.h"
#include "datatypes.h"
#include "discord_rich_presence.h"
#include <QApplication>
#include <QVector>
#include <QFile>
class NetworkManager;
class Lobby;
class Courtroom;
class AOApplication : public QApplication
{
Q_OBJECT
public:
AOApplication(int &argc, char **argv);
~AOApplication();
NetworkManager *net_manager;
Lobby *w_lobby;
Courtroom *w_courtroom;
AttorneyOnline::Discord *discord;
bool lobby_constructed = false;
bool courtroom_constructed = false;
void construct_lobby();
void destruct_lobby();
void construct_courtroom();
void destruct_courtroom();
void ms_packet_received(AOPacket *p_packet);
void server_packet_received(AOPacket *p_packet);
void send_ms_packet(AOPacket *p_packet);
void send_server_packet(AOPacket *p_packet, bool encoded = true);
/////////////////server metadata//////////////////
unsigned int s_decryptor = 5;
bool encryption_needed = true;
bool yellow_text_enabled = false;
bool prezoom_enabled = false;
bool flipping_enabled = false;
bool custom_objection_enabled = false;
bool improved_loading_enabled = false;
bool desk_mod_enabled = false;
bool evidence_enabled = false;
///////////////loading info///////////////////
//player number, it's hardly used but might be needed for some old servers
int s_pv = 0;
QString server_software = "";
int char_list_size = 0;
int loaded_chars = 0;
int evidence_list_size = 0;
int loaded_evidence = 0;
int music_list_size = 0;
int loaded_music = 0;
bool courtroom_loaded = false;
//////////////////versioning///////////////
int get_release() {return RELEASE;}
int get_major_version() {return MAJOR_VERSION;}
int get_minor_version() {return MINOR_VERSION;}
QString get_version_string();
///////////////////////////////////////////
void set_favorite_list();
QVector<server_type>& get_favorite_list() {return favorite_list;}
void add_favorite_server(int p_server);
void set_server_list();
QVector<server_type>& get_server_list() {return server_list;}
//reads the theme from config.ini and sets it accordingly
void reload_theme();
//Returns the character the player has currently selected
QString get_current_char();
//implementation in path_functions.cpp
QString get_base_path();
QString get_data_path();
QString get_theme_path();
QString get_default_theme_path();
QString get_character_path(QString p_character);
QString get_demothings_path();
QString get_sounds_path();
QString get_music_path(QString p_song);
QString get_background_path();
QString get_default_background_path();
QString get_evidence_path();
////// Functions for reading and writing files //////
// Implementations file_functions.cpp
//Returns the config value for the passed searchline from a properly formatted config ini file
QString read_config(QString searchline);
//Returns text from note file
QString read_note(QString filename);
//Reads the theme from config.ini and loads it into the current_theme variable
QString read_theme();
//Returns the blip rate from config.ini
int read_blip_rate();
//Returns true if blank blips is enabled in config.ini and false otherwise
bool get_blank_blip();
//Returns the value of default_music in config.ini
int get_default_music();
//Returns the value of default_sfx in config.ini
int get_default_sfx();
//Returns the value of default_blip in config.ini
int get_default_blip();
//Returns the list of words in callwords.ini
QStringList get_call_words();
QStringList get_sfx_list();
//Appends the argument string to serverlist.txt
void write_to_serverlist_txt(QString p_line);
//Writes to note file
void write_note(QString p_text, QString filename);
//appends to note file
void append_note(QString p_line, QString filename);
//Overwrites config.ini with new theme
void write_theme(QString theme);
//Returns the contents of serverlist.txt
QVector<server_type> read_serverlist_txt();
//Returns the value of p_identifier in the design.ini file in p_design_path
QString read_design_ini(QString p_identifier, QString p_design_path);
//Returns the coordinates of widget with p_identifier from p_file
QPoint get_button_spacing(QString p_identifier, QString p_file);
//Returns the dimensions of widget with specified identifier from p_file
pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
//Returns the value of font_size with p_identifier from p_file
int get_font_size(QString p_identifier, QString p_file);
//Returns the name of the font with p_identifier from p_file
QString get_font_name(QString p_identifier, QString p_file);
//Returns the color with p_identifier from p_file
QColor get_color(QString p_identifier, QString p_file);
//Returns the sfx with p_identifier from sounds.ini in the current theme path
QString get_sfx(QString p_identifier);
//Returns the value of p_search_line within target_tag and terminator_tag
QString read_char_ini(QString p_char, QString p_search_line, QString target_tag, QString terminator_tag);
//Returns the text between target_tag and terminator_tag in p_file
QString get_stylesheet(QString target_tag, QString p_file);
//Returns string list (characters, color) from p_file
QVector<QStringList> get_highlight_color();
//Returns the side of the p_char character from that characters ini file
QString get_char_side(QString p_char);
//Returns the showname from the ini of p_char
QString get_showname(QString p_char);
//Returns showname from showname.ini
QString read_showname(QString p_char);
//Returns the value of chat from the specific p_char's ini file
QString get_chat(QString p_char);
//Returns the value of shouts from the specified p_char's ini file
QString get_char_shouts(QString p_char);
//Returns the preanim duration of p_char's p_emote
int get_preanim_duration(QString p_char, QString p_emote);
//Same as above, but only returns if it has a % in front(refer to Preanims section in the manual)
int get_ao2_preanim_duration(QString p_char, QString p_emote);
//Not in use
int get_text_delay(QString p_char, QString p_emote);
//Returns the name of p_char
QString get_char_name(QString p_char);
//Returns the total amount of emotes of p_char
int get_emote_number(QString p_char);
//Returns the emote comment of p_char's p_emote
QString get_emote_comment(QString p_char, int p_emote);
//Returns the base name of p_char's p_emote
QString get_emote(QString p_char, int p_emote);
//Returns the preanimation name of p_char's p_emote
QString get_pre_emote(QString p_char, int p_emote);
//Returns x,y offset for effect p_effect
QStringList get_effect_offset(QString p_char, int p_effect);
//Returns overlay at p_effect in char_path/overlay
QStringList get_overlay(QString p_char, int p_effect);
//Returns the sfx of p_char's p_emote
QString get_sfx_name(QString p_char, int p_emote);
//Not in use
int get_sfx_delay(QString p_char, int p_emote);
//Returns the modifier for p_char's p_emote
int get_emote_mod(QString p_char, int p_emote);
//Returns the desk modifier for p_char's p_emote
int get_desk_mod(QString p_char, int p_emote);
//Returns p_char's gender
QString get_gender(QString p_char);
private:
const int RELEASE = 2;
const int MAJOR_VERSION = 4;
const int MINOR_VERSION = 8;
QString current_theme = "default";
QVector<server_type> server_list;
QVector<server_type> favorite_list;
private slots:
void ms_connect_finished(bool connected, bool will_retry);
public slots:
void server_disconnected();
void loading_cancelled();
};
#endif // AOAPPLICATION_H