Esempio n. 1
0
/*==========================================
 * Request auth confirmation
 *------------------------------------------*/
void chrif_authreq(struct map_session_data *sd)
{
	struct auth_node *node= chrif_search(sd->bl.id);

	if( node != NULL )
	{
		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);
}
Esempio n. 2
0
int mapif_pet_info(int fd, int account_id, struct s_pet *p){
	WFIFOHEAD(fd, sizeof(struct s_pet) + 9);
	WFIFOW(fd, 0) =0x3881;
	WFIFOW(fd, 2) =sizeof(struct s_pet) + 9;
	WFIFOL(fd, 4) =account_id;
	WFIFOB(fd, 8)=0;
	memcpy(WFIFOP(fd, 9), p, sizeof(struct s_pet));
	WFIFOSET(fd, WFIFOW(fd, 2));

	return 0;
}
Esempio n. 3
0
int mapif_itembound_ack(int fd, int aid, int guild_id)
{
#ifdef GP_BOUND_ITEMS
	WFIFOHEAD(fd,8);
	WFIFOW(fd,0) = 0x3856;
	WFIFOL(fd,2) = aid;/* the value is not being used, drop? */
	WFIFOW(fd,6) = guild_id;
	WFIFOSET(fd,8);
#endif
	return 0;
}
Esempio n. 4
0
// Create a party whether or not
int mapif_party_created(int fd,int account_id,int char_id,struct party *p)
{
	WFIFOHEAD(fd, 39);
	WFIFOW(fd,0)=0x3820;
	WFIFOL(fd,2)=account_id;
	WFIFOL(fd,6)=char_id;
	if(p!=NULL){
		WFIFOB(fd,10)=0;
		WFIFOL(fd,11)=p->party_id;
		memcpy(WFIFOP(fd,15),p->name,NAME_LENGTH);
		ShowInfo("Grupo criado (PID: %d | Nome: %s).\n",p->party_id,p->name);
	}else{
		WFIFOB(fd,10)=1;
		WFIFOL(fd,11)=0;
		memset(WFIFOP(fd,15),0,NAME_LENGTH);
	}
	WFIFOSET(fd,39);

	return 0;
}
Esempio n. 5
0
// Create a party whether or not
int mapif_party_created(int fd,int account_id,int char_id,struct party *p)
{
	WFIFOHEAD(fd, 39);
	WFIFOW(fd,0)=0x3820;
	WFIFOL(fd,2)=account_id;
	WFIFOL(fd,6)=char_id;
	if(p!=NULL) {
		WFIFOB(fd,10)=0;
		WFIFOL(fd,11)=p->party_id;
		memcpy(WFIFOP(fd,15),p->name,NAME_LENGTH);
		ShowInfo(read_message("Source.char.party_created"),p->party_id,p->name);
	} else {
		WFIFOB(fd,10)=1;
		WFIFOL(fd,11)=0;
		memset(WFIFOP(fd,15),0,NAME_LENGTH);
	}
	WFIFOSET(fd,39);

	return 0;
}
Esempio n. 6
0
void mapif_homunculus_created(int fd, int account_id, const struct s_homunculus *sh, unsigned char flag)
{
	nullpo_retv(sh);
	WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
	WFIFOW(fd,0) = 0x3890;
	WFIFOW(fd,2) = sizeof(struct s_homunculus)+9;
	WFIFOL(fd,4) = account_id;
	WFIFOB(fd,8)= flag;
	memcpy(WFIFOP(fd,9),sh,sizeof(struct s_homunculus));
	WFIFOSET(fd, WFIFOW(fd,2));
}
Esempio n. 7
0
int mapif_pet_noinfo(int fd, int account_id){
	WFIFOHEAD(fd, sizeof(struct s_pet) + 9);
	WFIFOW(fd, 0) =0x3881;
	WFIFOW(fd, 2) =sizeof(struct s_pet) + 9;
	WFIFOL(fd, 4) =account_id;
	WFIFOB(fd, 8)=1;
	memset(WFIFOP(fd, 9), 0, sizeof(struct s_pet));
	WFIFOSET(fd, WFIFOW(fd, 2));

	return 0;
}
Esempio n. 8
0
// Create a party whether or not
int mapif_party_created(int fd,uint32 account_id,uint32 char_id,struct party *p)
{
	WFIFOHEAD(fd, 39);
	WFIFOW(fd,0)=0x3820;
	WFIFOL(fd,2)=account_id;
	WFIFOL(fd,6)=char_id;
	if(p!=NULL){
		WFIFOB(fd,10)=0;
		WFIFOL(fd,11)=p->party_id;
		memcpy(WFIFOP(fd,15),p->name,NAME_LENGTH);
		ShowInfo("int_party: Party created (%d - %s)\n",p->party_id,p->name);
	}else{
		WFIFOB(fd,10)=1;
		WFIFOL(fd,11)=0;
		memset(WFIFOP(fd,15),0,NAME_LENGTH);
	}
	WFIFOSET(fd,39);

	return 0;
}
Esempio n. 9
0
int mapif_info_homunculus(int fd, int account_id, struct s_homunculus *hd)
{
	WFIFOHEAD(fd, sizeof(struct s_homunculus)+9);
	WFIFOW(fd,0) = 0x3891;
	WFIFOW(fd,2) = sizeof(struct s_homunculus)+9;
	WFIFOL(fd,4) = account_id;
	WFIFOB(fd,8) = 1; // account loaded with success

	memcpy(WFIFOP(fd,9), hd, sizeof(struct s_homunculus));
	WFIFOSET(fd, sizeof(struct s_homunculus)+9);
	return 0;
}
Esempio n. 10
0
int mapif_homun_noinfo(int fd,int account_id)
{
	WFIFOHEAD(fd,sizeof(struct s_homunculus) + 9);
	WFIFOW(fd,0)=0x3891;
	WFIFOW(fd,2)=sizeof(struct s_homunculus) + 9;
	WFIFOL(fd,4)=account_id;
	WFIFOB(fd,8)=0;
	memset(WFIFOP(fd,9),0,sizeof(struct s_homunculus));
	WFIFOSET(fd,WFIFOW(fd,2));

	return 0;
}
Esempio n. 11
0
/*==========================================
 * 性別変化要求
 *------------------------------------------*/
