/* Common routine for the Castle Twins. */ int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname) { struct char_data *king, *twin; if (!AWAKE(ch)) return (FALSE); if (cmd) return block_way(ch, cmd, arg, castle_virtual(ctlnum), 1); if ((king = find_npc_by_name(ch, "King Welmar", 11)) != NULL) { char actbuf[MAX_INPUT_LENGTH]; if (!ch->master) do_follow(ch, strcpy(actbuf, "King Welmar"), 0, 0); /* strcpy: OK */ if (FIGHTING(king)) do_npc_rescue(ch, king); } if ((twin = find_npc_by_name(ch, twinname, strlen(twinname))) != NULL) if (FIGHTING(twin) && 2 * GET_HIT(twin) < GET_HIT(ch)) do_npc_rescue(ch, twin); if (GET_POS(ch) != POS_FIGHTING) banzaii(ch); return (FALSE); }
void ui_playlist_notebook_update (void * data, void * user) { gint global_level = GPOINTER_TO_INT (data); if (global_level == PLAYLIST_UPDATE_STRUCTURE) add_remove_pages (); gint lists = aud_playlist_count (); for (gint list = 0; list < lists; list ++) { if (global_level >= PLAYLIST_UPDATE_METADATA) set_tab_label (list, get_tab_label (list)); gint at, count; gint level = aud_playlist_updated_range (list, & at, & count); if (level) ui_playlist_widget_update (playlist_get_treeview (list), level, at, count); } gtk_notebook_set_current_page ((GtkNotebook *) notebook, aud_playlist_get_active ()); do_follow (); }
void playlist_set_focus (gint list, gint row) { g_queue_push_tail (& follow_queue, GINT_TO_POINTER (aud_playlist_get_unique_id (list))); g_queue_push_tail (& follow_queue, GINT_TO_POINTER (row)); if (! aud_playlist_update_pending ()) do_follow (); }
int PulleyDispatcher::exec(const std::string& verb, const Values& values, Object& response) { if (verb == "connect") return do_connect(values, response); else if (verb == "stop") return do_stop(values); else if (verb == "serverinfo") return do_serverinfo(values, response); else if (verb == "follow") return do_follow(values, response); else if (verb == "unfollow") return do_unfollow(values, response); else if (verb == "dump_dit") return do_dump_dit(values, response); else if (verb == "resync") return do_resync(values, response); else if (verb == "script") return do_script(values, response); return -1; }
void get_mob_group( CHAR_DATA * ch, CHAR_DATA * target ) { CHAR_DATA *vch; bool ch_is_leader = FALSE; bool tar_is_leader = FALSE; bool is_hunting = FALSE; bool ch_is_higher = FALSE; char buf[MAX_STRING_LENGTH]; int number_of_tar_group = 1; int number_of_ch_group = 1; ch_is_leader = is_group_leader( ch ); tar_is_leader = is_group_leader( target ); if ( tar_is_leader == TRUE ) { for ( vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room ) { if ( !AI_MOB( vch ) ) { continue; } if ( vch != target && is_same_group( vch, target ) ) { number_of_tar_group = number_of_tar_group + 1; continue; } if ( vch != ch && is_same_group( ch, vch ) ) { number_of_ch_group = number_of_ch_group + 1; continue; } } } do_say( ch, "Hello there. What are you up to?" ); // WAIT_STATE( target, 560 ); if ( target->hunting != NULL ) { is_hunting = TRUE; if ( tar_is_leader == TRUE ) { snprintf( buf, MSL, "We're planning on killing %s.", target->hunting->get_name() ); } else { snprintf( buf, MSL, "I'm planning on killing %s.", target->hunting->get_name() ); } do_say( target, buf ); } else { do_say( target, "Nothing. Just hanging around." ); } WAIT_STATE( ch, 275 ); /* * check to see which of the two is higher. the higher mob will lead */ if ( ch->get_level("psuedo") >= target->get_level("psuedo") ) ch_is_higher = TRUE; /* * if ch is higher in levels and victim is hunting, then say * * appropriate line. */ if ( ( ch_is_higher == FALSE ) && ( is_hunting == TRUE ) ) { do_say( ch, "Oh really? Cool! Need any help?" ); } else if ( ( ch_is_higher == FALSE ) && ( is_hunting == FALSE ) ) { do_say( ch, "Great! Since you're not doing anything, wanna group?" ); } else if ( ( ch_is_higher == TRUE ) && ( is_hunting == TRUE ) ) { if ( ch_is_leader == TRUE ) { snprintf( buf, MSL, "Want to help us kill %s instead?", ch->hunting->get_name() ); do_say( ch, buf ); } else if ( ch_is_leader == FALSE ) { snprintf( buf, MSL, "Want to help me kill %s instead?", ch->hunting->get_name() ); do_say( ch, buf ); } } else if ( ( ch_is_higher == TRUE ) && ( ch->hunting == FALSE ) ) { do_say( ch, "Want to group?" ); } WAIT_STATE( target, 275 ); if ( ch_is_higher == TRUE ) { do_say( target, "Ok sure! Thanks for asking." ); if ( tar_is_leader == TRUE ) { mob_group_follow( target, ch ); } do_follow( target, const_cast<char *>(ch->name.c_str()) ); do_group( ch, const_cast<char *>(target->name.c_str()) ); } else { do_say( target, "Ok, why not!? Follow me." ); WAIT_STATE( ch, 275 ); do_say( ch, "Cool!" ); if ( ch_is_leader == TRUE ) { mob_group_follow( ch, target ); } do_follow( ch, const_cast<char *>(target->name.c_str()) ); do_group( target, const_cast<char *>(target->name.c_str()) ); } return; }
void mob_group_follow( CHAR_DATA * ch, CHAR_DATA * target ) { char buf[MAX_STRING_LENGTH]; CHAR_DATA *vch; int num; if ( ( ch == NULL ) || ( target == NULL ) ) { snprintf( buf, MSL, "%s", "Null ch and/or target in mob_group_follow, exiting." ); monitor_chan( buf, MONITOR_MOB ); return; } snprintf( buf, MSL, "Ok guys, let's all follow %s.", target->get_name() ); do_say( ch, buf ); for ( vch = ch->in_room->first_person; vch != NULL; vch = vch->next_in_room ) { if ( ( ch != vch ) && ( AI_MOB( vch ) ) && ( is_same_group( ch, vch ) ) ) { if ( vch->position != POS_STANDING ) do_stand( vch, "" ); num = number_percent( ); // WAIT_STATE( vch, 275 ); if ( num > 85 ) do_say( vch, "Ok boss. Whatever you say." ); else if ( num > 70 ) do_say( vch, "Alright! More people, more power!" ); else if ( num > 55 ) do_say( vch, "Whoo Hooo!" ); else if ( num > 35 ) do_say( vch, "Sure thing." ); else if ( num > 29 ) { if ( num > 32 ) snprintf( buf, MSL, "Man I don't want to join %s's group!", target->get_name() ); else snprintf( buf, MSL, "I hate big groups." ); do_say( vch, buf ); do_follow( vch, const_cast<char *>(vch->name.c_str()) ); do_say( vch, "I'm outta here." ); do_recall( vch, "" ); continue; } if ( !can_see( vch, target ) ) { vch->master = target; vch->leader = NULL; } else { do_follow( vch, const_cast<char *>(target->name.c_str()) ); } do_group( target, "all" ); } } return; }