def onTextInput(player, item, inputid, text): # Check if the vendor the item is in is owned by us vendor = item.getoutmostchar() if not vendor or not vendor.hasscript('npc.playervendor'): return if not player.gm and vendor.owner != player: player.socket.sysmessage(tr('You cannot set the properties of items in a player vendor not owned by you.')) return parts = text.split(' ', 1) description = '' try: price = int(parts[0]) except: price = 0 if price < 0: price = 0 if len(parts) == 2: description = parts[1] else: description = '' setSellInfo(item, price, description)
def onTextInput(player, item, inputid, text): # Check if the vendor the item is in is owned by us vendor = item.getoutmostchar() if not vendor or not vendor.hasscript('npc.playervendor'): return if not player.gm and vendor.owner != player: player.socket.sysmessage( tr('You cannot set the properties of items in a player vendor not owned by you.' )) return parts = text.split(' ', 1) description = '' try: price = int(parts[0]) except: price = 0 if price < 0: price = 0 if len(parts) == 2: description = parts[1] else: description = '' setSellInfo(item, price, description)
def onTextInputCancel(player, item, inputid): # Check if the vendor the item is in is owned by us vendor = item.getoutmostchar() if not vendor or not vendor.hasscript('npc.playervendor'): return if not player.gm and vendor.owner != player: player.socket.sysmessage(tr('You cannot set the properties of items in a player vendor not owned by you.')) return setSellInfo(item, 0, '')
def onTextInputCancel(player, item, inputid): # Check if the vendor the item is in is owned by us vendor = item.getoutmostchar() if not vendor or not vendor.hasscript('npc.playervendor'): return if not player.gm and vendor.owner != player: player.socket.sysmessage( tr('You cannot set the properties of items in a player vendor not owned by you.' )) return setSellInfo(item, 0, '')