示例#1
0
    def __init__(self, **kwargs):
        super().__init__()
        self.affected = []
        self.affected_by = bit.Bit(flagset_name="affect_flags")
        self.itemaff = bit.Bit(flagset_name="itemaff_flags")
        self.immune = bit.Bit(flagset_name="immune_flags")
        self.polyaff = bit.Bit(flagset_name="polyaff_flags")

        if kwargs:
            [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()]
示例#2
0
 def __init__(self):
     super().__init__()
     self.name = ""
     self.short_descr = ""
     self.long_descr = ""
     self.description = ""
     self.form = bit.Bit(flags=tables.form_flags)
     self.parts = bit.Bit(flags=tables.part_flags)
     self.size = 0
     self.material = ""
     self.weight = 0
    def __init__(self, template=None, **kwargs):
        super().__init__()
        self.is_item = True
        self.vnum = 0
        self.instance_id = None
        self.valid = False
        self.chobj = None
        self.chpoweron = ""
        self.chpoweroff = ""
        self.chpoweruse = ""
        self.victpoweron = ""
        self.victpoweroff = ""
        self.victpoweruse = ""
        self.questmaker = ""
        self.questowner = ""

        self.count = 0
        self.reset_num = 0
        self.item_type = merc.ITEM_TRASH
        self.cost = 0
        self.level = 0
        self.condition = 0
        self.toughness = 0
        self.resistance = 0
        self.timer = 0
        self.points = 0
        self.specpower = 0

        self.extra_descr = []
        self.affected = []
        self.value = [0] * 5
        self.quest = bit.Bit(flagset_name="quest_flags")
        self.spectype = bit.Bit(flagset_name="spectype_flags")
        self.flags = item_flags.ItemFlags()

        if kwargs:
            [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()]

        if template:
            [
                setattr(self, k, copy.deepcopy(v))
                for k, v in template.__dict__.items()
            ]
            self.instancer()

        if self.instance_id:
            self.instance_setup()
            Items.instance_count += 1
        else:
            Items.template_count += 1

        self._last_saved = None
        self._md5 = None
示例#4
0
    def __init__(self, template=None, **kwargs):
        self.name = ""
        self.to_room_vnum = None
        self.to_room = None
        self.exit_info = bit.Bit(flagset_name="exit_flags")
        self.key = 0
        self.keyword = ""
        self.description = ""
        self.is_broken = False

        if template:
            [
                setattr(self, k, copy.deepcopy(v))
                for k, v in template.__dict__.items()
            ]

            if self.to_room_vnum != -1 and not None and self.to_room_vnum in instance.instances_by_room:
                self.to_room = instance.instances_by_room[self.to_room_vnum][0]
            elif self.to_room_vnum == -1 or None:
                # This is a case where
                self.to_room = None
            elif self.to_room_vnum not in instance.instances_by_room:
                self.is_broken = True
                comm.notify(
                    "Exit: bad to_room_vnum {}".format(self.to_room_vnum),
                    merc.CONSOLE_ERROR)
            else:
                self.to_room = None

            if self.key <= 0:
                self.key = None

        if kwargs:
            [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()]
示例#5
0
 def __init__(self):
     super().__init__()
     #Immortal
     self._trust = 0
     self.invis_level = 0
     self.incog_level = 0
     self.wiznet = bit.Bit(flags=const.wiznet_table)
示例#6
0
    def __init__(self, template=None, **kwargs):
        super().__init__()
        self.is_pc = False
        self.is_room = True
        self.vnum = 0
        self.area = ""
        self.name = ""
        self.description = ""

        self.available_light = 0
        self.sector_type = 0
        self.blood = 0

        self.extra_descr = []
        self.roomtext = []
        self.special_inventory = []
        self.track = [[""] * 10] * merc.MAX_DIR
        self.track_dir = [0] * merc.MAX_DIR
        self.exit = [None] * merc.MAX_DIR

        self.room_flags = bit.Bit(flagset_name="room_flags")

        if kwargs:
            [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()]

        if template:
            [
                setattr(self, k, copy.deepcopy(v))
                for k, v in template.__dict__.items()
            ]
            self.instancer()

        if self.environment:
            if self._environment not in instance.global_instances.keys():
                self.environment = None

        if self.special_inventory:
            for t in self.special_inventory[:]:
                self.inventory += t[0]
                import importlib
                words = t[1].split(".")
                class_name = words[-1]
                module_name = ".".join(words[0:-1])
                if module_name != "" and class_name != "":
                    module_ref = importlib.import_module(module_name)
                    class_ref = getattr(module_ref, class_name)
                    if hasattr(class_ref, "load"):
                        return class_ref.load(t[0])
            del self.special_inventory

        if self.instance_id:
            self.instance_setup()
            Room.instance_count += 1
        else:
            Room.template_count += 1

        self._last_saved = None
        self._md5 = None
