Exemplo n.º 1
0
 def requiredSkills(self):
     if self.__requiredSkills is None:
         # This import should be here to make sure it's fully initialized
         from eos import db
         requiredSkills = OrderedDict()
         self.__requiredSkills = requiredSkills
         # Map containing attribute IDs we may need for required skills
         # { requiredSkillX : requiredSkillXLevel }
         srqIDMap = {182: 277, 183: 278, 184: 279, 1285: 1286, 1289: 1287, 1290: 1288}
         combinedAttrIDs = set(srqIDMap.iterkeys()).union(set(srqIDMap.itervalues()))
         # Map containing result of the request
         # { attributeID : attributeValue }
         skillAttrs = {}
         # Get relevant attribute values from db (required skill IDs and levels) for our item
         for attrInfo in db.directAttributeRequest((self.ID,), tuple(combinedAttrIDs)):
             attrID = attrInfo[1]
             attrVal = attrInfo[2]
             skillAttrs[attrID] = attrVal
         # Go through all attributeID pairs
         for srqIDAtrr, srqLvlAttr in srqIDMap.iteritems():
             # Check if we have both in returned result
             if srqIDAtrr in skillAttrs and srqLvlAttr in skillAttrs:
                 skillID = int(skillAttrs[srqIDAtrr])
                 skillLvl = skillAttrs[srqLvlAttr]
                 # Fetch item from database and fill map
                 item = db.getItem(skillID)
                 requiredSkills[item] = skillLvl
     return self.__requiredSkills
Exemplo n.º 2
0
 def requiredSkills(self):
     if self.__requiredSkills is None:
         # This import should be here to make sure it's fully initialized
         from eos import db
         requiredSkills = OrderedDict()
         self.__requiredSkills = requiredSkills
         # Map containing attribute IDs we may need for required skills
         # { requiredSkillX : requiredSkillXLevel }
         srqIDMap = {182: 277, 183: 278, 184: 279, 1285: 1286, 1289: 1287, 1290: 1288}
         combinedAttrIDs = set(srqIDMap.iterkeys()).union(set(srqIDMap.itervalues()))
         # Map containing result of the request
         # { attributeID : attributeValue }
         skillAttrs = {}
         # Get relevant attribute values from db (required skill IDs and levels) for our item
         for attrInfo in db.directAttributeRequest((self.ID,), tuple(combinedAttrIDs)):
             attrID = attrInfo[1]
             attrVal = attrInfo[2]
             skillAttrs[attrID] = attrVal
         # Go through all attributeID pairs
         for srqIDAtrr, srqLvlAttr in srqIDMap.iteritems():
             # Check if we have both in returned result
             if srqIDAtrr in skillAttrs and srqLvlAttr in skillAttrs:
                 skillID = int(skillAttrs[srqIDAtrr])
                 skillLvl = skillAttrs[srqLvlAttr]
                 # Fetch item from database and fill map
                 item = db.getItem(skillID)
                 requiredSkills[item] = skillLvl
     return self.__requiredSkills