Пример #1
0
/// @copydoc Serializer::SerializeCharName()
void DirectDeserializer::SerializeCharName( CharName& rValue )
{
    if( m_bEndOfStream )
    {
        return;
    }

    size_t count = 0;
    ReadValue( count );
    if( m_bEndOfStream )
    {
        return;
    }

    if( !count )
    {
        rValue.Set( NULL );
        return;
    }

    ThreadLocalStackAllocator stackAllocator;

    size_t byteCount = sizeof( char ) * count;
    char* pNameString = static_cast< char* >( stackAllocator.Allocate( byteCount + sizeof( char ) ) );
    HELIUM_ASSERT( pNameString );
    ReadBytes( pNameString, byteCount );
    if( !m_bEndOfStream )
    {
        pNameString[ count ] = '\0';
        rValue.Set( pNameString );
    }

    stackAllocator.Free( pNameString );
}
Пример #2
0
// Wisp/page request to send
static
void mapif_parse_WisRequest(int fd)
{
    static int wisid = 0;

    if (RFIFOW(fd, 2) - 52 <= 0)
    {                           // normaly, impossible, but who knows...
        PRINTF("inter: Wis message doesn't exist.\n");
        return;
    }

    CharName from = stringish<CharName>(RFIFO_STRING<24>(fd, 4));
    CharName to = stringish<CharName>(RFIFO_STRING<24>(fd, 28));

    // search if character exists before to ask all map-servers
    const mmo_charstatus *mcs = search_character(to);
    if (!mcs)
    {
        uint8_t buf[27];
        WBUFW(buf, 0) = 0x3802;
        WBUF_STRING(buf, 2, from.to__actual(), 24);
        WBUFB(buf, 26) = 1;    // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
        mapif_send(fd, buf, 27);
        // Character exists. So, ask all map-servers
    }
    else
    {
        // to be sure of the correct name, rewrite it
        to = mcs->name;
        // if source is destination, don't ask other servers.
        if (from == to)
        {
            uint8_t buf[27];
            WBUFW(buf, 0) = 0x3802;
            WBUF_STRING(buf, 2, from.to__actual(), 24);
            WBUFB(buf, 26) = 1;    // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
            mapif_send(fd, buf, 27);
        }
        else
        {
            struct WisData wd {};

            // Whether the failure of previous wisp/page transmission (timeout)
            check_ttl_wisdata();

            wd.id = ++wisid;
            wd.fd = fd;
            size_t len = RFIFOW(fd, 2) - 52;
            wd.src = from;
            wd.dst = to;
            wd.msg = RFIFO_STRING(fd, 52, len);
            wd.tick = gettick();
            wis_db.insert(wd.id, wd);
            mapif_wis_message(&wd);
        }
    }
}
Пример #3
0
// パーティ競合チェック要求
void intif_party_checkconflict(int party_id, int account_id, CharName nick)
{
    WFIFOW(char_fd, 0) = 0x3028;
    WFIFOL(char_fd, 2) = party_id;
    WFIFOL(char_fd, 6) = account_id;
    WFIFO_STRING(char_fd, 10, nick.to__actual(), 24);
    WFIFOSET(char_fd, 34);
}
Пример #4
0
// パーティ脱退通知
static
void mapif_party_leaved(int party_id, int account_id, CharName name)
{
    unsigned char buf[34];

    WBUFW(buf, 0) = 0x3824;
    WBUFL(buf, 2) = party_id;
    WBUFL(buf, 6) = account_id;
    WBUF_STRING(buf, 10, name.to__actual(), 24);
    mapif_sendall(buf, 34);
    PRINTF("int_party: party leaved %d %d %s\n", party_id, account_id, name);
}
Пример #5
0
// The transmission of GM only Wisp/Page from server to inter-server
void intif_wis_message_to_gm(CharName Wisp_name, int min_gm_level, ZString mes)
{
    size_t mes_len = mes.size() + 1;
    WFIFOW(char_fd, 0) = 0x3003;
    WFIFOW(char_fd, 2) = mes_len + 30;
    WFIFO_STRING(char_fd, 4, Wisp_name.to__actual(), 24);
    WFIFOW(char_fd, 28) = min_gm_level;
    WFIFO_STRING(char_fd, 30, mes, mes_len);
    WFIFOSET(char_fd, WFIFOW(char_fd, 2));

    if (battle_config.etc_log)
        PRINTF("intif_wis_message_to_gm: from: '%s', min level: %d, message: '%s'.\n",
                Wisp_name, min_gm_level, mes);
}
Пример #6
0
// The transmission of Wisp/Page to inter-server (player not found on this server)
void intif_wis_message(dumb_ptr<map_session_data> sd, CharName nick, ZString mes)
{
    nullpo_retv(sd);

    size_t mes_len = mes.size() + 1;
    WFIFOW(char_fd, 0) = 0x3001;
    WFIFOW(char_fd, 2) = mes_len + 52;
    WFIFO_STRING(char_fd, 4, sd->status.name.to__actual(), 24);
    WFIFO_STRING(char_fd, 28, nick.to__actual(), 24);
    WFIFO_STRING(char_fd, 52, mes, mes_len);
    WFIFOSET(char_fd, WFIFOW(char_fd, 2));

    if (battle_config.etc_log)
        PRINTF("intif_wis_message from %s to %s (message: '%s')\n",
                sd->status.name, nick, mes);
}
Пример #7
0
Файл: mmo.hpp Проект: qiuhw/tmwa
 friend
 VString<23> convert_for_printf(const CharName& vs) { return vs.to__actual(); }
Пример #8
0
Файл: mmo.hpp Проект: qiuhw/tmwa
 friend bool operator >= (const CharName& l, const CharName& r)
 { return l.to__canonical() >= r.to__canonical(); }