int chrif_changesex(int id, int sex)
{
	chrif_check(-1);

	WFIFOHEAD(char_fd,9);
	WFIFOW(char_fd,0) = 0x2b11;
	WFIFOW(char_fd,2) = 9;
	WFIFOL(char_fd,4) = id;
	WFIFOB(char_fd,8) = sex;
	WFIFOSET(char_fd,9);
	return 0;
}
Esempio n. 12
0
/*==========================================
 * timer関数
 * 今このmap鯖に繋がっているクライアント人数をchar鯖へ送る
 *------------------------------------------*/
int send_users_tochar(int tid, unsigned int tick, int id, int data)
{
	int count, users=0, i;
	struct map_session_data **all_sd;

	chrif_check(-1);

	all_sd = map_getallusers(&count);
	WFIFOHEAD(char_fd, 6+8*users);
	WFIFOW(char_fd,0) = 0x2aff;
	for (i = 0; i < count; i++) {
		WFIFOL(char_fd,6+8*users) = all_sd[i]->status.account_id;
		WFIFOL(char_fd,6+8*users+4) = all_sd[i]->status.char_id;
		users++;
	}
	WFIFOW(char_fd,2) = 6 + 8 * users;
	WFIFOW(char_fd,4) = users;
	WFIFOSET(char_fd,6+8*users);

	return 0;
}
Esempio n. 13
0
/**
 * Sending inventory/cart/storage data to player
 * IZ 0x388a <size>.W <type>.B <account_id>.L <result>.B <inventory>.?B
 * @param fd
 * @param account_id
 * @param type
 * @param entries Inventory/cart/storage entries
 * @param result
 */
void mapif_storage_data_loaded(int fd, uint32 account_id, char type, struct s_storage entries, bool result) {
	uint16 size = sizeof(struct s_storage) + 10;
	
	WFIFOHEAD(fd, size);
	WFIFOW(fd, 0) = 0x388a;
	WFIFOW(fd, 2) = size;
	WFIFOB(fd, 4) = type;
	WFIFOL(fd, 5) = account_id;
	WFIFOB(fd, 9) = result;
	memcpy(WFIFOP(fd, 10), &entries, sizeof(struct s_storage));
	WFIFOSET(fd, size);
}
Esempio n. 14
0
int chlogif_send_usercount(int users){
	if( login_fd > 0 && session[login_fd] )
	{
		// 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);
		return 1;
	}
	return 0;
}
Esempio n. 15
0
/**
 * Argument-list version of inter_msg_to_fd
 * @see inter_msg_to_fd
 */
