/*==========================================
* 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;
}