mob = practitioner if ch.practice <= 0: ch.send("You have no practice sessions left.\n") return skill = state_checks.prefix_lookup(const.skill_table, argument) if not skill or not ch.is_npc() \ and (ch.level < skill.skill_level[ch.guild.name] or ch.learned[skill.name] < 1 \ or skill.rating[ch.guild.name] == 0): ch.send("You can't practice that.\n") return adept = 100 if ch.is_npc() else ch.guild.skill_adept if ch.learned[skill.name] >= adept: ch.send("You are already learned at %s.\n" % skill.name) else: ch.practice -= 1 ch.learned[skill.name] += const.int_app[ch.stat(merc.STAT_INT)].learn // skill.rating[ ch.guild.name] if ch.learned[skill.name] < adept: handler_game.act("You practice $T.", ch, None, skill.name, merc.TO_CHAR) handler_game.act("$n practices $T.", ch, None, skill.name, merc.TO_ROOM) else: ch.learned[skill.name] = adept handler_game.act("You are now learned at $T.", ch, None, skill.name, merc.TO_CHAR) handler_game.act("$n is now learned at $T.", ch, None, skill.name, merc.TO_ROOM) return interp.register_command(interp.cmd_type('practice', do_practice, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1))
return if victim.desc.snoop_by: ch.send("Busy already.\n") return if not ch.is_room_owner(victim.in_room) and ch.in_room != victim.in_room \ and victim.in_room.is_private() and not state_checks.IS_TRUSTED(ch, merc.MAX_LEVEL): ch.send("That character is in a private room.\n") return if victim.trust >= ch.trust or victim.comm.is_set(merc.COMM_SNOOP_PROOF): ch.send("You failed.\n") return if ch.desc: d = ch.desc.snoop_by while d: if d.character == victim or d.original == victim: ch.send("No snoop loops.\n") return d = d.snoop_by victim.desc.snoop_by = ch.desc buf = "$N starts snooping on %s" % (victim.short_descr if ch.is_npc() else victim.name) handler_game.wiznet(buf, ch, None, merc.WIZ_SNOOPS, merc.WIZ_SECURE, ch.trust) ch.send("Ok.\n") return interp.register_command( interp.cmd_type('snoop', do_snoop, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1))
ch.train -= cost ch.perm_mana += 10 ch.max_mana += 10 ch.mana += 10 handler_game.act("Your power increases!", ch, None, None, merc.TO_CHAR) handler_game.act("$n's power increases!", ch, None, None, merc.TO_ROOM) return else: ch.send("You can train:") if ch.perm_stat[merc.STAT_STR] < ch.get_max_train(merc.STAT_STR): ch.send(" str") if ch.perm_stat[merc.STAT_INT] < ch.get_max_train(merc.STAT_INT): ch.send(" int") if ch.perm_stat[merc.STAT_WIS] < ch.get_max_train(merc.STAT_WIS): ch.send(" wis") if ch.perm_stat[merc.STAT_DEX] < ch.get_max_train(merc.STAT_DEX): ch.send(" dex") if ch.perm_stat[merc.STAT_CON] < ch.get_max_train(merc.STAT_CON): ch.send(" con") ch.send(" hp mana") return if ch.perm_stat[stat] >= ch.get_max_train(stat): handler_game.act("Your $T is already at maximum.", ch, None, pOutput, merc.TO_CHAR) return if cost > ch.train: ch.send("You don't have enough training sessions.\n") return ch.train -= cost ch.perm_stat[stat] += 1 handler_game.act("Your $T increases!", ch, None, pOutput, merc.TO_CHAR) handler_game.act("$n's $T increases!", ch, None, pOutput, merc.TO_ROOM) return interp.register_command(interp.cmd_type('train', do_train, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
argument, arg = game_utils.read_word(argument) if not arg: ch.send("Follow whom?\n") return victim = ch.get_char_room(arg) if not victim: ch.send("They aren't here.\n") return if ch.is_affected(merc.AFF_CHARM) and ch.master: handler_game.act("But you'd rather follow $N!", ch, None, ch.master, merc.TO_CHAR) return if victim == ch: if ch.master is None: ch.send("You already follow yourself.\n") return handler_ch.stop_follower(ch) return if not victim.is_npc() \ and victim.act.is_set(merc.PLR_NOFOLLOW) \ and not ch.is_immortal(): handler_game.act("$N doesn't seem to want any followers.\n", ch, None, victim, merc.TO_CHAR) return ch.act.rem_bit(merc.PLR_NOFOLLOW) if ch.master: handler_ch.stop_follower(ch) handler_ch.add_follower(ch, victim) return interp.register_command(interp.cmd_type('follow', do_follow, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
skills.gn_add(ch, gn) handler_game.act("$N trains you in the art of $t", ch, gn.name, trainer, merc.TO_CHAR) ch.train -= gn.rating[ch.guild.name] return if argument.lower() in const.skill_table: sn = const.skill_table[argument.lower()] if sn.spell_fun is not None: handler_game.act("$N tells you 'You must learn the full group.'", ch, None, trainer, merc.TO_CHAR) return if sn.name in ch.learned: handler_game.act("$N tells you 'You already know that skill!'", ch, None, trainer, merc.TO_CHAR) return if sn.rating[ch.guild.name] <= 0: handler_game.act("$N tells you 'That skill is beyond your powers.'", ch, None, trainer, merc.TO_CHAR) return if ch.train < sn.rating[ch.guild.name]: handler_game.act("$N tells you 'You are not yet ready for that skill.'", ch, None, trainer, merc.TO_CHAR) return # add the skill ch.learned[sn.name] = 1 handler_game.act("$N trains you in the art of $t", ch, sn.name, trainer, merc.TO_CHAR) ch.train -= sn.rating[ch.guild.name] return handler_game.act("$N tells you 'I do not understand...'", ch, None, trainer, merc.TO_CHAR) return interp.register_command(interp.cmd_type('gain', do_gain, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import handler_ch import interp import merc def do_south(ch, argument): handler_ch.move_char(ch, merc.DIR_SOUTH, False) return interp.register_command( interp.cmd_type('south', do_south, merc.POS_STANDING, 0, merc.LOG_NEVER, 0))
if ch.comm.is_set(merc.COMM_NOGOSSIP): ch.send("Gossip channel is now ON.\n") ch.comm.rem_bit(merc.COMM_NOGOSSIP) else: ch.send("Gossip channel is now OFF.\n") ch.comm.set_bit(merc.COMM_NOGOSSIP) else: # gossip message sent, turn gossip on if it isn't already if ch.comm.is_set(merc.COMM_QUIET): ch.send("You must turn off quiet mode first.\n") return if ch.comm.is_set(merc.COMM_NOCHANNELS): ch.send("The gods have revoked your channel privileges.\n") return ch.comm.rem_bit(merc.COMM_NOGOSSIP) ch.send("You gossip '%s'\n" % argument) for d in merc.descriptor_list: victim = handler_ch.CH(d) if d.is_connected(nanny.con_playing) \ and d.character != ch \ and not victim.comm.is_set(merc.COMM_NOGOSSIP) \ and not victim.comm.is_set(merc.COMM_QUIET): handler_game.act("$n gossips '$t'", ch, argument, d.character, merc.TO_VICT, merc.POS_SLEEPING) interp.register_command( interp.cmd_type('.', do_gossip, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 0)) interp.register_command( interp.cmd_type('gossip', do_gossip, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp import handler_item def do_equipment(ch, argument): ch.send("You are using:\n") found = False for slot, item_id in ch.equipped.items(): item = ch.get_eq(slot) if not item: continue if item.flags.two_handed and ch.equipped['off_hand'] == item.instance_id and 'off_hand' in slot: continue else: ch.send(merc.eq_slot_strings[slot]) if ch.can_see_item(item): ch.send(handler_item.format_item_to_char(item, ch, True) + "\n") else: ch.send("something.\n") found = True if not found: ch.send("Nothing.\n") interp.register_command(interp.cmd_type('equipment', do_equipment, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
import merc import interp import game_utils def do_trust(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1 or not arg2 or not arg2.isdigit(): ch.send("Syntax: trust <char> <level>.\n") return victim = ch.get_char_world(arg1) if not victim: ch.send("That player is not here.\n") return level = int(arg2) if level < 0 or level > merc.MAX_LEVEL: ch.send("Level must be 0 (reset) or 1 to %d.\n" % merc.MAX_LEVEL) return if level > ch.trust: ch.send("Limited to your trust.\n") return victim.trust = level return interp.register_command( interp.cmd_type('trust', do_trust, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1))
logger = logging.getLogger() import merc import interp import handler_game import instance def do_gtell(ch, argument): if not argument: ch.send("Tell your group what?\n") return if ch.comm.is_set(merc.COMM_NOTELL): ch.send("Your message didn't get through!\n") return found = False for gch in instance.characters.values(): if gch.is_same_group(ch): handler_game.act("$n tells the group '$t'", ch, argument, gch, merc.TO_VICT, merc.POS_SLEEPING) found = True if found: handler_game.act("$n tells the group '$t'", ch, argument, ch, merc.TO_CHAR, merc.POS_SLEEPING) else: ch.send("You do not have a group.\n") return interp.register_command(interp.cmd_type('gtell', do_gtell, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) interp.register_command(interp.cmd_type(';', do_gtell, merc.POS_DEAD, 0, merc.LOG_NORMAL, 0))
# dex */ chance += ch.stat(merc.STAT_DEX) chance -= victim.stat(merc.STAT_DEX) * 3 // 2 # speed */ if (ch.is_npc() and ch.off_flags.is_set(merc.OFF_FAST)) or ch.is_affected(merc.AFF_HASTE): chance += 10 if (victim.is_npc() and victim.off_flags.is_set(merc.OFF_FAST)) or victim.is_affected( merc.AFF_HASTE): chance -= 20 # level */ chance += (ch.level - victim.level) * 2 # now the attack */ if random.randint(1,99) < chance: handler_game.act("$n trips you and you go down!",ch,None,victim, merc.TO_VICT) handler_game.act("You trip $N and $N goes down!",ch,None,victim, merc.TO_CHAR) handler_game.act("$n trips $N, sending $M to the ground.",ch,None,victim, merc.TO_NOTVICT) if ch.is_pc(): ch.check_improve('trip', True, 1) state_checks.DAZE_STATE(victim,2 * merc.PULSE_VIOLENCE) state_checks.WAIT_STATE(ch,const.skill_table['trip'].beats) victim.position = merc.POS_RESTING fight.damage(ch,victim,random.randint(2, 2 + 2 * victim.size),'trip', merc.DAM_BASH,True) else: fight.damage(ch,victim,0,'trip', merc.DAM_BASH,True) state_checks.WAIT_STATE(ch,const.skill_table['trip'].beats*2 // 3) if ch.is_pc(): ch.check_improve('trip', False, 1) fight.check_killer(ch,victim) interp.register_command(interp.cmd_type('trip', do_trip, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1))
victim = ch else: victim = ch.get_char_room(arg2) obj = ch.get_item_here(arg2) if not victim and not obj: ch.send("You can't find it.\n") return handler_game.act("$n recites $p.", ch, scroll, None, merc.TO_ROOM) handler_game.act("You recite $p.", ch, scroll, None, merc.TO_CHAR) if random.randint(1, 99) >= 20 + ch.get_skill("scrolls") * 4 // 5: ch.send("You mispronounce a syllable.\n") if ch.is_pc(): ch.check_improve("scrolls", False, 2) else: handler_magic.obj_cast_spell(scroll.value[1], scroll.value[0], ch, victim, obj) handler_magic.obj_cast_spell(scroll.value[2], scroll.value[0], ch, victim, obj) handler_magic.obj_cast_spell(scroll.value[3], scroll.value[0], ch, victim, obj) if ch.is_pc(): ch.check_improve("scrolls", True, 2) scroll.extract() return interp.register_command( interp.cmd_type('recite', do_recite, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp import settings import handler_game # RT anti-newbie code def do_newlock(ch, argument): if not settings.NEWLOCK: handler_game.wiznet("$N locks out new characters.", ch, None, 0, 0, 0) ch.send("New characters have been locked out.\n") settings.NEWLOCK = True else: handler_game.wiznet("$N allows new characters back in.", ch, None, 0, 0, 0) ch.send("Newlock removed.\n") settings.NEWLOCK = False return interp.register_command(interp.cmd_type('newlock', do_newlock, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1))
import logging logger = logging.getLogger() import merc import interp import instance def do_areas(ch, argument): if argument: ch.send("No argument is used with this command.\n") return col = 0 for iArea in instance.areas.values(): ch.send("%-39s" % iArea.credits) col += 1 if col % 2 == 0: ch.send("\n") interp.register_command(interp.cmd_type('areas', do_areas, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp import handler_game def do_report(ch, argument): ch.send("You say 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'\n" % ( ch.hit, ch.max_hit, ch.mana, ch.max_mana, ch.move, ch.max_move, ch.exp )) buf = "$n says 'I have %d/%d hp %d/%d mana %d/%d mv %d xp.'" % ( ch.hit, ch.max_hit, ch.mana, ch.max_mana, ch.move, ch.max_move, ch.exp ) handler_game.act(buf, ch, None, None, merc.TO_ROOM) return interp.register_command(interp.cmd_type('report', do_report, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp import game_utils def do_pecho(ch, argument): argument, arg = game_utils.read_word(argument) if not argument or not arg: ch.send("Personal echo what?\n") return victim = ch.get_char_world(arg) if not victim: ch.send("Target not found.\n") return if victim.trust >= ch.trust != merc.MAX_LEVEL: victim.send("personal> ") argument = argument.strip() victim.send(argument) victim.send("\n") ch.send("personal> ") ch.send(argument) ch.send("\n") interp.register_command(interp.cmd_type('pecho', do_pecho, merc.POS_DEAD, merc.L4, merc.LOG_ALWAYS, 1))
import handler_game import merc import interp import game_utils import instance def do_pmote(ch, argument): if not ch.is_npc() and ch.comm.is_set(merc.COMM_NOEMOTE): ch.send("You can't show your emotions.\n") return if not argument: ch.send("Emote what?\n") return handler_game.act("$n $t", ch, argument, None, merc.TO_CHAR) for vch_id in ch.in_room.people: vch = instance.characters[vch_id] if vch.desc is None or vch == ch: continue if vch.name not in argument: handler_game.act("$N $t", vch, argument, ch, merc.TO_CHAR) continue temp = game_utils.mass_replace({vch.name: " you "}, argument) handler_game.act("$N $t", vch, temp, ch, merc.TO_CHAR) return interp.register_command( interp.cmd_type('pmote', do_pmote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
fch = instance.characters[fch_id] if not portal or portal.value[0] == -1: # no following through dead portals continue if fch.master == ch and state_checks.IS_AFFECTED(fch, merc.AFF_CHARM) \ and fch.position < merc.POS_STANDING: fch.do_stand("") if fch.master == ch and fch.position == merc.POS_STANDING: if state_checks.IS_SET(ch.in_room.room_flags, merc.ROOM_LAW) \ and (state_checks.IS_NPC(fch) and fch.act.is_set(merc.ACT_AGGRESSIVE)): handler_game.act("You can't bring $N into the city.", ch, None, fch, merc.TO_CHAR) handler_game.act("You aren't allowed in the city.", fch, None, None, merc.TO_CHAR) continue handler_game.act("You follow $N.", fch, None, ch, merc.TO_CHAR) fch.do_enter(argument) if portal and portal.value[0] == -1: handler_game.act("$p fades out of existence.", ch, portal, None, merc.TO_CHAR) if ch.in_room == old_room: handler_game.act("$p fades out of existence.", ch, portal, None, merc.TO_ROOM) elif old_room.people: handler_game.act("$p fades out of existence.", old_room.people, portal, None, merc.TO_CHAR) handler_game.act("$p fades out of existence.", old_room.people, portal, None, merc.TO_ROOM) portal.extract() return ch.send("Nope, can't do it.\n") return interp.register_command(interp.cmd_type('enter', do_enter, merc.POS_STANDING, 0, merc.LOG_NORMAL, 1)) interp.register_command(interp.cmd_type('go', do_enter, merc.POS_STANDING, 0, merc.LOG_NORMAL, 0))
import logging logger = logging.getLogger() import merc import interp def do_holylight(ch, argument): if ch.is_npc(): return if ch.act.is_set(merc.PLR_HOLYLIGHT): ch.act.rem_bit(merc.PLR_HOLYLIGHT) ch.send("Holy light mode off.\n") else: ch.act.set_bit(merc.PLR_HOLYLIGHT) ch.send("Holy light mode on.\n") return interp.register_command(interp.cmd_type('holylight', do_holylight, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1))
logger = logging.getLogger() import merc import interp import game_utils import instance def do_mfind(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Find whom?\n") return fAll = False # !str_cmp( arg, "all" ) found = False nMatch = 0 # Yeah, so iterating over all vnum's takes 10,000 loops. # Get_mob_index is fast, and I don't feel like threading another link. # Do you? # -- Furey for pMobIndex in instance.npc_templates.values(): if fAll or game_utils.is_name(arg, pMobIndex.name): found = True ch.send("[[%5d]] %s\n" % (pMobIndex.vnum, pMobIndex.short_descr)) if not found: ch.send("No mobiles by that name.\n") return interp.register_command(interp.cmd_type('mfind', do_mfind, merc.POS_DEAD, merc.L4, merc.LOG_NORMAL, 1))
# string an obj obj = ch.get_item_world(arg1) if not obj: ch.send("Nothing like that in heaven or earth.\n") return if "name".startswith(arg2): obj.name = arg3 return if "short".startswith(arg2): obj.short_descr = arg3 return if "long".startswith(arg2): obj.description = arg3 return if "extended".startswith(arg2) or "ed".startswith(arg2): argument, arg3 = game_utils.read_word(argument) if argument is None: ch.send("Syntax: oset <object> ed <keyword> <string>\n") return argument += "\n" ed = world_classes.ExtraDescrData() ed.keyword = arg3 ed.description = argument obj.extra_descr.append(ed) return # echo bad use message ch.do_string("") interp.register_command(interp.cmd_type('string', do_string, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1))
import logging logger = logging.getLogger() import game_utils import merc import interp # 'Wimpy' originally by Dionysos. def do_wimpy(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: wimpy = ch.max_hit // 5 else: wimpy = int(arg) if wimpy < 0: ch.send("Your courage exceeds your wisdom.\n") return if wimpy > ch.max_hit // 2: ch.send("Such cowardice ill becomes you.\n") return ch.wimpy = wimpy ch.send("Wimpy set to %d hit points.\n" % wimpy) return interp.register_command(interp.cmd_type('wimpy', do_wimpy, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
if not arg1 or not arg2: ch.send("Syntax: password <old> <new>.\n") return if settings.ENCRYPT_PASSWORD: # Had to add .encode() for unicode text input. arg1 = hashlib.sha512(arg1.encode()).hexdigest() arg2 = hashlib.sha512(arg2.encode()).hexdigest() if arg1 != ch.pwd: state_checks.WAIT_STATE(ch, 40) ch.send("Wrong password. Wait 10 seconds.\n") return if len(arg2) < 5: ch.send("New password must be at least five characters long.\n") return # No tilde allowed because of player file format. # Also now not true. Davion ch.pwd = arg2 ch.save() ch.send("Ok.\n") return interp.register_command( interp.cmd_type('password', do_password, merc.POS_DEAD, 0, merc.LOG_NEVER, 1))
if not state_checks.IS_SET(ch.wiznet, merc.WIZ_ON): buf += "off " for name, flag in const.wiznet_table.items(): if state_checks.IS_SET(ch.wiznet, flag.bit): buf += name + " " ch.send("Wiznet status:\n%s\n" % buf) return if "show".startswith(argument): # list of all wiznet options buf = '' for name, flag in const.wiznet_table.items(): if flag.level <= ch.trust: buf += name + " " ch.send("Wiznet options available to you are:\n%s\n" % buf) return flag = state_checks.prefix_lookup(const.wiznet_table, argument) if not flag or ch.trust < flag.level: ch.send("No such option.\n") return if state_checks.IS_SET(ch.wiznet, flag.bit): ch.send("You will no longer see %s on wiznet.\n" % flag.name) ch.wiznet = state_checks.REMOVE_BIT(ch.wiznet, flag.bit) return else: ch.send("You will now see %s on wiznet.\n" % flag.name) ch.wiznet = state_checks.SET_BIT(ch.wiznet, flag.bit) return interp.register_command(interp.cmd_type('wiznet', do_wiznet, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import interp import merc import database def do_tableload(ch, argument): if not argument: ch.send("Reloading all tables.") database.read.read_tables(ch) interp.register_command(interp.cmd_type('tableload', do_tableload, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1))
logger = logging.getLogger() import merc import interp import game_utils def do_trust(ch, argument): argument, arg1 = game_utils.read_word(argument) argument, arg2 = game_utils.read_word(argument) if not arg1 or not arg2 or not arg2.isdigit(): ch.send("Syntax: trust <char> <level>.\n") return victim = ch.get_char_world(arg1) if not victim: ch.send("That player is not here.\n") return level = int(arg2) if level < 0 or level > merc.MAX_LEVEL: ch.send("Level must be 0 (reset) or 1 to %d.\n" % merc.MAX_LEVEL) return if level > ch.trust: ch.send("Limited to your trust.\n") return victim.trust = level return interp.register_command(interp.cmd_type('trust', do_trust, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1))
return victim = ch.fighting if victim: skill = ch.get_skill("recall") if random.randint(1, 99) < 80 * skill / 100: if ch.is_pc(): ch.check_improve( "recall", False, 6) state_checks.WAIT_STATE(ch, 4) ch.send("You failed!.\n") return lose = 25 if ch.desc else 50 update.gain_exp(ch, 0 - lose) if ch.is_pc(): ch.check_improve( "recall", True, 4) ch.send("You recall from combat! You lose %d exps.\n" % lose) fight.stop_fighting(ch, True) ch.move /= 2 handler_game.act("$n disappears.", ch, None, None, merc.TO_ROOM) ch.in_room.get(ch) location.put(ch) handler_game.act("$n appears in the room.", ch, None, None, merc.TO_ROOM) ch.do_look("auto") if ch.pet is not None: ch.pet.do_recall("") return interp.register_command(interp.cmd_type("recall", do_recall, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1)) interp.register_command(interp.cmd_type("/", do_recall, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0))
merc.TO_ROOM) elif state_checks.IS_SET(obj.value[2], merc.REST_ON): handler_game.act("You sit on $p and rest.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n sits on $p and rests.", ch, obj, None, merc.TO_ROOM) else: handler_game.act("You rest in $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n rests in $p.", ch, obj, None, merc.TO_ROOM) ch.position = merc.POS_RESTING return elif ch.position == merc.POS_SITTING: if not obj: ch.send("You rest.\n") handler_game.act("$n rests.", ch, None, None, merc.TO_ROOM) elif state_checks.IS_SET(obj.value[2], merc.REST_AT): handler_game.act("You rest at $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n rests at $p.", ch, obj, None, merc.TO_ROOM) elif state_checks.IS_SET(obj.value[2], merc.REST_ON): handler_game.act("You rest on $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n rests on $p.", ch, obj, None, merc.TO_ROOM) else: handler_game.act("You rest in $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n rests in $p.", ch, obj, None, merc.TO_ROOM) ch.position = merc.POS_RESTING return interp.register_command( interp.cmd_type('rest', do_rest, merc.POS_SLEEPING, 0, merc.LOG_NORMAL, 1))
handler_game.act("You drink $T from $p.", ch, obj, const.liq_table[liquid].name, merc.TO_CHAR) update.gain_condition(ch, merc.COND_DRUNK, amount * const.liq_table[liquid].proof / 36) update.gain_condition(ch, merc.COND_FULL, amount * const.liq_table[liquid].full / 4) update.gain_condition(ch, merc.COND_THIRST, amount * const.liq_table[liquid].thirst / 10) update.gain_condition(ch, merc.COND_HUNGER, amount * const.liq_table[liquid].food / 2) if not ch.is_npc() and ch.condition[merc.COND_DRUNK] > 10: ch.send("You feel drunk.\n") if not ch.is_npc() and ch.condition[merc.COND_FULL] > 40: ch.send("You are full.\n") if not ch.is_npc() and ch.condition[merc.COND_THIRST] > 40: ch.send("Your thirst is quenched.\n") if obj.value[3] != 0: # The drink was poisoned ! af = handler_game.AFFECT_DATA() handler_game.act("$n chokes and gags.", ch, None, None, merc.TO_ROOM) ch.send("You choke and gag.\n") af.where = merc.TO_AFFECTS af.type = "poison" af.level = game_utils.number_fuzzy(amount) af.duration = 3 * amount af.location = merc.APPLY_NONE af.modifier = 0 af.bitvector = merc.AFF_POISON ch.affect_join(af) if obj.value[0] > 0: obj.value[1] -= amount return interp.register_command(interp.cmd_type('drink', do_drink, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp def do_autosplit(ch, argument): if ch.is_npc(): return if ch.act.is_set(merc.PLR_AUTOSPLIT): ch.send("Autosplitting removed.\n") ch.act.rem_bit(merc.PLR_AUTOSPLIT) else: ch.send("Automatic gold splitting set.\n") ch.act.set_bit(merc.PLR_AUTOSPLIT) interp.register_command( interp.cmd_type('autosplit', do_autosplit, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
# ch.send("You must MURDER a player.\n") # return if victim == ch: ch.send("You hit yourself. Ouch!\n") fight.multi_hit(ch, ch, merc.TYPE_UNDEFINED) return if fight.is_safe(ch, victim): return if victim.fighting and not ch.is_same_group(victim.fighting): ch.send("Kill stealing is not permitted.\n") return if ch.is_affected(merc.AFF_CHARM) and ch.master == victim: handler_game.act("$N is your beloved master.", ch, None, victim, merc.TO_CHAR) return if ch.position == merc.POS_FIGHTING: ch.send("You do the best you can!\n") return state_checks.WAIT_STATE(ch, 1 * merc.PULSE_VIOLENCE) fight.check_killer(ch, victim) fight.multi_hit(ch, victim, merc.TYPE_UNDEFINED) return interp.register_command( interp.cmd_type('hit', do_kill, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 0)) interp.register_command( interp.cmd_type('kill', do_kill, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1))
victim = ch.get_char_room(arg) if not victim: ch.send("They aren't here.\n") return if ch == victim: ch.send("Suicide is a mortal sin.\n") return if not victim.is_npc() and victim.level >= ch.trust: ch.send("You failed.\n") return handler_game.act("You slay $M in cold blood!", ch, None, victim, merc.TO_CHAR) handler_game.act("$n slays you in cold blood!", ch, None, victim, merc.TO_VICT) handler_game.act("$n slays $N in cold blood!", ch, None, victim, merc.TO_NOTVICT) fight.raw_kill(victim) return def do_sla(ch, argument): ch.send("If you want to SLAY, spell it out.\n") return interp.register_command( interp.cmd_type('slay', do_slay, merc.POS_DEAD, merc.L3, merc.LOG_ALWAYS, 1)) interp.register_command( interp.cmd_type('sla', do_sla, merc.POS_DEAD, merc.L3, merc.LOG_NORMAL, 0))
import logging logger = logging.getLogger() import handler_ch import interp import merc def do_up(ch, argument): handler_ch.move_char(ch, merc.DIR_UP, False) return interp.register_command( interp.cmd_type('up', do_up, merc.POS_STANDING, 0, merc.LOG_NEVER, 0))
def do_at(ch, argument): argument, arg = game_utils.read_word(argument) if not arg or not argument: ch.send("At where what?\n") return location = game_utils.find_location(ch, arg) if not location: ch.send("No such location.\n") return if not ch.is_room_owner(location) and location.is_private() \ and ch.trust < merc.MAX_LEVEL: ch.send("That room is private right now.\n") return original = ch.in_room on = ch.on original.get(ch) location.put(ch) ch.interpret(argument) # See if 'ch' still exists before continuing! # Handles 'at XXXX quit' case. for wch in instance.characters.values(): if wch == ch: location.get(ch) original.put(ch) ch.on = on break interp.register_command(interp.cmd_type('at', do_at, merc.POS_DEAD, merc.L6, merc.LOG_NORMAL, 1))
def do_notell(ch, argument): argument, arg = game_utils.read_word(argument) if not arg: ch.send("Notell whom?") return victim = ch.get_char_world(arg) if not victim: ch.send("They aren't here.\n") return if victim.trust >= ch.trust: ch.send("You failed.\n") return if victim.comm.is_set(merc.COMM_NOTELL): victim.comm = state_checks.REMOVE_BIT(victim.comm, merc.COMM_NOTELL) victim.send("You can tell again.\n") ch.send("NOTELL removed.\n") handler_game.wiznet("$N restores tells to %s." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) else: victim.comm = state_checks.SET_BIT(victim.comm, merc.COMM_NOTELL) victim.send("You can't tell!\n") ch.send("NOTELL set.\n") handler_game.wiznet("$N revokes %s's tells." % victim.name, ch, None, merc.WIZ_PENALTIES, merc.WIZ_SECURE, 0) return interp.register_command( interp.cmd_type('notell', do_notell, merc.POS_DEAD, merc.L5, merc.LOG_ALWAYS, 1))
ch.send("Offense: %s\n" % repr(victim.off_flags)) if victim.imm_flags: ch.send("Immune: %s\n" % repr(victim.imm_flags)) if victim.res_flags: ch.send("Resist: %s\n" % repr(victim.res_flags)) if victim.vuln_flags: ch.send("Vulnerable: %s\n" % repr(victim.vuln_flags)) ch.send("Form: %s\nParts: %s\n" % (repr(victim.form), repr(victim.parts))) if victim.affected_by: ch.send("Affected by %s\n" % repr(victim.affected_by)) ch.send("Master: %s Leader: %s Pet: %s\n" % (victim.master.name if victim.master else "(none)", victim.leader.name if victim.leader else "(none)", victim.pet.name if victim.pet else "(none)")) ch.send("Short description: %s\nLong description: %s" % (victim.short_descr, victim.long_descr if victim.long_descr else "(none)\n")) if victim.is_npc() and victim.spec_fun is not None: ch.send("Npc has special procedure %s.\n" % victim.spec_fun.__name__) for paf in victim.affected: ch.send( "Spell: '%s' modifies %s by %d for %d hours with bits %s, level %d.\n" % (paf.type, merc.affect_loc_name(paf.location), paf.modifier, paf.duration, merc.affect_bit_name(paf.bitvector), paf.level)) interp.register_command( interp.cmd_type('mstat', do_mstat, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp import state_checks def do_nosummon(ch, argument): if ch.is_npc(): if state_checks.IS_SET(ch.imm_flags, merc.IMM_SUMMON): ch.send("You are no longer immune to summon.\n") ch.imm_flags = state_checks.REMOVE_BIT(ch.imm_flags, merc.IMM_SUMMON) else: ch.send("You are now immune to summoning.\n") ch.imm_flags = state_checks.SET_BIT(ch.imm_flags, merc.IMM_SUMMON) else: if ch.act.is_set(merc.PLR_NOSUMMON): ch.send("You are no longer immune to summon.\n") ch.act.rem_bit(merc.PLR_NOSUMMON) else: ch.send("You are now immune to summoning.\n") ch.act.set_bit(merc.PLR_NOSUMMON) interp.register_command( interp.cmd_type('nosummon', do_nosummon, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
return if not state_checks.IS_SET(obj.value[1], merc.CONT_CLOSEABLE): ch.send("You can't do that.\n") return obj.value[1] = state_checks.SET_BIT(obj.value[1], merc.CONT_CLOSED) handler_game.act("You close $p.", ch, obj, None, merc.TO_CHAR) handler_game.act("$n closes $p.", ch, obj, None, merc.TO_ROOM) return door = handler_room.find_door(ch, arg) if handler_room.find_door(ch, arg) >= 0: # 'close door' pexit = ch.in_room.exit[door] if pexit.exit_info.is_set(merc.EX_CLOSED): ch.send("It's already closed.\n") return pexit.exit_info.set_bit(merc.EX_CLOSED) handler_game.act("$n closes the $d.", ch, None, pexit.keyword, merc.TO_ROOM) ch.send("Ok.\n") # close the other side to_room = instance.rooms[pexit.to_room] pexit_rev = to_room.exit[merc.rev_dir[door]] if pexit.to_room else None if to_room and pexit_rev and pexit_rev.to_room == ch.in_room.instance_id: pexit_rev.exit_info.set_bit(merc.EX_CLOSED) for rch_id in to_room.people[:]: rch = instance.characters[rch_id] handler_game.act("The $d closes.", rch, None, pexit_rev.keyword, merc.TO_CHAR) interp.register_command(interp.cmd_type('close', do_close, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import handler_ch import interp import merc def do_down(ch, argument): handler_ch.move_char(ch, merc.DIR_DOWN, False) return interp.register_command(interp.cmd_type('down', do_down, merc.POS_STANDING, 0, merc.LOG_NEVER, 0))
def do_help(ch, argument): if not argument: argument = "summary" found = [h for h in merc.help_list if h.level <= ch.trust and argument.lower() in h.keyword.lower()] for pHelp in found: if ch.desc.is_connected(nanny.con_playing): ch.send("\n============================================================\n") ch.send(pHelp.keyword) ch.send("\n") text = pHelp.text if pHelp.text[0] == '.': text = pHelp.text[1:] ch.send(text + "\n") # small hack :) if ch.desc and ch.desc.connected != nanny.con_playing and ch.desc.connected != nanny.con_gen_groups: break if not found: ch.send("No help on that word.\n") interp.register_command(interp.cmd_type('help', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1)) interp.register_command(interp.cmd_type('motd', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'motd')) interp.register_command(interp.cmd_type('imotd', do_help, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1, 'imotd')) interp.register_command(interp.cmd_type('rules', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'rules')) interp.register_command(interp.cmd_type('story', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'story')) interp.register_command(interp.cmd_type('wizlist', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'wizlist')) interp.register_command(interp.cmd_type('credits', do_help, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1, 'credits'))
if state_checks.IS_SET(container.value[1], merc.CONT_CLOSED): handler_game.act("The $d is closed.", ch, None, container.name, merc.TO_CHAR) return if not arg1.startswith('all'): # 'get obj container' item = ch.get_item_list(arg1, container.inventory) if not item is None: handler_game.act("I see nothing like that in the $T.", ch, None, arg2, merc.TO_CHAR) return handler_item.get_item(ch, item, container) else: # 'get all container' or 'get all.obj container' found = False for item_id in container.inventory[:]: item = instance.items[item_id] if (len(arg1) == 3 or arg1[4:] in item.name) and ch.can_see_item(item): found = True if container.vnum == merc.OBJ_VNUM_PIT and not ch.is_immortal(): ch.send("Don't be so greedy!\n") return handler_item.get_item(ch, item, container) if not found: if len(arg1) == 3: handler_game.act("I see nothing in the $T.", ch, None, arg2, merc.TO_CHAR) else: handler_game.act("I see nothing like that in the $T.", ch, None, arg2, merc.TO_CHAR) interp.register_command(interp.cmd_type('get', do_get, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) interp.register_command(interp.cmd_type('take', do_get, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp def do_autoassist(ch, argument): if ch.is_npc(): return if ch.act.is_set(merc.PLR_AUTOASSIST): ch.send("Autoassist removed.\n") ch.act.rem_bit(merc.PLR_AUTOASSIST) else: ch.send("You will now assist when needed.\n") ch.act.set_bit(merc.PLR_AUTOASSIST) interp.register_command(interp.cmd_type('autoassist', do_autoassist, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp def do_autoloot(ch, argument): if ch.is_npc(): return if ch.act.is_set(merc.PLR_AUTOLOOT): ch.send("Autolooting removed.\n") ch.act.rem_bit(merc.PLR_AUTOLOOT) else: ch.send("Automatic corpse looting set.\n") ch.act.set_bit(merc.PLR_AUTOLOOT) interp.register_command(interp.cmd_type('autoloot', do_autoloot, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
logger = logging.getLogger() import merc import interp def do_prompt(ch, argument): if not argument: if ch.comm.is_set(merc.COMM_PROMPT): ch.send("You will no longer see prompts.\n") ch.comm.rem_bit(merc.COMM_PROMPT) else: ch.send("You will now see prompts.\n") ch.comm.set_bit(merc.COMM_PROMPT) return if argument.lower() == "all": buf = "<%hhp %mm %vmv> " else: if len(argument) > 50: argument = argument[:50] buf = argument if buf.endswith("%c"): buf += " " ch.prompt = buf ch.send("Prompt set to %s\n" % ch.prompt) return interp.register_command( interp.cmd_type('prompt', do_prompt, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
argument, arg = game_utils.read_word(argument) if not arg or not argument: ch.send("At where what?\n") return location = game_utils.find_location(ch, arg) if not location: ch.send("No such location.\n") return if not ch.is_room_owner(location) and location.is_private() \ and ch.trust < merc.MAX_LEVEL: ch.send("That room is private right now.\n") return original = ch.in_room on = ch.on original.get(ch) location.put(ch) ch.interpret(argument) # See if 'ch' still exists before continuing! # Handles 'at XXXX quit' case. for wch in instance.characters.values(): if wch == ch: location.get(ch) original.put(ch) ch.on = on break interp.register_command( interp.cmd_type('at', do_at, merc.POS_DEAD, merc.L6, merc.LOG_NORMAL, 1))
and sn in ch.learned: found = True level = skill.skill_level[ch.guild.name] if ch.level < level: buf = "%-18s n/a " % skill.name else: mana = max(skill.min_mana, 100 / (2 + ch.level - level)) buf = "%-18s %3d mana " % (skill.name, mana) if level not in spell_list: spell_list[level] = "\nLevel %2d: %s" % (level, buf) spell_column[level] = 0 else: # append spell_column[level] += 1 if spell_column[level] % 2 == 0: spell_list[level] += "\n " spell_list[level] += buf # return results if not found: ch.send("No spells found.\n") return for level, buf in spell_list.items(): ch.send(buf) ch.send("\n") interp.register_command( interp.cmd_type('spells', do_spells, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import database import merc import interp def do_tabledump(ch, argument): if not argument: ch.send("Dumping all tables.\n") database.write.write_tables(ch) interp.register_command(interp.cmd_type('tabledump', do_tabledump, merc.POS_DEAD, merc.ML, merc.LOG_ALWAYS, 1))
logger = logging.getLogger() import merc import interp import nanny import state_checks import handler_game def do_immtalk(ch, argument): if not argument: if ch.comm.is_set(merc.COMM_NOWIZ): ch.send("Immortal channel is now ON\n") ch.comm.rem_bit(merc.COMM_NOWIZ) else: ch.send("Immortal channel is now OFF\n") ch.comm.set_bit(merc.COMM_NOWIZ) return ch.comm.rem_bit(merc.COMM_NOWIZ) handler_game.act("$n: $t", ch, argument, None, merc.TO_CHAR, merc.POS_DEAD) for d in merc.descriptor_list: if d.is_connected(nanny.con_playing) and state_checks.IS_IMMORTAL(d.character) \ and not state_checks.IS_SET(d.character.comm, merc.COMM_NOWIZ): handler_game.act("$n: $t", ch, argument, d.character, merc.TO_VICT, merc.POS_DEAD) interp.register_command(interp.cmd_type('immtalk', do_immtalk, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1)) interp.register_command(interp.cmd_type(':', do_immtalk, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 0))
and victim.off_flags.is_set(merc.OFF_FAST)) or victim.is_affected( merc.AFF_HASTE): chance -= 20 # level */ chance += (ch.level - victim.level) * 2 # now the attack */ if random.randint(1, 99) < chance: handler_game.act("$n trips you and you go down!", ch, None, victim, merc.TO_VICT) handler_game.act("You trip $N and $N goes down!", ch, None, victim, merc.TO_CHAR) handler_game.act("$n trips $N, sending $M to the ground.", ch, None, victim, merc.TO_NOTVICT) if ch.is_pc(): ch.check_improve('trip', True, 1) state_checks.DAZE_STATE(victim, 2 * merc.PULSE_VIOLENCE) state_checks.WAIT_STATE(ch, const.skill_table['trip'].beats) victim.position = merc.POS_RESTING fight.damage(ch, victim, random.randint(2, 2 + 2 * victim.size), 'trip', merc.DAM_BASH, True) else: fight.damage(ch, victim, 0, 'trip', merc.DAM_BASH, True) state_checks.WAIT_STATE(ch, const.skill_table['trip'].beats * 2 // 3) if ch.is_pc(): ch.check_improve('trip', False, 1) fight.check_killer(ch, victim) interp.register_command( interp.cmd_type('trip', do_trip, merc.POS_FIGHTING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp # RT deaf blocks out all shouts def do_deaf(ch, argument): if ch.comm.is_set(merc.COMM_DEAF): ch.send("You can now hear tells again.\n") ch.comm.rem_bit(merc.COMM_DEAF) else: ch.send("From now on, you won't hear tells.\n") ch.comm.set_bit(merc.COMM_DEAF) interp.register_command( interp.cmd_type('deaf', do_deaf, merc.POS_DEAD, 0, merc.LOG_NORMAL, 1))
import random import logging logger = logging.getLogger() import merc import interp def do_hide(ch, argument): ch.send("You attempt to hide.\n") if ch.is_affected(merc.AFF_HIDE): ch.affected_by.rem_bit(merc.AFF_HIDE) if random.randint(1, 99) < ch.get_skill("hide"): ch.affected_by.set_bit(merc.AFF_HIDE) if ch.is_pc(): ch.check_improve( "hide", True, 3) else: if ch.is_pc(): ch.check_improve( "hide", False, 3) return interp.register_command(interp.cmd_type('hide', do_hide, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import merc import interp import pyprogs from handler_game import act def do_say(ch, argument): if not argument: ch.send("Say what?\n") return act("$n says '$T'", ch, None, argument, merc.TO_ROOM) act("You say '$T'", ch, None, argument, merc.TO_CHAR) pyprogs.emit_signal('say', actor=ch, argument=argument, audience=ch.in_room.people) return interp.register_command(interp.cmd_type('say', do_say, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) interp.register_command(interp.cmd_type("'", do_say, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0))
ch.invis_level = 0 handler_game.act("$n slowly fades into existence.", ch, None, None, merc.TO_ROOM) ch.send("You slowly fade back into existence.\n") else: ch.invis_level = ch.trust handler_game.act("$n slowly fades into thin air.", ch, None, None, merc.TO_ROOM) ch.send("You slowly vanish into thin air.\n") else: # do the level thing level = int(arg) if arg.isdigit() else -1 if level < 2 or level > ch.trust: ch.send("Invis level must be between 2 and your level.\n") return else: ch.reply = None ch.invis_level = level handler_game.act("$n slowly fades into thin air.", ch, None, None, merc.TO_ROOM) ch.send("You slowly vanish into thin air.\n") return interp.register_command( interp.cmd_type('invis', do_invis, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 0)) interp.register_command( interp.cmd_type('wizinvis', do_invis, merc.POS_DEAD, merc.IM, merc.LOG_NORMAL, 1))
import logging logger = logging.getLogger() import handler_game import merc import interp def do_emote(ch, argument): if not ch.is_npc() and ch.comm.is_set(merc.COMM_NOEMOTE): ch.send("You can't show your emotions.\n") return if not argument: ch.send("Emote what?\n") return handler_game.act("$n $T", ch, None, argument, merc.TO_ROOM) handler_game.act("$n $T", ch, None, argument, merc.TO_CHAR) return interp.register_command(interp.cmd_type('emote', do_emote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 1)) interp.register_command(interp.cmd_type(',', do_emote, merc.POS_RESTING, 0, merc.LOG_NORMAL, 0))