void inter_vmsg_to_fd(int fd, int u_fd, int aid, char* msg, va_list ap) {
	char msg_out[512];
	va_list apcopy;
	int len = 1;/* yes we start at 1 */

	va_copy(apcopy, ap);
	len += vsnprintf(msg_out, 512, msg, apcopy);
	va_end(apcopy);

	WFIFOHEAD(fd,12 + len);

	WFIFOW(fd,0) = 0x3807;
	WFIFOW(fd,2) = 12 + (unsigned short)len;
	WFIFOL(fd,4) = u_fd;
	WFIFOL(fd,8) = aid;
	safestrncpy((char*)WFIFOP(fd,12), msg_out, len);

	WFIFOSET(fd,12 + len);

	return;
}
Esempio n. 16
0
// GMメッセージを送信
int intif_GMmessage(char* mes,int len,int flag)
{
	
	int lp=(flag&0x10)?8:4;
	WFIFOW(inter_fd,0) = 0x3000;
	WFIFOW(inter_fd,2) = lp+len;
	WFIFOL(inter_fd,4) = 0x65756c62;
	memcpy(WFIFOP(inter_fd,lp), mes, len);
	WFIFOSET(inter_fd, WFIFOW(inter_fd,2) );

	return 0;
}
Esempio n. 17
0
// ギルド作成要求
int intif_guild_create (const char *name, const struct guild_member *master)
{
    nullpo_retr (0, master);

    WFIFOW (inter_fd, 0) = 0x3030;
    WFIFOW (inter_fd, 2) = sizeof (struct guild_member) + 32;
    WFIFOL (inter_fd, 4) = master->account_id;
    memcpy (WFIFOP (inter_fd, 8), name, 24);
    memcpy (WFIFOP (inter_fd, 32), master, sizeof (struct guild_member));
    WFIFOSET (inter_fd, WFIFOW (inter_fd, 2));
    return 0;
}
Esempio n. 18
0
//Request to kick char from a certain map server. [Skotlex]
int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason)
{
	if(fd >= 0) {
		WFIFOHEAD(fd,7);
		WFIFOW(fd,0) = 0x2b1f;
		WFIFOL(fd,2) = account_id;
		WFIFOB(fd,6) = reason;
		WFIFOSET(fd,7);
		return 0;
	}
	return -1;
}
Esempio n. 19
0
// recive packet about storage data
int mapif_load_storage(int fd,int account_id)
{
	//load from DB
	WFIFOHEAD(fd, sizeof(struct storage)+8);
	storage_fromsql(account_id, storage_pt);
	WFIFOW(fd,0)=0x3810;
	WFIFOW(fd,2)=sizeof(struct storage)+8;
	WFIFOL(fd,4)=account_id;
	memcpy(WFIFOP(fd,8),storage_pt,sizeof(struct storage));
	WFIFOSET(fd,WFIFOW(fd,2));
	return 0;
}
Esempio n. 20
0
// パーティ作成要求
void intif_create_party(dumb_ptr<map_session_data> sd, PartyName name)
{
    nullpo_retv(sd);

    WFIFOW(char_fd, 0) = 0x3020;
    WFIFOL(char_fd, 2) = sd->status.account_id;
    WFIFO_STRING(char_fd, 6, name, 24);
    WFIFO_STRING(char_fd, 30, sd->status.name.to__actual(), 24);
    WFIFO_STRING(char_fd, 54, sd->bl_m->name_, 16);
    WFIFOW(char_fd, 70) = sd->status.base_level;
    WFIFOSET(char_fd, 72);
}
Esempio n. 21
0
void mapif_mail_sendinbox(int fd, int char_id, unsigned char flag, struct mail_data *md)
{
	nullpo_retv(md);
	//FIXME: dumping the whole structure like this is unsafe [ultramage]
	WFIFOHEAD(fd, sizeof(struct mail_data) + 9);
	WFIFOW(fd,0) = 0x3848;
	WFIFOW(fd,2) = sizeof(struct mail_data) + 9;
	WFIFOL(fd,4) = char_id;
	WFIFOB(fd,8) = flag;
	memcpy(WFIFOP(fd,9),md,sizeof(struct mail_data));
	WFIFOSET(fd,WFIFOW(fd,2));
}
Esempio n. 22
0
int chlogif_send_reqaccdata(int fd, struct char_session_data *sd){
        //loginif_isconnected
	if (login_fd > 0) { // request account data
		// request account data
		WFIFOHEAD(fd,6);
		WFIFOW(fd,0) = 0x2716;
		WFIFOL(fd,2) = sd->account_id;
		WFIFOSET(fd,6);
		return 1;
	}
	return 0;
}
Esempio n. 23
0
// request to move a character between mapservers
int chrif_changemapserver(struct map_session_data* sd, uint32 ip, uint16 port)
{
	nullpo_retr(-1, sd);

	if (other_mapserver_count < 1)
	{	//No other map servers are online!
		clif_authfail_fd(sd->fd, 0);
		return -1;
	}

	chrif_check(-1);

	WFIFOHEAD(char_fd,35);
	WFIFOW(char_fd, 0) = 0x2b05;
	WFIFOL(char_fd, 2) = sd->bl.id;
	WFIFOL(char_fd, 6) = sd->login_id1;
	WFIFOL(char_fd,10) = sd->login_id2;
	WFIFOL(char_fd,14) = sd->status.char_id;
	WFIFOW(char_fd,18) = sd->mapindex;
	WFIFOW(char_fd,20) = sd->bl.x;
	WFIFOW(char_fd,22) = sd->bl.y;
	WFIFOL(char_fd,24) = htonl(ip);
	WFIFOW(char_fd,28) = htons(port);
	WFIFOB(char_fd,30) = sd->status.sex;
	WFIFOL(char_fd,31) = 0; // sd's IP, not used anymore
	WFIFOSET(char_fd,35);
	return 0;
}
Esempio n. 24
0
/*==========================================
 * Return Mail
 *------------------------------------------*/
