NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

dynamicItemSvc.py (1852B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\dogma\dynamicItemSvc.py
      2 import dynamicitemattributes
      3 from carbon.common.script.sys.service import Service
      4 from eve.client.script.ui.shared.dynamicItem.craftingWindow import CraftingWindow
      5 from eve.client.script.ui.shared.fittingScreen.ghostFittingUtil import GetOriganlItemIDFromItemKey
      6 
      7 class DynamicItemSvc(Service):
      8     __guid__ = 'svc.dynamicItemSvc'
      9 
     10     def Run(self, memStream = None):
     11         self.dynamicItemCache = {}
     12 
     13     def IsDynamicItem(self, typeID):
     14         return dynamicitemattributes.IsDynamicType(typeID)
     15 
     16     def GetDynamicItem(self, itemID):
     17         itemID = self._DecodeItemID(itemID)
     18         if itemID not in self.dynamicItemCache:
     19             remoteSvc = sm.RemoteSvc('dynamicItemService')
     20             self.dynamicItemCache[itemID] = remoteSvc.GetDynamicItemInfo(itemID)
     21         return self.dynamicItemCache[itemID]
     22 
     23     def GetDynamicItemAttributes(self, itemID):
     24         itemID = self._DecodeItemID(itemID)
     25         item = self.GetDynamicItem(itemID)
     26         return item.attributes
     27 
     28     def GetMutatedAttributes(self, itemID):
     29         itemID = self._DecodeItemID(itemID)
     30         item = self.GetDynamicItem(itemID)
     31         mutatorAttributes = dynamicitemattributes.GetMutatorAttributes(item.mutatorTypeID)
     32         return {attributeID:item.attributes[attributeID] for attributeID in mutatorAttributes}
     33 
     34     def OpenCraftWindow(self, item):
     35         CraftingWindow.Open(mutator=item, session=session)
     36 
     37     def CreateDynamicItem(self, mutatorID, sourceID):
     38         return sm.RemoteSvc('dynamicItemService').CreateDynamicItem(mutatorID, sourceID)
     39 
     40     def _DecodeItemID(self, itemID):
     41         if sm.GetService('info').IsItemSimulated(itemID):
     42             return GetOriganlItemIDFromItemKey(itemID)
     43         else:
     44             return itemID