static void ctl_file_name(char *name) { current_file = name; if (video_ctl.verbosity>=0 || video_ctl.trace_playing) cmsg(CMSG_INFO, VERB_NORMAL, "Playing %s", name); }
static void ctl_pass_playing_list(int init_number_of_files, char * /*init_list_of_files*/ []) { EventRecord event; if( init_number_of_files!=0 ){ cmsg(CMSG_FATAL, VERB_NORMAL, "ctl_pass_playing_list: Sorry. Fatal error."); } #ifdef MAC_USE_OMS mac_oms_setup(); #endif { FSSpec spec; OSErr err; err=FSMakeFSSpec(0, 0, MAC_STARTUP_FOLDER_NAME, &spec); if( err==noErr ){ mac_add_fsspec( &spec ); } } gQuit=false; while(!gQuit) { WaitNextEvent(everyEvent, &event, 1,0); mac_HandleEvent(&event); } DoQuit(); }
/* * Converts a w_hook_desc structure to a Ruby OpenStruct object * * The returned Ruby object can be access by member variables of exactly same * name as defined in w_hook_desc structure */ static VALUE w_hook_desc_to_rb_struct(struct w_hook_desc *w) { VALUE ost_klass; VALUE ost_obj; int ost_argc = 0; VALUE *ost_argv = NULL; char *host; if(!w) { cmsg("WARN: NULL parameter(s) in w_hook_desc_to_rb_struct(..)"); return Qnil; } rb_require("ostruct"); /* Comes default with Ruby 1.8.x */ ost_klass = rb_const_get(rb_cObject, rb_intern("OpenStruct")); ost_obj = rb_class_new_instance(ost_argc, ost_argv, ost_klass); { struct sockaddr_in sin; sin.sin_addr.s_addr = w->host; host = (char*) inet_ntoa(sin.sin_addr); } rb_funcall(ost_obj, rb_intern("host="), 1, rb_str_new2(host)); rb_funcall(ost_obj, rb_intern("port="), 1, INT2FIX(w->port)); rb_funcall(ost_obj, rb_intern("run_count="), 1, INT2FIX(w->run_count)); rb_funcall(ost_obj, rb_intern("role="), 1, INT2FIX(w->role)); return ost_obj; }
static VALUE rb_mWireplay_load_library(VALUE klass, VALUE rblib) { char *libpath = NULL; char *rblib_path; char *rblib_dir = "/rblib/"; struct stat st; VALUE ret = Qnil; w_get_lib_path(&libpath); assert(libpath != NULL); StringValue(rblib); rblib_path = malloc(strlen(libpath) + strlen(StringValuePtr(rblib)) + strlen(rblib_dir) + 1); assert(rblib_path != NULL); /* * Really, I don't carry if you /../ here */ strcpy(rblib_path, libpath); strcpy(rblib_path + strlen(libpath), rblib_dir); strcpy(rblib_path + strlen(libpath) + strlen(rblib_dir), StringValuePtr(rblib)); if(stat(rblib_path, &st) == -1) cmsg("WARN: Attempting to evaluate non-existent file (%s)", rblib_path); rb_w_eval_rbfile(rblib_path); free(rblib_path); free(libpath); return ret; }
/* * UI function */ static VALUE rb_w_cmsg(VALUE obj, VALUE str) { StringValue(str); cmsg("%s", StringValuePtr(str)); return Qnil; }
void ap_log_error_cb( const Falcon::String& msg, void* data ) { Falcon::AutoCString cmsg( msg ); request_rec* request = (request_rec*) data; ap_log_rerror( APLOG_MARK, APLOG_INFO, 0, request, "%s", cmsg.c_str() ); }
static void ctl_total_time(long tt) { int mins, secs; if (ctl.trace_playing) { secs=(int)(tt/play_mode->rate); mins=secs/60; secs-=mins*60; cmsg(CMSG_INFO, VERB_NORMAL, "Total playing time: %3d min %02d s", mins, secs); } }
void ChatManager::SendTell(psChatMessage& msg, const char* who,Client *client,Client *target) { Debug2(LOG_CHAT, client->GetClientNum(), "SendTell: %s!", msg.sText.GetDataSafe()); // Sanity check that we are sending to correct clientnum! csString targetName = msg.sPerson; targetName = NormalizeCharacterName(targetName); CS_ASSERT(strcasecmp(target->GetName(), targetName) == 0); // Create a new message and send it to that person if found psChatMessage cmsg(target->GetClientNum(), client->GetActor()->GetEID(), who, 0, msg.sText, msg.iChatType, msg.translate); cmsg.SendMessage(); // Echo the message back to the speaker also psChatMessage cmsg2(client->GetClientNum(), client->GetActor()->GetEID(), targetName, 0, msg.sText, CHAT_TELLSELF, msg.translate); cmsg2.SendMessage(); // Save to both actors' chat history (PS#2789) client->GetActor()->LogChatMessage(who, msg); target->GetActor()->LogChatMessage(who, msg); }
static int ctl_save_playlist(char *fileptr) { FILE *fp; int i, nfiles; if((fp = fopen(fileptr, "w")) == NULL) { w32g_lock_open_file = 0; cmsg(CMSG_FATAL, VERB_NORMAL, "%s: %s", fileptr, strerror(errno)); w32g_lock_open_file = 0; return RC_NONE; } w32g_get_playlist_index(NULL, &nfiles, NULL); for(i = 0; i < nfiles; i++) { fputs(w32g_get_playlist(i), fp); fputs("\n", fp); } fclose(fp); w32g_lock_open_file = 0; return RC_NONE; }
static int fill_bank(Renderer *song, int dr, int b) { int i, errors = 0; ToneBank *bank = ((dr) ? drumset[b] : tonebank[b]); if (bank == NULL) { cmsg(CMSG_ERROR, VERB_NORMAL, "Huh. Tried to load instruments in non-existent %s %d\n", (dr) ? "drumset" : "tone bank", b); return 0; } for (i = 0; i < MAXPROG; i++) { if (bank->instrument[i] == MAGIC_LOAD_INSTRUMENT) { bank->instrument[i] = NULL; bank->instrument[i] = load_instrument_dls(song, dr, b, i); if (bank->instrument[i] != NULL) { continue; } Instrument *ip; ip = load_instrument_font_order(song, 0, dr, b, i); if (ip == NULL) { if (bank->tone[i].fontbank >= 0) { ip = load_instrument_font(song, bank->tone[i].name, dr, b, i); } else { ip = load_instrument(song, bank->tone[i].name, (dr) ? 1 : 0, bank->tone[i].pan, (bank->tone[i].note != -1) ? bank->tone[i].note : ((dr) ? i : -1), (bank->tone[i].strip_loop != -1) ? bank->tone[i].strip_loop : ((dr) ? 1 : -1), (bank->tone[i].strip_envelope != -1) ? bank->tone[i].strip_envelope : ((dr) ? 1 : -1), bank->tone[i].strip_tail); } if (ip == NULL) { ip = load_instrument_font_order(song, 1, dr, b, i); } } bank->instrument[i] = ip; if (ip == NULL) { if (bank->tone[i].name.IsEmpty()) { cmsg(CMSG_WARNING, (b != 0) ? VERB_VERBOSE : VERB_NORMAL, "No instrument mapped to %s %d, program %d%s\n", (dr) ? "drum set" : "tone bank", b, i, (b != 0) ? "" : " - this instrument will not be heard"); } else { cmsg(CMSG_ERROR, VERB_NORMAL, "Couldn't load instrument %s (%s %d, program %d)\n", bank->tone[i].name.GetChars(), (dr) ? "drum set" : "tone bank", b, i); } if (b != 0) { /* Mark the corresponding instrument in the default bank / drumset for loading (if it isn't already) */ if (((dr) ? drumset[0] : tonebank[0])->instrument[i] != NULL) { ((dr) ? drumset[0] : tonebank[0])->instrument[i] = MAGIC_LOAD_INSTRUMENT; } } errors++; } } } return errors; }
/* If panning or note_to_use != -1, it will be used for all samples, instead of the sample-specific values in the instrument file. For note_to_use, any value <0 or >127 will be forced to 0. For other parameters, 1 means yes, 0 means no, other values are undefined. TODO: do reverse loops right */ static Instrument *load_instrument(Renderer *song, const char *name, int percussion, int panning, int note_to_use, int strip_loop, int strip_envelope, int strip_tail) { Instrument *ip; Sample *sp; FileReader *fp; GF1PatchHeader header; GF1InstrumentData idata; GF1LayerData layer_data; GF1PatchData patch_data; int i, j; bool noluck = false; if (!name) return 0; /* Open patch file */ if ((fp = pathExpander.openFileReader(name, NULL)) == NULL) { /* Try with various extensions */ FString tmp = name; tmp += ".pat"; if ((fp = pathExpander.openFileReader(tmp, NULL)) == NULL) { #ifdef __unix__ // Windows isn't case-sensitive. tmp.ToUpper(); if ((fp = pathExpander.openFileReader(tmp, NULL)) == NULL) #endif { noluck = true; } } } if (noluck) { cmsg(CMSG_ERROR, VERB_NORMAL, "Instrument `%s' can't be found.\n", name); return 0; } cmsg(CMSG_INFO, VERB_NOISY, "Loading instrument %s\n", name); /* Read some headers and do cursory sanity checks. */ if (sizeof(header) != fp->Read(&header, sizeof(header))) { failread: cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Error reading instrument.\n", name); delete fp; return 0; } if (strncmp(header.Header, GF1_HEADER_TEXT, HEADER_SIZE - 4) != 0) { cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Not an instrument.\n", name); delete fp; return 0; } if (strcmp(header.Header + 8, "110") < 0) { cmsg(CMSG_ERROR, VERB_NORMAL, "%s: Is an old and unsupported patch version.\n", name); delete fp; return 0; } if (sizeof(idata) != fp->Read(&idata, sizeof(idata))) { goto failread; } header.WaveForms = LittleShort(header.WaveForms); header.MasterVolume = LittleShort(header.MasterVolume); header.DataSize = LittleLong(header.DataSize); idata.Instrument = LittleShort(idata.Instrument); if (header.Instruments != 1 && header.Instruments != 0) /* instruments. To some patch makers, 0 means 1 */ { cmsg(CMSG_ERROR, VERB_NORMAL, "Can't handle patches with %d instruments.\n", header.Instruments); delete fp; return 0; } if (idata.Layers != 1 && idata.Layers != 0) /* layers. What's a layer? */ { cmsg(CMSG_ERROR, VERB_NORMAL, "Can't handle instruments with %d layers.\n", idata.Layers); delete fp; return 0; } if (sizeof(layer_data) != fp->Read(&layer_data, sizeof(layer_data))) { goto failread; } if (layer_data.Samples == 0) { cmsg(CMSG_ERROR, VERB_NORMAL, "Instrument has 0 samples.\n"); delete fp; return 0; } ip = new Instrument; ip->samples = layer_data.Samples; ip->sample = (Sample *)safe_malloc(sizeof(Sample) * layer_data.Samples); memset(ip->sample, 0, sizeof(Sample) * layer_data.Samples); for (i = 0; i < layer_data.Samples; ++i) { if (sizeof(patch_data) != fp->Read(&patch_data, sizeof(patch_data))) { fail: cmsg(CMSG_ERROR, VERB_NORMAL, "Error reading sample %d.\n", i); delete ip; delete fp; return 0; } sp = &(ip->sample[i]); sp->data_length = LittleLong(patch_data.WaveSize); sp->loop_start = LittleLong(patch_data.StartLoop); sp->loop_end = LittleLong(patch_data.EndLoop); sp->sample_rate = LittleShort(patch_data.SampleRate); sp->low_freq = float(LittleLong(patch_data.LowFrequency)); sp->high_freq = float(LittleLong(patch_data.HighFrequency)) + 0.9999f; sp->root_freq = float(LittleLong(patch_data.RootFrequency)); sp->high_vel = 127; sp->velocity = -1; sp->type = INST_GUS; // Expand to SF2 range. if (panning == -1) { sp->panning = (patch_data.Balance & 0x0F) * 1000 / 15 - 500; } else { sp->panning = (panning & 0x7f) * 1000 / 127 - 500; } song->compute_pan((sp->panning + 500) / 1000.0, INST_GUS, sp->left_offset, sp->right_offset); /* tremolo */ if (patch_data.TremoloRate == 0 || patch_data.TremoloDepth == 0) { sp->tremolo_sweep_increment = 0; sp->tremolo_phase_increment = 0; sp->tremolo_depth = 0; cmsg(CMSG_INFO, VERB_DEBUG, " * no tremolo\n"); } else { sp->tremolo_sweep_increment = convert_tremolo_sweep(song, patch_data.TremoloSweep); sp->tremolo_phase_increment = convert_tremolo_rate(song, patch_data.TremoloRate); sp->tremolo_depth = patch_data.TremoloDepth; cmsg(CMSG_INFO, VERB_DEBUG, " * tremolo: sweep %d, phase %d, depth %d\n", sp->tremolo_sweep_increment, sp->tremolo_phase_increment, sp->tremolo_depth); } /* vibrato */ if (patch_data.VibratoRate == 0 || patch_data.VibratoDepth == 0) { sp->vibrato_sweep_increment = 0; sp->vibrato_control_ratio = 0; sp->vibrato_depth = 0; cmsg(CMSG_INFO, VERB_DEBUG, " * no vibrato\n"); } else { sp->vibrato_control_ratio = convert_vibrato_rate(song, patch_data.VibratoRate); sp->vibrato_sweep_increment = convert_vibrato_sweep(song, patch_data.VibratoSweep, sp->vibrato_control_ratio); sp->vibrato_depth = patch_data.VibratoDepth; cmsg(CMSG_INFO, VERB_DEBUG, " * vibrato: sweep %d, ctl %d, depth %d\n", sp->vibrato_sweep_increment, sp->vibrato_control_ratio, sp->vibrato_depth); } sp->modes = patch_data.Modes; /* Mark this as a fixed-pitch instrument if such a deed is desired. */ if (note_to_use != -1) { sp->scale_note = note_to_use; sp->scale_factor = 0; } else { sp->scale_note = LittleShort(patch_data.ScaleFrequency); sp->scale_factor = LittleShort(patch_data.ScaleFactor); if (sp->scale_factor <= 2) { sp->scale_factor *= 1024; } else if (sp->scale_factor > 2048) { sp->scale_factor = 1024; } if (sp->scale_factor != 1024) { cmsg(CMSG_INFO, VERB_DEBUG, " * Scale: note %d, factor %d\n", sp->scale_note, sp->scale_factor); } } #if 0 /* seashore.pat in the Midia patch set has no Sustain. I don't understand why, and fixing it by adding the Sustain flag to all looped patches probably breaks something else. We do it anyway. */ if (sp->modes & PATCH_LOOPEN) { sp->modes |= PATCH_SUSTAIN; } #endif /* [RH] Alas, eawpats has percussion instruments with bad envelopes. :( * (See cymchina.pat for one example of this sadness.) * Do this logic for instruments without a description, only. Hopefully that * catches all the patches that need it without including any extra. */ for (j = 0; j < DESC_SIZE; ++j) { if (header.Description[j] != 0) break; } /* Strip any loops and envelopes we're permitted to */ /* [RH] (But PATCH_BACKWARD isn't a loop flag at all!) */ if ((strip_loop == 1) && (sp->modes & (PATCH_SUSTAIN | PATCH_LOOPEN | PATCH_BIDIR | PATCH_BACKWARD))) { cmsg(CMSG_INFO, VERB_DEBUG, " - Removing loop and/or sustain\n"); if (j == DESC_SIZE) { sp->modes &= ~(PATCH_SUSTAIN | PATCH_LOOPEN | PATCH_BIDIR | PATCH_BACKWARD); } } if (strip_envelope == 1) { cmsg(CMSG_INFO, VERB_DEBUG, " - Removing envelope\n"); /* [RH] The envelope isn't really removed, but this is the way the standard * Gravis patches get that effect: All rates at maximum, and all offsets at * a constant level. */ if (j == DESC_SIZE) { int k; for (k = 1; k < ENVELOPES; ++k) { /* Find highest offset. */ if (patch_data.EnvelopeOffset[k] > patch_data.EnvelopeOffset[0]) { patch_data.EnvelopeOffset[0] = patch_data.EnvelopeOffset[k]; } } for (k = 0; k < ENVELOPES; ++k) { patch_data.EnvelopeRate[k] = 63; patch_data.EnvelopeOffset[k] = patch_data.EnvelopeOffset[0]; } } } for (j = 0; j < 6; j++) { sp->envelope.gf1.rate[j] = patch_data.EnvelopeRate[j]; /* [RH] GF1NEW clamps the offsets to the range [5,251], so we do too. */ sp->envelope.gf1.offset[j] = clamp<BYTE>(patch_data.EnvelopeOffset[j], 5, 251); } /* Then read the sample data */ if (((sp->modes & PATCH_16) && sp->data_length/2 > MAX_SAMPLE_SIZE) || (!(sp->modes & PATCH_16) && sp->data_length > MAX_SAMPLE_SIZE)) { goto fail; } sp->data = (sample_t *)safe_malloc(sp->data_length); if (sp->data_length != fp->Read(sp->data, sp->data_length)) goto fail; convert_sample_data(sp, sp->data); /* Reverse reverse loops and pass them off as normal loops */ if (sp->modes & PATCH_BACKWARD) { int t; /* The GUS apparently plays reverse loops by reversing the whole sample. We do the same because the GUS does not SUCK. */ cmsg(CMSG_WARNING, VERB_NORMAL, "Reverse loop in %s\n", name); reverse_data((sample_t *)sp->data, 0, sp->data_length); sp->data[sp->data_length] = sp->data[sp->data_length - 1]; t = sp->loop_start; sp->loop_start = sp->data_length - sp->loop_end; sp->loop_end = sp->data_length - t; sp->modes &= ~PATCH_BACKWARD; sp->modes |= PATCH_LOOPEN; /* just in case */ } /* Then fractional samples */ sp->data_length <<= FRACTION_BITS; sp->loop_start <<= FRACTION_BITS; sp->loop_end <<= FRACTION_BITS; /* Adjust for fractional loop points. */ sp->loop_start |= (patch_data.Fractions & 0x0F) << (FRACTION_BITS-4); sp->loop_end |= (patch_data.Fractions & 0xF0) << (FRACTION_BITS-4-4); /* If this instrument will always be played on the same note, and it's not looped, we can resample it now. */ if (sp->scale_factor == 0 && !(sp->modes & PATCH_LOOPEN)) { pre_resample(song, sp); } if (strip_tail == 1) { /* Let's not really, just say we did. */ cmsg(CMSG_INFO, VERB_DEBUG, " - Stripping tail\n"); sp->data_length = sp->loop_end; } } delete fp; return ip; }
static void do_file(FILE *fp) { char *cp; char *begin; char ch; int continuation = 0; int quotes_found = 0; int i; int j; while (fgets(buf, MAX_LEN, fp)) { chk_len(buf); cp = buf; if (*cp == '#') continue; if (!continuation) { /* * Look for gettext. */ while (strncmp(cp, "gettext", 7) != 0) { cp++; if (!*cp) break; } if (!*cp) continue; } if (is_private_function(cp)) continue; continuation = 0; if (quotes_found == 0) { /* * Find first quote after gettext. */ while (*cp && *cp != '"' && *cp != '\'') { if (is_continuation(cp)) { continuation = 1; break; } cp++; } if (!*cp) { (void) fprintf(stderr, "Cannot find quote after gettext():\n"); (void) fprintf(stderr, "%s\n", buf); continue; } if (continuation) continue; /* * We have our first quote. */ ch = *cp; quotes_found = 1; cp++; if (!*cp) { (void) fprintf(stderr, "String ended unexpectedly: %s\n", buf); continue; } /* * Remember the start of our string. */ begin = cp; } /* * Look for second quote. */ while (*cp) { /* * Allow backslash quotes in the string. */ if (*cp == '\\') { cp++; if (cp && *cp && *cp == ch) { cp++; } else cp--; } if (is_continuation(cp)) { /* * Remove backslash and newline */ buf[cp - buf] = '\0'; continuation = 1; break; } /* * Is this our second quote. */ if (*cp == ch) { *cp = '\0'; (void) strcat(string, begin); quotes_found = 2; continuation = 0; break; } cp++; } if (continuation) { (void) strcat(string, begin); begin = buf; continue; } if (quotes_found != 2) { (void) fprintf(stderr, "Missing matching quote:\n"); (void) fprintf(stderr, "%s\n", buf); continuation = 0; quotes_found = 0; continue; } for (i = 0; i < (int) strlen(string); i++) { if (string[i] == '"' && i > 0 && string[i-1] != '\\') { string[strlen(string) + 1] = '\0'; for (j = strlen(string); j > i; j--) string[j] = string[j - 1]; string[i] = '\\'; } } if (!cmsg(string)) { (void) fprintf(ofp, "msgid \"%s\"\n", string); if (msgstrtag) { (void) fprintf(ofp, "msgstr \"%s%s\"\n", msgstrtag, string); } else (void) fprintf(ofp, "msgstr\n"); } else { (void) fprintf(ofp, "# msgid \"%s\"\n", string); if (msgstrtag) { (void) fprintf(ofp, "# msgstr \"%s%s\"\n", msgstrtag, string); } else (void) fprintf(ofp, "# msgstr\n"); } (void) memset(string, '\0', MAX_LEN); (void) memset(buf, '\0', MAX_LEN); quotes_found = 0; } }
static void ctl_file_name(char *name) { if (ctl.verbosity>=0 || ctl.trace_playing) cmsg(CMSG_INFO, VERB_NORMAL, "Playing %s", name); }
void dimd_loop(void) { int i, fromlevel, fromgodlevel; fd_set input_set, output_set, exc_set; static char buf[MAX_STRING_LENGTH], extra[MAX_STRING_LENGTH], fromname[MAX_INPUT_LENGTH], fromkeyname[MAX_INPUT_LENGTH], dcommand[MAX_INPUT_LENGTH], toname[MAX_INPUT_LENGTH], *scan; struct char_data *vict; char comm[MAX_INPUT_LENGTH]; struct timeval null_time; struct descriptor_data *d; switch (dimd_state) { /****************************************************************/ case DIMD_OPENING: if ((dimd_local_mud=getlocalmud())==UNDEFINED) { DIMDLOG("Couldn't figure out what this mud's name is! DIMD NOT opened."); dimd_state = DIMD_CLOSED; dimd_on = FALSE; return; }; dimd_port = DIMD_PORT; dimd_s=init_socket(dimd_port); DIMDLOG("DIMD port opened."); for(i=0; muds[i].address; i++) if (IS_SET(muds[i].flags, DD_AUTOTRY)) call_a_mud(i); dimd_state = DIMD_OPEN; break; /****************************************************************/ case DIMD_OPEN: null_time.tv_sec = 0; null_time.tv_usec = 0; FD_ZERO(&input_set); FD_ZERO(&output_set); FD_ZERO(&exc_set); FD_SET(dimd_s, &input_set); for(i=0; muds[i].address; i++) if (IS_SET(muds[i].flags, DD_CONNECTED)) { FD_SET(muds[i].desc, &input_set); FD_SET(muds[i].desc, &exc_set); FD_SET(muds[i].desc, &output_set); }; if (select(maxdesc + 1, &input_set, &output_set, &exc_set, &null_time) < 0) { perror("Tell select poll"); return; }; /* Respond to whatever might be happening */ /* New connection? */ if (FD_ISSET(dimd_s, &input_set)) if (!answer_a_mud()) perror("New connection"); for(i=0; muds[i].address; i++) if (IS_SET(muds[i].flags, DD_CONNECTED)) { if (FD_ISSET(muds[i].desc, &exc_set)) { FD_CLR(muds[i].desc, &input_set); FD_CLR(muds[i].desc, &output_set); hangup_on_a_mud(i); }; }; for(i=0; muds[i].address; i++) if (IS_SET(muds[i].flags, DD_CONNECTED)) { if (FD_ISSET(muds[i].desc, &input_set)) if (process_dimd_input(i) < 0) hangup_on_a_mud(i); }; for(i=0; muds[i].address; i++) if (IS_SET(muds[i].flags, DD_CONNECTED)) { while(get_from_q(&muds[i].input, comm)) { if (!IS_SET(muds[i].flags, DD_VERIFIED)) { if (str_cmp(comm, DIMD_PASSWORD)) { sprintf(buf, "The mud is located at port %d.\n\r", dimd_port-2); write_to_descriptor(muds[i].desc, buf); sprintf(buf, "%s[%s]'s server didn't know our password.", muds[i].formalname, muds[i].host); DIMDLOG(buf); hangup_on_a_mud(i); break; }; SET_BIT(muds[i].flags, DD_VERIFIED); break; }; if (*comm != '^') { if (!(vict=get_char(muds[i].pcname))) { sprintf(buf, "DIMD stream for unknown player %s rejected.", muds[i].pcname); DIMDLOG(buf); DIMDLOG(comm); } else msg(comm, vict); continue; }; scan = comm+1; scan = one_dimd_argument(scan, fromname); scan = one_dimd_argument(scan, fromkeyname); scan = one_dimd_argument(scan, buf); fromlevel = atoi(buf); if (!*fromname || !*fromkeyname || !fromlevel) { write_to_descriptor(muds[i].desc, "Your server isn't working properly."); sprintf(buf, "%s[%s] didn't supply PC names or level.", muds[i].formalname, muds[i].host); DIMDLOG(buf); hangup_on_a_mud(i); break; }; if (fromlevel < muds[i].min_level) sprintf(buf, "You must be at least %d level to use DIMD on %s.", muds[i].min_level, muds[i].formalname); else { fromgodlevel = (fromlevel-muds[i].immort_level) * muds[i].immort_level_mult; scan = one_lc_dimd_argument(scan, dcommand); switch(*dcommand) { case '#': strcpy(muds[i].pcname, fromkeyname); continue; case 'a': switch(*(dcommand+1)) { case 'g': sprintf(buf, "%s is now accepting remote gossips.", muds[i].formalname); REMOVE_BIT(muds[i].flags, DD_NOGOSSIP); break; case 'm': sprintf(buf, "%s is now accepting remote muses.", muds[i].formalname); REMOVE_BIT(muds[i].flags, DD_NOMUSE); break; case 't': sprintf(buf, "%s is now accepting remote thinks.", muds[i].formalname); REMOVE_BIT(muds[i].flags, DD_NOTHINK); break; default: sprintf(buf, "Unknown accept command from %s.", muds[i].formalname); }; DIMDLOG(buf); continue; case 'r': switch(*(dcommand+1)) { case 'g': sprintf(buf, "%s is now refusing remote gossips.", muds[i].formalname); SET_BIT(muds[i].flags, DD_NOGOSSIP); break; case 'm': sprintf(buf, "%s is now refusing remote muses.", muds[i].formalname); SET_BIT(muds[i].flags, DD_NOMUSE); break; case 't': sprintf(buf, "%s is now refusing remote thinks.", muds[i].formalname); SET_BIT(muds[i].flags, DD_NOTHINK); break; default: sprintf(buf, "Unknown refuse command from %s.", muds[i].formalname); }; DIMDLOG(buf); continue; case 'w': sprintf(buf, "Who request from %s at %s served.", fromname, muds[i].formalname); DIMDLOG(buf); /* construct_who_list(buf, 39, NULL, fromgodlevel, scan); */ break; case 't': scan = one_lc_dimd_argument(scan, toname); while(isspace(*scan)) scan++; if (!(vict = get_char(toname)) || !dimd_can_see(fromgodlevel, vict)) strcpy(buf, "No char by that name."); else { #if USE_COLOR sprintf(buf, "$kW%s $kMfrom $kW%s $kMtells you '%s'.", fromname, muds[i].formalname, scan); #else sprintf(buf, "%s from %s tells you '%s'.", fromname, muds[i].formalname, scan); #endif cmsg(buf, vict, CLR_TELL); if (IS_SET(vict->pc->comm, COMM_AFK)) #if USE_COLOR sprintf(buf, "$kMYou tell $kW%s$kM (who is AFK), '%s'", PER(vict), scan); #else sprintf(buf, "You tell %s (who is AFK), '%s'", PER(vict), scan); #endif else #if USE_COLOR sprintf(buf, "$kMYou tell $kW%s$kM, '%s'", PER(vict), scan); #else sprintf(buf, "You tell %s, '%s'", PER(vict), scan); #endif }; break; case 'g': if (!dimd_gossip) { write_to_descriptor(muds[i].desc, "^DIMD^DIMD^110^rg\n\r"); sprintf(buf, "%s is no longer accepting remote gossips.", muds[dimd_local_mud].formalname); break; }; if (*(dcommand+1)=='g') #if USE_COLOR sprintf(buf, "$kW%s $kYfrom $kW%s $kYdimension gossips, '%s'", fromname, muds[i].formalname, scan); #else sprintf(buf, "%s from %s dimension gossips, '%s'", fromname, muds[i].formalname, scan); #endif else #if USE_COLOR sprintf(buf, "$kW%s $kYfrom $kW%s $kYgossips, '%s'", fromname, muds[i].formalname, scan); #else sprintf(buf, "%s from %s gossips, '%s'", fromname, muds[i].formalname, scan); #endif for(d = descriptor_list; d; d = d->next) if (!d->connected && !IS_SET(d->character->pc->comm, COMM_NOGOSSIP) && !check_soundproof(d->character)) cmsg(buf, d->character, CLR_GOSSIP); #if USE_COLOR sprintf(buf, "$kYYou gossip on $kW%s$kY, '%s'", muds[dimd_local_mud].formalname, scan); #else sprintf(buf, "You gossip on %s, '%s'", muds[dimd_local_mud].formalname, scan); #endif break; case 'm': if (!dimd_muse) { write_to_descriptor(muds[i].desc, "^DIMD^DIMD^110^rm\n\r"); sprintf(buf, "%s is no longer accepting remote muses.", muds[dimd_local_mud].formalname); break; }; if (*(dcommand+1)=='g') #if USE_COLOR sprintf(buf, "$kW%s $kLfrom $kW%s $kLdimension muses, '%s'", fromname, muds[i].formalname, scan); #else sprintf(buf, "%s from %s dimension muses, '%s'", fromname, muds[i].formalname, scan); #endif else #if USE_COLOR sprintf(buf, "$kW%s $kLfrom $kW%s $kLmuses, '%s'", fromname, muds[i].formalname, scan); #else sprintf(buf, "%s from %s muses, '%s'", fromname, muds[i].formalname, scan); #endif for(d = descriptor_list; d; d = d->next) if (!d->connected && GetMaxLevel(d->character) >= LOW_IMMORTAL && !IS_SET(d->character->pc->comm, COMM_NOMUSE)) cmsg(buf, d->character, CLR_MUSE); #if USE_COLOR sprintf(buf, "$kLYou muse on $kW%s$kL, '%s'", muds[dimd_local_mud].formalname, scan); #else sprintf(buf, "You muse on %s, '%s'", muds[dimd_local_mud].formalname, scan); #endif break; case '*': if (!dimd_think) { write_to_descriptor(muds[i].desc, "^DIMD^DIMD^110^rt\n\r"); sprintf(buf, "%s is no longer accepting remote thinks.", muds[dimd_local_mud].formalname); break; }; if (*(dcommand+1)=='g') #if USE_COLOR sprintf(buf, "$kW%s $kLfrom $kW%s $kLdimension thinks, '%s'", fromname, muds[i].formalname, scan); #else sprintf(buf, "%s from %s dimension thinks, '%s'", fromname, muds[i].formalname, scan); #endif else #if USE_COLOR sprintf(buf, "$kW%s $kLfrom $kW%s $kLthinks, '%s'", fromname, muds[i].formalname, scan); #else sprintf(buf, "%s from %s thinks, '%s'", fromname, muds[i].formalname, scan); #endif for(d = descriptor_list; d; d = d->next) if (!d->connected && GetMaxLevel(d->character) >= DEMIGOD && !IS_SET(d->character->pc->comm, COMM_NOMUSE)) cmsg(buf, d->character, CLR_THINK); #if USE_COLOR sprintf(buf, "$kLYou think on $kW%s$kL, '%s'", muds[dimd_local_mud].formalname, scan); #else sprintf(buf, "You think on %s, '%s'", muds[dimd_local_mud].formalname, scan); #endif break; default: #if USE_COLOR sprintf(buf, "$kW%s $kRfrom $kW%s $kRissued invalid command '%s'.", fromname, muds[i].formalname, dcommand); #else sprintf(buf, "%s from %s issued invalid command '%s'.", fromname, muds[i].formalname, dcommand); #endif DIMDLOG(buf); #if USE_COLOR strcpy(buf, "$k+BRYour server isn't functioning properly."); #else strcpy(buf, "Your server isn't functioning properly."); #endif }; };
int w_rbhook_init() { cmsg("Initializing Ruby hook (Hook File: %s)", w_hook_get_file()); w_register_hook(&rb_hook, &rb_hook_conf); }