viewing paste Unknown #7253 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
int mmo_char_tobuf(uint8* buf, struct mmo_charstatus* p)
{
    if( buf == NULL || p == NULL )
        return 0;
 
    WBUFL(buf,0) = p->char_id;
    WBUFL(buf,4) = min(p->base_exp, LONG_MAX);
    WBUFL(buf,8) = p->zeny;
    WBUFL(buf,12) = min(p->job_exp, LONG_MAX);
    WBUFL(buf,16) = p->job_level;
    WBUFL(buf,20) = 0; // probably opt1
    WBUFL(buf,24) = 0; // probably opt2
    WBUFL(buf,28) = p->option;
    WBUFL(buf,32) = p->karma;
    WBUFL(buf,36) = p->manner;
    WBUFW(buf,40) = min(p->status_point, SHRT_MAX);
    WBUFW(buf,42) = min(p->hp, SHRT_MAX);
    WBUFW(buf,44) = min(p->max_hp, SHRT_MAX);
    WBUFW(buf,46) = min(p->sp, SHRT_MAX);
    WBUFW(buf,48) = min(p->max_sp, SHRT_MAX);
    WBUFW(buf,50) = DEFAULT_WALK_SPEED; // p->speed;
    WBUFW(buf,52) = p->class_;
    WBUFW(buf,54) = p->hair;
    WBUFW(buf,56) = p->option&0x20 ? 0 : p->weapon; //When the weapon is sent and your option is riding, the client crashes on login!?
    WBUFW(buf,58) = p->base_level;
    WBUFW(buf,60) = min(p->skill_point, SHRT_MAX);
    WBUFW(buf,62) = p->head_bottom;
    WBUFW(buf,64) = p->shield;
    WBUFW(buf,66) = p->head_top;
    WBUFW(buf,68) = p->head_mid;
    WBUFW(buf,70) = p->hair_color;
    WBUFW(buf,72) = p->clothes_color;
    memcpy(WBUFP(buf,74), p->name, NAME_LENGTH);
    WBUFB(buf,98) = min(p->str, UCHAR_MAX);
    WBUFB(buf,99) = min(p->agi, UCHAR_MAX);
    WBUFB(buf,100) = min(p->vit, UCHAR_MAX);
    WBUFB(buf,101) = min(p->int_, UCHAR_MAX);
    WBUFB(buf,102) = min(p->dex, UCHAR_MAX);
    WBUFB(buf,103) = min(p->luk, UCHAR_MAX);
    WBUFW(buf,104) = p->char_num;
    if (char_rename) {
        WBUFW(buf,106) = 1;// Rename bit (0=rename,1=no rename)
        return 108;
    } else {
        return 106;
    }
}
 
Viewed 820 times, submitted by Guest.