Ejemplo n.º 1
0
/*==========================================
 * アカウント変数保存要求
 *------------------------------------------
 */
int chrif_saveaccountreg2(dumb_ptr<map_session_data> sd)
{
    nullpo_retr(-1, sd);

    if (!char_session)
        return -1;

    std::vector<Packet_Repeat<0x2b10>> repeat_10;
    for (size_t j = 0; j < sd->status.account_reg2_num; j++)
    {
        GlobalReg *reg = &sd->status.account_reg2[j];
        if (reg->str && reg->value != 0)
        {
            Packet_Repeat<0x2b10> info;
            info.name = reg->str;
            info.value = reg->value;
            repeat_10.push_back(info);
        }
    }

    Packet_Head<0x2b10> head_10;
    head_10.account_id = block_to_account(sd->bl_id);
    send_vpacket<0x2b10, 8, 36>(char_session, head_10, repeat_10);

    return 0;
}
Ejemplo n.º 2
0
/*==========================================
 *
 *------------------------------------------
 */
int chrif_authreq(dumb_ptr<map_session_data> sd)
{
    nullpo_retr(-1, sd);

    if (!sd || !char_session || !sd->bl_id || !sd->login_id1)
        return -1;

    for (io::FD i : iter_fds())
    {
        Session *s = get_session(i);
        if (!s)
            continue;
        if (dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())) == sd)
        {
            assert (s == sd->sess);
            Packet_Fixed<0x2afc> fixed_fc;
            fixed_fc.account_id = block_to_account(sd->bl_id);
            fixed_fc.char_id = sd->char_id_;
            fixed_fc.login_id1 = sd->login_id1;
            fixed_fc.login_id2 = sd->login_id2;
            fixed_fc.ip = s->client_ip;
            send_fpacket<0x2afc, 22>(char_session, fixed_fc);
            break;
        }
    }

    return 0;
}
Ejemplo n.º 3
0
/*==========================================
 *
 *------------------------------------------
 */
int chrif_charselectreq(dumb_ptr<map_session_data> sd)
{
    nullpo_retr(-1, sd);

    if (!sd || !char_session || !sd->bl_id || !sd->login_id1)
        return -1;

    IP4Address s_ip;
    for (io::FD i : iter_fds())
    {
        Session *s = get_session(i);
        if (!s)
            continue;
        if (dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())) == sd)
        {
            assert (s == sd->sess);
            s_ip = s->client_ip;
            break;
        }
    }

    Packet_Fixed<0x2b02> fixed_02;
    fixed_02.account_id = block_to_account(sd->bl_id);
    fixed_02.login_id1 = sd->login_id1;
    fixed_02.login_id2 = sd->login_id2;
    fixed_02.ip = s_ip;
    send_fpacket<0x2b02, 18>(char_session, fixed_02);

    return 0;
}
Ejemplo n.º 4
0
// アカウント変数要求
void intif_request_accountreg(dumb_ptr<map_session_data> sd)
{
    nullpo_retv(sd);

    if (!char_session)
        return;

    Packet_Fixed<0x3005> fixed_05;
    fixed_05.account_id = block_to_account(sd->bl_id);
    send_fpacket<0x3005, 6>(char_session, fixed_05);
}
Ejemplo n.º 5
0
/*==========================================
 * マップ鯖間移動のためのデータ準備要求
 *------------------------------------------
 */
int chrif_changemapserver(dumb_ptr<map_session_data> sd,
        MapName name, int x, int y, IP4Address ip, short port)
{
    nullpo_retr(-1, sd);

    if (!char_session)
        return -1;

    IP4Address s_ip;
    for (io::FD i : iter_fds())
    {
        Session *s = get_session(i);
        if (!s)
            continue;
        if (dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())) == sd)
        {
            assert (s == sd->sess);
            s_ip = s->client_ip;
            break;
        }
    }

    Packet_Fixed<0x2b05> fixed_05;
    fixed_05.account_id = block_to_account(sd->bl_id);
    fixed_05.login_id1 = sd->login_id1;
    fixed_05.login_id2 = sd->login_id2;
    fixed_05.char_id = sd->status_key.char_id;
    fixed_05.map_name = name;
    fixed_05.x = x;
    fixed_05.y = y;
    fixed_05.map_ip = ip;
    fixed_05.map_port = port;
    fixed_05.sex = sd->status.sex;
    fixed_05.client_ip = s_ip;
    send_fpacket<0x2b05, 49>(char_session, fixed_05);

    return 0;
}