• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python gamedb.getobj函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mufsim.gamedb.getobj函数的典型用法代码示例。如果您正苦于以下问题:Python getobj函数的具体用法?Python getobj怎么用?Python getobj使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getobj函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: compile_source

 def compile_source(self, prog):
     comp = CompiledMuf(prog)
     self.compiled = comp
     self.line = 1
     self.word_line = 1
     self.stmt_stack = []
     self.funcname = None
     self.defines = dict(self.builtin_defines)
     self.include_defs_from(0, suppress=True)
     src = db.getobj(prog).sources
     try:
         code, src = self.compile_r(src)
         if self.funcname:
             raise MufCompileError("Function incomplete.")
         self.check_for_incomplete_block()
         if code:
             for inum, inst in enumerate(code):
                 if type(inst) in [
                     instfl.InstTry,
                     instfl.InstJmp,
                     instfl.InstJmpIfFalse
                 ]:
                     inst.value += inum
             comp.code = code
             db.getobj(prog).compiled = comp
             return True
         return False
     except MufCompileError as e:
         errlog("Error in line %d: %s" % (self.word_line, e))
         return None
开发者ID:gitter-badger,项目名称:mufsim,代码行数:30,代码来源:compiler.py


示例2: usercmd_at_dig

def usercmd_at_dig(proclist, descr, user, cmd):
    if user is None or user == -1:
        notify_descr_or_user(descr, user, "Huh?")
        return
    userobj = db.getobj(user)
    roomname, cmd = getword(cmd, '=')
    envroom, regname = getword(cmd, '=')
    regname = regname.strip()
    envref = db.match_from(userobj.dbref, envroom)
    if not db.validobj(envref):
        userobj.notify("I don't know which room you mean.")
        return
    envobj = db.getobj(envref)
    if envobj.objtype != "room":
        userobj.notify("I don't know which room you mean.")
        return
    newroom = db.DBObject(
        name=roomname.strip(),
        objtype="room",
        location=envobj.dbref,
        owner=user,
    )
    if regname:
        db.register_obj(user, regname, newroom.dbref)
    userobj.notify("Room created as #%d." % newroom.dbref)
开发者ID:revarbat,项目名称:mufsim,代码行数:25,代码来源:commands.py


示例3: debug_cmd_break

 def debug_cmd_break(self, args):
     addr = self.fr.curr_addr()
     prog = addr.prog
     if ' ' in args:
         prg, args = args.split(' ', 1)
         prg = prg.strip()
         args = args.strip()
         obj = db.match_dbref(prg)
         if obj == -1:
             obj = db.match_registered(db.getobj(0), prg)
         obj = db.getobj(obj)
         if not db.validobj(obj):
             log("Invalid program!")
             return
         if db.getobj(obj).objtype != "program":
             log("Invalid program!")
             return
         prog = obj
     addr = self.fr.program_function_addr(prog, args)
     if addr:
         line = self.fr.get_inst_line(addr)
         bpnum = self.fr.add_breakpoint(prog, line)
         log("Added breakpoint %d at #%d line %d." % (bpnum, prog, line))
     elif util.is_int(args):
         line = int(args)
         bpnum = self.fr.add_breakpoint(prog, line)
         log("Added breakpoint %d at #%d line %d." % (bpnum, prog, line))
     else:
         log("Usage: break [PROG] LINE")
         log("   or: break [PROG] FUNCNAME")
开发者ID:revarbat,项目名称:mufsim,代码行数:30,代码来源:__init__.py


示例4: usercmd_page

def usercmd_page(proclist, descr, user, cmd):
    if user is None or user == -1:
        netifc.descr_notify(descr, "Huh?")
        return
    userobj = db.getobj(user)
    targname, mesg = getword(cmd, '=')
    targref = db.match_playername(targname)
    if targref == -1:
        targref = db.match_playername_prefix(targname)
    if targref == -1:
        userobj.notify("I don't recognize that player.")
        return
    if targref == -2:
        userobj.notify("I don't know which player you mean.")
        return
    targobj = db.getobj(targref)
    if not netifc.is_user_online(targobj.dbref):
        targobj.notify('%s is not awake.' % targobj.name)
        return
    if not mesg:
        locname = db.getobj(userobj.location).name
        targobj.notify('%s is looking for you in %s.' % (userobj.name, locname))
        userobj.notify('You page %s.' % targobj.name)
    else:
        targobj.notify('%s pages, "%s" to you.' % (userobj.name, mesg))
        userobj.notify('You page, "%s" to %s.' % (mesg, targobj.name))
开发者ID:revarbat,项目名称:mufsim,代码行数:26,代码来源:commands.py


示例5: usercmd_look

