本文整理汇总了Python中BetterMUD.character方法的典型用法代码示例。如果您正苦于以下问题:Python BetterMUD.character方法的具体用法?Python BetterMUD.character怎么用?Python BetterMUD.character使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BetterMUD
的用法示例。
在下文中一共展示了BetterMUD.character方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, args ):
if not args: raise PythonCommand.UsageError
me = BetterMUD.character( self.me )
r = BetterMUD.room( me.Room() )
m = BetterMUD.character( FindTarget( r.SeekCharacter, r.IsValidCharacter, r.CurrentCharacter, args ) )
m.DoAction( "do", 0, 0, me.ID(), 0, "list" )
示例2: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, action, arg1, arg2, arg3, arg4, data ):
me = BetterMUD.character( self.me )
if action == "do" and data == "list":
character = BetterMUD.character( arg3 )
character.DoAction( "announce", 0, 0, 0, 0, "<#7F7F7F>--------------------------------------------------------------------------------" )
character.DoAction( "announce", 0, 0, 0, 0, "<#FFFFFF> Item | Cost" )
character.DoAction( "announce", 0, 0, 0, 0, "<#7F7F7F>--------------------------------------------------------------------------------" )
for x in self.iteminventory:
item = BetterMUD.itemtemplate( x )
character.DoAction( "announce", 0, 0, 0, 0, "<#7F7F7F> " + item.Name().ljust( 42 ) + "| " + str( item.GetAttribute( "value" ) ) )
character.DoAction( "announce", 0, 0, 0, 0, "<#7F7F7F>--------------------------------------------------------------------------------" )
return
if action == "do" and data[:3] == "buy":
itemname = data.split( None, 1 )
itemname = itemname[1]
character = BetterMUD.character( arg3 )
id = FindName( BetterMUD.itemtemplate, self.iteminventory, itemname )
if id == 0:
character.DoAction( "announce", 0, 0, 0, 0, "Sorry, you can't buy " + itemname + "here!" )
return
t = BetterMUD.itemtemplate( id )
if not HasEnoughCurrency( character, t.GetAttribute( "value" ) ):
character.DoAction( "announce", 0, 0, 0, 0, "Sorry, you don't have enough money to buy " + t.Name() + "!" )
return
GiveCurrency( character, me, t.GetAttribute( "value" ) )
self.mud.DoAction( "spawnitem", id, character.ID(), 1, 0, "" )
self.mud.AddActionAbsolute( 0, "vision", character.Room(), 0, 0, 0, character.Name() + " buys " + t.Name() + "." )
示例3: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, action, arg1, arg2, arg3, arg4, data ):
me = BetterMUD.character( self.me )
if action == "say" and data.find( "pies" ) != -1 and arg1 != me.ID():
c = BetterMUD.character( arg1 )
self.mud.AddActionAbsolute( 0, "attemptsay", me.ID(), 0, 0, 0, c.Name() + ": YES!!! PIES!!!!!" )
return 0
示例4: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, action, arg1, arg2, arg3, arg4, data ):
if action == "canreceiveitem":
g = BetterMUD.character( arg1 )
if not g.IsPlayer(): return 0 # accept stuff from NPC's with the implcit promise that they aren't malicious
i = BetterMUD.item( arg3 )
me = BetterMUD.character( self.me )
me.DoAction( "error", 0, 0, 0, 0, g.Name() + " tried to give you " + i.Name() + " but you have item receiving turned off. Type \"/receive on\" to turn receiving back on." )
g.DoAction( "error", 0, 0, 0, 0, me.Name() + " refuses to take " + i.Name() + "!" )
return 1
示例5: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, args ):
if not args: raise PythonCommand.UsageError
parms = args.split( None, 1 )
if len(parms) < 2: raise PythonCommand.UsageError
me = BetterMUD.character( self.me )
id = self.mud.FindPlayerOnlinePart( parms[0] )
if not id:
me.DoAction( "error", 0, 0, 0, 0, "Cannot find player: " + parms[0] )
return
c = BetterMUD.character( id )
self.mud.AddActionAbsolute( 0, "command", c.ID(), 0, 0, 0, parms[1] )
示例6: Execute
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Execute( self, args ):
try:
self.Run( args )
except UsageError:
me = BetterMUD.character( self.me )
me.DoAction( "error", 0, 0, 0, 0, "Usage: " + self.Usage() )
except TargetError, e:
me = BetterMUD.character( self.me )
me.DoAction( "error", 0, 0, 0, 0, "Cannot find: " + e.value )
示例7: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, args ):
if not args: raise PythonCommand.UsageError
me = BetterMUD.character( self.me )
r = BetterMUD.room( me.Room() )
# find the name:
id = FindTarget( r.SeekCharacter, r.IsValidCharacter, r.CurrentCharacter, args )
c = BetterMUD.character( id )
name = c.Name()
self.mud.AddActionAbsolute( 0, "addlogic", 0, id, 0, 0, "superglue" )
self.mud.AddActionAbsolute( 0, "vision", r.ID(), 0, 0, 0, "<#FF0000>OMG!!! " + me.Name() + " just SUPERGLUED " + name + " to the floor!!!!!" )
self.mud.AddActionRelative( 20000, "messagelogic", 0, id, 0, 0, "superglue remove" )
示例8: Disarm
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Disarm( self, itemtype ):
if itemtype == 1:
me = BetterMUD.character( self.me )
if me.GetAttribute( "weapon" ) != 0:
weapon = BetterMUD.item( me.GetAttribute( "weapon" ) )
me.SetAttribute( "weapon", 0 )
self.mud.AddActionAbsolute( 0, "vision", me.Room(), 0, 0, 0, me.Name() + " disarms " + weapon.Name() + "." )
示例9: Break
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Break( self, me ):
if self.target == 0:
return
t = BetterMUD.character( self.target )
me.KillHook( "do", "attack" )
self.mud.AddActionAbsolute( 0, "vision", me.Room(), 0, 0, 0, me.Name() + " stops attacking " + t.Name() + "!!" )
t.DoAction( "do", 0, 0, self.me, 0, "brokeattack" )
self.target = 0
示例10: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, args ):
me = BetterMUD.character( self.me )
r = BetterMUD.room( me.Room() )
# find the name:
if not args:
name = "himself"
else:
r.SeekCharacter( args )
if not r.IsValidCharacter():
me.DoAction( "error", 0, 0, 0, 0, "Cannot find character: " + args )
return
id = r.CurrentCharacter()
c = BetterMUD.character( id )
name = c.Name()
self.mud.AddActionAbsolute( 0, "vision", r.ID(), 0, 0, 0, "<#00FF00>OMG!!! " + me.Name() + " just threw a huge <#FFFF00>CUSTARD PIE<#00FF00> at " + name + "!!!!" )
示例11: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, action, arg1, arg2, arg3, arg4, data ):
if action == "canenterregion":
character = BetterMUD.character( arg1 )
if character.TemplateID() == 2:
character.SeekItem( "Dwarven Mine Pass" )
if character.IsValidItem():
return 0
character.DoAction( "error", 0, 0, 0, 0, "As an elf, you are morally obligated to not enter these mines!" )
return 1
示例12: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, action, arg1, arg2, arg3, arg4, data ):
me = BetterMUD.character( self.me )
if action == "canleaveroom":
me.DoAction( "error", 0, 0, 0, 0, "You're superglued to the ground. Sit tight, you ain't goin nowhere." )
return 1
if action == "messagelogic":
if data == "superglue remove":
self.mud.AddActionAbsolute( 0, "dellogic", 0, self.me, 0, 0, "superglue" )
self.mud.AddActionAbsolute( 0, "vision", me.Room(), 0, 0, 0, "The superglue on " + me.Name() + " wears off!" )
示例13: DoRead
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def DoRead( self, character, item, name ):
c = BetterMUD.character( character )
i = BetterMUD.item( item )
if c.HasCommand( name ):
c.DoAction( "error", 0, 0, 0, 0, "You already know this spell!" )
return
c.AddCommand( name )
self.mud.AddActionAbsolute( 0, "vision", c.Room(), 0, 0, 0, c.Name() + " reads " + i.Name() + "!" )
self.mud.AddActionAbsolute( 1, "destroyitem", i.ID(), 0, 0, 0, "" )
c.DoAction( "announce", 0, 0, 0, 0, "You now know the spell " + name + "!" )
c.DoAction( "announce", 0, 0, 0, 0, "The " + i.Name() + " disappears in a bright flash of flame!" )
示例14: Run
# 需要导入模块: import BetterMUD [as 别名]
# 或者: from BetterMUD import character [as 别名]
def Run( self, action, arg1, arg2, arg3, arg4, data ):
me = BetterMUD.character( self.me )
# Attack anyone who enters the room
if action == "enterroom":
if arg1 != self.me:
self.mud.AddActionAbsolute( 0, "do", 0, me.ID(), arg1, 0, "initattack" )
return
# you killed someone find another target!
if action == "do" and data == "killed":
r = BetterMUD.room( me.Room() )
r.BeginCharacter()
while r.IsValidCharacter():
if r.CurrentCharacter() != arg3: # make sure you don't re-attack the character you just killed!
self.mud.AddActionAbsolute( 0, "do", 0, me.ID(), r.CurrentCharacter(), 0, "initattack" )
return
r.NextCharacter()
return