Example #1
0
 def remove_affect(self):
     if self.remove_string_self != "":
         _.send_to_char(self.target.get_peer(), self.remove_string_self)
     if self.remove_string_others != "":
         _.send_to_room_except(self.remove_string_others % self.target.get_name(), self.target.get_room(), \
                           [self.target.get_peer(),])
     self.target.affects.remove(self)
Example #2
0
 def lost_concentration(self, char):
     import combat
     char.player.add_lag(self.lag)
     _.send_to_char(char, "You lost your concentration.\n\r")
     _.send_to_room_except("%s utters the words, '%s'.\n\r" % (char.player.get_name(), self.words), \
                           char.player.get_room(), [char,])
     combat.end_combat_block()
Example #3
0
def do_update():
    from admin import parse_command
    for c in _.peers:
        #  Handle command lag and the command buffer
        if c.player.lag > 0:
            c.player.lag = max(c.player.lag - 0.25, 0)
        elif len(c.command_buf) > 0:
            parse_command(c, c.command_buf[0])
            c.command_buf.pop(0)
        #  Slowly time out linkdead players -- NOT IMPLEMENTED
        # if c.linkdead:
        #     if c.linkdead_count <= 0:
        #         c.state == _.STATE_QUIT
        #     else:
        #         c.linkdead_count -= 1
        #  Tick down nervous
        if c.nervous_count > 0:
            c.nervous_count -= 0.25
            if c.nervous_count <= 0:
                _.send_to_char(c, "You are no longer nervous.\n\r")

    #  Update and remove affects
    for m in _.mobiles:
        if len(m.affects) == 0:
            continue
        for a in m.affects:
            if a.duration == 0:
                a.remove_affect()
            else:
                a.duration -= 0.25
Example #4
0
def parse_password(char, input_string):
    import commands
    import player
    temp_password = input_string.split()[0].strip()
    if temp_password == char.player.stats["password"]:
        #  Check if character is already connected
        temp_player = player.get_player(char.player.get_name())
        if temp_player is not None:
            char.player = temp_player
            temp_player.get_peer().quit()
            _.send_to_char(char, "\n\rReconnecting.", False, True)
        _.send_to_char(char, "\n\rWelcome to Redemption!\n\rPlease don't feed the mobiles.\n\r\n\r", False, True)
        char.state = _.STATE_ONLINE
        _.mobiles.append(char.player)
        for p in [p for p in _.peers if p.player.get_room() == char.player.get_room() and p is not char]:
            _.send_to_char(p, "%s has entered the game.\n\r" % char.player.get_name(p.player).capitalize())
        commands.do_look(char, "")
        return
    else:
        char.password_count += 1
        if char.password_count >= _.MAX_PASSWORDS:
            _.send_to_char(char, "\n\rIncorrect password.\n\r", False, True)
            char.state = _.STATE_QUIT
            return
        else:
            _.send_to_char(char, "\n\rIncorrect password. Password: ", False, True)
            return
Example #5
0
 def remove_affect(self):
     if self.remove_string_self != "":
         _.send_to_char(self.target.get_peer(), self.remove_string_self)
     if self.remove_string_others != "":
         _.send_to_room_except(self.remove_string_others % self.target.get_name(), self.target.get_room(), \
                           [self.target.get_peer(),])
     self.target.affects.remove(self)
Example #6
0
 def lost_concentration(self, char):
     import combat
     char.player.add_lag(self.lag)
     _.send_to_char(char, "You lost your concentration.\n\r")
     _.send_to_room_except("%s utters the words, '%s'.\n\r" % (char.player.get_name(), self.words), \
                           char.player.get_room(), [char,])
     combat.end_combat_block()
Example #7
0
def do_move(char, direction):
    temp_new_room_vnum = char.player.get_room().exits[direction]
    if temp_new_room_vnum is None:
        _.send_to_char(char, "You can't go that way.\n\r")
        return
    elif temp_new_room_vnum not in [x.vnum for x in _.rooms]:
        _.send_to_char(char, "Illegal room. Contact an immortal.\n\r")
        return

    dir_string = _.get_dir_string(direction)

    if "sneak" not in char.player.get_skills():
        _.send_to_room_except(
            "%s leaves %s.\n\r" % (char.player.stats["name"], dir_string),
            char.player.get_room(), [
                char,
            ])
    char.player.stats["room"] = temp_new_room_vnum
    do_look(char, "")
    if "sneak" not in char.player.get_skills():
        _.send_to_room_except(
            "%s has arrived.\n\r" % char.player.stats["name"],
            char.player.get_room(), [
                char,
            ])
    return
Example #8
0
def do_update():
    from admin import parse_command
    for c in _.peers:
        #  Handle command lag and the command buffer
        if c.player.lag > 0:
            c.player.lag = max(c.player.lag - 0.25, 0)
        elif len(c.command_buf) > 0:
            parse_command(c, c.command_buf[0])
            c.command_buf.pop(0)
        #  Slowly time out linkdead players -- NOT IMPLEMENTED
        # if c.linkdead:
        #     if c.linkdead_count <= 0:
        #         c.state == _.STATE_QUIT
        #     else:
        #         c.linkdead_count -= 1
        #  Tick down nervous
        if c.nervous_count > 0:
            c.nervous_count -= 0.25
            if c.nervous_count <= 0:
                _.send_to_char(c, "You are no longer nervous.\n\r")

    #  Update and remove affects
    for m in _.mobiles:
        if len(m.affects) == 0:
            continue
        for a in m.affects:
            if a.duration == 0:
                a.remove_affect()
            else:
                a.duration -= 0.25
Example #9
0
def do_who(char, args):
    buf = ""
    for c in _.peers:
        if c.state == _.STATE_ONLINE:
            buf += "[51 %-7s %7s] [  Loner ] %s%s %s\n\r" % ( c.player.stats["race"].capitalize(), \
                c.player.stats["class"].capitalize(), "<LINKDEAD> " if c.linkdead else "", \
                c.player.stats["name"], c)
    _.send_to_char(char, buf)
