Make basic system functionality actually work
Reminder to add docs
This commit is contained in:
		
							parent
							
								
									15d4deebd3
								
							
						
					
					
						commit
						4bc53ab61c
					
				@ -1331,6 +1331,13 @@ class AOClient : public QObject {
 | 
			
		||||
     * @details [Insert explanation here]
 | 
			
		||||
     */
 | 
			
		||||
    void cmdDeleteStatement(int argc, QStringList argv);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @brief [Insert description here]
 | 
			
		||||
     *
 | 
			
		||||
     * @details [Insert explanation here]
 | 
			
		||||
     */
 | 
			
		||||
    void cmdPauseTestimony(int argc, QStringList argv);
 | 
			
		||||
  
 | 
			
		||||
    // Messaging/Client
 | 
			
		||||
    
 | 
			
		||||
@ -1650,7 +1657,11 @@ class AOClient : public QObject {
 | 
			
		||||
        {"judgelog",           {ACLFlags.value("CM"),           0, &AOClient::cmdJudgeLog}},
 | 
			
		||||
        {"allow_blankposting", {ACLFlags.value("MODCHAT"),      0, &AOClient::cmdAllow_Blankposting}},
 | 
			
		||||
        {"baninfo",            {ACLFlags.value("BAN"),          1, &AOClient::cmdBanInfo}},
 | 
			
		||||
        {"testify",            {ACLFlags.value("CM"),           0, &AOClient::cmdTestify}},
 | 
			
		||||
        {"examine",            {ACLFlags.value("CM"),           0, &AOClient::cmdExamine}},
 | 
			
		||||
        {"pause",              {ACLFlags.value("CM"),           0, &AOClient::cmdPauseTestimony}},
 | 
			
		||||
        {"delete",             {ACLFlags.value("CM"),           0, &AOClient::cmdDeleteStatement}},
 | 
			
		||||
        {"update",             {ACLFlags.value("CM"),           0, &AOClient::cmdUpdateStatement}},
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -1356,7 +1356,7 @@ void AOClient::cmdBanInfo(int argc, QStringList argv)
 | 
			
		||||
    sendServerMessage(ban_info.join("\n"));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClient::cmdExamine(int argc, QStringList argv)
 | 
			
		||||
void AOClient::cmdTestify(int argc, QStringList argv)
 | 
			
		||||
{
 | 
			
		||||
    AreaData* area = server->areas[current_area];
 | 
			
		||||
    if (area->test_rec == AreaData::TestimonyRecording::RECORDING) {
 | 
			
		||||
@ -1370,6 +1370,39 @@ void AOClient::cmdExamine(int argc, QStringList argv)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClient::cmdExamine(int argc, QStringList argv)
 | 
			
		||||
{
 | 
			
		||||
    AreaData* area = server->areas[current_area];
 | 
			
		||||
    if (area->testimony.size() -1 > 0)
 | 
			
		||||
    {
 | 
			
		||||
        area->test_rec = AreaData::TestimonyRecording::PLAYBACK;
 | 
			
		||||
        server->broadcast(AOPacket("RT",{"testimony2"}), current_area);
 | 
			
		||||
        server->broadcast(AOPacket("MS", {area->testimony[0]}), current_area);
 | 
			
		||||
        area->statement = 0;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    if (area->test_rec == AreaData::TestimonyRecording::PLAYBACK)
 | 
			
		||||
        sendServerMessage("Unable to examine while another examination is running");
 | 
			
		||||
    else
 | 
			
		||||
        sendServerMessage("Unable to start replay without prior examination.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClient::cmdDeleteStatement(int argc, QStringList argv)
 | 
			
		||||
{
 | 
			
		||||
    deleteStatement();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClient::cmdUpdateStatement(int argc, QStringList argv)
 | 
			
		||||
{
 | 
			
		||||
    server->areas[current_area]->test_rec = AreaData::TestimonyRecording::UPDATE;
 | 
			
		||||
    sendServerMessage("Recording updated statement.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOClient::cmdStop(int argc, QStringList argv)
 | 
			
		||||
{
 | 
			
		||||
    pauseTestimony();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QStringList AOClient::buildAreaList(int area_idx)
 | 
			
		||||
{
 | 
			
		||||
    QStringList entries;
 | 
			
		||||
 | 
			
		||||
@ -631,8 +631,8 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
 | 
			
		||||
    //Testimony playback
 | 
			
		||||
    if (area->test_rec == AreaData::TestimonyRecording::RECORDING || area->test_rec == AreaData::TestimonyRecording::ADD) {
 | 
			
		||||
        if (area->statement == 0) {
 | 
			
		||||
            args[4] = "~~--== " + args[4] + " ==--";
 | 
			
		||||
            args[14] = "5";
 | 
			
		||||
            args[4] = "~~-- " + args[4] + " --";
 | 
			
		||||
            args[14] = "3";
 | 
			
		||||
            server->broadcast(AOPacket("RT",{"testimony1"}), current_area);
 | 
			
		||||
        }
 | 
			
		||||
        addStatement(args);
 | 
			
		||||
@ -641,7 +641,15 @@ AOPacket AOClient::validateIcPacket(AOPacket packet)
 | 
			
		||||
        args = updateStatement(args);
 | 
			
		||||
    }
 | 
			
		||||
    else if (area->test_rec == AreaData::TestimonyRecording::PLAYBACK) {
 | 
			
		||||
        args = playTestimony(); // This still needs to handle > and < and when you jump, but god I am not doing this at 11PM
 | 
			
		||||
        if (args[4] == ">") {
 | 
			
		||||
            area->statement = area->statement + 1;
 | 
			
		||||
            args = playTestimony();
 | 
			
		||||
        }
 | 
			
		||||
        if (args[4] == "<") {
 | 
			
		||||
            area->statement = area->statement - 1;
 | 
			
		||||
            args = playTestimony();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return AOPacket("MS", args);
 | 
			
		||||
 | 
			
		||||
@ -23,44 +23,49 @@ void AOClient::addStatement(QStringList packet)
 | 
			
		||||
{
 | 
			
		||||
    AreaData* area = server->areas[current_area];
 | 
			
		||||
    int c_statement = area->statement;
 | 
			
		||||
    packet[14] = 1;
 | 
			
		||||
    if (area->test_rec == AreaData::TestimonyRecording::RECORDING) {
 | 
			
		||||
        if (c_statement <= 50) { //Make this configurable once Mangos ConfigManager changes get merged
 | 
			
		||||
            area->testimony.append(packet);
 | 
			
		||||
            area->statement = c_statement + 1;
 | 
			
		||||
            return;
 | 
			
		||||
    if (c_statement >= 0) {
 | 
			
		||||
        if (area->test_rec == AreaData::TestimonyRecording::RECORDING) {
 | 
			
		||||
            if (c_statement <= 50) { //Make this configurable once Mangos ConfigManager changes get merged
 | 
			
		||||
                if (c_statement == 0)
 | 
			
		||||
                    packet[14] = "3";
 | 
			
		||||
                else
 | 
			
		||||
                    packet[14] = "1";
 | 
			
		||||
                area->testimony.append(packet);
 | 
			
		||||
                area->statement = c_statement + 1;
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                sendServerMessage("Unable to add more statements. The maximum amount of statements has been reached.");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            sendServerMessage("Unable to add more statements. The maximum amount of statements has been reached.");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    else if (area->test_rec == AreaData::TestimonyRecording::ADD) {
 | 
			
		||||
        if (c_statement < 50) { //Make this configurable once Mangos ConfigManager changes get merged
 | 
			
		||||
           area->testimony.insert(c_statement,packet);
 | 
			
		||||
           area->test_rec = AreaData::TestimonyRecording::PLAYBACK;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            sendServerMessage("Unable to add more statements. The maximum amount of statements has been reached.");
 | 
			
		||||
            area->test_rec = AreaData::TestimonyRecording::PLAYBACK;
 | 
			
		||||
        else if (area->test_rec == AreaData::TestimonyRecording::ADD) {
 | 
			
		||||
            if (c_statement < 50) { //Make this configurable once Mangos ConfigManager changes get merged
 | 
			
		||||
               area->testimony.insert(c_statement,packet);
 | 
			
		||||
               area->test_rec = AreaData::TestimonyRecording::PLAYBACK;
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                sendServerMessage("Unable to add more statements. The maximum amount of statements has been reached.");
 | 
			
		||||
                area->test_rec = AreaData::TestimonyRecording::PLAYBACK;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QStringList AOClient::updateStatement(QStringList packet)
 | 
			
		||||
{
 | 
			
		||||
    AreaData* area = server->areas[current_area];
 | 
			
		||||
    int c_statement = area->statement;
 | 
			
		||||
    if ((c_statement >= 0 && !(area->testimony[c_statement].isEmpty()))) {
 | 
			
		||||
    area->test_rec = AreaData::TestimonyRecording::PLAYBACK;
 | 
			
		||||
    if (c_statement <= 0 || area->testimony[c_statement].empty())
 | 
			
		||||
        sendServerMessage("Unable to update an empty statement. Please use /addtestimony.");
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        packet[13] = 1;
 | 
			
		||||
        packet[14] = "1";
 | 
			
		||||
        area->testimony.replace(c_statement, packet);
 | 
			
		||||
        sendServerMessage("Updated current statement.");
 | 
			
		||||
        return area->testimony[c_statement];
 | 
			
		||||
    }
 | 
			
		||||
    area->test_rec = AreaData::TestimonyRecording::PLAYBACK;
 | 
			
		||||
    return packet;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -87,10 +92,15 @@ QStringList AOClient::playTestimony()
 | 
			
		||||
{
 | 
			
		||||
    AreaData* area = server->areas[current_area];
 | 
			
		||||
    int c_statement = area->statement;
 | 
			
		||||
    if (c_statement > area->testimony.size()) {
 | 
			
		||||
    if (c_statement > area->testimony.size() - 1) {
 | 
			
		||||
        sendServerMessageArea("Last statement reached. Looping to first statement.");
 | 
			
		||||
        area->statement = 1;
 | 
			
		||||
        return area->testimony[1];
 | 
			
		||||
        return area->testimony[area->statement];
 | 
			
		||||
    }
 | 
			
		||||
    if (c_statement <= 0) {
 | 
			
		||||
        sendServerMessage("First statement reached.");
 | 
			
		||||
        area->statement = 1;
 | 
			
		||||
        return area->testimony[area->statement = 1];
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        return area->testimony[c_statement];
 | 
			
		||||
@ -101,5 +111,5 @@ void AOClient::pauseTestimony()
 | 
			
		||||
{
 | 
			
		||||
    AreaData* area = server->areas[current_area];
 | 
			
		||||
    area->test_rec = AreaData::TestimonyRecording::STOPPED;
 | 
			
		||||
    sendServerMessage("Testimony playback has been stopped.");
 | 
			
		||||
    sendServerMessage("Testimony has been stopped.");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user