Guilty / Not Guilty buttons for the judge position.
This commit is contained in:
		
							parent
							
								
									331bca5f73
								
							
						
					
					
						commit
						0368e7dc45
					
				@ -157,6 +157,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
			
		||||
  ui_ooc_toggle = new AOButton(this, ao_app);
 | 
			
		||||
  ui_witness_testimony = new AOButton(this, ao_app);
 | 
			
		||||
  ui_cross_examination = new AOButton(this, ao_app);
 | 
			
		||||
  ui_guilty = new AOButton(this, ao_app);
 | 
			
		||||
  ui_not_guilty = new AOButton(this, ao_app);
 | 
			
		||||
 | 
			
		||||
  ui_change_character = new AOButton(this, ao_app);
 | 
			
		||||
  ui_reload_theme = new AOButton(this, ao_app);
 | 
			
		||||
@ -276,6 +278,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
 | 
			
		||||
 | 
			
		||||
  connect(ui_witness_testimony, SIGNAL(clicked()), this, SLOT(on_witness_testimony_clicked()));
 | 
			
		||||
  connect(ui_cross_examination, SIGNAL(clicked()), this, SLOT(on_cross_examination_clicked()));
 | 
			
		||||
  connect(ui_guilty, SIGNAL(clicked()), this, SLOT(on_guilty_clicked()));
 | 
			
		||||
  connect(ui_not_guilty, SIGNAL(clicked()), this, SLOT(on_not_guilty_clicked()));
 | 
			
		||||
 | 
			
		||||
  connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked()));
 | 
			
		||||
  connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked()));
 | 
			
		||||