示例#7
0
 def __init__(self, template=None, **kwargs):
     super().__init__()
     #self.is_npc = True
     self.vnum = 0  # Needs to come before the template to setup the instance
     self.memory = None
     self.spec_fun = None
     self.new_format = True
     self.area = ""
     self.off_flags = bit.Bit(flags=tables.off_flags)
     self.damage = [0, 0, 0]
     self.start_pos = 0
     self.default_pos = 0
     self.hit_dice = [0, 0, 0]
     self.mana_dice = [0, 0, 0]
     self.dam_dice = [0, 0, 0]
     self.template_wealth = 0
     self.count = 0
     self.killed = 0
     self.pShop = None
     self.listeners = {}
     if kwargs:
         [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()]
     if template:
         [
             setattr(self, k, copy.deepcopy(v))
             for k, v in template.__dict__.items()
         ]
         self.instancer()
     if self.environment:
         if self._environment not in instance.global_instances.keys():
             self.environment = None
     if self.inventory:
         for instance_id in self.inventory[:]:
             handler_item.Items.load(instance_id=instance_id)
     for item_id in self.equipped.values():
         if item_id:
             handler_item.Items.load(instance_id=item_id)
     if self.instance_id:
         self.instance_setup()
         Npc.instance_count += 1
     else:
         Npc.template_count += 1
     self._last_saved = None
     self._md5 = None
示例#8
0
    def __init__(self, template=None, **kwargs):
        super().__init__()
        # self.is_npc = True
        self.vnum = 0  # Needs to come before the template to setup the instance
        self.is_pc = False
        self.spec_fun = None
        self.area = ""
        self.powertype = ""
        self.poweraction = ""
        self.act = bit.Bit(flagset_name="act_flags")
        self.count = 0
        self.killed = 0
        self.pshop = None

        if kwargs:
            [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()]

        if template:
            [
                setattr(self, k, copy.deepcopy(v))
                for k, v in template.__dict__.items()
            ]
            self.instancer()

        if self.environment:
            if self._environment not in instance.global_instances.keys():
                self.environment = None

        if self.inventory:
            for instance_id in self.inventory[:]:
                handler_item.Items.load(instance_id=instance_id)

        for item_id in self.equipped.values():
            if item_id:
                handler_item.Items.load(instance_id=item_id)

        if self.instance_id:
            self.instance_setup()
            Npc.instance_count += 1
        else:
            Npc.template_count += 1

        self._last_saved = None
        self._md5 = None
示例#9
0
 def __init__(self, **kwargs):
     super().__init__()
     self.affected = []
     self.affected_by = bit.Bit(flags=tables.affect_flags)
     if kwargs:
         [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()]
示例#10
0
    def __init__(self, template=None, **kwargs):
        import handler_item
        super().__init__()
        self.is_pc = True
        self.valid = False
        self.pnote = None

        self.act = bit.Bit(merc.PLR_BLANK | merc.PLR_COMBINE | merc.PLR_PROMPT,
                           flagset_name="plr_flags")

        self.bamfin = ""
        self.bamfout = ""
        self.last_host = ""
        self.email = ""
        self._title = ""
        self.pload = ""
        self.prompt = ""
        self.cprompt = ""
        self.pwd = ""

        self.createtime = int(merc.current_time)
        self.home = merc.ROOM_VNUM_TEMPLE
        self.last_note = 0

        self.score = [0] * merc.MAX_SCORE
        self.learned = {}

        self._last_login = time.time()
        self._last_logout = None
        self._saved_room_vnum = merc.ROOM_VNUM_TEMPLE

        if template or kwargs:
            if template and not kwargs:
                self.name = template
                self.instancer()

            if kwargs:
                [setattr(self, k, copy.deepcopy(v)) for k, v in kwargs.items()]

                if self._fighting:
                    self._fighting = None
                    self.position = merc.POS_STANDING

                if self.environment:
                    if self._environment not in instance.global_instances.keys(
                    ):
                        self.environment = None

                if self.inventory:
                    for instance_id in self.inventory[:]:
                        handler_item.Items.load(instance_id=instance_id,
                                                player_name=self.name)

                for item_id in self.equipped.values():
                    if item_id:
                        handler_item.Items.load(instance_id=item_id,
                                                player_name=self.name)

            self.instance_setup()

        if self.instance_id:
            Pc.instance_count += 1
        else:
            Pc.template_count += 1

        self._last_saved = None
        self._md5 = None
示例#11
0
'''
Created on Jun 10, 2014

@author: lmosiman
'''

if __name__ == '__main__':
    pass

import bit
import cut

print "Welcome to RadBits v0.3 alpha!"
print "============================="

new_cut = cut.Cut()
new_bit = bit.Bit()

new_bit.get_bit_radius(new_cut.radius, new_cut.depth, new_cut.sin_of_min_angle)
new_bit.get_sin_of_bit_angle(new_cut.radius, new_cut.depth)

print "Bit radius: " ,new_bit.rational_num
print "Bit angle: " ,new_bit.angle

input("Press <enter> to quit.")