started adding the desk/nodesk feature
This commit is contained in:
		
							parent
							
								
									2f4e6881e0
								
							
						
					
					
						commit
						3495dfae3a
					
				@ -49,6 +49,7 @@ public:
 | 
				
			|||||||
  bool flipping_enabled = false;
 | 
					  bool flipping_enabled = false;
 | 
				
			||||||
  bool custom_objection_enabled = false;
 | 
					  bool custom_objection_enabled = false;
 | 
				
			||||||
  bool improved_loading_enabled = false;
 | 
					  bool improved_loading_enabled = false;
 | 
				
			||||||
 | 
					  bool desk_mod_enabled = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ///////////////loading info///////////////////
 | 
					  ///////////////loading info///////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -17,24 +17,20 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  this->moveCursor(QTextCursor::End);
 | 
					  this->moveCursor(QTextCursor::End);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this->insertPlainText(p_name + ": ");
 | 
					  this->append(p_name + ": ");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QRegExp split_rx("(\\ |\\n)");
 | 
					  QStringList word_list = p_message.split(" ");
 | 
				
			||||||
  QStringList word_list = p_message.split(split_rx);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (QString i_word : word_list)
 | 
					  for (QString i_word : word_list)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    if (i_word.startsWith("http"))
 | 
					    if (i_word.startsWith("http"))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      i_word.replace("\r", "");
 | 
					 | 
				
			||||||
      this->insertHtml("<a href=\"" + i_word + "\">" + i_word + "</a> ");
 | 
					      this->insertHtml("<a href=\"" + i_word + "\">" + i_word + "</a> ");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      this->insertPlainText(i_word + " ");
 | 
					      this->insertPlainText(i_word + " ");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  this->insertPlainText("\n");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (old_cursor.hasSelection() || !is_scrolled_down)
 | 
					  if (old_cursor.hasSelection() || !is_scrolled_down)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
      // The user has selected text or scrolled away from the bottom: maintain position.
 | 
					      // The user has selected text or scrolled away from the bottom: maintain position.
 | 
				
			||||||
 | 
				
			|||||||
@ -793,7 +793,14 @@ void Courtroom::on_chat_return_pressed()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  QStringList packet_contents;
 | 
					  QStringList packet_contents;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  packet_contents.append("chat");
 | 
					  QString f_side = ao_app->get_char_side(current_char);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QString f_desk_mod = QString::number(ao_app->get_desk_mod(current_char, current_emote));
 | 
				
			||||||
 | 
					  qDebug() << "f_desk_mod: " << f_desk_mod;
 | 
				
			||||||
 | 
					  if (f_desk_mod == "-1")
 | 
				
			||||||
 | 
					    f_desk_mod = "chat";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  packet_contents.append(f_desk_mod);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  packet_contents.append(ao_app->get_pre_emote(current_char, current_emote));
 | 
					  packet_contents.append(ao_app->get_pre_emote(current_char, current_emote));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -803,7 +810,7 @@ void Courtroom::on_chat_return_pressed()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  packet_contents.append(ui_ic_chat_message->text());
 | 
					  packet_contents.append(ui_ic_chat_message->text());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  packet_contents.append(ao_app->get_char_side(current_char));
 | 
					  packet_contents.append(f_side);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  packet_contents.append(ao_app->get_sfx_name(current_char, current_emote));
 | 
					  packet_contents.append(ao_app->get_sfx_name(current_char, current_emote));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1295,6 +1302,7 @@ void Courtroom::set_scene()
 | 
				
			|||||||
  QString f_image = "witnessempty.png";
 | 
					  QString f_image = "witnessempty.png";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QString f_side = m_chatmessage[SIDE];
 | 
					  QString f_side = m_chatmessage[SIDE];
 | 
				
			||||||
 | 
					  QString f_desk_mod = m_chatmessage[DESK_MOD];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (f_side == "def")
 | 
					  if (f_side == "def")
 | 
				
			||||||
    f_image = "defenseempty.png";
 | 
					    f_image = "defenseempty.png";
 | 
				
			||||||