Example #10
0
def do_who(char, args):
    buf = ""
    for c in _.peers:
        if c.state == _.STATE_ONLINE:
            buf += "[51 %-7s %7s] [  Loner ] %s%s %s\n\r" % ( c.player.stats["race"].capitalize(), \
                c.player.stats["class"].capitalize(), "<LINKDEAD> " if c.linkdead else "", \
                c.player.stats["name"], c)
    _.send_to_char(char, buf)
Example #11
0
def do_inventory(char, args):
    buf = "You are carrying:\n\r"
    if len(char.player.inventory) == 0:
        _.send_to_char(char, buf + "Nothing.\n\r")
        return
    for i in char.player.inventory:
        buf += "   " + i.get_name() + "\n\r"
    buf += "\n\r"
    _.send_to_char(char, buf)
Example #12
0
def do_quit(char, args):  # -Rework- to avoid quitting while nervous
    from admin import save_char
    if char.nervous_count > 0:
        _.send_to_char(char, "You are too excited to quit!\n\r")
        return
    save_char(char)
    _.send_to_char(char, "Alas, all good things must come to an end.\n\r")
    char.quit()
    char.state = _.STATE_QUIT
Example #13
0
 def apply_affect(self, target, duration):
     new_affect = copy.deepcopy(self)
     new_affect.target = target
     new_affect.duration = duration
     target.affects.append(new_affect)
     if self.apply_function is not None:
         self.apply_function(new_affect)
     _.send_to_char(target.get_peer(), self.apply_string_self)
     _.send_to_room_except(self.apply_string_others % target.get_name(), target.get_room(), [target.get_peer(),])
Example #14
0
def do_where(char, args):
    found = False
    buf = "Players near you:\n\r"
    for c in _.peers:
        buf += "%s  %s\n\r" % (c.player.stats["name"], c.player.get_room().get_name())
        found = True
    if not found:
        buf += "None\n\r"
    _.send_to_char(char, buf)
Example #15
0
def do_quit(char, args):  # -Rework- to avoid quitting while nervous
    from admin import save_char
    if char.nervous_count > 0:
        _.send_to_char(char, "You are too excited to quit!\n\r")
        return
    save_char(char)
    _.send_to_char(char, "Alas, all good things must come to an end.\n\r")
    char.quit()
    char.state = _.STATE_QUIT
Example #16
0
def do_inventory(char, args):
    buf = "You are carrying:\n\r"
    if len(char.player.inventory) == 0:
        _.send_to_char(char, buf + "Nothing.\n\r")
        return
    for i in char.player.inventory:
        buf += "   " + i.get_name() + "\n\r"
    buf += "\n\r"
    _.send_to_char(char, buf)
Example #17
0
def do_affects(char, args):
    buf = "You are affected by the following:\n\r"
    if not char.player.affects:
        buf += "None\n\r"
    else:
        for a in char.player.affects:
            buf += "%s: %s for %s rounds\n\r" % (a.name, a.desc, int(a.duration / 4))
    buf += "\n\r"
    _.send_to_char(char, buf)
Example #18
0
def do_cgossip(char, args):
    if args == "":
        _.send_to_char(char, "What do you want to cgossip?\n\r")
        return
    _.send_to_char(char, "You cgossip '%s'\n\r" % args)
    _.send_to_all_except(
        "%s cgossips '%s'\n\r" % (char.player.stats["name"], args), [
            char,
        ])
Example #19
0
def parse_new_password2(char, input_string):
    temp_password = input_string.split()[0].strip()
    if temp_password == char.player.stats["password"]:
        _.send_to_char(char, "New character.\n\rChoose from the following races:\n\r" + str(_.race_list)+ " ",
                       False, True)
        char.state = _.STATE_RACE
    else:
        _.send_to_char(char, "\n\rPasswords don't match. Disconnecting.", False, True)
        char.state = _.STATE_QUIT
Example #20
0
def do_affects(char, args):
    buf = "You are affected by the following:\n\r"
    if not char.player.affects:
        buf += "None\n\r"
    else:
        for a in char.player.affects:
            buf += "%s: %s for %s rounds\n\r" % (a.name, a.desc,
                                                 int(a.duration / 4))
    buf += "\n\r"
    _.send_to_char(char, buf)
Example #21
0
def do_say(char, args):
    if args == "":
        _.send_to_char(char, "What do you want to say?\n\r")
        return
    _.send_to_char(char, "You say '%s'\n\r" % args)
    _.send_to_room_except(
        "%s says '%s'\n\r" % (char.player.stats["name"], args),
        char.player.get_room(), [
            char,
        ])
Example #22
0
def do_yell(char, args):
    if args == "":
        _.send_to_char(char, "Yell what?\n\r")
        return
    _.send_to_char(char, "You yell '%s'\n\r" % args)
    _.send_to_area_except(
        "%s yells '%s'\n\r" % (char.player.stats["name"], args),
        char.player.get_area(), [
            char,
        ])
Example #23
0
def do_where(char, args):
    found = False
    buf = "Players near you:\n\r"
    for c in _.peers:
        buf += "%s  %s\n\r" % (c.player.stats["name"],
                               c.player.get_room().get_name())
        found = True
    if not found:
        buf += "None\n\r"
    _.send_to_char(char, buf)
Example #24
0
def end_combat_block():
    for m in _.peers:
        if m.player.fighting is not None:
            _.send_to_char(m, m.player.fighting.get_condition())

    _.block_send = False

    for p in _.peers:
        if p.send_buffer != "":
            _.send_buf_to_char(p)
            p.send_buffer = ""
