move skill mapping to item class

This commit is contained in:
blitzmann
2017-04-22 03:11:25 -04:00
parent 58abdcfa22
commit b21c850598

View File

@@ -303,6 +303,8 @@ class Item(EqBase):
eos.db.saveddata_session.delete(override)
eos.db.commit()
srqIDMap = {182: 277, 183: 278, 184: 279, 1285: 1286, 1289: 1287, 1290: 1288}
@property
def requiredSkills(self):
if self.__requiredSkills is None:
@@ -310,8 +312,7 @@ class Item(EqBase):
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()))
combinedAttrIDs = set(self.srqIDMap.iterkeys()).union(set(self.srqIDMap.itervalues()))
# Map containing result of the request
# { attributeID : attributeValue }
skillAttrs = {}
@@ -321,7 +322,7 @@ class Item(EqBase):
attrVal = attrInfo[2]
skillAttrs[attrID] = attrVal
# Go through all attributeID pairs
for srqIDAtrr, srqLvlAttr in srqIDMap.iteritems():
for srqIDAtrr, srqLvlAttr in self.srqIDMap.iteritems():
# Check if we have both in returned result
if srqIDAtrr in skillAttrs and srqLvlAttr in skillAttrs:
skillID = int(skillAttrs[srqIDAtrr])
@@ -337,10 +338,9 @@ class Item(EqBase):
self.__requiredFor = dict()
# Map containing attribute IDs we may need for required skills
srqIDMap = {182: 277, 183: 278, 184: 279, 1285: 1286, 1289: 1287, 1290: 1288}
# Get relevant attribute values from db (required skill IDs and levels) for our item
q = eos.db.getRequiredFor(self.ID, srqIDMap)
q = eos.db.getRequiredFor(self.ID, self.srqIDMap)
for itemID, lvl in q:
# Fetch item from database and fill map