コード例 #1
0
ファイル: chrif.cpp プロジェクト: Rosalila/tswa
/*==========================================
 *
 *------------------------------------------
 */
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;
}
コード例 #2
0
ファイル: chrif.cpp プロジェクト: Rosalila/tswa
/*==========================================
 *
 *------------------------------------------
 */
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;
}
コード例 #3
0
ファイル: chrif.cpp プロジェクト: Rosalila/tswa
/*==========================================
 * timer関数
 * 今このmap鯖に繋がっているクライアント人数をchar鯖へ送る
 *------------------------------------------
 */
static
void send_users_tochar(TimerData *, tick_t)
{
    if (!char_session)
        return;

    Packet_Head<0x2aff> head_ff;
    std::vector<Packet_Repeat<0x2aff>> repeat_ff;
    for (io::FD i : iter_fds())
    {
        Session *s = get_session(i);
        if (!s)
            continue;
        dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get()));
        if (sd && sd->state.auth &&
            !((battle_config.hide_GM_session
               || sd->state.shroud_active
               || bool(sd->status.option & Opt0::HIDE)) && pc_isGM(sd)))
        {
            Packet_Repeat<0x2aff> info;
            info.char_id = sd->status_key.char_id;
            repeat_ff.push_back(info);
        }
    }
    head_ff.users = repeat_ff.size();
    send_vpacket<0x2aff, 6, 4>(char_session, head_ff, repeat_ff);
}
コード例 #4
0
ファイル: party.cpp プロジェクト: mrktj/tmwa
// 情報所得失敗(そのIDのキャラを全部未所属にする)
int party_recv_noinfo(PartyId party_id)
{
    for (io::FD i : iter_fds())
    {
        Session *s = get_session(i);
        if (!s)
            continue;
        map_session_data *sd = static_cast<map_session_data *>(s->session_data.get());
        if (sd && sd->state.auth)
        {
            if (sd->status.party_id == party_id)
                sd->status.party_id = PartyId();
        }
    }
    return 0;
}
コード例 #5
0
ファイル: intif.cpp プロジェクト: themanaworld/tmwa
// Received wisp message from map-server via char-server for ALL gm
static
void mapif_parse_WisToGM(Session *, const Packet_Head<0x3803>& head, AString& message)
{
    // 0x3003/0x3803 <packet_len>.w <wispname>.24B <min_gm_level>.w <message>.?B
    GmLevel min_gm_level = head.min_gm_level;
    CharName Wisp_name = head.char_name;
    // information is sended to all online GM
    for (io::FD i : iter_fds())
    {
        Session *s2 = get_session(i);
        if (!s2)
            continue;
        dumb_ptr<map_session_data> pl_sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s2->session_data.get()));
        if (pl_sd && pl_sd->state.auth && !pl_sd->state.connect_new)
        {
            if (pc_isGM(pl_sd).satisfies(min_gm_level))
                clif_wis_message(s2, Wisp_name, message);
        }
    }
}
コード例 #6
0
ファイル: party.cpp プロジェクト: mrktj/tmwa
// 所属キャラの確認
static
int party_check_member(PartyPair p)
{
    nullpo_retz(p);

    for (io::FD i : iter_fds())
    {
        Session *s = get_session(i);
        if (!s)
            continue;
        map_session_data *sd = static_cast<map_session_data *>(s->session_data.get());
        if (sd && sd->state.auth)
        {
            if (sd->status.party_id == p.party_id)
            {
                int j, f = 1;
                for (j = 0; j < MAX_PARTY; j++)
                {               // パーティにデータがあるか確認
                    if (p->member[j].account_id == sd->status_key.account_id)
                    {
                        if (p->member[j].name == sd->status_key.name)
                            f = 0;  // データがある
                        else
                        {
                            // I can prove it was already zeroed
                            // p->member[j].sd = nullptr; // 同垢別キャラだった
                        }
                    }
                }
                if (f)
                {
                    sd->status.party_id = PartyId();
                    if (battle_config.error_log)
                        PRINTF("party: check_member %d[%s] is not member\n"_fmt,
                                sd->status_key.account_id, sd->status_key.name);
                }
            }
        }
    }
    return 0;
}
コード例 #7
0
ファイル: chrif.cpp プロジェクト: Rosalila/tswa
/*==========================================
 * マップ鯖間移動のためのデータ準備要求
 *------------------------------------------
 */
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;
}