示例#1
0
/*
 * Function to choose wich kind of charlist to send to client depending on his version
 */
void chclif_mmo_char_send(int fd, struct char_session_data* sd){
	ShowInfo("sd->version = %d\n",sd->version);
	if(sd->version >= date2version(20130000) ){
		chclif_mmo_send082d(fd,sd);
		chclif_mmo_send006b(fd,sd);
		chclif_charlist_notify(fd,sd);
	} else
		chclif_mmo_send006b(fd,sd);
	//@FIXME dump from kro doesn't show 6b transmission
	if(sd->version >= date2version(20060819) )
 		chclif_block_character(fd,sd);
}
示例#2
0
int chlogif_parse_ackaccreq(int fd, struct char_session_data* sd){
	if (RFIFOREST(fd) < 25)
		return 0;
	{
		int account_id = RFIFOL(fd,2);
		uint32 login_id1 = RFIFOL(fd,6);
		uint32 login_id2 = RFIFOL(fd,10);
		uint8 sex = RFIFOB(fd,14);
		uint8 result = RFIFOB(fd,15);
		int request_id = RFIFOL(fd,16);
		uint32 version = RFIFOL(fd,20);
		uint8 clienttype = RFIFOB(fd,24);
		RFIFOSKIP(fd,25);

		if( session_isActive(request_id) && (sd=(struct char_session_data*)session[request_id]->session_data) &&
			!sd->auth && sd->account_id == account_id && sd->login_id1 == login_id1 && sd->login_id2 == login_id2 && sd->sex == sex )
		{
			int client_fd = request_id;
			sd->version = version;
			sd->clienttype = clienttype;
			if(sd->version != date2version(PACKETVER))
				ShowWarning("s aid=%d has an incorect version=%d in clientinfo. Server compiled for %d\n",
					sd->account_id,sd->version,date2version(PACKETVER));

			switch( result )
			{
			case 0:// ok
				char_auth_ok(client_fd, sd);
				break;
			case 1:// auth failed
				WFIFOHEAD(client_fd,3);
				WFIFOW(client_fd,0) = 0x6c;
				WFIFOB(client_fd,2) = 0;// rejected from server
				WFIFOSET(client_fd,3);
				break;
			}
		}
	}
	return 1;
}
示例#3
0
/**
 * Inform client that auth has failed.
 * @param sd: player session
 * @param result: nb (msg define in conf)
    0 = Unregistered ID
    1 = Incorrect Password
    2 = This ID is expired
    3 = Rejected from Server
    4 = You have been blocked by the GM Team
    5 = Your Game's EXE file is not the latest version
    6 = Your are Prohibited to log in until %s
    7 = Server is jammed due to over populated
    8 = No more accounts may be connected from this company
    9 = MSI_REFUSE_BAN_BY_DBA
    10 = MSI_REFUSE_EMAIL_NOT_CONFIRMED
    11 = MSI_REFUSE_BAN_BY_GM
    12 = MSI_REFUSE_TEMP_BAN_FOR_DBWORK
    13 = MSI_REFUSE_SELF_LOCK
    14 = MSI_REFUSE_NOT_PERMITTED_GROUP
    15 = MSI_REFUSE_NOT_PERMITTED_GROUP
    99 = This ID has been totally erased
    100 = Login information remains at %s
    101 = Account has been locked for a hacking investigation. Please contact the GM Team for more information
    102 = This account has been temporarily prohibited from login due to a bug-related investigation
    103 = This character is being deleted. Login is temporarily unavailable for the time being
    104 = This character is being deleted. Login is temporarily unavailable for the time being
     default = Unknown Error.
 */