def usercmd_look(proclist, descr, user, cmd):
    if user is None or user == -1:
        notify_descr_or_user(descr, user, "Huh?")
        return
    userobj = db.getobj(user)
    if not cmd:
        targobj = db.getobj(userobj.location)
    else:
        targ = db.match_noisy(user, cmd)
        if not db.validobj(targ):
            return
        targobj = db.getobj(targ)
    userobj.notify(targobj.unparse_for(user))
    desc = targobj.getprop('_/de')
    if not desc:
        desc = "You see nothing special."
    # TODO: process for MPI
    userobj.notify(desc)
    lck = targobj.getprop('_/lok')
    unlocked = True
    if lck and isinstance(lck, lock.LockNode) and not lck.eval(user):
        unlocked = False
    if unlocked:
        db.do_succ(user, targobj.dbref)
    else:
        db.do_fail(user, targobj.dbref)
    if targobj.contents:
        userobj.notify('Contents:')
        for obj in targobj.contents:
            obj = db.getobj(obj)
            userobj.notify(obj.unparse_for(user))
开发者ID:revarbat,项目名称:mufsim,代码行数:31,代码来源:commands.py


示例6: execute

 def execute(self, fr):
     name = fr.data_pop(str)
     obj = db.DBObject(
         name=name,
         objtype="program",
         location=db.getobj(fr.user).dbref,
         owner=db.getobj(fr.user).dbref,
     )
     fr.data_push(si.DBRef(obj.dbref))
开发者ID:revarbat,项目名称:mufsim,代码行数:9,代码来源:objectdb.py


示例7: compile

 def compile(self, cmplr, code, src):
     comp = cmplr.compiled
     nam, src = cmplr.get_word(src)
     if nam.startswith('\\'):
         nam = nam[1:]
         if db.getobj(comp.program).getprop("_defs/%s" % nam):
             return (False, src)
     prog = db.getobj(comp.program)
     val = "#%d %s call" % (prog.dbref, util.escape_str(nam))
     prog.setprop("_defs/%s" % nam, val)
     return (False, src)
开发者ID:revarbat,项目名称:mufsim,代码行数:11,代码来源:directives.py


示例8: execute

 def execute(self, fr):
     s = fr.data_pop(str)
     msg = "%s [%s] %s: %s\n" % (
         db.getobj(fr.user),
         db.getobj(fr.program),
         time.strftime("%m/%d/%y %H/%M/%S"),
         s
     )
     with open("userlog.log", "a") as f:
         f.write(msg)
     log("USERLOG: %s" % msg)
开发者ID:gitter-badger,项目名称:mufsim,代码行数:11,代码来源:io.py


示例9: usercmd_at_unlink

def usercmd_at_unlink(proclist, descr, user, cmd):
    if user is None or user == -1:
        notify_descr_or_user(descr, user, "Huh?")
        return
    userobj = db.getobj(user)
    objname = cmd.strip()
    obj = db.match_controlled(user, objname)
    if not db.validobj(obj):
        return
    obj = db.getobj(obj)
    obj.links = {}
    userobj.notify("Unlinked.")
开发者ID:revarbat,项目名称:mufsim,代码行数:12,代码来源:commands.py


示例10: execute

 def execute(self, fr):
     fr.check_underflow(2)
     prop = fr.data_pop(str)
     obj = fr.data_pop_object().dbref
     while obj >= 0:
         val = db.getobj(obj).getprop(prop)
         if val is not None:
             break
         obj = db.getobj(obj).location
     if val is None:
         val = 0
     fr.data_push(val)
开发者ID:gitter-badger,项目名称:mufsim,代码行数:12,代码来源:properties.py


示例11: usercmd_pose

def usercmd_pose(proclist, descr, user, cmd):
    if user is None or user == -1:
        netifc.descr_notify(descr, "Huh?")
        return
    loc = db.getobj(user).location
    conts = db.getobj(loc).contents
    userobj = db.getobj(user)
    for obj in conts:
        obj = db.getobj(obj)
        if cmd.startswith("'"):
            obj.notify("%s%s" % (userobj.name, cmd))
        else:
            obj.notify("%s %s" % (userobj.name, cmd))
开发者ID:revarbat,项目名称:mufsim,代码行数:13,代码来源:commands.py


示例12: usercmd_say

def usercmd_say(proclist, descr, user, cmd):
    if user is None or user == -1:
        netifc.descr_notify(descr, "Huh?")
        return
    loc = db.getobj(user).location
    conts = db.getobj(loc).contents
    userobj = db.getobj(user)
    for obj in conts:
        obj = db.getobj(obj)
        if obj.dbref == user:
            obj.notify('You say, "%s"' % cmd)
        else:
            obj.notify('%s says, "%s"' % (userobj.name, cmd))