Example #25
0
 def handle_death(self, villain):
     self.remove_from_combat()
     _.send_to_char(self.get_peer(), "You have been KILLED!!\n\r", False)
     _.send_to_room_except("%s is DEAD!!\n\r" % self.get_name(), self.get_room(), [self.get_peer(),])
     if villain.has_peer() and self.has_peer():
         _.send_to_all("%s suffers defeat at the hands of %s.\n\r" % (self.get_name(), villain.get_name()))
     if self.has_peer():
         self.set_position(_.POS_RESTING)
         self.stats["room"] = _.START_ROOM
         self.stats["hp"] = self.stats["max_hp"]
     else:
         _.mobiles.remove(self)
Example #26
0
 def apply_affect(self, target, duration):
     new_affect = copy.deepcopy(self)
     new_affect.target = target
     new_affect.duration = duration
     target.affects.append(new_affect)
     if self.apply_function is not None:
         self.apply_function(new_affect)
     _.send_to_char(target.get_peer(), self.apply_string_self)
     _.send_to_room_except(self.apply_string_others % target.get_name(),
                           target.get_room(), [
                               target.get_peer(),
                           ])
Example #27
0
def do_look(char, args):
    temp_room = char.player.get_room()

    if not char.player.can_see(None):
        _.send_to_char(char, "You can't see anything!\n\r")
        return

    #  Name and description
    buf = temp_room.get_name() + "\n\r\n\r"\
    + temp_room.get_desc() + "\n\r\n\rExits: [ "

    #  Exits
    noexit = True  # -Rework-
    for d in [x for x in sorted(temp_room.exits) if temp_room.exits[x] is not None]:
        buf += _.get_dir_string(d) + " "
        noexit = False

    if noexit:
        buf += "none "

    buf += "]\n\r\n\r"

    #  Items

    for r in temp_room.items:
        buf += "%s\n\r" % r.get_desc()
    if len(temp_room.items) > 0:
        buf += "\n\r"

    #  Characters

    other_players = [c.player for c in _.peers if c is not char and c.player.get_room() == char.player.get_room()
                                           and not c.linkdead and c.state == _.STATE_ONLINE]
    other_mobs = [m for m in _.mobiles if m.get_peer() is None and m.get_room() == char.player.get_room()]
    others = other_mobs + other_players

    for c in others:
        pos_string = ""
        pos_tag = ""
        if c.get_position() == _.POS_FIGHTING:
            pos_tag = ", fighting %s" % c.fighting.get_name() if c.fighting is not None else "null"
        elif c.get_position() == _.POS_RESTING:
            pos_string = "resting "
        elif c.get_position() == _.POS_SLEEPING:
            pos_string = "sleeping "
        buf += "%s%s is %shere%s.\n\r" % ("<LINKDEAD> " if c.get_peer() is not None and c.get_peer().linkdead else "",
                                          c.stats["name"].capitalize(), pos_string, pos_tag)
    if len(others) > 0:
        buf += "\n\r"

    _.send_to_char(char, buf)
Example #28
0
def do_kill(char, args):
    import mobile
    import combat

    if char.player.fighting is not None:
        _.send_to_char(char, "You are already fighting!\n\r")
        return
    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Kill whom?\n\r")
        return
    temp_target = mobile.get_mobile_in_room(target, char.player.get_room())
    if temp_target is None:
        _.send_to_char(char, "They aren't here.\n\r")
        return
    elif temp_target == char.player:
        _.send_to_char(char, "Suicide is a mortal sin.\n\r")
        return
    combat.start_combat(char.player, temp_target)
    temp_vector = temp_target.get_peer()
    combat.start_combat_block()
    if temp_vector is not None:
        do_yell(temp_vector,
                "Help! I am being attacked by %s!" % char.player.get_name())
    combat.do_one_round(char.player)
    combat.end_combat_block()
Example #29
0
def do_kill(char, args):
    import mobile
    import combat

    if char.player.fighting is not None:
        _.send_to_char(char, "You are already fighting!\n\r")
        return
    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Kill whom?\n\r")
        return
    temp_target = mobile.get_mobile_in_room(target, char.player.get_room())
    if temp_target is None:
        _.send_to_char(char, "They aren't here.\n\r")
        return
    elif temp_target == char.player:
        _.send_to_char(char, "Suicide is a mortal sin.\n\r")
        return
    combat.start_combat(char.player, temp_target)
    temp_vector = temp_target.get_peer()
    combat.start_combat_block()
    if temp_vector is not None:
        do_yell(temp_vector, "Help! I am being attacked by %s!" % char.player.get_name())
    combat.do_one_round(char.player)
    combat.end_combat_block()
Example #30
0
def spell_gate(char, args, target):
    import commands

    try:
        target = mobile.get_mobile(args.split()[0])
    except IndexError:
        _.send_to_char(char, "You must provide a target for that spell.\n\r")
        return
    if target is None:
        _.send_to_char(char, "You can't find them.\n\r")
        return
    if target == char.player:
        _.send_to_char(char, "You can't gate to yourself.\n\r")
        return
    char.player.remove_from_combat()
    _.send_to_room_except(
        "%s steps through a gate and vanishes.\n\r" % char.player.get_name(),
        char.player.get_room(), [
            char,
        ])
    _.send_to_char(char, "You step through a gate and vanish.\n\r")
    char.player.stats["room"] = target.get_room().vnum
    _.send_to_room_except(
        "%s has arrived through a gate.\n\r" % char.player.get_name(),
        char.player.get_room(), [
            char,
        ])
    commands.do_look(char, "")
Example #31
0
def do_cast(char, args):
    try:
        spell_name = args.split()[0]
    except IndexError:
        _.send_to_char(char, "What spell do you want to cast?\n\r")
        return
    for s in _.spell_list_sorted:
        if s not in char.player.get_spells():
            continue
        if len(s) >= len(spell_name):
            if spell_name == s[:len(spell_name)]:
                _.spell_list[s].execute_spell(char, "".join(args.split()[1:]))
                break
    else:
        _.send_to_char(char, "You don't know any spells by that name.\n\r")
