def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = 1 #self.allowrepair = 1 self.submaterials1 = skills.blacksmithing.METALS self.submaterial1missing = 1042081 # Ingots self.submaterial1noskill = 500586 self.gumptype = 0x4f6ba469 # This should be unique
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = 1 self.allowrepair = 1 #self.allowenhance = 1 self.submaterials1 = LEATHERS self.submaterial1missing = 1044463 self.submaterial1noskill = 1049311 self.gumptype = 0x4f1ba411 # This should be unique
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True self.allowrepair = True self.submaterials1 = WOOD self.submaterial1missing = 1042081 self.submaterial1noskill = 500298 self.gumptype = 0x4f1bff56 # This should be unique self.requiretool = True
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True self.allowrepair = True self.submaterials1 = blacksmithing.METALS self.submaterials2 = GEMS self.submaterial1missing = 1044037 self.submaterial1noskill = 1044268 self.submaterial2missing = 1044240 self.gumptype = 0x41afb410 # This should be unique
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = False self.allowrepair = False self.allowenhance = False self.allowsmelt = False self.submaterials1 = GRANITES self.submaterial1noskill = 1044268 self.gumptype = 0x4f1ba414 # This should be unique self.requiretool = True self.checklearned = True
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True self.allowrepair = True self.allowenhance = True self.submaterials1 = LEATHERS self.submaterial1missing = 1044463 self.submaterial1noskill = 1049311 self.gumptype = 0x4f1ba411 # This should be unique self.repairsound = 0x248 # Repair soundeffect self.requiretool = True
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True self.allowrepair = True self.submaterials1 = TINKERINGMETALS self.submaterials2 = GEMS self.submaterial1missing = 1044037 self.submaterial1noskill = 1044268 self.submaterial2missing = 1044240 self.gumptype = 0x41afb410 # This should be unique self.requiretool = True
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = 1 self.allowrepair = 1 #self.allowenhance = 1 self.allowsmelt = 1 self.submaterials1 = METALS self.submaterials2 = SCALES self.submaterial2missing = 1060884 self.submaterial1missing = 1044037 self.submaterial1noskill = 1044268 self.gumptype = 0x4f1ba410 # This should be unique
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True self.allowrepair = False self.submaterials1 = WOOD self.submaterials2 = CARPENTRYMETALS self.submaterial1missing = 1042081 # Boards self.submaterial1noskill = 500298 self.submaterial2missing = 1042081 # Ingots self.submaterial2noskill = 500298 self.gumptype = 0x466b5b1a # This should be unique self.requiretool = True
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True self.allowrepair = True self.allowenhance = True self.allowsmelt = True self.submaterials1 = METALS self.submaterials2 = SCALES self.submaterial2missing = 1060884 self.submaterial1missing = 1044037 self.submaterial1noskill = 1044268 self.gumptype = 0x4f1ba410 # This should be unique self.repairsound = 0x2a self.requiretool = True
def checktool(self, player, item, wearout = False): if not MakeMenu.checktool(self, player, item, wearout): return False if not checkforge(player): player.socket.clilocmessage(1044628) # You must be near a forge to blow glass.) return False return True
def checktool(self, player, item, wearout = False): if not MakeMenu.checktool(self, player, item, wearout): return False if not checkanvilandforge(player): player.socket.clilocmessage(1044267) return False return True
def generateGoMenu(): locations = wolfpack.getdefinitions(WPDT_LOCATION) gomenu = MakeMenu('GOMENU', None, 'Go Menu') submenus = {} for location in locations: if not location.hasattribute('category'): continue categories = location.getattribute('category').split('\\') description = categories[len(categories) - 1] # Name of the action categories = categories[:len(categories) - 1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = gomenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('GOMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' # Parse the position of this makemenu entry if location.text.count(',') != 3: raise RuntimeError, "Wrong position information for location %s." % location.getattribute( 'id') (x, y, z, map) = location.text.split(',') pos = wolfpack.coord(int(x), int(y), int(z), int(map)) if len(categories) == 0: GoAction(gomenu, description, pos) else: GoAction(submenus['\\'.join(categories) + '\\'], description, pos) for menu in submenus.values(): menu.sort() gomenu.sort() return
def generateGoMenu(): locations = wolfpack.getdefinitions(WPDT_LOCATION) gomenu = MakeMenu("GOMENU", None, "Go Menu") submenus = {} for location in locations: if not location.hasattribute("category"): continue categories = location.getattribute("category").split("\\") description = categories[len(categories) - 1] # Name of the action categories = categories[: len(categories) - 1] # Iterate trough the categories and see if they're all there category = "" if len(categories) > 0 and not submenus.has_key("\\".join(categories) + "\\"): for subcategory in categories: if not submenus.has_key(category + subcategory + "\\"): # Category is our parent category parent = None if len(category) == 0: parent = gomenu elif category in submenus: parent = submenus[category] category += subcategory + "\\" menu = MakeMenu("GOMENU_" + category, parent, subcategory) submenus[category] = menu else: category += subcategory + "\\" # Parse the position of this makemenu entry if location.text.count(",") != 3: raise RuntimeError, "Wrong position information for location %s." % location.getattribute("id") (x, y, z, map) = location.text.split(",") pos = wolfpack.coord(int(x), int(y), int(z), int(map)) if len(categories) == 0: GoAction(gomenu, description, pos) else: GoAction(submenus["\\".join(categories) + "\\"], description, pos) for menu in submenus.values(): menu.sort() gomenu.sort() return
def generateGoMenu(): locations = wolfpack.getdefinitions(WPDT_LOCATION) gomenu = MakeMenu('GOMENU', None, 'Go Menu') submenus = {} for location in locations: if not location.hasattribute('category'): continue categories = location.getattribute('category').split('\\') description = categories[len(categories)-1] # Name of the action categories = categories[:len(categories)-1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = gomenu elif submenus.has_key(category): parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('GOMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' # Parse the position of this makemenu entry if location.text.count(',') != 3: raise RuntimeError, "Wrong position information for location %s." % location.getattribute('id') (x, y, z, map) = location.text.split(',') pos = wolfpack.coord(int(x), int(y), int(z), int(map)) if len(categories) == 0: GoAction(gomenu, description, pos) else: GoAction(submenus['\\'.join(categories) + '\\'], description, pos) for menu in submenus.values(): menu.sort() gomenu.sort()
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.gumptype = 0xf4132a42 # This should be unique self.name_makelast = "Select Last"
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True self.gumptype = 0xce123456 # This should be unique self.requiretool = True
def checktool(self, player, item, wearout = False): if not MakeMenu.checktool(self, player, item, wearout): return False return True
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = 0 self.delay = 2000 self.gumptype = 0x9ca51fcb # This should be unique self.requiretool = True
def generateAddMenu(): items = wolfpack.getdefinitions(WPDT_ITEM) addmenu= MakeMenu('ADDMENU', None, 'Add Menu') submenus = {} for item in items: if not item.hasattribute('id'): continue child = item.findchild('category') if not child: continue categories = ['Items'] + child.text.split('\\') description = categories[len(categories)-1] # Name of the action categories = categories[:len(categories)-1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif submenus.has_key(category): parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('ADDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' child = item.findchild('id') if child: try: id = int(child.value) except: id = 0 else: id = 0 definition = item.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: additem = AddItemAction(addmenu, description, id, definition) else: additem = AddItemAction(submenus['\\'.join(categories) + '\\'], description, id, definition) additem.description = 'Definition: ' + definition for menu in submenus.values(): menu.sort() npcs = wolfpack.getdefinitions(WPDT_NPC) submenus = {} for npc in npcs: if not npc.hasattribute('id'): continue child = npc.findchild('category') if not child: continue categories = ['NPCs'] + child.text.split('\\') description = categories[len(categories)-1] # Name of the action categories = categories[:len(categories)-1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif submenus.has_key(category): parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('ADDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' definition = npc.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: addnpc = AddNpcAction(addmenu, description, definition) else: addnpc = AddNpcAction(submenus['\\'.join(categories) + '\\'], description, definition) addnpc.description = 'Definition: ' + definition for menu in submenus.values(): menu.sort() addmenu.sort()
def generateAddMenu(serial = 0, items = None): char = wolfpack.findchar(serial) if not char or not char.socket: char = None """if not items: items = wolfpack.getdefinitions(WPDT_ITEM) if char: char.socket.sysmessage('Done getting list of definitions.') wolfpack.queuecode(generateAddMenu, (serial, items)) return""" addmenu= MakeMenu('ADDMENU', None, 'Add Menu') submenus = {} # Process 100 at a time definitions = wolfpack.definitionsiterator(WPDT_ITEM) item = definitions.first while item: if not item.hasattribute('id'): item = definitions.next continue child = item.findchild('category') if not child: item = definitions.next continue categories = ['Items'] + child.text.split('\\') description = categories[len(categories)-1] # Name of the action categories = categories[:len(categories)-1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif submenus.has_key(category): parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('ADDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' child = item.findchild('id') if child: try: id = int(child.value) except: id = 0 else: id = 0 definition = item.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: additem = AddItemAction(addmenu, description, id, definition) else: additem = AddItemAction(submenus['\\'.join(categories) + '\\'], description, id, definition) additem.description = 'Definition: ' + definition item = definitions.next for menu in submenus.values(): menu.sort() npcs = wolfpack.definitionsiterator(WPDT_NPC) submenus = {} npc = npcs.first while npc: if not npc.hasattribute('id'): npc = npcs.next continue child = npc.findchild('category') if not child: npc = npcs.next continue categories = ['NPCs'] + child.text.split('\\') description = categories[len(categories)-1] # Name of the action categories = categories[:len(categories)-1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif submenus.has_key(category): parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('ADDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' definition = npc.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: addnpc = AddNpcAction(addmenu, description, definition) else: addnpc = AddNpcAction(submenus['\\'.join(categories) + '\\'], description, definition) addnpc.description = 'Definition: ' + definition npc = npcs.next for menu in submenus.values(): menu.sort() addmenu.sort() if char: addmenu.send(char)
def find(socket, command, arguments): if (len(arguments) == 0): socket.sysmessage(tr('Usage: find <searchpattern>')) return findsmenu = MakeMenu('FINDMENU', None, 'Find Menu') submenus = {} items = wolfpack.definitionsiterator(WPDT_ITEM) item = items.first while item: if not item.hasattribute('id'): item = items.next continue child = item.findchild('category') if not child: item = items.next continue categories = ['Items'] + child.text.split('\\') description = categories[len(categories) - 1] # Name of the action categories = ['Items'] if (re.search(arguments.lower(), description.lower())): # Iterate through the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key( '\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = findsmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('FINDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' child = item.findchild('id') if child: try: id = int(child.value) except: id = 0 else: id = 0 definition = item.getattribute('id') additem = AddItemAction(menu, description, id, definition) additem.otherhtml = 'Definition: ' + definition item = items.next npcs = wolfpack.definitionsiterator(WPDT_NPC) submenus = {} npc = npcs.first while npc: if not npc.hasattribute('id'): npc = npcs.next continue child = npc.findchild('category') if not child: npc = npcs.next continue id = npc.findchild('id') if id: try: if id.value.startswith('0x'): id = wolfpack.bodyinfo(hex2dec(id.value))['figurine'] else: id = wolfpack.bodyinfo(int(id.value))['figurine'] except: id = 0 else: id = 0 description = npc.findchild('desc') if description: description = description.value else: description = tr('No description available.') categories = ['NPCs'] + child.text.split('\\') title = categories[len(categories) - 1] # Name of the action categories = ['NPCs'] if (re.search(arguments.lower(), title.lower())): # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key( '\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = findsmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('FINDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' definition = npc.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: addnpc = AddNpcAction(menu, title, definition, definition) else: addnpc = AddNpcAction(submenus['\\'.join(categories) + '\\'], title, id, definition) addnpc.otherhtml = str(description) npc = npcs.next multis = wolfpack.definitionsiterator(WPDT_MULTI) submenus = {} multi = multis.first while multi: if not multi.hasattribute('id'): multi = multi.next continue child = multi.findchild('category') if not child: multi = multis.next continue categories = ['Multis'] + child.text.split('\\') description = categories[len(categories) - 1] # Name of the action categories = ['Multis'] if (re.search(arguments.lower(), description.lower())): # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key( '\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = findsmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('FINDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' child = multi.findchild('id') if child: try: id = int(child.value) except: id = 0 else: id = 0 multi = multi.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: addmulti = AddMultiAction(addmenu, description, id, multi) else: addmulti = AddMultiAction( submenus['\\'.join(categories) + '\\'], description, id, multi) addmulti.otherhtml = 'Definition: ' + multi multi = multis.next if (len(findsmenu.submenus) > 0): findsmenu.send(socket) else: socket.sysmessage( tr('Could not find any item, npc or multi matching the arguments.') )
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True # generally allow marking, but not all items are markable self.delay = 1250 self.gumptype = 0xB10CAE72 # This should be unique self.requiretool = True # Require a tool
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = 1 self.allowrepair = 1 self.gumptype = 0x4f1ba412 # This should be unique
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True self.gumptype = 0xce123456 # This should be unique
def generateAddMenu(serial=0, items=None): char = wolfpack.findchar(serial) if not char or not char.socket: char = None """if not items: items = wolfpack.getdefinitions(WPDT_ITEM) if char: char.socket.sysmessage('Done getting list of definitions.') wolfpack.queuecode(generateAddMenu, (serial, items)) return""" addmenu = MakeMenu("ADDMENU", None, "Add Menu") submenus = {} # Process 100 at a time definitions = wolfpack.definitionsiterator(WPDT_ITEM) item = definitions.first while item: if not item.hasattribute("id"): item = definitions.next continue child = item.findchild("category") if not child: item = definitions.next continue categories = ["Items"] + child.text.split("\\") description = categories[len(categories) - 1] # Name of the action categories = categories[: len(categories) - 1] # Iterate trough the categories and see if they're all there category = "" if len(categories) > 0 and not submenus.has_key("\\".join(categories) + "\\"): for subcategory in categories: if not submenus.has_key(category + subcategory + "\\"): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif category in submenus: parent = submenus[category] category += subcategory + "\\" menu = MakeMenu("ADDMENU_" + category, parent, subcategory) submenus[category] = menu else: category += subcategory + "\\" child = item.findchild("id") if child: try: id = int(child.value) except: id = 0 else: id = 0 definition = item.getattribute("id") # Parse the position of this makemenu entry if len(categories) == 0: additem = AddItemAction(addmenu, description, id, definition) else: additem = AddItemAction(submenus["\\".join(categories) + "\\"], description, id, definition) additem.otherhtml = "Definition: " + definition item = definitions.next for menu in submenus.values(): menu.sort() npcs = wolfpack.definitionsiterator(WPDT_NPC) submenus = {} npc = npcs.first while npc: if not npc.hasattribute("id"): npc = npcs.next continue child = npc.findchild("category") if not child: npc = npcs.next continue id = npc.findchild("id") if id: try: if id.value.startswith("0x"): id = wolfpack.bodyinfo(hex2dec(id.value))["figurine"] else: id = wolfpack.bodyinfo(int(id.value))["figurine"] except: id = 0 else: id = 0 description = npc.findchild("desc") if description: description = description.value else: description = tr("No description available.") categories = ["NPCs"] + child.text.split("\\") title = categories[len(categories) - 1] # Name of the action categories = categories[: len(categories) - 1] # Iterate trough the categories and see if they're all there category = "" if len(categories) > 0 and not submenus.has_key("\\".join(categories) + "\\"): for subcategory in categories: if not submenus.has_key(category + subcategory + "\\"): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif category in submenus: parent = submenus[category] category += subcategory + "\\" menu = MakeMenu("ADDMENU_" + category, parent, subcategory) submenus[category] = menu else: category += subcategory + "\\" definition = npc.getattribute("id") # Parse the position of this makemenu entry if len(categories) == 0: addnpc = AddNpcAction(addmenu, title, definition, definition) else: addnpc = AddNpcAction(submenus["\\".join(categories) + "\\"], title, id, definition) addnpc.otherhtml = str(description) npc = npcs.next for menu in submenus.values(): menu.sort() multis = wolfpack.definitionsiterator(WPDT_MULTI) submenus = {} multi = multis.first while multi: if not multi.hasattribute("id"): multi = multi.next continue child = multi.findchild("category") if not child: multi = multis.next continue categories = ["Multis"] + child.text.split("\\") description = categories[len(categories) - 1] # Name of the action categories = categories[: len(categories) - 1] # Iterate trough the categories and see if they're all there category = "" if len(categories) > 0 and not submenus.has_key("\\".join(categories) + "\\"): for subcategory in categories: if not submenus.has_key(category + subcategory + "\\"): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif category in submenus: parent = submenus[category] category += subcategory + "\\" menu = MakeMenu("ADDMENU_" + category, parent, subcategory) submenus[category] = menu else: category += subcategory + "\\" child = multi.findchild("id") if child: try: id = int(child.value) except: id = 0 else: id = 0 multi = multi.getattribute("id") # Parse the position of this makemenu entry if len(categories) == 0: addmulti = AddMultiAction(addmenu, description, id, multi) else: addmulti = AddMultiAction(submenus["\\".join(categories) + "\\"], description, id, multi) addmulti.otherhtml = "Definition: " + multi multi = multis.next for menu in submenus.values(): menu.sort() addmenu.sort() if char: addmenu.send(char)
def generateAddMenu(serial=0, items=None): char = wolfpack.findchar(serial) if not char or not char.socket: char = None """if not items: items = wolfpack.getdefinitions(WPDT_ITEM) if char: char.socket.sysmessage('Done getting list of definitions.') wolfpack.queuecode(generateAddMenu, (serial, items)) return""" addmenu = MakeMenu('ADDMENU', None, 'Add Menu') submenus = {} # Process 100 at a time definitions = wolfpack.definitionsiterator(WPDT_ITEM) item = definitions.first while item: if not item.hasattribute('id'): item = definitions.next continue child = item.findchild('category') if not child: item = definitions.next continue categories = ['Items'] + child.text.split('\\') description = categories[len(categories) - 1] # Name of the action categories = categories[:len(categories) - 1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('ADDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' child = item.findchild('id') if child: try: id = int(child.value) except: id = 0 else: id = 0 definition = item.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: additem = AddItemAction(addmenu, description, id, definition) else: additem = AddItemAction(submenus['\\'.join(categories) + '\\'], description, id, definition) additem.otherhtml = 'Definition: ' + definition item = definitions.next for menu in submenus.values(): menu.sort() npcs = wolfpack.definitionsiterator(WPDT_NPC) submenus = {} npc = npcs.first while npc: if not npc.hasattribute('id'): npc = npcs.next continue child = npc.findchild('category') if not child: npc = npcs.next continue id = npc.findchild('id') if id: try: if id.value.startswith('0x'): id = wolfpack.bodyinfo(hex2dec(id.value))['figurine'] else: id = wolfpack.bodyinfo(int(id.value))['figurine'] except: id = 0 else: id = 0 description = npc.findchild('desc') if description: description = description.value else: description = tr('No description available.') categories = ['NPCs'] + child.text.split('\\') title = categories[len(categories) - 1] # Name of the action categories = categories[:len(categories) - 1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('ADDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' definition = npc.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: addnpc = AddNpcAction(addmenu, title, definition, definition) else: addnpc = AddNpcAction(submenus['\\'.join(categories) + '\\'], title, id, definition) addnpc.otherhtml = str(description) npc = npcs.next for menu in submenus.values(): menu.sort() multis = wolfpack.definitionsiterator(WPDT_MULTI) submenus = {} multi = multis.first while multi: if not multi.hasattribute('id'): multi = multi.next continue child = multi.findchild('category') if not child: multi = multis.next continue categories = ['Multis'] + child.text.split('\\') description = categories[len(categories) - 1] # Name of the action categories = categories[:len(categories) - 1] # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = addmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('ADDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' child = multi.findchild('id') if child: try: id = int(child.value) except: id = 0 else: id = 0 multi = multi.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: addmulti = AddMultiAction(addmenu, description, id, multi) else: addmulti = AddMultiAction(submenus['\\'.join(categories) + '\\'], description, id, multi) addmulti.otherhtml = 'Definition: ' + multi multi = multis.next for menu in submenus.values(): menu.sort() addmenu.sort() if char: addmenu.send(char)
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = False self.delay = 1250 self.gumptype = 0xb10cae72 # This should be unique
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = 0 self.delay = 2000 self.gumptype = 0x9ca51fca # This should be unique self.requiretool = True
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.gumptype = 0xf4132a42 # This should be unique self.name_makelast = tr("Select Last")
def find(socket, command, arguments): if (len(arguments) == 0): socket.sysmessage( tr('Usage: find <searchpattern>') ) return findsmenu = MakeMenu('FINDMENU', None, 'Find Menu') submenus = {} items = wolfpack.definitionsiterator(WPDT_ITEM) item = items.first while item: if not item.hasattribute('id'): item = items.next continue child = item.findchild('category') if not child: item = items.next continue categories = ['Items'] + child.text.split('\\') description = categories[len(categories)-1] # Name of the action categories = ['Items'] if ( re.search(arguments.lower(), description.lower()) ): # Iterate through the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = findsmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('FINDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' child = item.findchild('id') if child: try: id = int(child.value) except: id = 0 else: id = 0 definition = item.getattribute('id') additem = AddItemAction(menu, description, id, definition) additem.otherhtml = 'Definition: ' + definition item = items.next npcs = wolfpack.definitionsiterator(WPDT_NPC) submenus = {} npc = npcs.first while npc: if not npc.hasattribute('id'): npc = npcs.next continue child = npc.findchild('category') if not child: npc = npcs.next continue id = npc.findchild('id') if id: try: if id.value.startswith('0x'): id = wolfpack.bodyinfo(hex2dec(id.value))['figurine'] else: id = wolfpack.bodyinfo(int(id.value))['figurine'] except: id = 0 else: id = 0 description = npc.findchild('desc') if description: description = description.value else: description = tr('No description available.') categories = ['NPCs'] + child.text.split('\\') title = categories[len(categories)-1] # Name of the action categories = ['NPCs'] if ( re.search(arguments.lower(), title.lower()) ): # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = findsmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('FINDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' definition = npc.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: addnpc = AddNpcAction(menu, title , definition, definition) else: addnpc = AddNpcAction(submenus['\\'.join(categories) + '\\'], title, id, definition) addnpc.otherhtml = str(description) npc = npcs.next multis = wolfpack.definitionsiterator(WPDT_MULTI) submenus = {} multi = multis.first while multi: if not multi.hasattribute('id'): multi = multi.next continue child = multi.findchild('category') if not child: multi = multis.next continue categories = ['Multis'] + child.text.split('\\') description = categories[len(categories)-1] # Name of the action categories = ['Multis'] if ( re.search(arguments.lower(), description.lower()) ): # Iterate trough the categories and see if they're all there category = '' if len(categories) > 0 and not submenus.has_key('\\'.join(categories) + '\\'): for subcategory in categories: if not submenus.has_key(category + subcategory + '\\'): # Category is our parent category parent = None if len(category) == 0: parent = findsmenu elif category in submenus: parent = submenus[category] category += subcategory + '\\' menu = MakeMenu('FINDMENU_' + category, parent, subcategory) submenus[category] = menu else: category += subcategory + '\\' child = multi.findchild('id') if child: try: id = int(child.value) except: id = 0 else: id = 0 multi = multi.getattribute('id') # Parse the position of this makemenu entry if len(categories) == 0: addmulti = AddMultiAction(addmenu, description, id, multi) else: addmulti = AddMultiAction(submenus['\\'.join(categories) + '\\'], description, id, multi) addmulti.otherhtml = 'Definition: ' + multi multi = multis.next if ( len(findsmenu.submenus) > 0 ): findsmenu.send( socket ) else: socket.sysmessage( tr('Could not find any item, npc or multi matching the arguments.') )
def __init__(self, id, parent, title): MakeMenu.__init__(self, id, parent, title) self.allowmark = True # generally allow marking, but not all items are markable self.delay = 1250 self.gumptype = 0xb10cae72 # This should be unique self.requiretool = True # Require a tool