本文整理汇总了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." )
示例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()
示例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()