Example #32
0
def do_cast(char, args):
    try:
        spell_name = args.split()[0]
    except IndexError:
        _.send_to_char(char, "What spell do you want to cast?\n\r")
        return
    for s in _.spell_list_sorted:
        if s not in char.player.get_spells():
            continue
        if len(s) >= len(spell_name):
            if spell_name == s[:len(spell_name)]:
                _.spell_list[s].execute_spell(char, "".join(args.split()[1:]))
                break
    else:
        _.send_to_char(char, "You don't know any spells by that name.\n\r")
Example #33
0
def do_damage(hitter, victim, damage, noun, magical):
    dam_adjective, dam_verb, dam_tag = get_damage_string(damage, magical)
    _.send_to_char(hitter.get_peer(), "Your %s%s %s %%s%s (%s)\n\r" % (dam_adjective, noun, dam_verb,
                                                                    dam_tag, damage), True, False, [victim, ])
    try:
        _.send_to_char(hitter.fighting.get_peer(), "%s's %s%s %s you%s (%s)\n\r" % (hitter.get_name(victim).capitalize(),
                                                                                    dam_adjective, noun, dam_verb,
                                                                                    dam_tag, damage))
    except AttributeError:
        pass
    _.send_to_room_except("%%s's %s%s %s %%s%s (%s)\n\r" % (dam_adjective, noun,
                                                           dam_verb, dam_tag, damage)
                        , hitter.get_room(), [hitter.get_peer(), victim.get_peer()], [hitter, victim])
    victim.damage(damage)  # -Debug- only, should be victim.damage(damage)
    if victim.is_dead():
        victim.handle_death(hitter)
        hitter.handle_kill(victim)
Example #34
0
def do_score(char, args):
    buf = ""
    temp_player = char.player

    buf += temp_player.get_name() + "\n\r"
    buf += "---------------------------------- Info ---------------------------------\n\r"
    buf += "Race: %-15s Class: %-15s\n\r" % (temp_player.stats["race"], temp_player.stats["class"])
    buf += "---------------------------------- Stats --------------------------------\n\r"
    buf += "Hp: %s of %s\n\r" % (temp_player.get_hp(), temp_player.get_max_hp())
    buf += "Str: %2s of %2s     Con: %2s of %2s\n\r" % (temp_player.get_stat("str"), temp_player.get_max_stat("str"),
                                                        temp_player.get_stat("con"), temp_player.get_max_stat("con"))
    buf += "Int: %2s of %2s     Wis: %2s of %2s\n\r" % (temp_player.get_stat("int"), temp_player.get_max_stat("int"),
                                                        temp_player.get_stat("wis"), temp_player.get_max_stat("wis"))
    buf += "Dex: %2s of %2s\n\r" % (temp_player.get_stat("dex"), temp_player.get_max_stat("dex"))
    buf += "Hitroll: %s Damroll: %s\n\r" % (temp_player.get_hitroll(), temp_player.get_damroll())

    _.send_to_char(char, buf)
Example #35
0
def do_move(char, direction):
    temp_new_room_vnum = char.player.get_room().exits[direction]
    if temp_new_room_vnum is None:
        _.send_to_char(char, "You can't go that way.\n\r")
        return
    elif temp_new_room_vnum not in [x.vnum for x in _.rooms]:
        _.send_to_char(char, "Illegal room. Contact an immortal.\n\r")
        return

    dir_string = _.get_dir_string(direction)

    if "sneak" not in char.player.get_skills():
        _.send_to_room_except("%s leaves %s.\n\r" % (char.player.stats["name"], dir_string), char.player.get_room(), [char,])
    char.player.stats["room"] = temp_new_room_vnum
    do_look(char, "")
    if "sneak" not in char.player.get_skills():
        _.send_to_room_except("%s has arrived.\n\r" % char.player.stats["name"], char.player.get_room(), [char,])
    return