static void mapif_Mail_return(int fd, int char_id, int mail_id)
{
	struct mail_message msg;
	int new_mail = 0;

	if( mail_loadmessage(mail_id, &msg) )
	{
		if( msg.dest_id != char_id)
			return;
		else if( SQL_ERROR == SQL->Query(sql_handle, "DELETE FROM `%s` WHERE `id` = '%d'", mail_db, mail_id) )
			Sql_ShowDebug(sql_handle);
		else
		{
			char temp_[MAIL_TITLE_LENGTH];

			// swap sender and receiver
			swap(msg.send_id, msg.dest_id);
			safestrncpy(temp_, msg.send_name, NAME_LENGTH);
			safestrncpy(msg.send_name, msg.dest_name, NAME_LENGTH);
			safestrncpy(msg.dest_name, temp_, NAME_LENGTH);

			// set reply message title
			snprintf(temp_, MAIL_TITLE_LENGTH, "RE:%s", msg.title);
			safestrncpy(msg.title, temp_, MAIL_TITLE_LENGTH);

			msg.status = MAIL_NEW;
			msg.timestamp = time(NULL);

			new_mail = mail_savemessage(&msg);
			mapif_Mail_new(&msg);
		}
	}

	WFIFOHEAD(fd,11);
	WFIFOW(fd,0) = 0x384c;
	WFIFOL(fd,2) = char_id;
	WFIFOL(fd,6) = mail_id;
	WFIFOB(fd,10) = (new_mail == 0);
	WFIFOSET(fd,11);
}
Esempio n. 25
0
int mapif_load_scdata(int fd,int account_id,int char_id)
{
	struct scdata *sc = statusdb_load(char_id);

	if(sc) {
		if(sc->account_id <= 0) {	// アカウントIDがないのは困るので補完
			sc->account_id = account_id;
		}
		else if(sc->account_id != account_id) {
			printf("inter_status: data load error %d %d\n",account_id,char_id);
			return 0;
		}
	}

	WFIFOW(fd,0)=0x3878;
	WFIFOL(fd,4)=account_id;

	if(sc == NULL) {
		WFIFOW(fd,2)=8;
		WFIFOSET(fd,8);
	} else {
		int i,p;
		for(i=0,p=8; i<sc->count; i++,p+=22) {
			WFIFOW(fd,p)    = sc->data[i].type;
			WFIFOL(fd,p+2)  = sc->data[i].val1;
			WFIFOL(fd,p+6)  = sc->data[i].val2;
			WFIFOL(fd,p+10) = sc->data[i].val3;
			WFIFOL(fd,p+14) = sc->data[i].val4;
			WFIFOL(fd,p+18) = sc->data[i].tick;
		}
		WFIFOW(fd,2)=p;
		WFIFOSET(fd,p);
	}
	return 0;
}
Esempio n. 26
0
/**
 * Map-serv request to save mmo_char_status in sql
 * Receive character data from map-server for saving
 * @param fd: wich fd to parse from
 * @param id: wich map_serv id
 * @return : 0 not enough data received, 1 success
 */
