Ejemplo n.º 1
0
// Save account_reg into sql (type=2)
int mapif_parse_Registry(int fd)
{
	int j,p,len, max;
	struct accreg *reg=accreg_pt;
	
	memset(accreg_pt,0,sizeof(struct accreg));
	switch (RFIFOB(fd, 12)) {
	case 3: //Character registry
		max = GLOBAL_REG_NUM;
	break;
	case 2: //Account Registry
		max = ACCOUNT_REG_NUM;
	break;
	case 1: //Account2 registry, must be sent over to login server.
		return save_accreg2(RFIFOP(fd,4), RFIFOW(fd,2)-4);
	default:
		return 1;
	}
	for(j=0,p=13;j<max && p<RFIFOW(fd,2);j++){
		sscanf((char*)RFIFOP(fd,p), "%31c%n",reg->reg[j].str,&len);
		reg->reg[j].str[len]='\0';
		p +=len+1; //+1 to skip the '\0' between strings.
		sscanf((char*)RFIFOP(fd,p), "%255c%n",reg->reg[j].value,&len);
		reg->reg[j].value[len]='\0';
		p +=len+1;
	}
	reg->reg_num=j;

	inter_accreg_tosql(RFIFOL(fd,4),RFIFOL(fd,8),reg, RFIFOB(fd,12));
	mapif_account_reg(fd,RFIFOP(fd,0));	// Send updated accounts to other map servers.
	return 0;
}
Ejemplo n.º 2
0
Archivo: inter.cpp Proyecto: mrktj/tmwa
RecvResult mapif_parse_AccReg(Session *s)
{
    Packet_Head<0x3004> head;
    std::vector<Packet_Repeat<0x3004>> repeat;
    RecvResult rv = recv_vpacket<0x3004, 8, 36>(s, head, repeat);
    if (rv != RecvResult::Complete)
        return rv;

    struct accreg *reg = accreg_db.search(head.account_id);

    if (reg == nullptr)
    {
        AccountId account_id = head.account_id;
        reg = accreg_db.init(account_id);
        reg->account_id = account_id;
    }

    size_t jlim = std::min(repeat.size(), ACCOUNT_REG_NUM);
    for (size_t j = 0; j < jlim; ++j)
    {
        reg->reg[j].str = repeat[j].name;
        reg->reg[j].value = repeat[j].value;
    }
    reg->reg_num = jlim;

    // 他のMAPサーバーに送信
    mapif_account_reg(s, head.account_id, repeat);

    return rv;
}
Ejemplo n.º 3
0
// Save account_reg into sql (type=2)
int mapif_parse_AccReg(int fd)
{
	int j,p;
	struct accreg *reg=accreg_pt;
	int account_id = RFIFOL(fd,4);
	memset(accreg_pt,0,sizeof(struct accreg));

	for(j=0,p=8;j<ACCOUNT_REG_NUM && p<RFIFOW(fd,2);j++,p+=288){
		memcpy(reg->reg[j].str,RFIFOP(fd,p),32);
		memcpy(reg->reg[j].value,RFIFOP(fd,p+32),256);
	}
	reg->reg_num=j;

	inter_accreg_tosql(account_id,reg);

	mapif_account_reg(fd,RFIFOP(fd,0));	// Send confirm message to map
	return 0;
}
Ejemplo n.º 4
0
// アカウント変数保存要求
static
void mapif_parse_AccReg(int fd)
{
    int j, p;
    struct accreg *reg = accreg_db.search(RFIFOL(fd, 4));

    if (reg == NULL)
    {
        int account_id = RFIFOL(fd, 4);
        reg = accreg_db.init(account_id);
        reg->account_id = account_id;
    }

    for (j = 0, p = 8; j < ACCOUNT_REG_NUM && p < RFIFOW(fd, 2);
         j++, p += 36)
    {
        reg->reg[j].str = stringish<VarName>(RFIFO_STRING<32>(fd, p));
        reg->reg[j].value = RFIFOL(fd, p + 32);
    }
    reg->reg_num = j;

    // 他のMAPサーバーに送信
    mapif_account_reg(fd);
}