static void logclif_auth_failed(struct login_session_data* sd, int result) {
	int fd = sd->fd;
	uint32 ip = session[fd]->client_addr;

	if (login_config.log_login)
	{
		if(result >= 0 && result <= 15)
		    login_log(ip, sd->userid, result, msg_txt(result));
		else if(result >= 99 && result <= 104)
		    login_log(ip, sd->userid, result, msg_txt(result-83)); //-83 offset
		else
		    login_log(ip, sd->userid, result, msg_txt(22)); //unknow error
	}

	if( (result == 0 || result == 1) && login_config.dynamic_pass_failure_ban )
		ipban_log(ip); // log failed password attempt

//#if PACKETVER >= 20120000 /* not sure when this started */
	if( sd->version >= date2version(20120000) ){ /* not sure when this started */
		WFIFOHEAD(fd,26);
		WFIFOW(fd,0) = 0x83e;
		WFIFOL(fd,2) = result;
		if( result != 6 )
			memset(WFIFOP(fd,6), '\0', 20);
		else { // 6 = Your are Prohibited to log in until %s
			struct mmo_account acc;
			AccountDB* accounts = login_get_accounts_db();
			time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0;
			timestamp2string(WFIFOCP(fd,6), 20, unban_time, login_config.date_format);
		}
		WFIFOSET(fd,26);
	}
//#else	
	else {
		WFIFOHEAD(fd,23);
		WFIFOW(fd,0) = 0x6a;
		WFIFOB(fd,2) = (uint8)result;
		if( result != 6 )
			memset(WFIFOP(fd,3), '\0', 20);
		else { // 6 = Your are Prohibited to log in until %s
			struct mmo_account acc;
			AccountDB* accounts = login_get_accounts_db();
			time_t unban_time = ( accounts->load_str(accounts, &acc, sd->userid) ) ? acc.unban_time : 0;
			timestamp2string(WFIFOCP(fd,3), 20, unban_time, login_config.date_format);
		}
		WFIFOSET(fd,23);
	}
//#endif	
}
示例#4
0
int chlogif_parse_reqaccdata(int fd, struct char_session_data* sd){
	int u_fd; //user fd
	if (RFIFOREST(fd) < 79)
		return 0;

	// find the authenticated session with this account id
	ARR_FIND( 0, fd_max, u_fd, session[u_fd] && (sd = (struct char_session_data*)session[u_fd]->session_data) && sd->auth && sd->account_id == RFIFOL(fd,2) );
	if( u_fd < fd_max )
	{
		int server_id;
		memcpy(sd->email, RFIFOP(fd,6), 40);
		sd->expiration_time = (time_t)RFIFOL(fd,46);
		sd->group_id = RFIFOB(fd,50);
		sd->char_slots = RFIFOB(fd,51);
		if( sd->char_slots > MAX_CHARS ) {
			ShowError("Account '%d' `character_slots` column is higher than supported MAX_CHARS (%d), update MAX_CHARS in mmo.h! capping to MAX_CHARS...\n",sd->account_id,sd->char_slots);
			sd->char_slots = MAX_CHARS;/* cap to maximum */
		} else if ( !sd->char_slots )/* no value aka 0 in sql */
			sd->char_slots = MIN_CHARS;/* cap to minimum */
		safestrncpy(sd->birthdate, (const char*)RFIFOP(fd,52), sizeof(sd->birthdate));
                safestrncpy(sd->pincode, (const char*)RFIFOP(fd,63), sizeof(sd->pincode));
                sd->pincode_change = (time_t)RFIFOL(fd,68);
                sd->bank_vault = RFIFOL(fd,72);
                sd->isvip = RFIFOB(fd,76);
                sd->chars_vip = RFIFOB(fd,77);
                sd->chars_billing = RFIFOB(fd,78);
		ARR_FIND( 0, ARRAYLENGTH(map_server), server_id, map_server[server_id].fd > 0 && map_server[server_id].map[0] );
		// continued from char_auth_ok...
		if( server_id == ARRAYLENGTH(map_server) || //server not online, bugreport:2359
			(charserv_config.max_connect_user == 0 && sd->group_id != charserv_config.gm_allow_group) ||
			( charserv_config.max_connect_user > 0 && char_count_users() >= charserv_config.max_connect_user && sd->group_id != charserv_config.gm_allow_group ) ) {
			// refuse connection (over populated)
			WFIFOHEAD(u_fd,3);
			WFIFOW(u_fd,0) = 0x6c;
			WFIFOW(u_fd,2) = 0;
			WFIFOSET(u_fd,3);
		} else {
			// send characters to player
			chclif_mmo_char_send(u_fd, sd);
			if(sd->version >= date2version(20110309)){
				ShowInfo("Asking to start pincode\n");
				chlogif_pincode_start(u_fd,sd);
			}
		}
	}
	RFIFOSKIP(fd,79);
	return 1;
}
示例#5
0
/// @param result
/// 0 (0x718): An unknown error has occurred.
/// 1: none/success
/// 2 (0x71c): Due to system settings can not be deleted.
/// 3 (0x719): A database error occurred.
/// 4 (0x71d): Deleting not yet possible time.
/// 5 (0x71e): Date of birth do not match.
/// Any (0x718): An unknown error has occurred.
/// HC: <082a>.W <char id>.L <Msg:0-5>.L
void chclif_char_delete2_accept_ack(int fd, uint32 char_id, uint32 result) {
	if(result == 1 ){
		struct char_session_data* sd;
		sd = (struct char_session_data*)session[fd]->session_data;

		if( sd->version >= date2version(20130000) ){
			chclif_mmo_char_send(fd, sd);
		}
	}

	WFIFOHEAD(fd,10);
	WFIFOW(fd,0) = 0x82a;
	WFIFOL(fd,2) = char_id;
	WFIFOL(fd,6) = result;
	WFIFOSET(fd,10);
}
示例#6
0
//----------------------------------------
// Function to send characters to a player
//----------------------------------------
int chclif_mmo_send006b(int fd, struct char_session_data* sd){
	int j, offset = 0;
	bool newvers = (sd->version >= date2version(20100413) );
	if(newvers) //20100413
		offset += 3;
	if (charserv_config.save_log)
		ShowInfo("Loading Char Data ("CL_BOLD"%d"CL_RESET")\n",sd->account_id);

	j = 24 + offset; // offset
	WFIFOHEAD(fd,j + MAX_CHARS*MAX_CHAR_BUF);
	WFIFOW(fd,0) = 0x6b;
	if(newvers){ //20100413
		WFIFOB(fd,4) = MAX_CHARS; // Max slots.
		WFIFOB(fd,5) = MIN_CHARS; // Available slots. (PremiumStartSlot)
		WFIFOB(fd,6) = MIN_CHARS+sd->chars_vip; // Premium slots. (Any existent chars past sd->char_slots but within MAX_CHARS will show a 'Premium Service' in red)
	}
	memset(WFIFOP(fd,4 + offset), 0, 20); // unknown bytes
	j+=char_mmo_chars_fromsql(sd, WFIFOP(fd,j));
	WFIFOW(fd,2) = j; // packet len
	WFIFOSET(fd,j);

	return 0;
}