Ejemplo n.º 1
0
static int	check_nbr_client(int level, t_client *client,
				 t_map *map, int opt)
{
  static int	player_need[LVL] = {1, 2, 2, 4, 4, 6, 6};
  int		i;

  i = 0;
  while (client && client->end != 1)
    {
      if (client->type == CLIENT && client->map == map
	  && client->level - 1 == level)
	i++;
      client = client->nt;
    }
  client = client_reset(client);
  while (player_need[level] == i && opt == 1 && client->end != 1)
    {
      if (client->type == CLIENT && client->map == map
	  && client->level - 1 == level)
	{
	  client->level++;
	  send_mess(create_mess(client, get_mess_level_up(client->level)));
	}
      client = client->nt;
    }
  if (player_need[level] == i)
    return 1;
  return -1;
}
Ejemplo n.º 2
0
void ChatCore::add_UI(QObject *ui_core)
{
    this->ui_core=ui_core;
    QObject::connect(ui_core, SIGNAL(loginSignal(QString, QString, QString)),
                     this, SLOT(tryconnect(QString, QString, QString)));
    QObject::connect(ui_core, SIGNAL(disconnectSignal()),
                     this, SLOT(disconnect()));
    QObject::connect(ui_core, SIGNAL(sendMessSignal(QString, QString)),
                     this, SLOT(send_mess(QString, QString)));
}
Ejemplo n.º 3
0
void		level_up(t_msg *msg, t_client *client, t_map **map, t_opt *opt)
{
  (void)opt;
  sub_food(msg, client, "elevation en cours\n");
  send_mess(msg);
  if (map && client &&
      check_ress(client->level - 1, client->map, client, 0) == 1)
    {
      msg->time = get_time_client(client, 300);
      begin_incant(client->level, client, client->map->x, client->map->y);
    }
  else
    sub_food(msg, msg->client, "elevation fail\n");
}
Ejemplo n.º 4
0
t_msg		*exec_task(t_msg *task)
{
  while (task && task->end != 1 && task->time < get_time())
    {
      if (strcmp(task->comand, "incantation") == 0 && up_level(task) == 1)
	up_level(task);
      if (send_mess(task) == -1)
	printf("unable to send_mess\n");
      task = task->nt;
      free(task->prev);
    }
  if (task)
    task->prev = NULL;
  return task;
}
Ejemplo n.º 5
0
void MainWindow::on_actionStart_messages_triggered()
{
    send_mess();
}