Çözüldü Metin2 derece sistemi

Bu konu çözüme ulaştırılmıştır. Çözüm için konuya yazılan tüm yorumları okumayı unutmayın. Eğer konudaki yorumlar sorununuzu çözmediyse yeni bir konu açabilirsiniz.
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.

TheAdmin33

Ah bu şarkıların gözü kör olsun
Geliştirici
Yardımsever Üye
Usta Üye
Editör
Mesaj
759
Çözümler
44
Beğeni
1.392
Puan
1.139
Ticaret Puanı
0
Derece sisteminde bir kod kısmı var ve ben bu kodu sadeleştirmek istiyorum bunu nasıl yaparım?

derece sistemini 40 kademeli yapmak istiyorum ama uicharacter.py kısmını sadeleştirmek istiyorum .

kod;
uicharacter.py:
            if point >= 30000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_1_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_1_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_1_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 25000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_2_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_2_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_2_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 20000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_3_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_3_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_3_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 18000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_4_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_4_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_4_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 12000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_5_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_5_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_5_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 8000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_6_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_6_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_6_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 4000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_7_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_7_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_7_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 1000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_8_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_8_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_8_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point < 1000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_0_1, self.toolTipAlignment.NEGATIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_0_2, self.toolTipAlignment.NEGATIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_0_3, self.toolTipAlignment.NEGATIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)

mevcut kod bu, böyle 40 tane if sorgusu yazmadan tek for döngüsüyle bunu nasıl yaparım?