int chmapif_parse_reqsavechar(int fd, int id){
	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
		return 0;
	{
		int aid = RFIFOL(fd,4), cid = RFIFOL(fd,8), size = RFIFOW(fd,2);
		struct online_char_data* character;
		DBMap* online_char_db = char_get_onlinedb();

		if (size - 13 != sizeof(struct mmo_charstatus))
		{
			ShowError("parse_from_map (save-char): Size mismatch! %d != %d\n", size-13, sizeof(struct mmo_charstatus));
			RFIFOSKIP(fd,size);
			return 1;
		}
		//Check account only if this ain't final save. Final-save goes through because of the char-map reconnect
		if (RFIFOB(fd,12) || RFIFOB(fd,13) || (
			(character = (struct online_char_data*)idb_get(online_char_db, aid)) != NULL &&
			character->char_id == cid))
		{
			struct mmo_charstatus char_dat;
			memcpy(&char_dat, RFIFOP(fd,13), sizeof(struct mmo_charstatus));
			char_mmo_char_tosql(cid, &char_dat);
		} else {	//This may be valid on char-server reconnection, when re-sending characters that already logged off.
			ShowError("parse_from_map (save-char): Received data for non-existant/offline character (%d:%d).\n", aid, cid);
			char_set_char_online(id, cid, aid);
		}

		if (RFIFOB(fd,12))
		{	//Flag, set character offline after saving. [Skotlex]
			char_set_char_offline(cid, aid);
			WFIFOHEAD(fd,10);
			WFIFOW(fd,0) = 0x2b21; //Save ack only needed on final save.
			WFIFOL(fd,2) = aid;
			WFIFOL(fd,6) = cid;
			WFIFOSET(fd,10);
		}
		RFIFOSKIP(fd,size);
	}
	return 1;
}
Esempio n. 27
0
// パーティ作成要求
int intif_create_party(struct map_session_data *sd,char *name)
{
	WFIFOW(inter_fd,0) = 0x3020;
	WFIFOL(inter_fd,2) = sd->status.account_id;
	memcpy(WFIFOP(inter_fd, 6),name,24);
	memcpy(WFIFOP(inter_fd,30),sd->status.name,24);
	memcpy(WFIFOP(inter_fd,54),map[sd->bl.m].name,16);
	WFIFOW(inter_fd,70)= sd->status.base_level;
	WFIFOSET(inter_fd,72);
//	if(battle_config.etc_log)
//		printf("intif: create party\n");
	return 0;
}
Esempio n. 28
0
// The reply of Wisp/page
static
int intif_wis_replay (int id, int flag)
{
    WFIFOW (inter_fd, 0) = 0x3002;
    WFIFOL (inter_fd, 2) = id;
    WFIFOB (inter_fd, 6) = flag;    // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
    WFIFOSET (inter_fd, 7);

    if (battle_config.etc_log)
        printf ("intif_wis_replay: id: %d, flag:%d\n", id, flag);

    return 0;
}
Esempio n. 29
0
static void mapif_Auction_sendlist(int fd, int char_id, short count, short pages, unsigned char *buf)
{
	int len = (sizeof(struct auction_data) * count) + 12;

	WFIFOHEAD(fd, len);
	WFIFOW(fd,0) = 0x3850;
	WFIFOW(fd,2) = len;
	WFIFOL(fd,4) = char_id;
	WFIFOW(fd,8) = count;
	WFIFOW(fd,10) = pages;
	memcpy(WFIFOP(fd,12), buf, len - 12);
	WFIFOSET(fd,len);
}
Esempio n. 30
0
/*==========================================
 * キャラ名問い合わせ
 *------------------------------------------*/
int chrif_searchcharid(int char_id)
{
	if( !char_id )
		return -1;
	chrif_check(-1);

	WFIFOHEAD(char_fd,6);
	WFIFOW(char_fd,0) = 0x2b08;
	WFIFOL(char_fd,2) = char_id;
	WFIFOSET(char_fd,6);

	return 0;
}