本文整理汇总了Python中wolfpack.tr函数的典型用法代码示例。如果您正苦于以下问题:Python tr函数的具体用法?Python tr怎么用?Python tr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tr函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: sextant_parts
def sextant_parts( char, item ):
if not char.checkskill( TINKERING, 0, 500 ):
if random.randint( 1, 100 ) <= 25:
additional = tr(" and break the parts.")
if item.amount > 1:
item.amount -= 1
item.update()
else:
item.delete()
else:
additional = "."
char.message( "%s%s" % ( tr("You fail to create the sextant"), additional ) )
else:
if item.amount > 1:
item.amount -= 1
item.update()
else:
item.delete()
if item.id == 0x1059:
item = wolfpack.additem( '1057' )
else:
item = wolfpack.additem( '1058' )
char.getbackpack().additem( item, 1, 1, 0 )
item.update()
char.message( tr("You put the sextant into your backpack") )
return 1
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:31,代码来源:environment.py
示例2: cow
def cow(char, player, amount):
# List with id of empty pitcher
pitcher_list = [0x9A7, 0xFF6, 0xFF7]
found = 0
for pitcher in pitcher_list:
foundn = player.countresource(pitcher)
found += foundn
if not found:
player.socket.sysmessage(tr("You need something you can fill the milk in."))
return False
player.soundeffect(0x30)
if found < amount:
amount = found
amount_down = amount
for pitcher in pitcher_list:
# consume as many pitchers as needed
if amount_down > 0:
if player.useresource(amount, pitcher):
amount_down -= 1
else:
break
# add as many pitchers as consumed (item.amount not possible, because not generic)
for i in range(0, amount):
milk = wolfpack.additem("9ad")
if not wolfpack.utilities.tobackpack(milk, player):
milk.update()
char.settag("resourcecount", char.gettag("resourcecount") - amount)
player.socket.sysmessage(tr("You melk the cow and fill the milk in an empty pitcher."))
return
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:29,代码来源:farming.py
示例3: follow
def follow(char, pet, all=False):
if all:
char.socket.sysmessage(tr("Who do you want your pets to follow?"))
else:
char.socket.sysmessage(tr("Who do you want your pet to follow?"))
char.socket.attachtarget("speech.pets.follow_target", [pet.serial, all])
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:7,代码来源:pets.py
示例4: gump_response
def gump_response(char, args, response):
if len(args) < 1 or response.button != 1:
return
key = wolfpack.finditem(args[0])
if not char.canreach(key, 5):
char.socket.clilocmessage(501661)
return
# Rename
new_name = response.text[1][:30] # 30 Chars max.
key.name = new_name
char.socket.sysmessage(tr("You renamed the key to '%s'") % new_name)
# Rekey
if char.gm:
new_lock = response.text[2]
old_lock = ''
if key.hastag('lock'):
old_lock = str(key.gettag('lock'))
if old_lock != new_lock:
char.log(LOG_TRACE, tr("Changing lock of key 0x%x from '%s' to '%s'.\n") % (key.serial, old_lock, new_lock))
if len(new_lock) != 0:
key.settag('lock', new_lock)
char.socket.sysmessage(tr('This key now unlocks: ') + new_lock)
else:
key.deltag('lock')
char.socket.sysmessage(tr('You erase the lock information from the key.'))
key.resendtooltip()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:key.py
示例5: findlock
def findlock(socket, command, arguments):
if len(arguments) == 0:
socket.sysmessage( tr('Usage: findlock <lock>') )
return
lock = arguments.strip().lower()
items = wolfpack.itemiterator()
item = items.first
while item:
if item.hasscript( "lock" ):
if item.hastag( "lock" ) and item.gettag( "lock" ).lower() == lock:
container = item.getoutmostitem()
if container.container:
container = container.container
socket.sysmessage( tr("Going to item '%s' [Serial: 0x%x; Top: 0x%x]." % (item.getname(), item.serial, container.serial)) )
pos = container.pos
socket.player.removefromview()
socket.player.moveto(pos)
socket.player.update()
socket.resendworld()
if item.container:
socket.sendobject(item.container)
if item.container.isitem():
socket.sendcontainer(item.container)
return True
item = items.next
socket.sysmessage( "A matching lock with the id '%s' was not found." % lock )
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:33,代码来源:findlock.py
示例6: showWhoGump
def showWhoGump(player, page):
current_page = page
# Collect the current list of sockets first
wholist = []
worldsocket = wolfpack.sockets.first()
while worldsocket:
char = worldsocket.player
if char.invisible and char.rank > player.rank:
worldsocket = wolfpack.sockets.next()
continue
if not char.account:
wolfpack.sockets.next()
continue
wholist.append(char)
worldsocket = wolfpack.sockets.next()
count = len(wholist)
# Skip page * 10 users
newwholist = wholist[page * 10:]
while len(newwholist) == 0 and page > 0:
page -= 1
newwholist = wholist[page * 10:]
wholist = newwholist
# Player list increases by 22 pixels
pages = (count + 9) / 10 # 10 per page
gump = cGump( 0, 0, 0, 50, 50 )
gump.addBackground( 0xE10, 380, 360 )
gump.addCheckerTrans( 15, 15, 350, 330 );
gump.addGump( 130, 18, 0xFA8 )
gump.addText( 165, 20, tr("Who Menu"), 0x530 )
gump.addButton( 30, 320, 0xFB1, 0xFB3, 0 ) # Close Button
gump.addText( 70, 320, tr("Close"), 0x834 )
gump.addText( 145, 320, tr("Players: %u") % count, 0x834 )
gump.addText( 280, 320, tr( "Page %i of %i" % ( page + 1, pages ) ), 0x834 )
if page + 1 < pages:
gump.addButton( 260, 320, 0x0FA, 0x0FA, 1 ) # Next Page
if page > 0:
gump.addButton( 240, 320, 0x0FC, 0x0FC, 2 ) # Previous Page
offset = 22
wholist = wholist[:10]
for char in wholist:
gump.addButton( 20, 40 + offset, 0xFA5, 0xFA7, 2 + char.serial )
gump.addText( 54, 40 + offset, tr("%s [%s]") % ( char.name, char.account.name ), 0x834 )
gump.addText( 257, 40 + offset, unicode(char.socket.address), 0x834 )
offset += 24
gump.setArgs( [ current_page ] )
gump.setCallback( "commands.who.callbackWho" )
gump.send( player.socket )
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:60,代码来源:who.py
示例7: onUse
def onUse( char, item ):
# We only can rename marked runes
if item.gettag( 'marked' ) != 1:
char.socket.sysmessage( tr("This rune is not marked.") )
return True
# We are only handling runes
if not isrune( item ):
return 0
# It needs to be on our body
if item.getoutmostchar() != char:
char.socket.sysmessage( tr("The rune needs to be in your posession to rename it.") )
return True
gump = cGump( 0, 0, 0, 50, 50 )
# Header
gump.addBackground( 0x24a4, 300, 200 )
gump.addTilePic( 80, 33, 0x1F14 )
gump.addHtmlGump( 10, 30, 300, 20, tr('<basefont size="7" color="#336699"><center>Rename rune</center></basefont>') )
# Rename Field
gump.addHtmlGump( 40, 60, 300, 20, tr('How do you like to name the rune?') )
gump.addResizeGump( 40, 80, 0x2486, 206, 26 )
gump.addInputField( 43, 83, 200, 20, 0x539, 1, item.name )
gump.addButton( 43, 125, 2128, 2129, 1000 ) # Ok
gump.addButton( 110, 125, 2119, 2120, 0 ) # Cancel
gump.setCallback( rename_callback )
gump.setArgs( [ item ] )
gump.send( char )
return True
开发者ID:Mutilador,项目名称:Wolfpack,代码行数:34,代码来源:rune.py
示例8: onWalk
def onWalk(char, dir, sequence):
# Find the spiderweb
items = wolfpack.items(char.pos.x, char.pos.y, char.pos.map, 0)
spiderweb = None
for item in items:
if item.hasscript( 'spiderweb' ):
spiderweb = item
break
if spiderweb:
# Damage the web until it disappears
spiderweb.health = max(0, spiderweb.health - ceil(char.strength / 2.0))
if spiderweb.health == 0:
spiderweb.delete()
else:
if char.socket:
if random.random() <= 0.25:
char.socket.sysmessage( tr('You damage the spiderweb.') )
packet = wolfpack.packet(0x21, 8)
packet.setbyte(1, sequence)
packet.setshort(2, char.pos.x)
packet.setshort(4, char.pos.y)
packet.setbyte(6, char.direction)
packet.setbyte(7, char.pos.z)
packet.send(char.socket)
char.socket.walksequence = 0
return True
char.removescript( 'spiderweb' )
if char.socket:
char.socket.sysmessage( tr('You manage to break free of the spiderweb.') )
return False
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:35,代码来源:spiderweb.py
示例9: pressbutton
def pressbutton( player, partner, box1, box2 ):
#Switch buttons on trade gump
button1 = player.gettag( 'trade_button' )
button2 = partner.gettag( 'trade_button' )
sendtradepacket( player.socket, 2, box1.serial, button1, button2, "" )
sendtradepacket( partner.socket, 2, box2.serial, button2, button1, "" )
#To far away for trading ?
if player.distanceto( partner ) > 3:
player.socket.clilocmessage( 500295 ) # You are too far away to do that.
partner.socket.clilocmessage( 500295 ) # You are too far away to do that.
closetrade( player, partner, box1, box2 )
return True
if button1 == 1 and button2 == 1:
back1 = player.getbackpack()
back2 = partner.getbackpack()
for item in box1.content:
# Player is giving this item to partner
player.log(LOG_TRACE, tr("Trading item 0x%x ('%s', %u) to player '%s' (0x%x, %s)\n") % (item.serial, item.baseid, item.amount, partner.orgname, partner.serial, partner.account.name))
if not tocontainer( item, back2 ):
item.update()
for item in box2.content:
# Partner is giving this item to partner
partner.log(LOG_TRACE, tr("Trading item 0x%x ('%s', %u) to player '%s' (0x%x, %s)\n") % (item.serial, item.baseid, item.amount, player.orgname, player.serial, player.account.name))
if not tocontainer( item, back1 ):
item.update()
closetrade( player, partner, box1, box2 )
return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:33,代码来源:trading.py
示例10: onContextEntry
def onContextEntry(char, target, tag):
if tag == 1:
if char.dead:
target.say(500895) # That sounded spooky.
return True
if char.iscriminal():
target.say(500378) # Thou art a criminal and cannot access thy bank box.
return True
bank = char.getbankbox()
target.turnto(char)
# Check for invisible GMs
if not char.invisible:
target.say(tr("Here is your bank box, %s.") % char.name)
char.socket.sendcontainer(bank)
elif tag == 2:
target.turnto(char)
bank = char.getbankbox()
amount = bank.countresource(0xEED, 0x0)
# Check for invisible GMs
if not char.invisible:
if not amount:
target.say(tr("Alas you don't have any money in your bank."))
else:
target.say(tr("You have %i gold in your bank.") % amount)
else:
if not amount:
char.socket.sysmessage(tr("Alas you don't have any money in your bank."))
else:
char.socket.sysmessage(tr("You have %i gold in your bank.") % amount)
return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:35,代码来源:bankermenu.py
示例11: removescript_response
def removescript_response( player, arguments, target ):
script = arguments[0]
object = None
if target.item:
object = target.item
elif target.char:
if target.char.rank > player.rank and player != target.char:
player.socket.sysmessage( tr("You've burnt your fingers!") )
return False
object = target.char
else:
player.socket.sysmessage( tr('You have to target a character or item.') )
return False
if object.hasscript( str( script ) ):
player.log( LOG_MESSAGE, tr("Removes script '%s' from object 0x%x.\n" % ( script, object.serial )) )
object.removescript( str( script ) )
object.resendtooltip()
player.socket.sysmessage( tr('You remove the script from your target.') )
return True
else:
player.socket.sysmessage( tr('Your target does not have the given script.') )
return False
开发者ID:Mutilador,项目名称:Wolfpack,代码行数:25,代码来源:events.py
示例12: shrinktarget
def shrinktarget( char, args, target ):
if not target.char:
char.socket.sysmessage(tr('You can only shrink characters.'))
return
if target.char.player:
char.socket.sysmessage(tr('You cannot shrink other players.'))
return
bodyinfo = wolfpack.bodyinfo(target.char.id)
if bodyinfo['figurine'] <= 0 or bodyinfo['figurine'] >= 0x4000:
char.socket.sysmessage(tr('You cannot shrink that.'))
return
target.char.sound(SND_IDLE)
# Create a new figurine and make it newbie
figurine = wolfpack.additem('%x' % bodyinfo['figurine'])
figurine.newbie = True
figurine.addscript('figurine')
figurine.settag('pet', target.char.serial)
figurine.color = target.char.skin
figurine.name = target.char.name
figurine.update()
figurine.moveto(target.char.pos)
figurine.update()
target.char.removefromview()
target.char.owner = None
target.char.stablemaster = figurine.serial
target.char.addscript('figurine') # This is a figurined NPC
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:31,代码来源:figurine.py
示例13: onDamage
def onDamage(char, type, amount, source):
# 5% chance to talk
if random.random() >= 0.05:
return amount
if char.health - amount > 0:
if amount < 5:
sentence = random.choice([ tr("Ouch!"), tr("Me not hurt bad!"), tr("Thou fight bad."), tr("Thy blows soft!"), tr("You bad with weapon!") ])
else:
sentence = random.choice([ tr("Ouch! Me hurt!"), tr("No, kill me not!"), tr("Me hurt!"), tr("Away with thee!"), tr("Oof! That hurt!"), tr("Aaah! That hurt..."), tr("Good blow!") ])
else:
sentence = random.choice([ tr("Revenge!"), tr("NOOooo!"), tr("I... I..."), tr("Me no die!"), tr("Me die!"), tr("Must... not die..."), tr("Oooh, me hurt..."), tr("Me dying?")])
speech = char.getstrproperty('monsterspeech', '')
global speechbuilders
if not speech in speechbuilders:
return amount
speechbuilder = speechbuilders[speech]
# Say english sentence after constructed one
char.say( speechbuilder.buildsentence( random.randint(2, 3) ), speechbuilder.saycolor )
char.soundeffect( speechbuilder.saysound )
char.say( sentence, speechbuilder.saycolor )
return amount
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:25,代码来源:monster.py
示例14: nuke
def nuke( socket, command, argstring ):
argstring = argstring.strip() # Remove trailing and leading whitespaces
if len( argstring ) > 0:
if argstring.lower() == "all":
gump = WarningGump( 1060635, 30720, tr("Wiping <i>all</i> items in the world.<br>Do you wish to proceed?"), 0xFFC000, 420, 400, wipeAllWorld, [] )
gump.send( socket )
return
elif argstring.lower() == "map":
gump = WarningGump( 1060635, 30720, tr("Wiping <i>all</i> items in this map.<br>Do you wish to proceed?"), 0xFFC000, 420, 400, wipeMap, [] )
gump.send( socket )
return
else:
if argstring.lower() == "nomulti":
socket.sysmessage(tr("You choose to nuke anything except items in multis"))
baseid = argstring
else:
if argstring.lower() == "onlymulti":
socket.sysmessage(tr("You choose to nuke just items in multis"))
baseid = argstring
else:
baseid = argstring
else:
baseid = None
socket.sysmessage(tr("Select the area to remove"))
getBoundingBox( socket, wipeBoundingBox, baseid )
return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:27,代码来源:wipe.py
示例15: decoration
def decoration( socket, command, arguments ):
if len(arguments) > 0:
args = str(arguments)
if args == 'save':
saveObject = DecorationSaveHandler(socket)
socket.sysmessage(tr("Sorting items, please wait..."))
saveObject.sort()
socket.sysmessage(tr("Writting file..."))
saveObject.save()
return
parser = xml.sax.make_parser()
handler = DecorationHandler()
parser.setContentHandler(handler)
maps = []
try:
maponly = int(arguments)
maps.append(maponly)
except ValueError:
maps = [0, 1, 2, 3]
pass
for map in maps:
if wolfpack.hasmap(map):
socket.sysmessage(tr("Decorating map %i, please wait...") % map)
parser.parse("definitions/decoration/decoration.%i.xml" % map)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:26,代码来源:decoration.py
示例16: add
def add(self, page, notify = True):
updated = False
if page in self.pages:
updated = True
self.pages.remove(page)
self.pages.append(page)
self.save()
if notify:
char = wolfpack.findchar(page.serial)
if char:
if updated:
char.log(LOG_MESSAGE, tr("%s (%s) updates his gm page [%s]:\n%s\n") % (char.name, page.account, page.category, page.getmessage()))
else:
char.log(LOG_MESSAGE, tr("%s (%s) makes a gm page [%s]:\n%s\n") % (char.name, page.account, page.category, page.getmessage()))
notification = page.notification(updated)
socket = wolfpack.sockets.first()
while socket:
player = socket.player
# If the pagenotify flag is on and it is a staff account,
# send a notification about the new or updated page.
if player and player.rank > 1 and player.account.flags & 0x10 != 0:
# Send the notification to the socket
socket.sysmessage(notification, 0x846)
for line in page.message:
if len(line) > 0:
socket.sysmessage(line, 0x843)
socket = wolfpack.sockets.next()
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:pages.py
示例17: attack_target
def attack_target(char, arguments, target):
if not target.char or target.char == char:
char.socket.sysmessage(tr("Your pets cannot attack that."))
return
(pet, all) = arguments
if all:
if char.gm:
pos = char.pos
pets = wolfpack.chars(pos.x, pos.y, pos.map, 18, False)
for follower in pets:
if follower.npc and not follower.frozen:
attack_target(char, [follower.serial, False], target)
else:
for follower in char.followers:
attack_target(char, [follower.serial, False], target)
else:
pet = wolfpack.findchar(pet)
if target.char == pet:
char.socket.sysmessage(tr("Your pet refuses to kill itself."))
return
if pet and (pet.owner == char or char.gm) and pet.distanceto(char) < 18:
startfight(pet, target.char)
pet.fight(target.char)
# right here we need to not interrupt the target, but i can't register a fight unless i do, right? not sure.
target.char.fight(pet)
target.char.follow(pet)
go_target(char, arguments, target)
follow_target(char, arguments, target)
pet.sound(SND_ATTACK)
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:32,代码来源:pets.py
示例18: checkpay
def checkpay(char, vendor, count):
if char.countresource( 0xeed, 0 ) < count:
vendor.say( tr("You don't have enough gold!"), 5 )
return False
char.useresource( count, 0xeed, 0 )
char.soundeffect( 0x37, 0 )
vendor.say( tr("That is %i gold.") % count, 5 )
return True
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:8,代码来源:stablemaster.py
示例19: __init__
def __init__(self, parent):
CraftItemAction.__init__(self, parent, tr('Runebook'), 0x22c5, '22c5')
self.markable = True
self.runes = 8
# Add the other requirements
self.materials.append([['1f60'], 1, tr('Gate Travel Scrolls')])
self.materials.append([['1f4c'], 1, tr('Recall Scrolls')])
self.skills[INSCRIPTION] = [450, 1250, 250]
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:9,代码来源:inscription.py
示例20: type
def type(self):
if self.category == tr('BUG'):
return 0
elif self.category == tr('STUCK'):
return 1
elif self.category == tr('GAMEPLAY'):
return 2
else:
return 3
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:9,代码来源:pages.py
注:本文中的wolfpack.tr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论