@ -1309,11 +1317,9 @@ void Courtroom::set_scene()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  ui_vp_background->set_image(f_image);
 | 
					  ui_vp_background->set_image(f_image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //no-desk-emotes have been temporarily reverted
 | 
					  //we're done if deskmod is 0 or the deskmod is chat and it's a nondesk side
 | 
				
			||||||
  //we're done if one of the non-desk positions is the current one(jud, hlp and hld)
 | 
					  if (f_desk_mod == "0" ||
 | 
				
			||||||
  if (f_side == "jud" ||
 | 
					     (f_desk_mod == "chat" && (f_side == "hlp" || f_side == "hld" || f_side == "jud")))
 | 
				
			||||||
      f_side == "hlp" ||
 | 
					 | 
				
			||||||
      f_side == "hld")
 | 
					 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    ui_vp_desk->hide();
 | 
					    ui_vp_desk->hide();
 | 
				
			||||||
    ui_vp_legacy_desk->hide();
 | 
					    ui_vp_legacy_desk->hide();
 | 
				
			||||||
 | 
				
			|||||||
@ -78,7 +78,7 @@ struct pos_size_type
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
enum CHAT_MESSAGE
 | 
					enum CHAT_MESSAGE
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  CHAT = 0,
 | 
					  DESK_MOD = 0,
 | 
				
			||||||
  PRE_EMOTE,
 | 
					  PRE_EMOTE,
 | 
				
			||||||
  CHAR_NAME,
 | 
					  CHAR_NAME,
 | 
				
			||||||
  EMOTE,
 | 
					  EMOTE,
 | 
				
			||||||
 | 
				
			|||||||
@ -136,6 +136,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
				
			|||||||
    flipping_enabled = false;
 | 
					    flipping_enabled = false;
 | 
				
			||||||
    custom_objection_enabled = false;
 | 
					    custom_objection_enabled = false;
 | 
				
			||||||
    improved_loading_enabled = false;
 | 
					    improved_loading_enabled = false;
 | 
				
			||||||
 | 
					    desk_mod_enabled = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%");
 | 
					    AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%");
 | 
				
			||||||
    send_server_packet(hi_packet);
 | 
					    send_server_packet(hi_packet);
 | 
				
			||||||
@ -176,6 +177,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
				
			|||||||
        improved_loading_enabled = true;
 | 
					        improved_loading_enabled = true;
 | 
				
			||||||
    if (f_packet.contains("noencryption",Qt::CaseInsensitive))
 | 
					    if (f_packet.contains("noencryption",Qt::CaseInsensitive))
 | 
				
			||||||
        encryption_needed = false;
 | 
					        encryption_needed = false;
 | 
				
			||||||
 | 
					    if (f_packet.contains("deskmod",Qt::CaseInsensitive))
 | 
				
			||||||
 | 
					        desk_mod_enabled = true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  else if (header == "PN")
 | 
					  else if (header == "PN")
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
				
			|||||||
@ -459,10 +459,13 @@ int AOApplication::get_desk_mod(QString p_char, int p_emote)
 | 
				
			|||||||
  QStringList result_contents = f_result.split("#");
 | 
					  QStringList result_contents = f_result.split("#");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (result_contents.size() < 5)
 | 
					  if (result_contents.size() < 5)
 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    return -1;
 | 
					    return -1;
 | 
				
			||||||
  }
 | 
					
 | 
				
			||||||
  else return result_contents.at(4).toInt();
 | 
					  QString string_result = result_contents.at(4);
 | 
				
			||||||
 | 
					  if (string_result == "")
 | 
				
			||||||
 | 
					    return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  else return string_result.toInt();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString AOApplication::get_sfx_name(QString p_char, int p_emote)
 | 
					QString AOApplication::get_sfx_name(QString p_char, int p_emote)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user