ilgili fonksiyonun tam hali;
uicharacter.py:
    def RefreshAlignment(self):
        point, grade = player.GetAlignmentData()

        import colorInfo

        if app.ENABLE_ALIGN_RENEWAL:
            COLOR_DICT = {    0 : colorInfo.TITLE_RGB_GOOD_10,
                            1 : colorInfo.TITLE_RGB_GOOD_9,
                            2 : colorInfo.TITLE_RGB_GOOD_8,
                            3 : colorInfo.TITLE_RGB_GOOD_7,
                            4 : colorInfo.TITLE_RGB_GOOD_6,
                            5 : colorInfo.TITLE_RGB_GOOD_5,
                            6 : colorInfo.TITLE_RGB_GOOD_4,
                            7 : colorInfo.TITLE_RGB_GOOD_3,
                            8 : colorInfo.TITLE_RGB_GOOD_2,
                            9 : colorInfo.TITLE_RGB_GOOD_1,
                            10 : colorInfo.TITLE_RGB_GOOD_1,
                            11 : colorInfo.TITLE_RGB_NORMAL,
                            12 : colorInfo.TITLE_RGB_EVIL_1,
                            13 : colorInfo.TITLE_RGB_EVIL_2,
                            14 : colorInfo.TITLE_RGB_EVIL_3,
                            15 : colorInfo.TITLE_RGB_EVIL_4,
                            16 : colorInfo.TITLE_RGB_GOOD_10,
                            17 : colorInfo.TITLE_RGB_GOOD_9,
                            18 : colorInfo.TITLE_RGB_GOOD_8,
                            19 : colorInfo.TITLE_RGB_GOOD_7,
                            20 : colorInfo.TITLE_RGB_GOOD_6,
                            21 : colorInfo.TITLE_RGB_GOOD_5,
                            22 : colorInfo.TITLE_RGB_GOOD_4,
                            23 : colorInfo.TITLE_RGB_GOOD_3,
                            24 : colorInfo.TITLE_RGB_GOOD_2,
                            25 : colorInfo.TITLE_RGB_GOOD_1,
                            26 : colorInfo.TITLE_RGB_NORMAL,
                            27 : colorInfo.TITLE_RGB_EVIL_1,
                            28 : colorInfo.TITLE_RGB_EVIL_2,
                            29 : colorInfo.TITLE_RGB_EVIL_3,
                            30 : colorInfo.TITLE_RGB_EVIL_4,
                            31 : colorInfo.TITLE_RGB_GOOD_10,
                            32 : colorInfo.TITLE_RGB_GOOD_9,
                            33 : colorInfo.TITLE_RGB_GOOD_8,
                            34 : colorInfo.TITLE_RGB_GOOD_7,
                            35 : colorInfo.TITLE_RGB_GOOD_6,
                            36 : colorInfo.TITLE_RGB_GOOD_5,
                            37 : colorInfo.TITLE_RGB_GOOD_4,
                            38 : colorInfo.TITLE_RGB_GOOD_3,
                            39 : colorInfo.TITLE_RGB_GOOD_2,
                            40 : colorInfo.TITLE_RGB_NORMAL,
                            41 : colorInfo.TITLE_RGB_EVIL_1,
                            42 : colorInfo.TITLE_RGB_EVIL_2,
                            43 : colorInfo.TITLE_RGB_EVIL_3,
                            44 : colorInfo.TITLE_RGB_EVIL_4, }
        else:
            COLOR_DICT = {    0 : colorInfo.TITLE_RGB_GOOD_4,
                            1 : colorInfo.TITLE_RGB_GOOD_3,
                            2 : colorInfo.TITLE_RGB_GOOD_2,
                            3 : colorInfo.TITLE_RGB_GOOD_1,
                            4 : colorInfo.TITLE_RGB_NORMAL,
                            5 : colorInfo.TITLE_RGB_EVIL_1,
                            6 : colorInfo.TITLE_RGB_EVIL_2,
                            7 : colorInfo.TITLE_RGB_EVIL_3,
                            8 : colorInfo.TITLE_RGB_EVIL_4, }

        colorList = COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
        gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])

        self.toolTipAlignment.ClearToolTip()
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.TITLE_NAME_LIST[grade], gradeColor)
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGNMENT_NAME + str(point))
        self.toolTipAlignment.AppendSpace(1)

        self.toolTipAlignment.AutoAppendTextLine("____________________________________")
        self.toolTipAlignment.AppendSpace(1)

        colorList = COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
        gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.MY_GRADE % localeInfo.TITLE_NAME_LIST[grade], gradeColor)

        self.toolTipAlignment.AutoAppendTextLine("____________________________________")
        self.toolTipAlignment.AppendSpace(1)

        colorList2 = COLOR_DICT.get(grade-1, colorInfo.TITLE_RGB_NORMAL)
        gradeColor2 = ui.GenerateColor(colorList2[0], colorList2[1], colorList2[2])
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.NEXT_GRADE % localeInfo.TITLE_NAME_LIST[grade-1], gradeColor2)
        self.toolTipAlignment.AppendSpace(1)

        self.toolTipAlignment.AutoAppendTextLine("____________________________________")
        self.toolTipAlignment.AppendSpace(1)

        if app.ENABLE_ALIGN_RENEWAL:
            self.toolTipAlignment.AppendSpace(2)
            if point >= 30000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_1_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_1_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_1_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 25000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_2_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_2_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_2_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 20000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_3_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_3_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_3_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 18000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_4_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_4_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_4_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 12000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_5_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_5_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_5_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 8000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_6_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_6_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_6_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 4000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_7_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_7_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_7_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point >= 1000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_8_1, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_8_2, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_8_3, self.toolTipAlignment.POSITIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)
            elif point < 1000:
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_0_1, self.toolTipAlignment.NEGATIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_0_2, self.toolTipAlignment.NEGATIVE_COLOR)
                self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGN_BONUS_0_3, self.toolTipAlignment.NEGATIVE_COLOR)
                self.toolTipAlignment.AppendSpace(2)

        self.toolTipAlignment.AlignHorizonalCenter()