@ -483,6 +487,11 @@ void Courtroom::set_widgets()
 | 
			
		||||
  set_size_and_pos(ui_cross_examination, "cross_examination");
 | 
			
		||||
  ui_cross_examination->set_image("crossexamination.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_guilty, "guilty");
 | 
			
		||||
  ui_guilty->set_image("guilty.png");
 | 
			
		||||
  set_size_and_pos(ui_not_guilty, "not_guilty");
 | 
			
		||||
  ui_not_guilty->set_image("notguilty.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_change_character, "change_character");
 | 
			
		||||
  ui_change_character->setText("Change character");
 | 
			
		||||
 | 
			
		||||
@ -739,6 +748,8 @@ void Courtroom::enter_courtroom(int p_cid)
 | 
			
		||||
  {
 | 
			
		||||
    ui_witness_testimony->show();
 | 
			
		||||
    ui_cross_examination->show();
 | 
			
		||||
    ui_not_guilty->show();
 | 
			
		||||
    ui_guilty->show();
 | 
			
		||||
    ui_defense_minus->show();
 | 
			
		||||
    ui_defense_plus->show();
 | 
			
		||||
    ui_prosecution_minus->show();
 | 
			
		||||
@ -748,6 +759,8 @@ void Courtroom::enter_courtroom(int p_cid)
 | 
			
		||||
  {
 | 
			
		||||
    ui_witness_testimony->hide();
 | 
			
		||||
    ui_cross_examination->hide();
 | 
			
		||||
    ui_guilty->hide();
 | 
			
		||||
    ui_not_guilty->hide();
 | 
			
		||||
    ui_defense_minus->hide();
 | 
			
		||||
    ui_defense_plus->hide();
 | 
			
		||||
    ui_prosecution_minus->hide();
 | 
			
		||||
@ -2167,7 +2180,7 @@ void Courtroom::handle_song(QStringList *p_contents)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::handle_wtce(QString p_wtce)
 | 
			
		||||
void Courtroom::handle_wtce(QString p_wtce, int variant)
 | 
			
		||||
{
 | 
			
		||||
  QString sfx_file = "courtroom_sounds.ini";
 | 
			
		||||
 | 
			
		||||
@ -2186,6 +2199,20 @@ void Courtroom::handle_wtce(QString p_wtce)
 | 
			
		||||
    ui_vp_wtce->play("crossexamination");
 | 
			
		||||
    testimony_in_progress = false;
 | 
			
		||||
  }
 | 
			
		||||
  else if (p_wtce == "judgeruling")
 | 
			
		||||
  {
 | 
			
		||||
    if (variant == 0)
 | 
			
		||||
    {
 | 
			
		||||
        sfx_player->play(ao_app->get_sfx("not_guilty"));
 | 
			
		||||
        ui_vp_wtce->play("notguilty");
 | 
			
		||||
        testimony_in_progress = false;
 | 
			
		||||
    }
 | 
			
		||||
    else if (variant == 1) {
 | 
			
		||||
        sfx_player->play(ao_app->get_sfx("guilty"));
 | 
			
		||||
        ui_vp_wtce->play("guilty");
 | 
			
		||||
        testimony_in_progress = false;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::set_hp_bar(int p_bar, int p_state)
 | 
			
		||||
@ -2606,6 +2633,26 @@ void Courtroom::on_cross_examination_clicked()
 | 
			
		||||
  ui_ic_chat_message->setFocus();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::on_not_guilty_clicked()
 | 
			
		||||
{
 | 
			
		||||
  if (is_muted)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  ao_app->send_server_packet(new AOPacket("RT#judgeruling#0#%"));
 | 
			
		||||
 | 
			
		||||
  ui_ic_chat_message->setFocus();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::on_guilty_clicked()
 | 
			
		||||
{
 | 
			
		||||
  if (is_muted)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  ao_app->send_server_packet(new AOPacket("RT#judgeruling#1#%"));
 | 
			
		||||
 | 
			
		||||
  ui_ic_chat_message->setFocus();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::on_change_character_clicked()
 | 
			
		||||
{
 | 
			
		||||
  music_player->set_volume(0);
 | 
			
		||||
 | 
			
		||||
@ -133,7 +133,7 @@ public:
 | 
			
		||||
  void play_preanim();
 | 
			
		||||
 | 
			
		||||
  //plays the witness testimony or cross examination animation based on argument
 | 
			
		||||
  void handle_wtce(QString p_wtce);
 | 
			
		||||
  void handle_wtce(QString p_wtce, int variant);
 | 
			
		||||
 | 
			
		||||
  //sets the hp bar of defense(p_bar 1) or pro(p_bar 2)
 | 
			
		||||
  //state is an number between 0 and 10 inclusive
 | 
			
		||||
@ -366,6 +366,8 @@ private:
 | 
			
		||||
 | 
			
		||||
  AOButton *ui_witness_testimony;
 | 
			
		||||
  AOButton *ui_cross_examination;
 | 
			
		||||
  AOButton *ui_guilty;
 | 
			
		||||
  AOButton *ui_not_guilty;
 | 
			
		||||
 | 
			
		||||
  AOButton *ui_change_character;
 | 
			
		||||
  AOButton *ui_reload_theme;
 | 
			
		||||
@ -525,6 +527,8 @@ private slots:
 | 
			
		||||
 | 
			
		||||
  void on_witness_testimony_clicked();
 | 
			
		||||
  void on_cross_examination_clicked();
 | 
			
		||||
  void on_not_guilty_clicked();
 | 
			
		||||
  void on_guilty_clicked();
 | 
			
		||||
 | 
			
		||||
  void on_change_character_clicked();
 | 
			
		||||
  void on_reload_theme_clicked();
 | 
			
		||||
 | 
			
		||||
@ -490,7 +490,13 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
 | 
			
		||||
    if (f_contents.size() < 1)
 | 
			
		||||
      goto end;
 | 
			
		||||
    if (courtroom_constructed)
 | 
			
		||||
      w_courtroom->handle_wtce(f_contents.at(0));
 | 
			
		||||
    {
 | 
			
		||||
      if (f_contents.size() == 1)
 | 
			
		||||
          w_courtroom->handle_wtce(f_contents.at(0), 0);
 | 
			
		||||
      else if (f_contents.size() == 2) {
 | 
			
		||||
          w_courtroom->handle_wtce(f_contents.at(0), f_contents.at(1).toInt());
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  else if (header == "HP")
 | 
			
		||||
  {
 | 
			
		||||
 | 
			
		||||
@ -533,18 +533,23 @@ class AOProtocol(asyncio.Protocol):
 | 
			
		||||
        if not self.client.can_wtce:
 | 
			
		||||
            self.client.send_host_message('You were blocked from using judge signs by a moderator.')
 | 
			
		||||
            return
 | 
			
		||||
        if not self.validate_net_cmd(args, self.ArgType.STR):
 | 
			
		||||
        if not self.validate_net_cmd(args, self.ArgType.STR) and not self.validate_net_cmd(args, self.ArgType.STR, self.ArgType.INT):
 | 
			
		||||
            return
 | 
			
		||||
        if args[0] == 'testimony1':
 | 
			
		||||
            sign = 'WT'
 | 
			
		||||
        elif args[0] == 'testimony2':
 | 
			
		||||
            sign = 'CE'
 | 
			
		||||
        elif args[0] == 'judgeruling':
 | 
			
		||||
            sign = 'JR'
 | 
			
		||||
        else:
 | 
			
		||||
            return
 | 
			
		||||
        if self.client.wtce_mute():
 | 
			
		||||
            self.client.send_host_message('You used witness testimony/cross examination signs too many times. Please try again after {} seconds.'.format(int(self.client.wtce_mute())))
 | 
			
		||||
            return
 | 
			
		||||
        self.client.area.send_command('RT', args[0])
 | 
			
		||||
        if len(args) == 1:
 | 
			
		||||
            self.client.area.send_command('RT', args[0])
 | 
			
		||||
        elif len(args) == 2:
 | 
			
		||||
            self.client.area.send_command('RT', args[0], args[1])
 | 
			
		||||
        self.client.area.add_to_judgelog(self.client, 'used {}'.format(sign))
 | 
			
		||||
        logger.log_server("[{}]{} Used WT/CE".format(self.client.area.id, self.client.get_char_name()), self.client)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user