add all evidence mods EXCEPT hiddencm
This commit is contained in:
parent
5b328859cd
commit
1d4c1b8cda
@ -2,8 +2,10 @@
|
|||||||
background=gs4
|
background=gs4
|
||||||
protected_area=true
|
protected_area=true
|
||||||
iniswap_allowed=false
|
iniswap_allowed=false
|
||||||
|
evidence_mod=cm
|
||||||
|
|
||||||
[Courtroom 1]
|
[Courtroom 1]
|
||||||
background=gs4
|
background=gs4
|
||||||
protected_area=false
|
protected_area=false
|
||||||
iniswap_allowed=true
|
iniswap_allowed=true
|
||||||
|
evidence_mod=ffa
|
@ -75,6 +75,7 @@ class AOClient : public QObject {
|
|||||||
{"MODIFY_USERS", 1ULL << 3},
|
{"MODIFY_USERS", 1ULL << 3},
|
||||||
{"CM", 1ULL << 4},
|
{"CM", 1ULL << 4},
|
||||||
{"GLOBAL_TIMER", 1ULL << 5},
|
{"GLOBAL_TIMER", 1ULL << 5},
|
||||||
|
{"CHANGE_EVI_MOD", 1ULL << 6},
|
||||||
{"SUPER", ~0ULL}
|
{"SUPER", ~0ULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,9 +98,9 @@ class AOClient : public QObject {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum RollType {
|
enum RollType {
|
||||||
ROLL,
|
ROLL,
|
||||||
ROLLP,
|
ROLLP,
|
||||||
ROLLA
|
ROLLA
|
||||||
};
|
};
|
||||||
|
|
||||||
void handlePacket(AOPacket packet);
|
void handlePacket(AOPacket packet);
|
||||||
@ -140,6 +141,7 @@ class AOClient : public QObject {
|
|||||||
void sendEvidenceList(AreaData* area);
|
void sendEvidenceList(AreaData* area);
|
||||||
AOPacket validateIcPacket(AOPacket packet);
|
AOPacket validateIcPacket(AOPacket packet);
|
||||||
QString dezalgo(QString p_text);
|
QString dezalgo(QString p_text);
|
||||||
|
bool checkEvidenceAccess(AreaData* area);
|
||||||
|
|
||||||
// Packet helper global variables
|
// Packet helper global variables
|
||||||
int char_id = -1;
|
int char_id = -1;
|
||||||
@ -220,6 +222,7 @@ class AOClient : public QObject {
|
|||||||
void cmdDoc(int argc, QStringList argv);
|
void cmdDoc(int argc, QStringList argv);
|
||||||
void cmdClearDoc(int argc, QStringList argv);
|
void cmdClearDoc(int argc, QStringList argv);
|
||||||
void cmdTimer(int argc, QStringList argv);
|
void cmdTimer(int argc, QStringList argv);
|
||||||
|
void cmdEvidenceMod(int argc, QStringList argv);
|
||||||
// Messaging/Client
|
// Messaging/Client
|
||||||
void cmdPos(int argc, QStringList argv);
|
void cmdPos(int argc, QStringList argv);
|
||||||
void cmdForcePos(int argc, QStringList argv);
|
void cmdForcePos(int argc, QStringList argv);
|
||||||
@ -294,6 +297,7 @@ class AOClient : public QObject {
|
|||||||
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
{"forcepos", {ACLFlags.value("CM"), 2, &AOClient::cmdForcePos}},
|
||||||
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
{"currentmusic", {ACLFlags.value("NONE"), 0, &AOClient::cmdCurrentMusic}},
|
||||||
{"pm", {ACLFlags.value("NONE"), 2, &AOClient::cmdPM}},
|
{"pm", {ACLFlags.value("NONE"), 2, &AOClient::cmdPM}},
|
||||||
|
{"evidence_mod", {ACLFlags.value("CHANGE_EVI_MOD"), 1, &AOClient::cmdEvidenceMod}}
|
||||||
};
|
};
|
||||||
|
|
||||||
QString partial_packet;
|
QString partial_packet;
|
||||||
|
@ -74,6 +74,13 @@ class AreaData : public QObject {
|
|||||||
QString current_music;
|
QString current_music;
|
||||||
QString music_played_by;
|
QString music_played_by;
|
||||||
Logger* logger;
|
Logger* logger;
|
||||||
|
enum EvidenceMod{
|
||||||
|
FFA,
|
||||||
|
MOD,
|
||||||
|
CM,
|
||||||
|
HIDDEN_CM
|
||||||
|
};
|
||||||
|
EvidenceMod evi_mod;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AREA_DATA_H
|
#endif // AREA_DATA_H
|
||||||
|
@ -30,6 +30,7 @@ AreaData::AreaData(QStringList characters, QString p_name, int p_index)
|
|||||||
is_protected = areas_ini.value("protected_area", "false").toBool();
|
is_protected = areas_ini.value("protected_area", "false").toBool();
|
||||||
iniswap_allowed = areas_ini.value("iniswap_allowed", "true").toBool();
|
iniswap_allowed = areas_ini.value("iniswap_allowed", "true").toBool();
|
||||||
bg_locked = areas_ini.value("bg_locked", "false").toBool();
|
bg_locked = areas_ini.value("bg_locked", "false").toBool();
|
||||||
|
QString configured_evi_mod = areas_ini.value("evidence_mod", "FFA").toString().toLower();
|
||||||
areas_ini.endGroup();
|
areas_ini.endGroup();
|
||||||
player_count = 0;
|
player_count = 0;
|
||||||
locked = FREE;
|
locked = FREE;
|
||||||
@ -52,4 +53,13 @@ AreaData::AreaData(QStringList characters, QString p_name, int p_index)
|
|||||||
timers.append(timer3);
|
timers.append(timer3);
|
||||||
QTimer* timer4 = new QTimer();
|
QTimer* timer4 = new QTimer();
|
||||||
timers.append(timer4);
|
timers.append(timer4);
|
||||||
|
|
||||||
|
if (configured_evi_mod == "cm")
|
||||||
|
evi_mod = EvidenceMod::CM;
|
||||||
|
else if (configured_evi_mod == "mod")
|
||||||
|
evi_mod = EvidenceMod::MOD;
|
||||||
|
else if (configured_evi_mod == "hiddencm")
|
||||||
|
evi_mod = EvidenceMod::HIDDEN_CM;
|
||||||
|
else
|
||||||
|
evi_mod = EvidenceMod::FFA;
|
||||||
}
|
}
|
||||||
|
@ -682,6 +682,25 @@ void AOClient::cmdTimer(int argc, QStringList argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AOClient::cmdEvidenceMod(int argc, QStringList argv)
|
||||||
|
{
|
||||||
|
AreaData* area = server->areas[current_area];
|
||||||
|
argv[0] = argv[0].toLower();
|
||||||
|
if (argv[0] == "cm")
|
||||||
|
area->evi_mod = AreaData::EvidenceMod::CM;
|
||||||
|
else if (argv[0] == "mod")
|
||||||
|
area->evi_mod = AreaData::EvidenceMod::MOD;
|
||||||
|
else if (argv[0] == "hiddencm")
|
||||||
|
area->evi_mod = AreaData::EvidenceMod::HIDDEN_CM;
|
||||||
|
else if (argv[0] == "ffa")
|
||||||
|
area->evi_mod = AreaData::EvidenceMod::FFA;
|
||||||
|
else {
|
||||||
|
sendServerMessage("Invalid evidence mod.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sendServerMessage("Changed evidence mod.");
|
||||||
|
}
|
||||||
|
|
||||||
void AOClient::cmdArea(int argc, QStringList argv)
|
void AOClient::cmdArea(int argc, QStringList argv)
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
|
@ -269,6 +269,8 @@ void AOClient::pktModCall(AreaData* area, int argc, QStringList argv, AOPacket p
|
|||||||
|
|
||||||
void AOClient::pktAddEvidence(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
void AOClient::pktAddEvidence(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||||
{
|
{
|
||||||
|
if (!checkEvidenceAccess(area))
|
||||||
|
return;
|
||||||
AreaData::Evidence evi = {argv[0], argv[1], argv[2]};
|
AreaData::Evidence evi = {argv[0], argv[1], argv[2]};
|
||||||
area->evidence.append(evi);
|
area->evidence.append(evi);
|
||||||
sendEvidenceList(area);
|
sendEvidenceList(area);
|
||||||
@ -276,6 +278,8 @@ void AOClient::pktAddEvidence(AreaData* area, int argc, QStringList argv, AOPack
|
|||||||
|
|
||||||
void AOClient::pktRemoveEvidence(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
void AOClient::pktRemoveEvidence(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||||
{
|
{
|
||||||
|
if (!checkEvidenceAccess(area))
|
||||||
|
return;
|
||||||
bool is_int = false;
|
bool is_int = false;
|
||||||
int idx = argv[0].toInt(&is_int);
|
int idx = argv[0].toInt(&is_int);
|
||||||
if (is_int && idx <= area->evidence.size() && idx >= 0) {
|
if (is_int && idx <= area->evidence.size() && idx >= 0) {
|
||||||
@ -286,6 +290,8 @@ void AOClient::pktRemoveEvidence(AreaData* area, int argc, QStringList argv, AOP
|
|||||||
|
|
||||||
void AOClient::pktEditEvidence(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
void AOClient::pktEditEvidence(AreaData* area, int argc, QStringList argv, AOPacket packet)
|
||||||
{
|
{
|
||||||
|
if (!checkEvidenceAccess(area))
|
||||||
|
return;
|
||||||
bool is_int = false;
|
bool is_int = false;
|
||||||
int idx = argv[0].toInt(&is_int);
|
int idx = argv[0].toInt(&is_int);
|
||||||
AreaData::Evidence evi = {argv[1], argv[2], argv[3]};
|
AreaData::Evidence evi = {argv[1], argv[2], argv[3]};
|
||||||
@ -549,3 +555,18 @@ QString AOClient::dezalgo(QString p_text)
|
|||||||
QString filtered = p_text.replace(rxp, "");
|
QString filtered = p_text.replace(rxp, "");
|
||||||
return filtered;
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AOClient::checkEvidenceAccess(AreaData *area)
|
||||||
|
{
|
||||||
|
switch(area->evi_mod) {
|
||||||
|
case AreaData::EvidenceMod::FFA:
|
||||||
|
return true;
|
||||||
|
case AreaData::EvidenceMod::CM:
|
||||||
|
case AreaData::EvidenceMod::HIDDEN_CM:
|
||||||
|
return checkAuth(ACLFlags.value("CM"));
|
||||||
|
case AreaData::EvidenceMod::MOD:
|
||||||
|
return authenticated;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user