Esempio n. 1
0
/*==========================================
 * new auth system [Kevin]
 *------------------------------------------*/
void chrif_authreq(struct map_session_data *sd)
{
	struct auth_node *node= chrif_search(sd->bl.id);

	if(!node) {
		//data from char server has not arrived yet.
		chrif_sd_to_auth(sd, ST_LOGIN);
		return;
	}

	if(node->state == ST_LOGIN &&
		node->char_dat &&
		node->account_id == sd->status.account_id &&
		node->char_id == sd->status.char_id &&
		node->login_id1 == sd->login_id1)
	{	//auth ok
		if (!pc_authok(sd, node->login_id2, node->connect_until_time, node->char_dat))
		{
			chrif_char_offline(sd); //Set client offline
			chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN);
		}
		else {
			//char_dat no longer needed, but player auth is not completed yet.
			aFree(node->char_dat);
			node->char_dat = NULL;
			node->sd = sd;
			chrif_char_online(sd); //Set client online
		}
	} else { //auth failed
		pc_authfail(sd);
		chrif_char_offline(sd); //Set client offline
		chrif_auth_delete(sd->status.account_id, sd->status.char_id, ST_LOGIN);
	}
	return;
}
Esempio n. 2
0
static bool chrif_auth_logout(TBL_PC* sd, enum sd_state state)
{
	if(sd->fd && state == ST_LOGOUT)
  	{	//Disassociate player, and free it after saving ack returns. [Skotlex]
		//fd info must not be lost for ST_MAPCHANGE as a final packet needs to be sent to the player.
		if (session[sd->fd])
			session[sd->fd]->session_data = NULL;
		sd->fd = 0;
	}
	return chrif_sd_to_auth(sd, state);
}
Esempio n. 3
0
/*==========================================
 * Request auth confirmation
 *------------------------------------------*/
void chrif_authreq(struct map_session_data *sd) {
	struct auth_node *node= chrif_search(sd->bl.id);

	if( node != NULL || !chrif_isconnected() ) {
		set_eof(sd->fd);
		return;
	}

	WFIFOHEAD(char_fd,19);
	WFIFOW(char_fd,0) = 0x2b26;
	WFIFOL(char_fd,2) = sd->status.account_id;
	WFIFOL(char_fd,6) = sd->status.char_id;
	WFIFOL(char_fd,10) = sd->login_id1;
	WFIFOB(char_fd,14) = sd->status.sex;
	WFIFOL(char_fd,15) = htonl(session[sd->fd]->client_addr);
	WFIFOSET(char_fd,19);
	chrif_sd_to_auth(sd, ST_LOGIN);
}