başka bir fileste bulduğum ama anlamadığım bir kod;
uicharacter.py:
    def RefreshAlignment(self):
        point, grade = player.GetAlignmentData()

        colorList = colorInfo.ALIGN_GRADE_COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
        gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])

        self.toolTipAlignment.ClearToolTip()
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.TITLE_NAME_LIST[grade], gradeColor)
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGNMENT_NAME + str(point))
        self.toolTipAlignment.AppendSpace(1)

        self.toolTipAlignment.AutoAppendTextLine("____________________________________")
        self.toolTipAlignment.AppendSpace(1)

        colorList = colorInfo.ALIGN_GRADE_COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
        gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.MY_GRADE % localeInfo.TITLE_NAME_LIST[grade], gradeColor)

        self.toolTipAlignment.AutoAppendTextLine("____________________________________")
        self.toolTipAlignment.AppendSpace(1)

        colorList2 = colorInfo.ALIGN_GRADE_COLOR_DICT.get(grade-1, colorInfo.TITLE_RGB_NORMAL)
        gradeColor2 = ui.GenerateColor(colorList2[0], colorList2[1], colorList2[2])
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.NEXT_GRADE % localeInfo.TITLE_NAME_LIST[grade-1], gradeColor2)
        self.toolTipAlignment.AppendSpace(1)

        self.toolTipAlignment.AutoAppendTextLine("____________________________________")
        self.toolTipAlignment.AppendSpace(1)

        for i in xrange(40):
            if i == player.GetNewAlignmentData()-1:
                total = len(constInfo.derecebonus)
                if total == 0:
                    continue

                if int(constInfo.derecebonus[i]['applytype1']) > 0 and int(constInfo.derecebonus[i]['applyvalue1']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype1'])](int(constInfo.derecebonus[i]['applyvalue1'])), gradeColor)

                if int(constInfo.derecebonus[i]['applytype2']) > 0 and int(constInfo.derecebonus[i]['applyvalue2']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype2'])](int(constInfo.derecebonus[i]['applyvalue2'])), gradeColor)

                if int(constInfo.derecebonus[i]['applytype3']) > 0 and int(constInfo.derecebonus[i]['applyvalue3']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype3'])](int(constInfo.derecebonus[i]['applyvalue3'])), gradeColor)

                if int(constInfo.derecebonus[i]['applytype4']) > 0 and int(constInfo.derecebonus[i]['applyvalue4']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype4'])](int(constInfo.derecebonus[i]['applyvalue4'])), gradeColor)

        self.toolTipAlignment.AlignHorizonalCenter()
 
Çözüm
Python:
bonuslar = [
    (30000, ["ALIGN_BONUS_1_1", "ALIGN_BONUS_1_2", "ALIGN_BONUS_1_3"]),
    (25000, ["ALIGN_BONUS_2_1", "ALIGN_BONUS_2_2", "ALIGN_BONUS_2_3"]),
    (20000, ["ALIGN_BONUS_3_1", "ALIGN_BONUS_3_2", "ALIGN_BONUS_3_3"]),
    (18000, ["ALIGN_BONUS_4_1", "ALIGN_BONUS_4_2", "ALIGN_BONUS_4_3"]),
    (12000, ["ALIGN_BONUS_5_1", "ALIGN_BONUS_5_2", "ALIGN_BONUS_5_3"]),
    (8000, ["ALIGN_BONUS_6_1", "ALIGN_BONUS_6_2", "ALIGN_BONUS_6_3"]),
    (4000, ["ALIGN_BONUS_7_1", "ALIGN_BONUS_7_2", "ALIGN_BONUS_7_3"]),
    (1000, ["ALIGN_BONUS_8_1", "ALIGN_BONUS_8_2", "ALIGN_BONUS_8_3"]),
    (0, ["ALIGN_BONUS_0_1", "ALIGN_BONUS_0_2", "ALIGN_BONUS_0_3"]),
]

renk = self.toolTipAlignment.POSITIVE_COLOR if point_num >= 0 else...
ryzen filesinde bu şekilde yapmışlar üsttekinden birazdaha iyi gibi :D

Kod:
    def RefreshAlignment(self):
        point, grade = player.GetAlignmentData()

        import colorInfo
        COLOR_DICT = {   
                        0 : colorInfo.TITLE_RGB_GOOD_12,
                        1 : colorInfo.TITLE_RGB_GOOD_11,
                        2 : colorInfo.TITLE_RGB_GOOD_10,
                        3 : colorInfo.TITLE_RGB_GOOD_9,
                        4 : colorInfo.TITLE_RGB_GOOD_8,
                        5 : colorInfo.TITLE_RGB_GOOD_7,
                        6 : colorInfo.TITLE_RGB_GOOD_6,
                        7 : colorInfo.TITLE_RGB_GOOD_5,
                        8 : colorInfo.TITLE_RGB_GOOD_4,
                        9 : colorInfo.TITLE_RGB_GOOD_3,
                        10 : colorInfo.TITLE_RGB_GOOD_2,
                        11 : colorInfo.TITLE_RGB_GOOD_1,
                        12 : colorInfo.TITLE_RGB_NORMAL,
                        13 : colorInfo.TITLE_RGB_EVIL_1,
                        14 : colorInfo.TITLE_RGB_EVIL_2,
                        15 : colorInfo.TITLE_RGB_EVIL_3,
                        16 : colorInfo.TITLE_RGB_EVIL_4,}   
        colorList = COLOR_DICT.get(grade, colorInfo.TITLE_RGB_NORMAL)
        gradeColor = ui.GenerateColor(colorList[0], colorList[1], colorList[2])

        if point >= 12000 and point < 16000:
            p1 = 500
            p2 = 1
        elif point >= 16000 and point < 20000:
            p1 = 1000
            p2 = 10
        elif point >= 20000 and point < 24000:
            p1 = 2000
            p2 = 20
        elif point >= 24000 and point < 30000:
            p1 = 3000
            p2 = 30
        elif point >= 30000 and point < 50000:
            p1 = 4000
            p2 = 40
        elif point >= 50000 and point < 75000:
            p1 = 5000
            p2 = 50
        elif point >= 75000 and point < 100000:
            p1 = 6000
            p2 = 60
        elif point >= 100000 and point < 150000:
            p1 = 7000
            p2 = 70
        elif point >= 150000:
            p1 = 8000
            p2 = 80
        else:
            p1 = 0
            p2 = 0
                
        POSITIVE_COLOR = grp.GenerateColor(0.5411, 0.7254, 0.5568, 1.0)       
        
        
        self.toolTipAlignment.ClearToolTip()
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.TITLE_NAME_LIST[grade], gradeColor)
        self.toolTipAlignment.AutoAppendTextLine(localeInfo.ALIGNMENT_NAME + str(point))
        self.toolTipAlignment.AutoAppendTextLine("Max HP : " + str(p1),POSITIVE_COLOR)
        self.toolTipAlignment.AutoAppendTextLine("B???Sald??Yak? D?淆 Sald?? " + str(p2),POSITIVE_COLOR)
        self.toolTipAlignment.AutoAppendTextLine("Metinlere Kar?G淮l?: " + str(p2),POSITIVE_COLOR)
        self.toolTipAlignment.AutoAppendTextLine("Bosslara Kar?G淮l?: " + str(p2),POSITIVE_COLOR)
        self.toolTipAlignment.AlignHorizonalCenter()
 
benim yapmaya gayret gösterdiğim şey şu; oyuncu derecesine bakarken o anda sahip olduğu derece ve verdiği özelliği görsün hemen altında da bir sornaki seferde alacağı özelliği görsün istiyorum.
 
bu zaten kodun içinde var . bu verdiği özelliği göstermesine yarıyor ben ekstradan hemen altında da bir sornaki seferde alacağı özelliği görsün istiyorum.
 
Python:
bonuslar = [
    (30000, ["ALIGN_BONUS_1_1", "ALIGN_BONUS_1_2", "ALIGN_BONUS_1_3"]),
    (25000, ["ALIGN_BONUS_2_1", "ALIGN_BONUS_2_2", "ALIGN_BONUS_2_3"]),
    (20000, ["ALIGN_BONUS_3_1", "ALIGN_BONUS_3_2", "ALIGN_BONUS_3_3"]),
    (18000, ["ALIGN_BONUS_4_1", "ALIGN_BONUS_4_2", "ALIGN_BONUS_4_3"]),
    (12000, ["ALIGN_BONUS_5_1", "ALIGN_BONUS_5_2", "ALIGN_BONUS_5_3"]),
    (8000, ["ALIGN_BONUS_6_1", "ALIGN_BONUS_6_2", "ALIGN_BONUS_6_3"]),
    (4000, ["ALIGN_BONUS_7_1", "ALIGN_BONUS_7_2", "ALIGN_BONUS_7_3"]),
    (1000, ["ALIGN_BONUS_8_1", "ALIGN_BONUS_8_2", "ALIGN_BONUS_8_3"]),
    (0, ["ALIGN_BONUS_0_1", "ALIGN_BONUS_0_2", "ALIGN_BONUS_0_3"]),
]

renk = self.toolTipAlignment.POSITIVE_COLOR if point_num >= 0 else self.toolTipAlignment.NEGATIVE_COLOR

for denk, degerler in bonuslar:
    if point_num >= denk:
        for satir in degerler:
            self.toolTipAlignment.AutoAppendTextLine(getattr(localeInfo, satir), renk)
        self.toolTipAlignment.AppendSpace(2)
        break

Bu şekilde deneyebilirsin
 
Çözüm
Python:
bonuslar = [
    (30000, ["ALIGN_BONUS_1_1", "ALIGN_BONUS_1_2", "ALIGN_BONUS_1_3"]),
    (25000, ["ALIGN_BONUS_2_1", "ALIGN_BONUS_2_2", "ALIGN_BONUS_2_3"]),
    (20000, ["ALIGN_BONUS_3_1", "ALIGN_BONUS_3_2", "ALIGN_BONUS_3_3"]),
    (18000, ["ALIGN_BONUS_4_1", "ALIGN_BONUS_4_2", "ALIGN_BONUS_4_3"]),
    (12000, ["ALIGN_BONUS_5_1", "ALIGN_BONUS_5_2", "ALIGN_BONUS_5_3"]),
    (8000, ["ALIGN_BONUS_6_1", "ALIGN_BONUS_6_2", "ALIGN_BONUS_6_3"]),
    (4000, ["ALIGN_BONUS_7_1", "ALIGN_BONUS_7_2", "ALIGN_BONUS_7_3"]),
    (1000, ["ALIGN_BONUS_8_1", "ALIGN_BONUS_8_2", "ALIGN_BONUS_8_3"]),
    (0, ["ALIGN_BONUS_0_1", "ALIGN_BONUS_0_2", "ALIGN_BONUS_0_3"]),
]

renk = self.toolTipAlignment.POSITIVE_COLOR if point_num >= 0 else self.toolTipAlignment.NEGATIVE_COLOR

for denk, degerler in bonuslar:
    if point_num >= denk:
        for satir in degerler:
            self.toolTipAlignment.AutoAppendTextLine(getattr(localeInfo, satir), renk)
        self.toolTipAlignment.AppendSpace(2)
        break

Bu şekilde deneyebilirsin
Keşke bunun c++ versiyonu da olabilseydi :(
 
Keşke bunun c++ versiyonu da olabilseydi :(
C++:
    int point_num = 0; // ya da ch->GetBlaBla();
    std::vector<std::pair<int, std::vector<std::string>>> bonuslar = {
        {30000, {"ALIGN_BONUS_1_1", "ALIGN_BONUS_1_2", "ALIGN_BONUS_1_3"}},
        {25000, {"ALIGN_BONUS_2_1", "ALIGN_BONUS_2_2", "ALIGN_BONUS_2_3"}},
        {20000, {"ALIGN_BONUS_3_1", "ALIGN_BONUS_3_2", "ALIGN_BONUS_3_3"}},
        {18000, {"ALIGN_BONUS_4_1", "ALIGN_BONUS_4_2", "ALIGN_BONUS_4_3"}},
        {12000, {"ALIGN_BONUS_5_1", "ALIGN_BONUS_5_2", "ALIGN_BONUS_5_3"}},
        {8000, {"ALIGN_BONUS_6_1", "ALIGN_BONUS_6_2", "ALIGN_BONUS_6_3"}},
        {4000, {"ALIGN_BONUS_7_1", "ALIGN_BONUS_7_2", "ALIGN_BONUS_7_3"}},
        {1000, {"ALIGN_BONUS_8_1", "ALIGN_BONUS_8_2", "ALIGN_BONUS_8_3"}},
        {0, {"ALIGN_BONUS_0_1", "ALIGN_BONUS_0_2", "ALIGN_BONUS_0_3"}},
    };

    for (const auto& bonus : bonuslar)
    {
        int id = bonus.first;
        const auto& degerler = bonus.second;

        if (point_num >= id)
        {
            for (const auto& satir : degerler)
            {
                // yaptıracağın islemler
            }
            break;
        }
        else
        {
            // ...değilse yaptıracağın islemler
        }
    }

Yapmak istediğin şeylere göre özelleştirmen gerek
 
Python:
bonuslar = [
    (30000, ["ALIGN_BONUS_1_1", "ALIGN_BONUS_1_2", "ALIGN_BONUS_1_3"]),
    (25000, ["ALIGN_BONUS_2_1", "ALIGN_BONUS_2_2", "ALIGN_BONUS_2_3"]),
    (20000, ["ALIGN_BONUS_3_1", "ALIGN_BONUS_3_2", "ALIGN_BONUS_3_3"]),
    (18000, ["ALIGN_BONUS_4_1", "ALIGN_BONUS_4_2", "ALIGN_BONUS_4_3"]),
    (12000, ["ALIGN_BONUS_5_1", "ALIGN_BONUS_5_2", "ALIGN_BONUS_5_3"]),
    (8000, ["ALIGN_BONUS_6_1", "ALIGN_BONUS_6_2", "ALIGN_BONUS_6_3"]),
    (4000, ["ALIGN_BONUS_7_1", "ALIGN_BONUS_7_2", "ALIGN_BONUS_7_3"]),
    (1000, ["ALIGN_BONUS_8_1", "ALIGN_BONUS_8_2", "ALIGN_BONUS_8_3"]),
    (0, ["ALIGN_BONUS_0_1", "ALIGN_BONUS_0_2", "ALIGN_BONUS_0_3"]),
]

renk = self.toolTipAlignment.POSITIVE_COLOR if point_num >= 0 else self.toolTipAlignment.NEGATIVE_COLOR

for denk, degerler in bonuslar:
    if point_num >= denk:
        for satir in degerler:
            self.toolTipAlignment.AutoAppendTextLine(getattr(localeInfo, satir), renk)
        self.toolTipAlignment.AppendSpace(2)
        break

Bu şekilde deneyebilirsin
point_num yok deyip hata veriyor .

bu sefer de şunu fark ettim derece isimlerinin renklerini göstermiyor örn: derece - 'ye düşünce derece isimleri kırmızı tonlarında gözüküyor du ama şimdi gözükmüyor hep beyaz TITLE_RGB_NORMAL renginde gözüküyor +'lı derecelerin renkleride düzgün çalışmıyor. bazı fileslara baktım çok fazla derece seviyesi olanlar locale_game den renk vermiş nedeni ne olabilir ki?(c ekranında rrenkler düzgün gözüküyor ama karakterin isminin yanındaki derece isminin renkleri doğru çalışmıyor)
 
Son düzenleme:
point_num yok deyip hata veriyor .

bu sefer de şunu fark ettim derece isimlerinin renklerini göstermiyor örn: derece - 'ye düşünce derece isimleri kırmızı tonlarında gözüküyor du ama şimdi gözükmüyor hep beyaz TITLE_RGB_NORMAL renginde gözüküyor +'lı derecelerin renkleride düzgün çalışmıyor. bazı fileslara baktım çok fazla derece seviyesi olanlar locale_game den renk vermiş nedeni ne olabilir ki?(c ekranında rrenkler düzgün gözüküyor ama karakterin isminin yanındaki derece isminin renkleri doğru çalışmıyor)
renk tanımının üstüne point_num = bonuslar[0] ekleyebilirsin
Ayrıca kusura bakma unutmuşum, sistemin kullandığı isim neyse ona göre değiştirip uyarlaman gerekiyor yani point olarak kullanıyorsa verdiğim koddaki point_num kısımlarını point olarak değiştir
 
renk tanımının üstüne point_num = bonuslar[0] ekleyebilirsin
Ayrıca kusura bakma unutmuşum, sistemin kullandığı isim neyse ona göre değiştirip uyarlaman gerekiyor yani point olarak kullanıyorsa verdiğim koddaki point_num kısımlarını point olarak değiştir
teşekkür ederim sorunsuz çalışıyor ama renk sorunu devam ediyor bir fikrim varmıydı acaba?
 
teşekkür ederim sorunsuz çalışıyor ama renk sorunu devam ediyor bir fikrim varmıydı acaba?
Eğer benim verdiğim koddan sonra olduysa, uyarlama yapman gerekebilir.
Ama önceden de varsa yüzeysel olarak bir şey diyemem kodları görmem gerek
 
29.kıdem dahil sonrasındakilerin renkleri düzgün çalışıyor 33. kıdem hiç gözükmüyor. @Kaiser

1900000 ile 3000000 arasındakilerin renkler çalışıyor geri kalanı çalışmıyor.
 
29.kıdem dahil sonrasındakilerin renkleri düzgün çalışıyor 33. kıdem hiç gözükmüyor. @Kaiser

1900000 ile 3000000 arasındakilerin renkler çalışıyor geri kalanı çalışmıyor.
PythonPlayerModule.cpp :
C++:
PyObject * playerGetAlignmentData(PyObject* poSelf, PyObject* poArgs)
{
    CInstanceBase * pInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
    int iAlignmentPoint = 0;
    int iAlignmentGrade = 4;
    if (pInstance)
    {
        iAlignmentPoint = pInstance->GetAlignment();
        iAlignmentGrade = pInstance->GetAlignmentGrade();
    }
    return Py_BuildValue("ii", iAlignmentPoint, iAlignmentGrade);
}

Bunu şu şekilde değiştirip syserr'a düşen değerleri kontrol et. Eğer burdaki değerler doğru dönüyorsa sorun python tarafındadır. Dolayısıyla çıkan sonuçlara göre python tarafında kontrol sağlaman gerekir.
Yanlış dönüyorsa sorun kaynak dosyalarından kaynaklıdır.
C++:
PyObject * playerGetAlignmentData(PyObject* poSelf, PyObject* poArgs)
{
    CInstanceBase * pInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
    int iAlignmentPoint = 0;
    int iAlignmentGrade = 4;
    if (pInstance)
    {
        iAlignmentPoint = pInstance->GetAlignment();
        iAlignmentGrade = pInstance->GetAlignmentGrade();
        TraceError("Puan: "+iAlignmentPoint);
        TraceError("Derece:" +iAlignmentGrade);
    }
    return Py_BuildValue("ii", iAlignmentPoint, iAlignmentGrade);
}
 
PythonPlayerModule.cpp :
C++:
PyObject * playerGetAlignmentData(PyObject* poSelf, PyObject* poArgs)
{
    CInstanceBase * pInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
    int iAlignmentPoint = 0;
    int iAlignmentGrade = 4;
    if (pInstance)
    {
        iAlignmentPoint = pInstance->GetAlignment();
        iAlignmentGrade = pInstance->GetAlignmentGrade();
    }
    return Py_BuildValue("ii", iAlignmentPoint, iAlignmentGrade);
}

Bunu şu şekilde değiştirip syserr'a düşen değerleri kontrol et. Eğer burdaki değerler doğru dönüyorsa sorun python tarafındadır. Dolayısıyla çıkan sonuçlara göre python tarafında kontrol sağlaman gerekir.
Yanlış dönüyorsa sorun kaynak dosyalarından kaynaklıdır.
C++:
PyObject * playerGetAlignmentData(PyObject* poSelf, PyObject* poArgs)
{
    CInstanceBase * pInstance = CPythonPlayer::Instance().NEW_GetMainActorPtr();
    int iAlignmentPoint = 0;
    int iAlignmentGrade = 4;
    if (pInstance)
    {
        iAlignmentPoint = pInstance->GetAlignment();
        iAlignmentGrade = pInstance->GetAlignmentGrade();
        TraceError("Puan: "+iAlignmentPoint);
        TraceError("Derece:" +iAlignmentGrade);
    }
    return Py_BuildValue("ii", iAlignmentPoint, iAlignmentGrade);
}
Yaptığım hata şuymuş ;

client src de şu kısmı en başından beri düzenlemediğimden böyle oluyormuş
InstanceBase.h:
            TITLE_NUM                 = 9,
            TITLE_NONE                 = 4,

burayı düzenleyinde 33. kıdemin gözükmemesi, npclerin isimlerinin yanında tarafsız yazması, renklerin gözükmemesi vs. herşey düzeldi.
 
hataları, eksikleri, düzenlemeleri yaptıktan sonraki sonuç ;

Ekran Alıntısı.PNG


tek eksik: mevcut derece seviyesinden sonra gelecek olan seviyede hangi özelliği vereceğini yazdırmak kaldı ama for döngüsünü bir türlü ayarlayamadım. @Kaiser
 
hataları, eksikleri, düzenlemeleri yaptıktan sonraki sonuç ;

14228 eklentisini görüntüle

tek eksik: mevcut derece seviyesinden sonra gelecek olan seviyede hangi özelliği vereceğini yazdırmak kaldı ama for döngüsünü bir türlü ayarlayamadım. @Kaiser
Python:
        for i in xrange(40):
            if i == player.GetNewAlignmentData()-1:
                total = len(constInfo.derecebonus)
                if total == 0:
                    continue

                if int(constInfo.derecebonus[i]['applytype1']) > 0 and int(constInfo.derecebonus[i]['applyvalue1']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype1'])](int(constInfo.derecebonus[i]['applyvalue1'])), gradeColor)

                if int(constInfo.derecebonus[i]['applytype2']) > 0 and int(constInfo.derecebonus[i]['applyvalue2']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype2'])](int(constInfo.derecebonus[i]['applyvalue2'])), gradeColor)

                if int(constInfo.derecebonus[i]['applytype3']) > 0 and int(constInfo.derecebonus[i]['applyvalue3']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype3'])](int(constInfo.derecebonus[i]['applyvalue3'])), gradeColor)

Bunun altına ekleyip dene(for içine değil, aynı hizasına), çalışıp çalışmayacağından emin değilim.

Python:
        mevcut_level = player.GetNewAlignmentData() - 1
        sonraki_level = mevcut_level + 1
        if sonraki_level < len(constInfo.derecebonus):
            sonraki_derece_bilgi = constInfo.derecebonus[sonraki_level]
            if int(sonraki_derece_bilgi['applytype1']) > 0 and int(sonraki_derece_bilgi['applyvalue1']):
                self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(sonraki_derece_bilgi['applytype1'])](int(sonraki_derece_bilgi['applyvalue1'])))

            if int(sonraki_derece_bilgi['applytype2']) > 0 and int(sonraki_derece_bilgi['applyvalue2']):
                self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(sonraki_derece_bilgi['applytype2'])](int(sonraki_derece_bilgi['applyvalue2'])))

            if int(sonraki_derece_bilgi['applytype3']) > 0 and int(sonraki_derece_bilgi['applyvalue3']):
                self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(sonraki_derece_bilgi['applytype3'])](int(sonraki_derece_bilgi['applyvalue3'])))
 
Python:
        for i in xrange(40):
            if i == player.GetNewAlignmentData()-1:
                total = len(constInfo.derecebonus)
                if total == 0:
                    continue

                if int(constInfo.derecebonus[i]['applytype1']) > 0 and int(constInfo.derecebonus[i]['applyvalue1']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype1'])](int(constInfo.derecebonus[i]['applyvalue1'])), gradeColor)

                if int(constInfo.derecebonus[i]['applytype2']) > 0 and int(constInfo.derecebonus[i]['applyvalue2']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype2'])](int(constInfo.derecebonus[i]['applyvalue2'])), gradeColor)

                if int(constInfo.derecebonus[i]['applytype3']) > 0 and int(constInfo.derecebonus[i]['applyvalue3']):
                    self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(constInfo.derecebonus[i]['applytype3'])](int(constInfo.derecebonus[i]['applyvalue3'])), gradeColor)

Bunun altına ekleyip dene(for içine değil, aynı hizasına), çalışıp çalışmayacağından emin değilim.

Python:
        mevcut_level = player.GetNewAlignmentData() - 1
        sonraki_level = mevcut_level + 1
        if sonraki_level < len(constInfo.derecebonus):
            sonraki_derece_bilgi = constInfo.derecebonus[sonraki_level]
            if int(sonraki_derece_bilgi['applytype1']) > 0 and int(sonraki_derece_bilgi['applyvalue1']):
                self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(sonraki_derece_bilgi['applytype1'])](int(sonraki_derece_bilgi['applyvalue1'])))

            if int(sonraki_derece_bilgi['applytype2']) > 0 and int(sonraki_derece_bilgi['applyvalue2']):
                self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(sonraki_derece_bilgi['applytype2'])](int(sonraki_derece_bilgi['applyvalue2'])))

            if int(sonraki_derece_bilgi['applytype3']) > 0 and int(sonraki_derece_bilgi['applyvalue3']):
                self.toolTipAlignment.AutoAppendTextLine(AFFECT_DICT[int(sonraki_derece_bilgi['applytype3'])](int(sonraki_derece_bilgi['applyvalue3'])))
bu yorumundaki for döngüsü başka filestan alınma ve srcleri yok. GetNewAlignmentData fonksiyonu elimde yok o yüzden bu for döngüsünü kullanamıyorum.

ben senin verdiğin for döngüsünü kullanmıştım;
uicharacter.py:
        renk = self.toolTipAlignment.POSITIVE_COLOR if point >= 0 else self.toolTipAlignment.NEGATIVE_COLOR

        for denk, degerler in constInfo.bonuslar:
            if point >= denk:
                for satir in degerler:
                    self.toolTipAlignment.AutoAppendTextLine(getattr(localeInfo, satir) , renk)
                break
 
bu yorumundaki for döngüsü başka filestan alınma ve srcleri yok. GetNewAlignmentData fonksiyonu elimde yok o yüzden bu for döngüsünü kullanamıyorum.

ben senin verdiğin for döngüsünü kullanmıştım;
uicharacter.py:
        renk = self.toolTipAlignment.POSITIVE_COLOR if point >= 0 else self.toolTipAlignment.NEGATIVE_COLOR

        for denk, degerler in constInfo.bonuslar:
            if point >= denk:
                for satir in degerler:
                    self.toolTipAlignment.AutoAppendTextLine(getattr(localeInfo, satir) , renk)
                break
Ben de senin yukarıda verdiğin dosyalara dayanarak çözüm ürettim, senin elindeki dosyaların ve kodların farkılılığını görmeden bilemem doğal olarak. Son verdiğim kodun döngülerle bir bağlantısı yok, mantığını kavrarsan sendeki kodlara da kolaylıkla uyarlanabilir.
 
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.
Geri
Üst