Example #36
0
def do_equipment(char, args):
    buf = "You are using:\n\r"
    buf += "<used as light> %s\n\r" % (char.player.equipment[_.WEAR_LIGHT].get_name() \
       if char.player.equipment[_.WEAR_LIGHT] is not None else "Nothing")
    buf += "<worn on finger> %s\n\r" % (char.player.equipment[_.WEAR_FINGER].get_name() \
       if char.player.equipment[_.WEAR_FINGER] is not None else "Nothing")
    buf += "<worn on finger> %s\n\r" % (char.player.equipment[_.WEAR_FINGER2].get_name() \
       if char.player.equipment[_.WEAR_FINGER2] is not None else "Nothing")
    buf += "<worn around neck> %s\n\r" % (char.player.equipment[_.WEAR_NECK].get_name() \
       if char.player.equipment[_.WEAR_NECK] is not None else "Nothing")
    buf += "<worn around neck> %s\n\r" % (char.player.equipment[_.WEAR_NECK2].get_name() \
       if char.player.equipment[_.WEAR_NECK2] is not None else "Nothing")
    buf += "<worn on torso> %s\n\r" % (char.player.equipment[_.WEAR_TORSO].get_name() \
       if char.player.equipment[_.WEAR_TORSO] is not None else "Nothing")
    buf += "<worn on head> %s\n\r" % (char.player.equipment[_.WEAR_HEAD].get_name() \
       if char.player.equipment[_.WEAR_HEAD] is not None else "Nothing")
    buf += "<worn on legs> %s\n\r" % (char.player.equipment[_.WEAR_LEGS].get_name() \
       if char.player.equipment[_.WEAR_LEGS] is not None else "Nothing")
    buf += "<worn on feet> %s\n\r" % (char.player.equipment[_.WEAR_FEET].get_name() \
       if char.player.equipment[_.WEAR_FEET] is not None else "Nothing")
    buf += "<worn on hands> %s\n\r" % (char.player.equipment[_.WEAR_HAND].get_name() \
       if char.player.equipment[_.WEAR_HAND] is not None else "Nothing")
    buf += "<worn on arms> %s\n\r" % (char.player.equipment[_.WEAR_ARMS].get_name() \
       if char.player.equipment[_.WEAR_ARMS] is not None else "Nothing")
    buf += "<worn as shield> %s\n\r" % (char.player.equipment[_.WEAR_OFFHAND].get_name() \
       if char.player.equipment[_.WEAR_OFFHAND] is not None else "Nothing")
    buf += "<worn about body> %s\n\r" % (char.player.equipment[_.WEAR_BODY].get_name() \
       if char.player.equipment[_.WEAR_BODY] is not None else "Nothing")
    buf += "<worn about waist> %s\n\r" % (char.player.equipment[_.WEAR_WAIST].get_name() \
       if char.player.equipment[_.WEAR_WAIST] is not None else "Nothing")
    buf += "<worn around wrist> %s\n\r" % (char.player.equipment[_.WEAR_WRIST].get_name() \
       if char.player.equipment[_.WEAR_WRIST] is not None else "Nothing")
    buf += "<worn around wrist> %s\n\r" % (char.player.equipment[_.WEAR_WRIST2].get_name() \
       if char.player.equipment[_.WEAR_WRIST2] is not None else "Nothing")
    buf += "<wielded> %s\n\r" % (char.player.equipment[_.WEAR_WEAPON].get_name() \
       if char.player.equipment[_.WEAR_WEAPON] is not None else "Nothing")
    buf += "<held> %s\n\r" % (char.player.equipment[_.WEAR_HELD].get_name() \
       if char.player.equipment[_.WEAR_HELD] is not None else "Nothing")
    buf += "<floating nearby> %s\n\r" % (char.player.equipment[_.WEAR_FLOAT].get_name() \
       if char.player.equipment[_.WEAR_FLOAT] is not None else "Nothing")
    buf += "<orbiting nearby> %s\n\r" % (char.player.equipment[_.WEAR_FLOAT2].get_name() \
       if char.player.equipment[_.WEAR_FLOAT2] is not None else "Nothing")

    _.send_to_char(char, buf)
Example #37
0
def do_equipment(char, args):
    buf = "You are using:\n\r"
    buf += "<used as light> %s\n\r" % (char.player.equipment[_.WEAR_LIGHT].get_name() \
       if char.player.equipment[_.WEAR_LIGHT] is not None else "Nothing")
    buf += "<worn on finger> %s\n\r" % (char.player.equipment[_.WEAR_FINGER].get_name() \
       if char.player.equipment[_.WEAR_FINGER] is not None else "Nothing")
    buf += "<worn on finger> %s\n\r" % (char.player.equipment[_.WEAR_FINGER2].get_name() \
       if char.player.equipment[_.WEAR_FINGER2] is not None else "Nothing")
    buf += "<worn around neck> %s\n\r" % (char.player.equipment[_.WEAR_NECK].get_name() \
       if char.player.equipment[_.WEAR_NECK] is not None else "Nothing")
    buf += "<worn around neck> %s\n\r" % (char.player.equipment[_.WEAR_NECK2].get_name() \
       if char.player.equipment[_.WEAR_NECK2] is not None else "Nothing")
    buf += "<worn on torso> %s\n\r" % (char.player.equipment[_.WEAR_TORSO].get_name() \
       if char.player.equipment[_.WEAR_TORSO] is not None else "Nothing")
    buf += "<worn on head> %s\n\r" % (char.player.equipment[_.WEAR_HEAD].get_name() \
       if char.player.equipment[_.WEAR_HEAD] is not None else "Nothing")
    buf += "<worn on legs> %s\n\r" % (char.player.equipment[_.WEAR_LEGS].get_name() \
       if char.player.equipment[_.WEAR_LEGS] is not None else "Nothing")
    buf += "<worn on feet> %s\n\r" % (char.player.equipment[_.WEAR_FEET].get_name() \
       if char.player.equipment[_.WEAR_FEET] is not None else "Nothing")
    buf += "<worn on hands> %s\n\r" % (char.player.equipment[_.WEAR_HAND].get_name() \
       if char.player.equipment[_.WEAR_HAND] is not None else "Nothing")
    buf += "<worn on arms> %s\n\r" % (char.player.equipment[_.WEAR_ARMS].get_name() \
       if char.player.equipment[_.WEAR_ARMS] is not None else "Nothing")
    buf += "<worn as shield> %s\n\r" % (char.player.equipment[_.WEAR_OFFHAND].get_name() \
       if char.player.equipment[_.WEAR_OFFHAND] is not None else "Nothing")
    buf += "<worn about body> %s\n\r" % (char.player.equipment[_.WEAR_BODY].get_name() \
       if char.player.equipment[_.WEAR_BODY] is not None else "Nothing")
    buf += "<worn about waist> %s\n\r" % (char.player.equipment[_.WEAR_WAIST].get_name() \
       if char.player.equipment[_.WEAR_WAIST] is not None else "Nothing")
    buf += "<worn around wrist> %s\n\r" % (char.player.equipment[_.WEAR_WRIST].get_name() \
       if char.player.equipment[_.WEAR_WRIST] is not None else "Nothing")
    buf += "<worn around wrist> %s\n\r" % (char.player.equipment[_.WEAR_WRIST2].get_name() \
       if char.player.equipment[_.WEAR_WRIST2] is not None else "Nothing")
    buf += "<wielded> %s\n\r" % (char.player.equipment[_.WEAR_WEAPON].get_name() \
       if char.player.equipment[_.WEAR_WEAPON] is not None else "Nothing")
    buf += "<held> %s\n\r" % (char.player.equipment[_.WEAR_HELD].get_name() \
       if char.player.equipment[_.WEAR_HELD] is not None else "Nothing")
    buf += "<floating nearby> %s\n\r" % (char.player.equipment[_.WEAR_FLOAT].get_name() \
       if char.player.equipment[_.WEAR_FLOAT] is not None else "Nothing")
    buf += "<orbiting nearby> %s\n\r" % (char.player.equipment[_.WEAR_FLOAT2].get_name() \
       if char.player.equipment[_.WEAR_FLOAT2] is not None else "Nothing")

    _.send_to_char(char, buf)