开发者ID:revarbat,项目名称:mufsim,代码行数:13,代码来源:commands.py


示例13: execute

 def execute(self, fr):
     fr.check_underflow(2)
     msg = fr.data_pop(str)
     who = fr.data_pop_dbref()
     where = fr.data_pop_object()
     for ref in where.contents:
         if ref != who.value:
             db.getobj(ref).notify(msg)
     if db.validobj(who):
         who = db.getobj(who)
         log("NOTIFY TO ALL IN %s EXCEPT %s: %s" % (where, who, msg))
     else:
         log("NOTIFY TO ALL IN %s: %s" % (where, msg))
开发者ID:revarbat,项目名称:mufsim,代码行数:13,代码来源:io.py


示例14: execute

 def execute(self, fr):
     descr = fr.data_pop(int)
     who = conn.descr_user(descr)
     if who >= 0:
         fr.data_push(db.getobj(who).name)
     else:
         fr.data_push("")
开发者ID:gitter-badger,项目名称:mufsim,代码行数:7,代码来源:descriptors.py


示例15: execute

 def execute(self, fr):
     con = fr.data_pop(int)
     descr = netifc.descr_from_con(con)
     if descr >= 0:
         who = netifc.descr_dbref(descr)
         netifc.descr_disconnect(descr)
         log("BOOTED DESCRIPTOR %d: %s" % (descr, db.getobj(who)))
开发者ID:revarbat,项目名称:mufsim,代码行数:7,代码来源:connections.py


示例16: usercmd_at_open

def usercmd_at_open(proclist, descr, user, cmd):
    if user is None or user == -1:
        notify_descr_or_user(descr, user, "Huh?")
        return
    userobj = db.getobj(user)
    exitname, cmd = getword(cmd, '=')
    dests, regname = getword(cmd, '=')
    regname = regname.strip()
    destrefs = []
    for destname in dests.split(';'):
        destname = destname.strip()
        destref = db.match_controlled(userobj.dbref, destname)
        if not db.validobj(destref):
            return
        destrefs.append(destref)
    newexit = db.DBObject(
        name=exitname.strip(),
        objtype="exit",
        location=srcobj.dbref,
        owner=user,
    )
    newexit.links = destrefs
    if regname:
        db.register_obj(user, regname, newexit.dbref)
    userobj.notify("Exit created as #%d." % newexit.dbref)
开发者ID:revarbat,项目名称:mufsim,代码行数:25,代码来源:commands.py


示例17: program_compile

 def program_compile(self, prog):
     progobj = db.getobj(prog)
     progobj.compiled = None
     res = False
     if progobj.sources:
         res = MufCompiler().compile_source(progobj.dbref)
     return res
开发者ID:gitter-badger,项目名称:mufsim,代码行数:7,代码来源:stackframe.py


示例18: get_compiled

 def get_compiled(self, prog=-1):
     prog = db.normobj(prog)
     if prog < 0:
         addr = self.curr_addr()
         prog = addr.prog
     progobj = db.getobj(prog)
     return progobj.compiled
开发者ID:gitter-badger,项目名称:mufsim,代码行数:7,代码来源:stackframe.py


示例19: update_program_selector

 def update_program_selector(self):
     self.src_sel.menu.delete(0, END)
     progs = db.get_all_programs()
     if not progs:
         self.current_program.set("- Load a Program -")
     for prog in progs:
         progobj = db.getobj(prog)
         name = "%s(%s)" % (progobj.name, prog)
         self.src_sel.menu.add_radiobutton(
             label=name, value=name,
             variable=self.current_program,
             command=self.handle_source_selector_change,
         )
         if self.fr:
             addr = self.fr.call_addr(self.call_level)
             if addr and prog.value == addr.prog:
                 self.current_program.set(name)
         elif prog == progs[0]:
             self.current_program.set(name)
     self.src_sel.menu.add_separator()
     self.src_sel.menu.add_command(
         label="Load Program...",
         command=self.filemenu_load_program,
     )
     self.src_sel.menu.add_command(
         label="Load Library...",
         command=self.filemenu_load_library,
     )
开发者ID:gitter-badger,项目名称:mufsim,代码行数:28,代码来源:mufgui.py


示例20: execute

 def execute(self, fr):
     con = fr.data_pop(int)
     descr = conn.descr_from_con(con)
     if descr >= 0:
         who = conn.descr_user(descr)
         conn.disconnect(descr)
         log("BOOTED DESCRIPTOR %d: %s" % (descr, db.getobj(who)))
开发者ID:gitter-badger,项目名称:mufsim,代码行数:7,代码来源:connections.py



注:本文中的mufsim.gamedb.getobj函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python logger.log函数代码示例发布时间:2022-05-27
下一篇:
Python utils.muecke_get_object_or_404函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap