skillLevelsCont.py (4718B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\shipTree\skillLevelsCont.py 2 import carbonui.const as uiconst 3 import localization 4 from carbonui import TextColor 5 from carbonui.primitives.container import Container 6 from carbonui.primitives.fill import Fill 7 from carbonui.primitives.frame import Frame 8 import clonegrade 9 from carbonui.util.color import Color 10 from eve.client.script.ui import eveColor 11 from omega.client.clone_grade_svc import get_clone_grade_svc 12 BLUE_COLOR = (0.0, 0.52, 0.67, 1.0) 13 LIGHTBLUE_COLOR = (0.6, 0.8, 0.87, 1.0) 14 OMEGA_COLOR = Color(*clonegrade.COLOR_OMEGA_ORANGE).SetAlpha(0.8).GetRGBA() 15 16 class SkillLevelsCont(Container): 17 default_align = uiconst.TORIGHT 18 default_state = uiconst.UI_NORMAL 19 default_width = 47 20 default_height = 10 21 default_frameColor = (1.0, 1.0, 1.0, 0.3) 22 default_bgColor = (1.0, 1.0, 1.0, 0.0) 23 default_barColor = (1.0, 1.0, 1.0, 0.5) 24 25 def ApplyAttributes(self, attributes): 26 import expertSystems.client 27 Container.ApplyAttributes(self, attributes) 28 self.typeID = attributes.get('typeID', None) 29 self.groupID = attributes.get('groupID', None) 30 self.barColor = attributes.get('barColor', self.default_barColor) 31 frameColor = attributes.get('frameColor', self.default_frameColor) 32 bgColor = attributes.get('bgColor', self.default_bgColor) 33 self.bgFrame = Frame(bgParent=self, color=frameColor) 34 self.bgFill = Fill(bgParent=self, color=bgColor) 35 self.cnts = [] 36 self.bars = [] 37 self.lines = [] 38 for i in xrange(5): 39 padLeft = 2 if i == 0 else 1 40 cnt = Container(parent=self, name='cnt_level%d' % i, align=uiconst.TOLEFT_PROP, width=0.2, padding=(padLeft, 41 2, 42 0, 43 2)) 44 line = Fill(parent=cnt, name='level%d' % i, align=uiconst.TOBOTTOM_NOPUSH, color=expertSystems.Color.base, height=1) 45 bar = Fill(parent=cnt, name='bar_level%d' % i, align=uiconst.TOALL, color=self.barColor) 46 self.cnts.append(cnt) 47 self.bars.append(bar) 48 self.lines.append(line) 49 50 self.Update() 51 52 def Update(self): 53 skill = self.GetSkill() 54 self.SetLevel(skill) 55 56 def SetBarPadding(self, padding): 57 for i, bar in enumerate(self.cnts): 58 if i == 0: 59 bar.padLeft = padding + 1 60 else: 61 bar.padLeft = padding 62 63 def GetSkill(self): 64 return sm.GetService('skills').GetSkill(self.typeID) 65 66 def GetMyLevel(self): 67 return sm.GetService('skills').GetMyLevelIncludingLapsed(self.typeID) 68 69 def SetLevel(self, skill): 70 skillQueue = sm.GetService('skillqueue').GetQueue() 71 skillInTraining = sm.GetService('skillqueue').SkillInTraining() 72 myLevel = self.GetMyLevel() 73 level = myLevel if myLevel else 0 74 effectiveLevel = skill.effectiveSkillLevel if skill else 0 75 if skill and skill.trainedSkillPoints == 0: 76 hint = localization.GetByLabel('UI/SkillQueue/Skills/SkillNotTrained') 77 elif level == 5: 78 hint = localization.GetByLabel('UI/SkillQueue/Skills/SkillAtMaximumLevel') 79 else: 80 hint = localization.GetByLabel('UI/SkillQueue/Skills/SkillAtLevel', skillLevel=level) 81 inTraining = 0 82 plannedInQueue = 0 83 for trainingSkill in skillQueue: 84 if trainingSkill.trainingTypeID == self.typeID: 85 plannedInQueue = trainingSkill.trainingToLevel 86 87 if skillInTraining and skillInTraining.typeID == self.typeID: 88 inTraining = 1 89 for i in xrange(5): 90 fill = self.bars[i] 91 line = self.lines[i] 92 fill.SetRGBA(*self.barColor) 93 if level > i: 94 fill.display = True 95 if not get_clone_grade_svc().is_omega_with_grace_period() and get_clone_grade_svc().is_skill_level_restricted(self.typeID, i + 1): 96 fill.SetRGBA(*OMEGA_COLOR) 97 else: 98 fill.display = False 99 if effectiveLevel > i: 100 line.display = True 101 else: 102 line.display = False 103 if plannedInQueue and i >= level and i <= plannedInQueue - 1: 104 hint = localization.GetByLabel('UI/SkillQueue/Skills/SkillTrainingToLevel', skillLevel=plannedInQueue) 105 fill.SetRGBA(*BLUE_COLOR) 106 fill.display = True 107 if inTraining and i == level: 108 fill.SetRGBA(*LIGHTBLUE_COLOR) 109 sm.GetService('ui').BlinkSpriteA(fill, 1.0, time=1000.0, maxCount=0, passColor=0, minA=0.5) 110 111 self.hint = hint