Example #38
0
def do_tell(char, args):
    import player

    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Who do you want to tell?\n\r")
        return
    target_player = player.get_player(target)
    if target_player is None:
        _.send_to_char(char, "You can't find them.\n\r")
        return
    try:
        message = args.split()[1]
    except IndexError:
        _.send_to_char(char, "What do you want to tell them?\n\r")
        return
    _.send_to_char(char, "You tell %s '%s'\n\r" % (target_player.get_name(), message))
    _.send_to_char(target_player.get_peer(), "%s tells you '%s'\n\r" % (char.player.get_name(), message))
Example #39
0
def do_elemental(hitter, victim, element):
    if not victim:
        return
    if random.randint(0,10) > 5:
        return
    if "fire" in element:
        _.send_to_char(victim.get_peer(), "You are burned by " + hitter.get_name() + "'s flames.\n\r")
        _.send_to_char(hitter.get_peer(), victim.get_name() + " is burned by your flames.\n\r")
        _.send_to_room_except(victim.get_name() + "is burned by " + hitter.get_name() + "'s flames.\n\r",hitter.get_room(),[victim.get_peer(), hitter.get_peer()])
        victim.damage(2)
        _.affect_list["blind"].apply_affect(victim,1)
    if "shocking" in element:
        _.send_to_char(hitter.get_peer(), "You shock them with your weapon, but it doesn't seem to have any effect.\n\r")
    if "demon" in element:
        _.send_to_char(victim.get_peer(), "You are stricken by the damnation of " + hitter.get_name() + ".\n\r")
        _.send_to_char(hitter.get_peer(), victim.get_name() + " is struck down by hellfire.\n\r")
        _.send_to_room_except(victim.get_name() + "is struck down by the damnation of " + hitter.get_name() + ".\n\r",hitter.get_room(),[victim.get_peer(), hitter.get_peer()])
        victim.damage(2)
        _.affect_list["curse"].apply_affect(victim,1)
Example #40
0
def do_tell(char, args):
    import player

    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Who do you want to tell?\n\r")
        return
    target_player = player.get_player(target)
    if target_player is None:
        _.send_to_char(char, "You can't find them.\n\r")
        return
    try:
        message = args.split()[1]
    except IndexError:
        _.send_to_char(char, "What do you want to tell them?\n\r")
        return
    _.send_to_char(
        char, "You tell %s '%s'\n\r" % (target_player.get_name(), message))
    _.send_to_char(target_player.get_peer(),
                   "%s tells you '%s'\n\r" % (char.player.get_name(), message))
Example #41
0
 def execute_command(self, char, args):
     if char.player.get_position() == _.POS_FIGHTING and not self.in_combat:
         _.send_to_char(char, "No way! You are already fighting!\n\r")
         return
     if char.player.get_position() < self.position:
         if char.player.get_position() == _.POS_SLEEPING:
             _.send_to_char(char, "You can't do that, you're sleeping!\n\r")
         elif char.player.get_position() == _.POS_RESTING:
             _.send_to_char(char, "Nah...you're too relaxed.\n\r")
         elif char.player.get_position() == _.POS_STANDING:
             _.send_to_char(char, "You aren't fighting anyone.\n\r")
         return
     self.function(char, args)
     char.player.add_lag(self.lag)
Example #42
0
 def execute_command(self, char, args):
     if char.player.get_position() == _.POS_FIGHTING and not self.in_combat:
         _.send_to_char(char, "No way! You are already fighting!\n\r")
         return
     if char.player.get_position() < self.position:
         if char.player.get_position() == _.POS_SLEEPING:
             _.send_to_char(char, "You can't do that, you're sleeping!\n\r")
         elif char.player.get_position() == _.POS_RESTING:
             _.send_to_char(char, "Nah...you're too relaxed.\n\r")
         elif char.player.get_position() == _.POS_STANDING:
             _.send_to_char(char, "You aren't fighting anyone.\n\r")
         return
     self.function(char, args)
     char.player.add_lag(self.lag)
Example #43
0
def do_wake(char, args):
    temp_position = char.player.get_position()
    if char.player.affected_by(_.affect_list["sap"]):
        _.send_to_char(char, "You can't wake up!\n\r")
        return
    if temp_position == _.POS_SLEEPING:
        _.send_to_char(char, "You wake and stand up.\n\r")
        _.send_to_room_except("%s wakes and stands up.\n\r" % char.player.get_name(), char.player.get_room(), [char,])
        char.player.set_position(_.POS_STANDING)
    elif temp_position == _.POS_RESTING:
        _.send_to_char(char, "You stand up.\n\r")
        _.send_to_room_except("%s stands up.\n\r" % char.player.get_name(), char.player.get_room(), [char,])
        char.player.set_position(_.POS_STANDING)
    else:
        _.send_to_char(char, "You aren't sleeping.\n\r")
Example #44
0
def do_rest(char, args):
    temp_position = char.player.get_position()
    if temp_position == _.POS_SLEEPING:
        _.send_to_char(char, "You wake up and start resting.\n\r")
        _.send_to_room_except("%s wakes up and starts resting.\n\r" % char.player.get_name(), char.player.get_room(),
                              [char,])
        char.player.set_position(_.POS_RESTING)
    elif temp_position == _.POS_RESTING:
        _.send_to_char(char, "You are already resting.\n\r")
    elif temp_position == _.POS_STANDING:
        _.send_to_char(char, "You rest.\n\r")
        _.send_to_room_except("%s rests.\n\r" % char.player.get_name(), char.player.get_room(),
                              [char,])
        char.player.set_position(_.POS_RESTING)
    elif temp_position == _.POS_STANDING:
        _.send_to_char(char, "You are still fighting!\n\r")
