void init_alias_list() { object obj; #if 0 if(!list_ab && this_player()) { obj = first_inventory(this_player()); while(obj) { if(obj->query_quicktyper(0)) { if(1 || is_debug) { write("retrieving alias from existing quicktyper "); write(obj); write ("\n"); } /* retrieve alias from an existing quicktyper */ list_ab = obj->query_quicktyper(0); list_cmd = obj->query_quicktyper(1); break; } obj = next_inventory(obj); } if(!list_ab) { list_cmd = 0; } if(!list_cmd) { list_ab = 0; } } #endif if(!list_ab) { list_ab = allocate(24); } if(!list_cmd) { list_cmd = allocate(24); } }
find_dungeon_room(x, y, z) { object the_room; the_room = first_inventory(this_object()); while (the_room) { if (the_room->match_xyz(x, y, z)) return the_room; the_room = next_inventory(the_room); } }
main(string who) { WIZ_CHECK object victim = first_inventory(environment(this_player())); while (victim) { victim->stop_combat(); victim = next_inventory(victim); } this_player()->msg_local("~CBRT~Name ~verbraise ~poss hands and ~verbcall a time-out.~CDEF"); return 1; }
throw_out_players() { object obj, this_obj; obj = first_inventory(this_object()); while (obj) { this_obj = obj; obj = next_inventory(obj); if (living(this_obj) && !this_obj->query_npc()) { tell_object(this_obj, "Suddenly, you have a feeling of disorientation.\n"); this_obj->move_player("out#players/padrone/tower/hall"); } } /* while */ } /* throw_out_players */
int dive() { object ob; ob = first_inventory(this_player()); while(ob) { if (ob->can_put_and_get()) { this_player()->move_player("down#room/sea_bottom"); return 1; } ob = next_inventory(ob); } write("You can't breathe under water !\n"); write("You should try to get some portable air supply!\n"); return 1; }
int do_pulsar(string str) { object ob, temp; int changed; changed = 1; if (!stringp(str) || ((str != "boton") && (str != "botón"))) { notify_fail("¿Pulsar qué? Quizá quieras 'pulsar botón'.\n"); return 0; } tell_object(this_player(), "Pulsas el botón rojo.\n"); tell_room(environment(this_object()), this_player()->query_cap_name() + " pulsa el botón rojo.\n", this_player()); while (changed) { changed = 0; ob = first_inventory(environment(this_object())); while (ob) { if (ob != this_object() && !query_ip_number(ob)) { changed = 1; temp = ob; } ob = next_inventory(ob); if (temp) { temp->dest_me(); } } } return 1; }
void travelers_requirement_celebration_do_speak(descriptor dxr) { if(Speech_Flag_Check(dxr, Speech_Flag_OOC)) return; object who = Speech_Query(dxr, Speech_Speaker); if(!who->query_intoxication()) return; string msg = Speech_Query(dxr, Speech_Original_Message); if(!regmatch("\\<[Gg][Aa][Nn][Ee][Ss][Hh][Aa]\\>", msg)) return; object env = environment(who); if(!env) return; int count = 0; for(object obj = first_inventory(env); obj; obj = next_inventory(obj)) if(obj != who && obj->is_character() && obj->sentience() && obj->sentience()->query_sentience_emotion() && obj->query_intoxication()) count++; if(count < 3) return; object challenge = Travelers_Find_Challenge(who); if(challenge->ganesha_challenge_query_taboo() == "speaking other than by shouting" && Speech_Query(dxr, Speech_Command) != Speech_Command_Shout) return; challenge->ganesha_challenge_overcome(); }
void heart_beat() { int wimpy_ratio, cnd_flag; mapping my; object ob; my = query_entire_dbase(); // If we are dying because of mortal wounds? if( my["eff_kee"] < 0 || my["eff_sen"] < 0 || my["eff_gin"] < 0) { remove_all_enemy(); die(); return; } // If we're dying or falling unconcious? if( my["kee"] < 0 || my["sen"] < 0 || my["gin"] < 0) { remove_all_enemy(); if( !living(this_object()) ) die(); else unconcious(); return; } // Do attack if we are fighting. if( is_busy() ) { continue_action(); // We don't want heart beat be halt eventually, so return here. return; } else { // Is it time to flee? if( is_fighting() && intp(wimpy_ratio = (int)query("env/wimpy")) && wimpy_ratio > 0 && ( my["kee"] * 100 / my["max_kee"] <= wimpy_ratio || my["sen"] * 100 / my["max_sen"] <= wimpy_ratio || my["gin"] * 100 / my["max_gin"] <= wimpy_ratio) ) GO_CMD->do_flee(this_object()); // Do attack or clean up enemy if we have fleed. attack(); } if( !userp(this_object()) ) { this_object()->chat(); // chat() may do anything -- include destruct(this_object()) if( !this_object() ) return; } if( tick-- ) return; else tick = 5 + random(10); cnd_flag = update_condition(); // If we are compeletely in peace, turn off heart beat. // heal_up() must be called prior to other two to make sure it is called // because the && operator is lazy :P if( ((cnd_flag & CND_NO_HEAL_UP) || !heal_up()) && !is_fighting() && !interactive(this_object())) { if( environment() ) { ob = first_inventory(environment()); while(ob && !interactive(ob)) ob = next_inventory(ob); } if( !ob ) set_heart_beat(0); } if( !interactive(this_object()) ) return; // Make us a bit older. Only player's update_age is defined. // Note: update_age() is no need to be called every heart_beat, it // remember how much time has passed since last call. this_object()->update_age(); if(query_idle(this_object()) > IDLE_TIMEOUT) this_object()->user_dump(DUMP_IDLE); }
int update_sex_status() { mapping my; string dodge, force, spells; int sex_per, update_flag, sex_affair; update_flag = 0; my = query_entire_dbase(); if (!mapp(my)) return 0; if (my["want"] > 0 && my["want"] > my["eff_want"]) { my["want"] -= 1; update_flag++; } if (my["enjoy"] > 0) { my["enjoy"] -= 1; update_flag++; } sex_per = my["per"] + query_temp("apply/personality"); dodge = query_skill_mapped("dodge"); force = query_skill_mapped("force"); spells = query_skill_mapped("spells"); sex_affair = 0; if (dodge) { sex_affair += SKILL_D(dodge)->query_sex_affair(); if (sex_affair == 0) ; else if (sex_affair < 0) { my["want"] += sex_affair; update_flag++; } else if (sex_affair > 0) { sex_per += sex_affair; } } if (force) { sex_affair += SKILL_D(force)->query_sex_affair(); if (sex_affair == 0) ; else if (sex_affair < 0) { my["want"] += sex_affair; update_flag++; } else if (sex_affair > 0) { sex_per += sex_affair; } } if (spells) { sex_affair += SKILL_D(spells)->query_sex_affair(); if (sex_affair == 0) ; else if (sex_affair < 0) { my["want"] += sex_affair; update_flag++; } else if (sex_affair > 0) { sex_per += sex_affair; } } sex_per += query_temp("apply/sex_personality"); if (sex_affair > 0) { object env = environment(); if (environment()) { object ob = first_inventory(environment()); while (ob) { if (living(ob)) { ob->add("want", sex_per); update_flag++; } ob = next_inventory(ob); } } } return update_flag; }
check_castle() { object client, idwand, an_obj; string client_name, client_lname; if (!present("walking castle", this_object())) return 0; client = call_other(CASTLE, "who_drove_it_here"); if (client) { client_name = client->query_name(); client_lname = lower_case(client_name); if (!present(client, this_object())) { notify("Padrone says: Excuse me, but I would like to talk to " + client->query_name() + ".\n"); return 0; } } else { /* Just take any player who happens to be here! */ an_obj = first_inventory(this_object()); while (an_obj && !client) { if (living(an_obj) && !an_obj->query_npc()) client = an_obj; an_obj = next_inventory(an_obj); } client_name = client->query_name(); client_lname = lower_case(client_name); } if (!client) return 0; if (client->query_quests("padrone")) { notify("Padrone says: Hi there, " + client_name+ ". Haven't I seen you before?\n"); notify("Padrone says: But it doesn't matter. I'll give you a reward this time too.\n"); log_file("padrone", ctime(time()) + ": " + client_name + " solved the quest (again).\n"); } else { notify("Padrone says: You found my castle! I am so happy!\n"); golem->init_command("kiss " + client_lname); #ifndef GENESIS shout("Padrone shouts: " + client_name + " just solved my quest!\n"); #endif client->set_quest("padrone"); log_file("padrone", ctime(time()) + ": " + client_name + " (level " + client->query_level() + ") solved the quest.\n"); } notify("Padrone says: Here! Take this small token of my appreciation!\n"); notify("Padrone fetches something from another dimension.\n"); idwand = clone_object("players/padrone/obj/idwand"); if (client->add_weight(1)) { notify("Padrone gives wand to " + client_name + ".\n"); move_object(idwand, client); } else { notify("Padrone drops the wand.\n"); move_object(idwand, this_object()); } notify("Padrone says: I have also arranged for a bodyguard for you.\n"); notify("Padrone says: Just go to Antonio's Personal Protection Service.\n"); notify("Padrone quietly opens a small door in reality. Then, he is gone.\n"); notify("The castle disappears in a puff of smoke.\n"); call_other(CASTLE, "callable_castle_reset"); /* Also resets the bridge */ move_object(golem, "players/padrone/store"); call_out("give_bodyguard", 4, client); destruct(golem); return 1; } /* check_castle */
void heart_beat() { int wimpy_ratio, to_wimpy, cnd_flag, oldbusy; mapping my; object ob; string savemyass; if(!this_object()) { return; } // command("say start heart_beat"); // command("say i am busy"+(string)query_busy()); if (query_temp("in_heart_beat")) return; my = query_entire_dbase(); // If we are dying because of mortal wounds? if( my["eff_kee"] < 0 || my["eff_sen"] < 0 || my["eff_gin"] < 0 || my["kee"] < -2 * my["dur"] || my["sen"] < -2 * my["dur"] || my["gin"] < -2 * my["dur"]) { remove_all_enemy(); die(); return; } // If we are unconcious, just return; if(query_temp("is_unconcious")) { return; } // If we're dying or falling unconcious? if( my["kee"] < 0 || my["sen"] < 0 || my["gin"] < 0) { remove_all_enemy(); unconcious(); return; } // let NPC do something in fight that won't be affected by busy...e.g talk // all actions in nb_chat will be executed in fight. They should never have busy() // as a consequence and they should be allowed to appear at same time. if (is_fighting()) if(objectp(this_object()) && !userp(this_object())) { this_object()->nb_chat(); if(!this_object()) { return; } } if (!is_busy()) { // (1) Do attack or clean up enemy if we have fleed. if(is_fighting()) { // Hey, NPC's 心神 doesn't need to be reduced here, let's save some resource // my["sen"]--; attack(); } // (2) chat() may do anything -- include destruct(this_object()) if(objectp(this_object()) && !userp(this_object())) { this_object()->chat(); if(!this_object()) { return; } } } // If busy, continue action and return here. if(is_busy()) { continue_action(); return; } if(tick--) { return; } else { tick = 5 + random(10); } cnd_flag = update_condition(); if (!living(this_object())) return; // If we are compeletely in peace, turn off heart beat. // heal_up() must be called prior to other two to make sure it is called // because the && operator is lazy :P if( ((cnd_flag & CND_NO_HEAL_UP) || !heal_up()) && !is_fighting() && !interactive(this_object())) { if(environment()) { ob = first_inventory(environment()); while(ob && !interactive(ob)) { ob = next_inventory(ob); } } if(!ob && !query("ALWAYS_ACTIVE")) set_heart_beat(0); } if(!this_object()) return; if(!interactive(this_object())) return; }
void heart_beat() { int t; int period; int wimpy_ratio, cnd_flag; mapping my; object ob; object me; string prompt; int is_player; me = this_object(); my = query_entire_dbase(); if (userp(me) && living(me) && mapp(my["env"])) { // update prompt prompt = my["env"]["prompt"]; if ((prompt == "time" || prompt == "mud" || prompt == "hp") && is_waiting_command() && ! me->is_attach_system()) { write_prompt(); } } // If we're dying or falling unconcious? if (my["qi"] < 0 || my["jing"] < 0) { if (! living(me)) die(); else unconcious(); // Why does the living test? Because // The wizard may set immortal but his // qi was -1, so I don't want return, // or the continue_action will never be // called in such case. if (! me || ! living(me)) return; } if (is_p_busy()) { continue_p_busy(); } // Do attack if we are fighting. if (is_busy()) { continue_action(); // We don't want heart beat be halt eventually, so return here. } else if (living(me)) { string apply; object apply_ob; // Is it time to flee? if (is_fighting() && intp(wimpy_ratio = (int)query("env/wimpy")) && wimpy_ratio > 0 && (my["qi"] * 100 / my["max_qi"] <= wimpy_ratio || my["jing"] * 100 / my["max_jing"] <= wimpy_ratio)) { if (stringp(apply = query("env/wimpy_apply")) && objectp(apply_ob = present(apply, me)) && apply_ob->query("can_apply_for_wimpy")) { apply_ob->apply_for_wimpy(this_object()); } else GO_CMD->do_flee(this_object()); } if (query("auto_perform") || me->query_auto_perform()) { if (my["eff_jing"] > 0 && my["jing"] * 100 / my["eff_jing"] <= 70) SKILL_D("force/regenerate")->exert(me, me); if (my["eff_qi"] > 0 && my["qi"] * 100 / my["eff_qi"] <= 70) SKILL_D("force/recover")->exert(me, me); // 如果不在打架而且处于受伤状态,则自行疗伤 if (! is_fighting()) { if (my["eff_jing"] < my["max_jing"]) SKILL_D("force/inspire")->exert(me, me); if (my["eff_qi"] < my["max_qi"]) SKILL_D("force/heal")->exert(me, me); } } // Do attack or clean up enemy if we have fleed. if (is_busy()) continue_action(); else attack(); } if (my["doing"] == "scheme") // executing schedule now SCHEME_CMD->execute_schedule(me); if (! me) return; if (! (is_player = playerp(me))) { me->scan(); // scan() may do anything -- include destruct(this_object()) if (! me) return; } if ((t = time()) < next_beat) return; else next_beat = t + 5 + random(10); if (! my["not_living"]) cnd_flag = update_condition(); if (! me) return; if (! (cnd_flag & CND_NO_HEAL_UP)) cnd_flag = heal_up(); // If we are compeletely in peace, turn off heart beat. // heal_up() must be called prior to other two to make sure it is called // because the && operator is lazy :P if (! cnd_flag && ! is_player && ! keep_beat_flag && ! is_fighting() && ! is_busy() && ! interactive(this_object())) { if (environment() && query("chat_msg")) { ob = first_inventory(environment()); while (ob && ! interactive(ob)) ob = next_inventory(ob); } else ob = 0; if (! ob) set_heart_beat(0); } update_all_limb_damage(); if (! me || ! is_player) return; // Make us a bit older. Only player's update_age is defined. // Note: update_age() is no need to be called every heart_beat, it // remember how much time has passed since last call. me->update_age(); #ifdef AUTO_SAVE if (living(me)) { period = t - ((int) my["last_save"]); if (period < 0 || period > 15 * 60) { string msg; msg = HBCYN HIW "【档案存储】您的档案已经自动存盘," "欢迎访问论坛 http://bbs.mudbuilder.com/ 。\n" NOR; if (! me->save()) msg = HIR "【数据保护】由于数据异常,您的档" "案本次存盘失败。\n" NOR; set("last_save", t); tell_object(me, msg); } } #endif if (! interactive(me)) return; if (my["food"] <= 0 || my["water"] <= 0) { if (environment() && ! environment()->is_chat_room() && ! wizardp(me) && ! query_condition("hunger")) { // born & enter the world apply_condition("hunger", 1); } } if (query_idle(me) > IDLE_TIMEOUT && ! wizardp(me) && (! mapp(my["env"]) || ! my["env"]["keep_idle"])) me->user_dump(DUMP_IDLE); }