viewing paste Unknown #6397 | 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
/*==========================================
 * Notifies party members of instance change
 * Flags:
 *  0 - Create an instance
 *  1 - Get instance status
 *  2 - Notify the client
 *------------------------------------------*/
void clif_instance_status(struct map_session_data *sd, const char *name, unsigned int limit1, unsigned int limit2, int flag)
{
#if PACKETVER >= 20071128
    unsigned char buf[71];
    short packet;
    nullpo_retv(sd);
 
    if(flag & 1) {
        packet = 0x2cb;
        WBUFW(buf,0) = packet;
        memcpy(WBUFP(buf,2),name,61);
        WBUFB(buf,62) = '\0';   // \0 terminal
        WBUFW(buf,63) = limit1;
    } else {
        packet = 0x2cd;
        WBUFW(buf,0) = packet;
        memcpy(WBUFP(buf,2),name,61);
        WBUFB(buf,62) = '\0';   // \0 terminal
        WBUFL(buf,63) = limit1;
        WBUFL(buf,67) = limit2;
    }
 
    if(flag & 2) {  // A timer has changed or been added
        clif_send(buf,packet_len(packet),&sd->bl,PARTY);
    } else {    // No notification
        memcpy(WFIFOP(sd->fd,0),buf,packet_len(packet));
        WFIFOSET(sd->fd,packet_len(packet));
    }
#endif
 
    return;
}
 
//Notifies client of change in instance timer
//Flags:
//  0 - Status timer change
//  1 - Wait timer change
//  2 - Updates client
void clif_instance_change(struct map_session_data *sd, int num, unsigned int limit, int flag)
{
#if PACKETVER >= 20071128
    unsigned char buf[10];
    short packet;
 
    nullpo_retv(sd);
 
    if(flag & 1) {
        packet = 0x2cc;
        WBUFW(buf,0) = packet;
        WBUFW(buf,2) = num;
    } else {
        packet = 0x2ce;
        WBUFW(buf,0) = packet;
        WBUFL(buf,2) = num;
        WBUFL(buf,6) = limit;
    }
 
    if(flag & 2) {  // A timer has changed or been added
        clif_send(buf,packet_len(packet),&sd->bl,PARTY);
    } else {    // No notification
        memcpy(WFIFOP(sd->fd,0),buf,packet_len(packet));
        WFIFOSET(sd->fd,packet_len(packet));
    }
#endif
 
    return;
}
Viewed 695 times, submitted by Guest.