Example #45
0
def do_score(char, args):
    buf = ""
    temp_player = char.player

    buf += temp_player.get_name() + "\n\r"
    buf += "---------------------------------- Info ---------------------------------\n\r"
    buf += "Race: %-15s Class: %-15s\n\r" % (temp_player.stats["race"],
                                             temp_player.stats["class"])
    buf += "---------------------------------- Stats --------------------------------\n\r"
    buf += "Hp: %s of %s\n\r" % (temp_player.get_hp(),
                                 temp_player.get_max_hp())
    buf += "Str: %2s of %2s     Con: %2s of %2s\n\r" % (
        temp_player.get_stat("str"), temp_player.get_max_stat("str"),
        temp_player.get_stat("con"), temp_player.get_max_stat("con"))
    buf += "Int: %2s of %2s     Wis: %2s of %2s\n\r" % (
        temp_player.get_stat("int"), temp_player.get_max_stat("int"),
        temp_player.get_stat("wis"), temp_player.get_max_stat("wis"))
    buf += "Dex: %2s of %2s\n\r" % (temp_player.get_stat("dex"),
                                    temp_player.get_max_stat("dex"))
    buf += "Hitroll: %s Damroll: %s\n\r" % (temp_player.get_hitroll(),
                                            temp_player.get_damroll())

    _.send_to_char(char, buf)
Example #46
0
def do_sleep(char, args):
    temp_position = char.player.get_position()
    if temp_position == _.POS_SLEEPING:
        _.send_to_char(char, "You're already asleep!\n\r")
    elif temp_position == _.POS_RESTING or temp_position == _.POS_STANDING:
        _.send_to_char(char, "You go to sleep.\n\r")
        _.send_to_room_except("%s goes to sleep.\n\r" % char.player.get_name(), char.player.get_room(), [char,])
        char.player.set_position(_.POS_SLEEPING)
    elif temp_position == _.POS_FIGHTING:
        _.send_to_char(char, "You are still fighting!\n\r")
Example #47
0
def do_stand(char, args):
    temp_position = char.player.get_position()
    if temp_position == _.POS_SLEEPING:
        _.send_to_char(char, "You wake and stand up.\n\r")
        _.send_to_room_except("%s wakes and stands up.\n\r" % char.player.get_name(), char.player.get_room(), [char,])
        char.player.set_position(_.POS_STANDING)
    elif temp_position == _.POS_RESTING:
        _.send_to_char(char, "You stand up.\n\r")
        _.send_to_room_except("%s stands up.\n\r" % char.player.get_name(), char.player.get_room(), [char,])
        char.player.set_position(_.POS_STANDING)
    elif temp_position == _.POS_FIGHTING or temp_position == _.POS_STANDING:
        _.send_to_char(char, "You are already standing.\n\r")
