Пример #1
0
def init(params=None):
	global _haltEvent
	
	# Create the event which can be used to halt all bots.
	_haltEvent = threading.Event()
	
	# Initialize the databases.
	ItemDatabase.init()
	SkillDatabase.init()
	
	# Force HTTP requests to timeout after 5 minutes.
	socket.setdefaulttimeout(300)
Пример #2
0
def init(params=None):
    global _haltEvent

    # Create the event which can be used to halt all bots.
    _haltEvent = threading.Event()

    # Initialize the databases.
    ItemDatabase.init()
    SkillDatabase.init()

    # Force HTTP requests to timeout after 5 minutes.
    socket.setdefaulttimeout(300)

    # Seed the pseudo-random number generator.
    random.seed()
Пример #3
0
def mergeItems():
	ItemDatabase.init()
	for i in range(len(_items)):
		item = _items[i]
		try:
			savedItem = ItemDatabase.getItemFromId(item["id"])
			
			for k,v in item.iteritems():
				if k != "enchantments" and k != "type":
					savedItem[k] = v
			if "enchantments" in item and len(item["enchantments"]) > 0:
				if "enchantments" not in savedItem:
					savedItem["enchantments"] = {}
				for k,v in item["enchantments"].iteritems():
					savedItem["enchantments"][k] = v
			_items[i] = savedItem
		except ItemNotFoundError:
			r = ItemDescriptionRequest(_session, item["descId"])
			itemInfo = r.doRequest()
			for k,v in itemInfo.iteritems():
				item[k] = v
Пример #4
0
def mergeItems():
    ItemDatabase.init()
    for i in range(len(_items)):
        item = _items[i]
        try:
            savedItem = ItemDatabase.getItemFromId(item["id"])

            for k,v in item.iteritems():
                if k != "enchantments" and k != "type":
                    savedItem[k] = v
            if "enchantments" in item and len(item["enchantments"]) > 0:
                if "enchantments" not in savedItem:
                    savedItem["enchantments"] = {}
                for k,v in item["enchantments"].iteritems():
                    savedItem["enchantments"][k] = v
            _items[i] = savedItem
        except ItemNotFoundError:
            r = ItemDescriptionRequest(_session, item["descId"])
            itemInfo = r.doRequest()
            for k,v in itemInfo.iteritems():
                item[k] = v
Пример #5
0
def mergeItems():
    ItemDatabase.init()
    for i in range(len(_items)):
        item = _items[i]
        try:
            savedItem = ItemDatabase.getItemFromId(item["id"])

            for k,v in item.iteritems():
                if k != "enchantments" and k != "type":
                    savedItem[k] = v
            if "enchantments" in item and len(item["enchantments"]) > 0:
                if "enchantments" not in savedItem:
                    savedItem["enchantments"] = {}
                for k,v in item["enchantments"].iteritems():
                    savedItem["enchantments"][k] = v
            _items[i] = savedItem
        except Error.Error, inst:
            if inst.code == Error.ITEM_NOT_FOUND:
                r = ItemDescriptionRequest(_session, item["descId"])
                itemInfo = r.doRequest()
                for k,v in itemInfo.iteritems():
                    item[k] = v
            else:
                raise inst
Пример #6
0
 def runTest(self):
     ItemDatabase.init()
Пример #7
0
 def runTest(self):
     ItemDatabase.init()