Thanks for dropping in. As requested, here is my update_msdp_affects() function:
Code:
void update_msdp_affects(struct char_data *ch) {
char msdp_buffer[MAX_STRING_LENGTH];
struct affected_type *af, *next;
bool first = TRUE;
/* MSDP */
msdp_buffer[0] = '\0';
if (ch && ch->desc) {
for (af = ch->affected; af; af = next) {
char buf[4000]; // Buffer for building the affect table for MSDP
next = af->next;
sprintf(buf, "%c%c"
"%c%s%c%s"
"%c%s%c%s"
"%c%s%c%d"
"%c%s%c%s"
"%c%s%c%d"
"%c",
(char)MSDP_VAL,
(char)MSDP_TABLE_OPEN,
(char)MSDP_VAR, "NAME", (char)MSDP_VAL, skill_name(af->spell),
(char)MSDP_VAR, "LOCATION", (char)MSDP_VAL, apply_types[(int) af->location],
(char)MSDP_VAR, "MODIFIER", (char)MSDP_VAL, af->modifier,
(char)MSDP_VAR, "TYPE", (char)MSDP_VAL, bonus_types[af->bonus_type],
(char)MSDP_VAR, "DURATION", (char)MSDP_VAL, af->duration,
(char)MSDP_TABLE_CLOSE);
strcat(msdp_buffer, buf);
first = FALSE;
}
MSDPSetArray(ch->desc, eMSDP_AFFECTS, msdp_buffer);
MSDPFlush(ch->desc, eMSDP_AFFECTS);
}
}
This is a deviation from the MSDP standard as I wanted to use additional data and this seemed like the best solution.