Example #48
0
def parse_name2(char, input_string):
    temp_answer = input_string[0].lower().strip()
    if temp_answer == "y":
        print("New character.")
        _.send_to_char(char, "New character.\n\rPlease choose a password: "******"n":
        _.send_to_char(char, "\n\rAlright, what is it then? ", False, True)
        char.state = _.STATE_NAME1
    else:
        _.send_to_char(char, "\n\rPlease answer yes or no. ", False, True)
Example #49
0
def do_get(char, args):
    import item

    temp_room = char.player.get_room()
    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Get what?\n\r")
        return
    if len(char.player.inventory) >= _.MAX_CARRY:
        _.send_to_char(char, "You can't carry any more.\n\r")
        return
    temp_item = item.get_item_in_room(temp_room, target)
    if temp_item is None:
        _.send_to_char(char, "You don't see that here.\n\r")
        return
    _.send_to_char(char, "You get %s.\n\r" % temp_item.get_name())
    _.send_to_room_except("%s gets %s.\n\r" % (char.player.get_name(), temp_item.get_name()), char.player.get_room(), [char,])
    temp_room.remove_item(temp_item)
    char.player.add_item(temp_item)
Example #50
0
def do_sleep(char, args):
    temp_position = char.player.get_position()
    if temp_position == _.POS_SLEEPING:
        _.send_to_char(char, "You're already asleep!\n\r")
    elif temp_position == _.POS_RESTING or temp_position == _.POS_STANDING:
        _.send_to_char(char, "You go to sleep.\n\r")
        _.send_to_room_except("%s goes to sleep.\n\r" % char.player.get_name(),
                              char.player.get_room(), [
                                  char,
                              ])
        char.player.set_position(_.POS_SLEEPING)
    elif temp_position == _.POS_FIGHTING:
        _.send_to_char(char, "You are still fighting!\n\r")
Example #51
0
def parse_name1(char, input_string):
    try:
        input_string = input_string.split()[0].strip()
    except IndexError:
        _.send_to_char(char, "Illegal name.\n\rBy what name do you wish to be known? ", False, True)
        return
    if input_string != ''.join(c for c in input_string if c in _.VALID_CHARS):
        _.send_to_char(char, "Illegal name.\n\rBy what name do you wish to be known? ", False, True)
        return

    #  See if player exists
    if load_char(char, input_string):
        _.send_to_char(char, "\n\rPassword: "******"name"] = input_string.capitalize()
        _.send_to_char(char, "\n\rDid I get that right, %s? (Y/N) " % char.player.stats["name"], False, True)
        char.state = _.STATE_NAME2
        return
Example #52
0
def do_rest(char, args):
    temp_position = char.player.get_position()
    if temp_position == _.POS_SLEEPING:
        _.send_to_char(char, "You wake up and start resting.\n\r")
        _.send_to_room_except(
            "%s wakes up and starts resting.\n\r" % char.player.get_name(),
            char.player.get_room(), [
                char,
            ])
        char.player.set_position(_.POS_RESTING)
    elif temp_position == _.POS_RESTING:
        _.send_to_char(char, "You are already resting.\n\r")
    elif temp_position == _.POS_STANDING:
        _.send_to_char(char, "You rest.\n\r")
        _.send_to_room_except("%s rests.\n\r" % char.player.get_name(),
                              char.player.get_room(), [
                                  char,
                              ])
        char.player.set_position(_.POS_RESTING)
    elif temp_position == _.POS_STANDING:
        _.send_to_char(char, "You are still fighting!\n\r")
Example #53
0
def do_wake(char, args):
    temp_position = char.player.get_position()
    if char.player.affected_by(_.affect_list["sap"]):
        _.send_to_char(char, "You can't wake up!\n\r")
        return
    if temp_position == _.POS_SLEEPING:
        _.send_to_char(char, "You wake and stand up.\n\r")
        _.send_to_room_except(
            "%s wakes and stands up.\n\r" % char.player.get_name(),
            char.player.get_room(), [
                char,
            ])
        char.player.set_position(_.POS_STANDING)
    elif temp_position == _.POS_RESTING:
        _.send_to_char(char, "You stand up.\n\r")
        _.send_to_room_except("%s stands up.\n\r" % char.player.get_name(),
                              char.player.get_room(), [
                                  char,
                              ])
        char.player.set_position(_.POS_STANDING)
    else:
        _.send_to_char(char, "You aren't sleeping.\n\r")
Example #54
0
def do_wear(char, args):
    import item

    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Wear what?\n\r")
        return
    if len(char.player.inventory) == 0:
        _.send_to_char(char, "You're not carrying that.\n\r")
        return
    temp_item = item.get_item_in_inventory(char, target)
    if temp_item is None:
        _.send_to_char(char, "You're not carrying that.\n\r")
        return
    char.player.wear_armor(temp_item)
Example #55
0
def do_get(char, args):
    import item

    temp_room = char.player.get_room()
    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Get what?\n\r")
        return
    if len(char.player.inventory) >= _.MAX_CARRY:
        _.send_to_char(char, "You can't carry any more.\n\r")
        return
    temp_item = item.get_item_in_room(temp_room, target)
    if temp_item is None:
        _.send_to_char(char, "You don't see that here.\n\r")
        return
    _.send_to_char(char, "You get %s.\n\r" % temp_item.get_name())
    _.send_to_room_except(
        "%s gets %s.\n\r" % (char.player.get_name(), temp_item.get_name()),
        char.player.get_room(), [
            char,
        ])
    temp_room.remove_item(temp_item)
    char.player.add_item(temp_item)
Example #56
0
def do_stand(char, args):
    temp_position = char.player.get_position()
    if temp_position == _.POS_SLEEPING:
        _.send_to_char(char, "You wake and stand up.\n\r")
        _.send_to_room_except(
            "%s wakes and stands up.\n\r" % char.player.get_name(),
            char.player.get_room(), [
                char,
            ])
        char.player.set_position(_.POS_STANDING)
    elif temp_position == _.POS_RESTING:
        _.send_to_char(char, "You stand up.\n\r")
        _.send_to_room_except("%s stands up.\n\r" % char.player.get_name(),
                              char.player.get_room(), [
                                  char,
                              ])
        char.player.set_position(_.POS_STANDING)
    elif temp_position == _.POS_FIGHTING or temp_position == _.POS_STANDING:
        _.send_to_char(char, "You are already standing.\n\r")
Example #57
0
def do_remove(char, args):
    import item

    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Remove what?\n\r")
        return
    try:
        temp_slot = item.get_item_slot_in_equipment(char, target)
        _.send_to_char(
            char, "You stop using %s.\n\r" %
            char.player.equipment[temp_slot].get_name())
        _.send_to_room_except("%s stops using %s.\n\r" % (char.player.get_name(), char.player.equipment[temp_slot].get_name()), \
                              char.player.get_room(), [char,])
        char.player.add_item(char.player.equipment[temp_slot])
        char.player.equipment[temp_slot] = None
    except KeyError:
        _.send_to_char(char, "You're not wearing that.\n\r")
Example #58
0
def do_flee(char, args):
    import combat
    if char.player.fighting is None:
        _.send_to_char(char, "You aren't fighting anyone.\n\r")
        return
    if char.player.get_room().random_exit() is None or random.randint(0,
                                                                      4) == 0:
        _.send_to_char(char, "PANIC! You couldn't escape!\n\r")
        return
    else:
        combat.start_combat_block()
        _.send_to_char(char, "You flee from combat!\n\r"
                       )  #  -Rework- to make you flee out of the room
        _.send_to_room_except("%s has fled!\n\r" % char.player.get_name(),
                              char.player.get_room(), [
                                  char,
                              ])
        char.player.remove_from_combat()
        do_move(char, char.player.get_room().random_exit())
        combat.end_combat_block()
Example #59
0
def do_drop(char, args):
    import item

    try:
        target = args.split()[0]
    except IndexError:
        _.send_to_char(char, "Drop what?\n\r")
        return
    try:
        temp_item = item.get_item_in_inventory(char, target)
        _.send_to_char(char, "You drop %s.\n\r" % temp_item.get_name())
        _.send_to_room_except(
            "%s drops %s.\n\r" %
            (char.player.get_name(), temp_item.get_name()),
            char.player.get_room(), [
                char,
            ])
        char.player.get_room().add_item(temp_item)
        char.player.remove_item(temp_item)
    except AttributeError:
        _.send_to_char(char, "You're not carrying that.\n\r")