Exemple #1
0
void chlogif_send_setallaccoffline(int fd){
	if (!chlogif_isconnected())
		return;
	WFIFOHEAD(fd,2);
	WFIFOW(fd,0) = 0x2737;
	WFIFOSET(fd,2);
}
int chlogif_broadcast_user_count(int tid, unsigned int tick, int id, intptr_t data)
{
	uint8 buf[6];
	int users = char_count_users();

	// only send an update when needed
	static int prev_users = 0;
	if( prev_users == users )
		return 0;
	prev_users = users;

	if( chlogif_isconnected() )
	{
		// send number of user to login server
		WFIFOHEAD(login_fd,6);
		WFIFOW(login_fd,0) = 0x2714;
		WFIFOL(login_fd,2) = users;
		WFIFOSET(login_fd,6);
	}

	// send number of players to all map-servers
	WBUFW(buf,0) = 0x2b00;
	WBUFL(buf,2) = users;
	chmapif_sendall(buf,6);

	return 0;
}
Exemple #3
0
void chlogif_send_setaccoffline(int fd, int aid){
	if (!chlogif_isconnected())
		return;
	WFIFOHEAD(fd,6);
	WFIFOW(fd,0) = 0x272c;
	WFIFOL(fd,2) = aid;
	WFIFOSET(fd,6);
}
Exemple #4
0
void chlogif_pincode_notifyLoginPinError( uint32 account_id ){
	if ( chlogif_isconnected() ){
		WFIFOHEAD(login_fd,6);
		WFIFOW(login_fd,0) = 0x2739;
		WFIFOL(login_fd,2) = account_id;
		WFIFOSET(login_fd,6);
	}
}
Exemple #5
0
void chlogif_send_setacconline(int aid){
	if (!chlogif_isconnected())
		return;
	WFIFOHEAD(login_fd,6);
	WFIFOW(login_fd,0) = 0x272b;
	WFIFOL(login_fd,2) = aid;
	WFIFOSET(login_fd,6);
}
Exemple #6
0
void chlogif_send_reqaccdata(int fd, struct char_session_data *sd){
	if (!chlogif_isconnected())
		return;
	WFIFOHEAD(fd,6);
	WFIFOW(fd,0) = 0x2716;
	WFIFOL(fd,2) = sd->account_id;
	WFIFOSET(fd,6);
}
Exemple #7
0
void chlogif_request_accreg2(uint32 account_id, uint32 char_id){
	if (!chlogif_isconnected())
		return;
	WFIFOHEAD(login_fd,10);
	WFIFOW(login_fd,0) = 0x272e;
	WFIFOL(login_fd,2) = account_id;
	WFIFOL(login_fd,6) = char_id;
	WFIFOSET(login_fd,10);
}
Exemple #8
0
void chlogif_send_usercount(int users){
	if (!chlogif_isconnected())
		return;
	// send number of user to login server
	WFIFOHEAD(login_fd,6);
	WFIFOW(login_fd,0) = 0x2714;
	WFIFOL(login_fd,2) = users;
	WFIFOSET(login_fd,6);
}
Exemple #9
0
void chlogif_upd_global_accreg(uint32 account_id, uint32 char_id) {
	if ( chlogif_isconnected() ){
		WFIFOHEAD(login_fd, 60000 + 300);
		WFIFOW(login_fd, 0) = 0x2728;
		WFIFOW(login_fd, 2) = 14;
		WFIFOL(login_fd, 4) = account_id;
		WFIFOL(login_fd, 8) = char_id;
		WFIFOW(login_fd, 12) = 0; // count
	}
}
int chlogif_send_setaccoffline(int fd, int aid){
	if (chlogif_isconnected()){
		WFIFOHEAD(fd,6);
		WFIFOW(fd,0) = 0x272c;
		WFIFOL(fd,2) = aid;
		WFIFOSET(fd,6);
		return 1;
	}
	return 0;
}
Exemple #11
0
void chlogif_pincode_notifyLoginPinUpdate( uint32 account_id, char* pin ){
	if ( chlogif_isconnected() ){
		int size = 8 + PINCODE_LENGTH+1;
		WFIFOHEAD(login_fd,size);
		WFIFOW(login_fd,0) = 0x2738;
		WFIFOW(login_fd,2) = size;
		WFIFOL(login_fd,4) = account_id;
		strncpy( WFIFOCP(login_fd,8), pin, PINCODE_LENGTH+1 );
		WFIFOSET(login_fd,size);
	}
}
Exemple #12
0
void chlogif_send_global_accreg(const char *key, unsigned int index, intptr_t val, bool is_string) {
	int nlen = WFIFOW(login_fd, 2);
	size_t len;

	if (!chlogif_isconnected())
		return;

	len = strlen(key)+1;

	WFIFOB(login_fd, nlen) = (unsigned char)len; // won't be higher; the column size is 32
	nlen += 1;

	safestrncpy(WFIFOCP(login_fd,nlen), key, len);
	nlen += len;

	WFIFOL(login_fd, nlen) = index;
	nlen += 4;

	if( is_string ) {
		WFIFOB(login_fd, nlen) = val ? 2 : 3;
		nlen += 1;

		if( val ) {
			char *sval = (char*)val;
			len = strlen(sval)+1;

			WFIFOB(login_fd, nlen) = (unsigned char)len; // won't be higher; the column size is 254
			nlen += 1;

			safestrncpy(WFIFOCP(login_fd,nlen), sval, len);
			nlen += len;
		}
	} else {
		WFIFOB(login_fd, nlen) = val ? 0 : 1;
		nlen += 1;

		if( val ) {
			WFIFOL(login_fd, nlen) = (int)val;
			nlen += 4;
		}
	}

	WFIFOW(login_fd,12) += 1;
	WFIFOW(login_fd, 2) = nlen;

	if( WFIFOW(login_fd, 2) > 60000 ) {
		int account_id = WFIFOL(login_fd,4), char_id = WFIFOL(login_fd,8);

		chlogif_prepsend_global_accreg();
		chlogif_upd_global_accreg(account_id, char_id); // prepare next
	}
}
/**
 * Timered function to send all account_id connected to login-serv
 * @param tid : Timer id
 * @param tick : Scheduled tick
 * @param id : GID linked to that timered call
 * @param data : data transmited for delayed function
 * @return 
 */
int chlogif_send_acc_tologin(int tid, unsigned int tick, int id, intptr_t data) {
	if ( chlogif_isconnected() ){
		DBMap*  online_char_db = char_get_onlinedb();
		// send account list to login server
		int users = online_char_db->size(online_char_db);
		int i = 0;

		WFIFOHEAD(login_fd,8+users*4);
		WFIFOW(login_fd,0) = 0x272d;
		online_char_db->foreach(online_char_db, chlogif_send_acc_tologin_sub, &i, users);
		WFIFOW(login_fd,2) = 8+ i*4;
		WFIFOL(login_fd,4) = i;
		WFIFOSET(login_fd,WFIFOW(login_fd,2));
		return 1;
	}
	return 0;
}
Exemple #14
0
void chlogif_prepsend_global_accreg(void) {
	if ( chlogif_isconnected() ){
		WFIFOSET(login_fd, WFIFOW(login_fd,2));
	}
}