当前位置: 首页>>代码示例>>Python>>正文


Python BetterMUD.charactertemplate方法代码示例

本文整理汇总了Python中BetterMUD.charactertemplate方法的典型用法代码示例。如果您正苦于以下问题:Python BetterMUD.charactertemplate方法的具体用法?Python BetterMUD.charactertemplate怎么用?Python BetterMUD.charactertemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BetterMUD的用法示例。


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

示例1: Run

# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import charactertemplate [as 别名]
 def Run( self, args ):
     if not args: raise PythonCommand.UsageError
     me = BetterMUD.character( self.me )
     t = BetterMUD.charactertemplate( int( args ) )
     me.DoAction( "announce", 0, 0, 0, 0, "Spawning Character..." )
     self.mud.DoAction( "spawncharacter", t.ID(), me.Room(), 0, 0, "" )
     me.DoAction( "announce", 0, 0, 0, 0, "Success." )
开发者ID:JaguarMantid,项目名称:bettermud,代码行数:9,代码来源:admincommands.py

示例2: init

# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import charactertemplate [as 别名]
def init():
    mud = BetterMUD.GameWrap()

    # add arms to every item
    mud.BeginItem()
    while mud.IsValidItem():
        item = BetterMUD.item( mud.CurrentItem() )
        template = BetterMUD.itemtemplate( item.TemplateID() )
        if not item.HasAttribute( "arms" ):
            item.AddAttribute( "arms", template.GetAttribute( "arms" ) )
        mud.NextItem()

    # add defaultweapon and weapon to every character
    mud.BeginCharacter()
    while mud.IsValidCharacter():
        character = BetterMUD.character( mud.CurrentCharacter() )
        template = BetterMUD.charactertemplate( character.TemplateID() )
        if not character.HasAttribute( "defaultweapon" ):
            character.AddAttribute( "defaultweapon", template.GetAttribute( "defaultweapon" ) )
        if not character.HasAttribute( "weapon" ):
            character.AddAttribute( "weapon", template.GetAttribute( "weapon" ) )
        mud.NextCharacter()
开发者ID:JaguarMantid,项目名称:bettermud,代码行数:24,代码来源:addarmaments.py

示例3: init

# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import charactertemplate [as 别名]
def init():
    mud = BetterMUD.GameWrap()

    # add weight to every item
    mud.BeginItem()
    while mud.IsValidItem():
        item = BetterMUD.item( mud.CurrentItem() )
        template = BetterMUD.itemtemplate( item.TemplateID() )
        if not item.HasAttribute( "weight" ):
            item.AddAttribute( "weight", template.GetAttribute( "weight" ) )
        mud.NextItem()

    # add encumbrance to every character
    mud.BeginCharacter()
    while mud.IsValidCharacter():
        character = BetterMUD.character( mud.CurrentCharacter() )
        template = BetterMUD.charactertemplate( character.TemplateID() )
        if not character.HasAttribute( "encumbrance" ):
            character.AddAttribute( "encumbrance", template.GetAttribute( "encumbrance" ) )
        if not character.HasAttribute( "maxencumbrance" ):
            character.AddAttribute( "maxencumbrance", template.GetAttribute( "maxencumbrance" ) )

        # now calculate encumbrance of carried items
        character.BeginItem()
        encumbrance = 0
        while character.IsValidItem():
            item = BetterMUD.item( character.CurrentItem() )
            if item.IsQuantity():
                encumbrance = encumbrance + item.GetAttribute( "weight" ) * item.GetQuantity()
            else:
                encumbrance = encumbrance + item.GetAttribute( "weight" )
            character.NextItem()
        character.SetAttribute( "encumbrance", encumbrance )
        if not character.HasLogic( "encumbrance" ):
            character.AddLogic( "encumbrance" )
        mud.NextCharacter()
开发者ID:JaguarMantid,项目名称:bettermud,代码行数:38,代码来源:addencumbrance.py


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