Asterix 2 Posted November 23, 2018 Share Posted November 23, 2018 Hello everyone! Today I was looking at the "uitooltip.py". And I immediately had an idea. Having it need to give a visual rarity, not script in game, to costumes. What is the function that governs the inclusion of colored writing under the bonuses? Thanks to anyone who can help me! Link to comment Share on other sites More sharing options...
xUniverse 18 Posted November 24, 2018 Share Posted November 24, 2018 hace 2 horas, Asterix dijo: Hello everyone! Today I was looking at the "uitooltip.py". And I immediately had an idea. Having it need to give a visual rarity, not script in game, to costumes. What is the function that governs the inclusion of colored writing under the bonuses? Thanks to anyone who can help me! Idk if I understand your question, but if I did -> Search: self.__AppendAttributeInformation(attrSlot) You will find more than one match (for weapon, armor, belt, rings, costume), so select it like you want (in this case costume). Then make a new line and add something like: self.AppendTextLine("some text...", self.MY_NEW_COLOR) And finally search NORMAL_COLOR in class ToolTip(ui.ThinBoard), make a new line and define MY_NEW_COLOR: NORMAL_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0) MY_NEW_COLOR = grp.GenerateColor(0.6863, 0.9725, 0.3216, 1.0) And change the color like you want... 1 Link to comment Share on other sites More sharing options...
Asterix 2 Posted November 24, 2018 Author Share Posted November 24, 2018 Thanks my friend... But i think that i have do a check of value, because i have need of more variety of colour based by value Link to comment Share on other sites More sharing options...
xUniverse 18 Posted November 24, 2018 Share Posted November 24, 2018 En 23/11/2018 a las 21:21, Asterix dijo: Thanks my friend... But i think that i have do a check of value, because i have need of more variety of colour based by value So you can define a new function, before def __GetAttributeColor(self, index, value) like this: def __AppendItemRarity(self, attrSlot): RareList = ["Common","Uncommon","Rare","Legendary","Epic","From other universe"] idxRarity = 0 if 0 != attrSlot: for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM): type = attrSlot[i][0] value = attrSlot[i][1] if value == 0: continue # HERE IS WHERE YOU MUST CHECK THE VALUES AND TYPES # # you have type and value, so you can increase idxRarity # like you want # ............... # The next lines is if idxRarity between 0 and 100 if idxRarity == 0: self.AppendTextLine(RareList[0], self.COLOR_RARE_0) elif idxRarity < 20: self.AppendTextLine(RareList[1], self.COLOR_RARE_1) elif idxRarity < 40: self.AppendTextLine(RareList[2], self.COLOR_RARE_2) elif idxRarity < 60: self.AppendTextLine(RareList[3], self.COLOR_RARE_3) elif idxRarity < 80: self.AppendTextLine(RareList[4], self.COLOR_RARE_4) else: self.AppendTextLine(RareList[5], self.COLOR_RARE_5) Search: self.__AppendAttributeInformation(attrSlot) And add after: self.__AppendItemRarity(attrSlot) And don't forget to define the colors in class ToolTip(ui.ThinBoard). ############ Some tips: - You can make a dictionary with some types and ranges of values to simplify. - You can use the same condition in attributes with "same values" (for example in defenses against weapons). ############ Example (i did it to test) : 2 Link to comment Share on other sites More sharing options...
Asterix 2 Posted November 24, 2018 Author Share Posted November 24, 2018 10 hours ago, xUniverse said: Quindi puoi definire una nuova funzione, prima di def __GetAttributeColor (self, index, value) in questo modo: Ricerca: E aggiungi dopo: E non dimenticare di definire i colori nella classe ToolTip (ui.ThinBoard). ############ - È possibile creare un dizionario con alcuni tipi e intervalli di valori da semplificare. - È possibile utilizzare la stessa condizione in attributi con "stessi valori" (ad esempio nelle difese contro le armi). ############ Esempio (l'ho fatto per testare) : Hi! i don’t understand where is the check of value 1 Link to comment Share on other sites More sharing options...
Asterix 2 Posted November 24, 2018 Author Share Posted November 24, 2018 And if is possibile made table of values for the item? For a ordinated code Link to comment Share on other sites More sharing options...
xUniverse 18 Posted November 24, 2018 Share Posted November 24, 2018 Check PM, I will send you my full code to explain it 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now