Yardım BattlePass Syserr

Konu sahibi bu konuda soru soruyor. Sorusu ile ilgili bilgisi olanların yanıtlamasını bekliyor.

MCB

Premium Üye
Premium Üye
MT Üye
Mesaj
218
Çözümler
16
Beğeni
60
Puan
109
Ticaret Puanı
0
Kod:
0221 09:48:12114 :: Traceback (most recent call last):

0221 09:48:12114 ::   File "networkModule.py", line 234, in SetGamePhase

0221 09:48:12114 ::   File "system.py", line 177, in __hybrid_import

0221 09:48:12114 ::   File "system.py", line 142, in _process_result

0221 09:48:12114 ::   File "game.py", line 71, in <module>

0221 09:48:12114 ::   File "game.py", line 2102, in GameWindow

0221 09:48:12114 :: NameError
0221 09:48:12114 :: :
0221 09:48:12114 :: name 'self' is not defined
0221 09:48:12114 ::

1708525845124.png


Sebebini çözemedim Loading Ekranında takılı kalıyor

o kod bloğunu iptal ettikten sonraysa loading ekranında oyun kapanıyor.
syserr bu fakat battlepasswindow.py uiscriptte
Kod:
0221 17:33:20921 :: UISCRIPT_LOAD_ERROR: No module named grp [filename uiscript/battlepasswindow.py]
0221 17:33:20921 ::
uibattlepass.py(line:49) __LoadWindow
ui.py(line:4708) LoadScriptFile

BattlePassWindow.LoadWindow.LoadObject - <type 'exceptions.KeyError'>:'window'

0221 17:33:20921 :: ============================================================================================================
0221 17:33:20921 :: Abort!!!!
 
en eski şekilde 1 tab fazladan atarak ikisinede dener misin?
1708530872169.png


Bu şekilde yaparak o syserrden kurtuldum fakat şuranda
bu syserri alıyorum
Kod:
uibattlepass.py(line:49) __LoadWindow
ui.py(line:4708) LoadScriptFile

BattlePassWindow.LoadWindow.LoadObject - <type 'exceptions.KeyError'>:'window'

0221 18:53:18429 :: ============================================================================================================
0221 18:53:18429 :: Abort!!!!
 
15346 eklentisini görüntüle

Bu şekilde yaparak o syserrden kurtuldum fakat şuranda
bu syserri alıyorum
Kod:
uibattlepass.py(line:49) __LoadWindow
ui.py(line:4708) LoadScriptFile

BattlePassWindow.LoadWindow.LoadObject - <type 'exceptions.KeyError'>:'window'

0221 18:53:18429 :: ============================================================================================================
0221 18:53:18429 :: Abort!!!!
uiscript içindeki battlepaswindow mu pynin adı neyse ordan bi ss atar mısın
 
battlepasswindowu kod editörüne yükler misin pcde değilim bi kontrol edeyim
Kusurabakmayın evde değildim buyurun battlepasswindow

Kod:
import grp
import uiScriptLocale

BOARD_WIDTH = 650
BOARD_HEIGHT = 425

window = {
    "name" : "BattlePassWindow",
    "style" : ("movable", "float",),
   
    "x" : 0,
    "y" : 0,
   
    "width" : BOARD_WIDTH,
    "height" : BOARD_HEIGHT,
   
    "children" :
    (
        {
            "name" : "board",
            "type" : "board_with_titlebar",
            "style" : ("attach",),
           
            "x" : 0,
            "y" : 0,
           
            "width" : BOARD_WIDTH,
            "height" : BOARD_HEIGHT,
           
            "title" : "Battle Pass",
            "children" :
            (
                {
                    "name" : "left_board",
                    "type" : "board",
                   
                    "x" : 12,
                    "y" : 38,
                   
                    "width":120, "height":BOARD_HEIGHT-51,
                    "children" :
                    (
                        {
                            "name" : "left_board_up",
                            "type" : "board",
                           
                            "x" : 0,
                            "y" : 0,
                           
                            "width":120, "height":172,
                            "children" :
                            (
                                {
                                    "name" : "face_image",
                                    "type" : "image",
                                    "style" : ("attach",),
                                    "x" : 20,
                                    "y" : -10,
                                    "image" : "interfaz_illum/icons/faces/icon_mninja.tga",
                                },
                                {"name" : "NameSlot", "type" : "thinboard", "x" : 15, "y" : 85, "width" : 90,
                                    "children":
                                    (
                                        { "name":"Character_Text", "type":"text", "x":47, "y":7, "text":"Noname", "color":0xffa18c87, "text_horizontal_align":"center" },

                                    ),
                                },
                                {"name" : "LvLSlot", "type" : "thinboard", "x" : 63, "y" : 113, "width" : 40,
                                    "children":
                                    (
                                        { "name":"Level_Text", "type":"text", "x":22, "y":7, "text":"Lv: 400", "color":0xffa18c87, "text_horizontal_align":"center" },
                                    ),
                                },
                                {"name" : "StartSlot", "type" : "thinboard", "x" : 15, "y" : 141, "width" : 90,
                                    "children":
                                    (
                                        { "name":"Start_Text", "type":"text", "x":47, "y":7, "text":"Starts: 0", "color":0xffa18c87, "text_horizontal_align":"center" },

                                    ),
                                },
                            ),
                        },
                        {
                            "name" : "left_board_down",
                            "type" : "board",
                           
                            "x" : 0,
                            "y" : 175,
                           
                            "width":120, "height":BOARD_HEIGHT-51-175,
                            "children" :
                            (
                                {
                                    "name" : "BtnWeek1",
                                    "type" : "button",

                                    "x": 8,
                                    "y": 15,

                                    "default_image": "interfaz_illum/dominios/btn_domain1_n.png",
                                    "over_image": "interfaz_illum/dominios/btn_domain1_a.png",
                                    "down_image": "interfaz_illum/dominios/btn_domain1_a.png",
                                    "disable_image": "interfaz_illum/dominios/btn_domain1_d.png",
                                    "children" :
                                    (
                                        {
                                            "name": "fontButton",
                                            "type": "text",

                                            "x": 8,
                                            "y": 7,
                                   
                                            "fontname" : "Tahoma Bold:16",
                                            "text" : uiScriptLocale.BATTLEPASS_WEEK+" 1",
                                            "color" : 0xffff1a1a,

                                        },
                                        {
                                            "name" : "DominionIcon1",
                                            "type" : "expanded_image",
                                           
                                            "horizontal_align" : "right",

                                            "x": 27,
                                            "y": 3,
                           
                                            "image" : "interfaz_illum/dominios/grocery_coin_gamecoinmini1.png",
                                        },
                                    ),
                                },
                                {
                                    "name" : "BtnWeek2",
                                    "type" : "button",

                                    "x": 8,
                                    "y": 55,

                                    "default_image": "interfaz_illum/dominios/btn_domain2_n.png",
                                    "over_image": "interfaz_illum/dominios/btn_domain2_a.png",
                                    "down_image": "interfaz_illum/dominios/btn_domain2_a.png",
                                    "disable_image": "interfaz_illum/dominios/btn_domain2_d.png",
                                    "children" :
                                    (
                                        {
                                            "name": "fontButton",
                                            "type": "text",

                                            "x": 8,
                                            "y": 7,
                                   
                                            "fontname" : "Tahoma Bold:16",
                                            "text" : uiScriptLocale.BATTLEPASS_WEEK+" 2",
                                            "color" : 0xff66ff66,

                                        },
                                        {
                                            "name" : "DominionIcon2",
                                            "type" : "expanded_image",
                                           
                                            "horizontal_align" : "right",

                                            "x": 27,
                                            "y": 3,
                           
                                            "image" : "interfaz_illum/dominios/grocery_coin_gamecoinmini2.png",
                                        },
                                    ),
                                },
                                {
                                    "name" : "BtnWeek3",
                                    "type" : "button",

                                    "x": 8,
                                    "y": 55+40,

                                    "default_image": "interfaz_illum/dominios/btn_domain3_n.png",
                                    "over_image": "interfaz_illum/dominios/btn_domain3_a.png",
                                    "down_image": "interfaz_illum/dominios/btn_domain3_a.png",
                                    "disable_image": "interfaz_illum/dominios/btn_domain3_d.png",
                                    "children" :
                                    (
                                        {
                                            "name": "fontButton",
                                            "type": "text",

                                            "x": 8,
                                            "y": 7,
                                   
                                            "fontname" : "Tahoma Bold:16",
                                            "text" : uiScriptLocale.BATTLEPASS_WEEK+" 3",
                                            "color" : 0xff66ffff,

                                        },
                                        {
                                            "name" : "DominionIcon3",
                                            "type" : "expanded_image",
                                           
                                            "horizontal_align" : "right",

                                            "x": 27,
                                            "y": 3,
                           
                                            "image" : "interfaz_illum/dominios/grocery_coin_gamecoinmini3.png",
                                        },
                                    ),
                                },
                                {
                                    "name" : "BtnWeek4",
                                    "type" : "button",

                                    "x": 8,
                                    "y": 55+40+40,

                                    "default_image": "interfaz_illum/dominios/btn_domain4_n.png",
                                    "over_image": "interfaz_illum/dominios/btn_domain4_a.png",
                                    "down_image": "interfaz_illum/dominios/btn_domain4_a.png",
                                    "disable_image": "interfaz_illum/dominios/btn_domain4_d.png",
                                    "children" :
                                    (
                                        {
                                            "name": "fontButton",
                                            "type": "text",

                                            "x": 8,
                                            "y": 7,
                                   
                                            "fontname" : "Tahoma Bold:16",
                                            "text" : uiScriptLocale.BATTLEPASS_WEEK+" 4",
                                            "color" : 0xffffff33,

                                        },
                                        {
                                            "name" : "DominionIcon4",
                                            "type" : "expanded_image",
                                           
                                            "horizontal_align" : "right",

                                            "x": 27,
                                            "y": 3,
                           
                                            "image" : "interfaz_illum/dominios/grocery_coin_gamecoinmini4.png",
                                        },
                                    ),
                                },
                                {
                                    "name" : "BtnRecompensa",
                                    "type" : "button",

                                    "x": 15,
                                    "y": 55+40+40+40,

                                    "default_image": "d:/ymir work/ui/public/large_button_01.sub",
                                    "over_image": "d:/ymir work/ui/public/large_button_02.sub",
                                    "down_image": "d:/ymir work/ui/public/large_button_03.sub",
                                    "text": uiScriptLocale.BATTLEPASS_REWARD
                                },
                            ),
                        },
                    ),
                },
                {
                    "name" : "right_board",
                    "type" : "board",
                   
                    "x" : 136,
                    "y" : 38,
                   
                    "width":BOARD_WIDTH-149, "height":BOARD_HEIGHT-51,
                   
                    "children" :
                    (
                        {
                            "name" : "right_board_up_left",
                            "type" : "board",
                           
                            "x" : 0,
                            "y" : 0,
                           
                            "width":BOARD_WIDTH-149, "height":85,
                            "children" :
                            (
                                {
                                    "name" : "BGImage",
                                    "type" : "expanded_image",

                                    "x": 1,
                                    "y": 1,
                   
                                    "image" : "interfaz/battlepass/battlepass.png",
                                },
                            ),
                        },
                        {
                            "name" : "right_board_down",
                            "type" : "board",
                           
                            "x" : 0,
                            "y" : 88,
                           
                            "width":BOARD_WIDTH-149, "height":BOARD_HEIGHT-51-88,
                            "children":
                            (
                                {
                                    "name" : "ScrollBar",
                                    "type" : "scrollbar",
                                    "horizontal_align" : "right",
                                   
                                    "x" : 25,
                                    "y" : 11,
                                   
                                    "size" : 270,
                                },
                            ),
                        },
                    ),
                },
            ),
        },
    ),
}
 
Kusurabakmayın evde değildim buyurun battlepasswindow

Kod:
import grp
import uiScriptLocale

BOARD_WIDTH = 650
BOARD_HEIGHT = 425

window = {
    "name" : "BattlePassWindow",
    "style" : ("movable", "float",),
  
    "x" : 0,
    "y" : 0,
  
    "width" : BOARD_WIDTH,
    "height" : BOARD_HEIGHT,
  
    "children" :
    (
        {
            "name" : "board",
            "type" : "board_with_titlebar",
            "style" : ("attach",),
          
            "x" : 0,
            "y" : 0,
          
            "width" : BOARD_WIDTH,
            "height" : BOARD_HEIGHT,
          
            "title" : "Battle Pass",
            "children" :
            (
                {
                    "name" : "left_board",
                    "type" : "board",
                  
                    "x" : 12,
                    "y" : 38,
                  
                    "width":120, "height":BOARD_HEIGHT-51,
                    "children" :
                    (
                        {
                            "name" : "left_board_up",
                            "type" : "board",
                          
                            "x" : 0,
                            "y" : 0,
                          
                            "width":120, "height":172,
                            "children" :
                            (
                                {
                                    "name" : "face_image",
                                    "type" : "image",
                                    "style" : ("attach",),
                                    "x" : 20,
                                    "y" : -10,
                                    "image" : "interfaz_illum/icons/faces/icon_mninja.tga",
                                },
                                {"name" : "NameSlot", "type" : "thinboard", "x" : 15, "y" : 85, "width" : 90,
                                    "children":
                                    (
                                        { "name":"Character_Text", "type":"text", "x":47, "y":7, "text":"Noname", "color":0xffa18c87, "text_horizontal_align":"center" },

                                    ),
                                },
                                {"name" : "LvLSlot", "type" : "thinboard", "x" : 63, "y" : 113, "width" : 40,
                                    "children":
                                    (
                                        { "name":"Level_Text", "type":"text", "x":22, "y":7, "text":"Lv: 400", "color":0xffa18c87, "text_horizontal_align":"center" },
                                    ),
                                },
                                {"name" : "StartSlot", "type" : "thinboard", "x" : 15, "y" : 141, "width" : 90,
                                    "children":
                                    (
                                        { "name":"Start_Text", "type":"text", "x":47, "y":7, "text":"Starts: 0", "color":0xffa18c87, "text_horizontal_align":"center" },

                                    ),
                                },
                            ),
                        },
                        {
                            "name" : "left_board_down",
                            "type" : "board",
                          
                            "x" : 0,
                            "y" : 175,
                          
                            "width":120, "height":BOARD_HEIGHT-51-175,
                            "children" :
                            (
                                {
                                    "name" : "BtnWeek1",
                                    "type" : "button",

                                    "x": 8,
                                    "y": 15,

                                    "default_image": "interfaz_illum/dominios/btn_domain1_n.png",
                                    "over_image": "interfaz_illum/dominios/btn_domain1_a.png",
                                    "down_image": "interfaz_illum/dominios/btn_domain1_a.png",
                                    "disable_image": "interfaz_illum/dominios/btn_domain1_d.png",
                                    "children" :
                                    (
                                        {
                                            "name": "fontButton",
                                            "type": "text",

                                            "x": 8,
                                            "y": 7,
                                  
                                            "fontname" : "Tahoma Bold:16",
                                            "text" : uiScriptLocale.BATTLEPASS_WEEK+" 1",
                                            "color" : 0xffff1a1a,

                                        },
                                        {
                                            "name" : "DominionIcon1",
                                            "type" : "expanded_image",
                                          
                                            "horizontal_align" : "right",

                                            "x": 27,
                                            "y": 3,
                          
                                            "image" : "interfaz_illum/dominios/grocery_coin_gamecoinmini1.png",
                                        },
                                    ),
                                },
                                {
                                    "name" : "BtnWeek2",
                                    "type" : "button",

                                    "x": 8,
                                    "y": 55,

                                    "default_image": "interfaz_illum/dominios/btn_domain2_n.png",
                                    "over_image": "interfaz_illum/dominios/btn_domain2_a.png",
                                    "down_image": "interfaz_illum/dominios/btn_domain2_a.png",
                                    "disable_image": "interfaz_illum/dominios/btn_domain2_d.png",
                                    "children" :
                                    (
                                        {
                                            "name": "fontButton",
                                            "type": "text",

                                            "x": 8,
                                            "y": 7,
                                  
                                            "fontname" : "Tahoma Bold:16",
                                            "text" : uiScriptLocale.BATTLEPASS_WEEK+" 2",
                                            "color" : 0xff66ff66,

                                        },
                                        {
                                            "name" : "DominionIcon2",
                                            "type" : "expanded_image",
                                          
                                            "horizontal_align" : "right",

                                            "x": 27,
                                            "y": 3,
                          
                                            "image" : "interfaz_illum/dominios/grocery_coin_gamecoinmini2.png",
                                        },
                                    ),
                                },
                                {
                                    "name" : "BtnWeek3",
                                    "type" : "button",

                                    "x": 8,
                                    "y": 55+40,

                                    "default_image": "interfaz_illum/dominios/btn_domain3_n.png",
                                    "over_image": "interfaz_illum/dominios/btn_domain3_a.png",
                                    "down_image": "interfaz_illum/dominios/btn_domain3_a.png",
                                    "disable_image": "interfaz_illum/dominios/btn_domain3_d.png",
                                    "children" :
                                    (
                                        {
                                            "name": "fontButton",
                                            "type": "text",

                                            "x": 8,
                                            "y": 7,
                                  
                                            "fontname" : "Tahoma Bold:16",
                                            "text" : uiScriptLocale.BATTLEPASS_WEEK+" 3",
                                            "color" : 0xff66ffff,

                                        },
                                        {
                                            "name" : "DominionIcon3",
                                            "type" : "expanded_image",
                                          
                                            "horizontal_align" : "right",

                                            "x": 27,
                                            "y": 3,
                          
                                            "image" : "interfaz_illum/dominios/grocery_coin_gamecoinmini3.png",
                                        },
                                    ),
                                },
                                {
                                    "name" : "BtnWeek4",
                                    "type" : "button",

                                    "x": 8,
                                    "y": 55+40+40,

                                    "default_image": "interfaz_illum/dominios/btn_domain4_n.png",
                                    "over_image": "interfaz_illum/dominios/btn_domain4_a.png",
                                    "down_image": "interfaz_illum/dominios/btn_domain4_a.png",
                                    "disable_image": "interfaz_illum/dominios/btn_domain4_d.png",
                                    "children" :
                                    (
                                        {
                                            "name": "fontButton",
                                            "type": "text",

                                            "x": 8,
                                            "y": 7,
                                  
                                            "fontname" : "Tahoma Bold:16",
                                            "text" : uiScriptLocale.BATTLEPASS_WEEK+" 4",
                                            "color" : 0xffffff33,

                                        },
                                        {
                                            "name" : "DominionIcon4",
                                            "type" : "expanded_image",
                                          
                                            "horizontal_align" : "right",

                                            "x": 27,
                                            "y": 3,
                          
                                            "image" : "interfaz_illum/dominios/grocery_coin_gamecoinmini4.png",
                                        },
                                    ),
                                },
                                {
                                    "name" : "BtnRecompensa",
                                    "type" : "button",

                                    "x": 15,
                                    "y": 55+40+40+40,

                                    "default_image": "d:/ymir work/ui/public/large_button_01.sub",
                                    "over_image": "d:/ymir work/ui/public/large_button_02.sub",
                                    "down_image": "d:/ymir work/ui/public/large_button_03.sub",
                                    "text": uiScriptLocale.BATTLEPASS_REWARD
                                },
                            ),
                        },
                    ),
                },
                {
                    "name" : "right_board",
                    "type" : "board",
                  
                    "x" : 136,
                    "y" : 38,
                  
                    "width":BOARD_WIDTH-149, "height":BOARD_HEIGHT-51,
                  
                    "children" :
                    (
                        {
                            "name" : "right_board_up_left",
                            "type" : "board",
                          
                            "x" : 0,
                            "y" : 0,
                          
                            "width":BOARD_WIDTH-149, "height":85,
                            "children" :
                            (
                                {
                                    "name" : "BGImage",
                                    "type" : "expanded_image",

                                    "x": 1,
                                    "y": 1,
                  
                                    "image" : "interfaz/battlepass/battlepass.png",
                                },
                            ),
                        },
                        {
                            "name" : "right_board_down",
                            "type" : "board",
                          
                            "x" : 0,
                            "y" : 88,
                          
                            "width":BOARD_WIDTH-149, "height":BOARD_HEIGHT-51-88,
                            "children":
                            (
                                {
                                    "name" : "ScrollBar",
                                    "type" : "scrollbar",
                                    "horizontal_align" : "right",
                                  
                                    "x" : 25,
                                    "y" : 11,
                                  
                                    "size" : 270,
                                },
                            ),
                        },
                    ),
                },
            ),
        },
    ),
}
uibattlepasside yükler misin kod editörüne
 
uibattlepasside yükler misin kod editörüne
Buyurun Hocam

Kod:
import ui
import net
import app
import player
import chat
import math
import wndMgr
import localeInfo
import serverInfo
import background
import uiCommon
import constInfo
import grp
import mouseModule
import item
import event
import uiScriptLocale
import playerSettingModule
import uibattlepasspassinfo
import uiToolTip
import nonplayer
import dbg
import time

img_faces = {
    playerSettingModule.RACE_WARRIOR_M    : "interfaz_illum/icons/faces/icon_mwarrior.tga",
    playerSettingModule.RACE_WARRIOR_W    : "interfaz_illum/icons/faces/icon_wwarrior.tga",
    playerSettingModule.RACE_ASSASSIN_M    : "interfaz_illum/icons/faces/icon_mninja.tga",
    playerSettingModule.RACE_ASSASSIN_W    : "interfaz_illum/icons/faces/icon_wninja.tga",
    playerSettingModule.RACE_SURA_M        : "interfaz_illum/icons/faces/icon_msura.tga",
    playerSettingModule.RACE_SURA_W        : "interfaz_illum/icons/faces/icon_wsura.tga",
    playerSettingModule.RACE_SHAMAN_M    : "interfaz_illum/icons/faces/icon_mshaman.tga",
    playerSettingModule.RACE_SHAMAN_W    : "interfaz_illum/icons/faces/icon_wshaman.tga"
}

class BattlePassWindow(ui.ScriptWindow):

    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.isLoaded = False
        self.__LoadWindow()
        
    def __del__(self):
        ui.ScriptWindow.__del__(self)

    def __LoadWindow(self):
        try:
            PythonScriptLoader = ui.PythonScriptLoader()
            PythonScriptLoader.LoadScriptFile(self, "UIScript/battlepasswindow.py")
        except:
            import exception
            exception.Abort("BattlePassWindow.LoadWindow.LoadObject")
        
        self.week = 1
        self.challengePos = 0
        self.Progress = 0
        self.BtnWeekCat = {}
        self.elements = {}
        self.vip = 0
        self.starts = -1

        self.board = self.GetChild("board")
        self.board.SetCloseEvent(ui.__mem_func__(self.Close))
        
        self.right_board_up_left = self.GetChild("right_board_up_left")
        self.right_board_down = self.GetChild("right_board_down")
        self.face_image = self.GetChild("face_image")
        self.Character_Text = self.GetChild("Character_Text")
        self.Level_Text = self.GetChild("Level_Text")
        self.Start_Text = self.GetChild("Start_Text")
        #
        self.BtnRecompensa = self.GetChild("BtnRecompensa")
        self.BtnRecompensa.SetEvent(self.OpenRewards)
        #
        
        self.Character_Text.SetText("%s" % player.GetName())
        race = net.GetMainActorRace()   
        faces = img_faces[race]
        self.face_image.LoadImage(faces)
        self.LoadWeeks()
        self.LoadChallenges()
        
        self.isLoaded = True
        
    def LoadWeeks(self):
        self.BtnWeek1 = self.GetChild("BtnWeek1")
        self.BtnWeek2 = self.GetChild("BtnWeek2")
        self.BtnWeek3 = self.GetChild("BtnWeek3")
        self.BtnWeek4 = self.GetChild("BtnWeek4")
        self.BtnWeek1.SetEvent(ui.__mem_func__(self.SetWeek), 1)
        self.BtnWeek2.SetEvent(ui.__mem_func__(self.SetWeek), 2)
        self.BtnWeek3.SetEvent(ui.__mem_func__(self.SetWeek), 3)
        self.BtnWeek4.SetEvent(ui.__mem_func__(self.SetWeek), 4)
        
    def LoadChallenges(self):
        self.elements = {
            'battlepass' : {
                'scrollbar' : self.GetChild("ScrollBar"),
                'box_0' : ChallengeBox(), 'box_1' : ChallengeBox(), 'box_2' : ChallengeBox(), 'box_3' : ChallengeBox(), 'box_4' : ChallengeBox(), 'box_5' : ChallengeBox(), 'box_6' : ChallengeBox(),
            },
        }
        
        for i in xrange(7):
            self.elements['battlepass']['box_%d' % i].Open(self.right_board_down, -5, 13+40*i)
        
        self.elements['battlepass']['scrollbar'].SetScrollEvent(ui.__mem_func__(self.__OnScroll))

    def __OnScroll(self):
        try:
            challengelen = len(constInfo.BattlePass['week'][self.week])
            self.challengePos = int(self.elements['battlepass']['scrollbar'].GetPos() * (challengelen-5))
        except:
            pass
        self.RefreshChallenges()
        
    def RefreshChallenges(self):
        longitud = len(constInfo.BattlePass['week'][self.week])
        self.RefreshHide()
        
        if longitud > 0:
            for i in xrange(7):
                if (i+self.challengePos<longitud):
                    curMision = constInfo.BattlePass['week'][self.week][i+self.challengePos]
                    #                                                                it->second.id, it->second.mision, mycount, it->second.count, finished, type,          premium,      starts,     claimed
                    self.elements['battlepass']['box_%d' % i].SetContent(self.week, curMision[0], curMision[1], curMision[2], curMision[3], curMision[4], curMision[5], curMision[6], curMision[7], curMision[8])
                    self.elements['battlepass']['box_%d' % i].Show()

            if longitud-1 >= 7:
                self.elements['battlepass']['scrollbar'].SetMiddleBarSize(float(5)/float(longitud-1))
                self.elements['battlepass']['scrollbar'].Show()
            
    def RefreshHide(self):
        for i in xrange(7):
            self.elements['battlepass']['box_%d' % i].Hide()

        self.elements['battlepass']['scrollbar'].Hide()
        
    def UpdateChallenge(self, week, idMision, mision, count, finished, claimed):
        if len(constInfo.BattlePass['week']) > 0 and len(constInfo.BattlePass['week'][week]) > 0 and week in constInfo.BattlePass['week']:
            for i in xrange(len(constInfo.BattlePass['week'][week])):
                if constInfo.BattlePass['week'][week][i][0] == idMision:
                    constInfo.BattlePass['week'][week][i][1] = mision
                    constInfo.BattlePass['week'][week][i][2] = count
                    constInfo.BattlePass['week'][week][i][4] = finished
                    constInfo.BattlePass['week'][week][i][8] = claimed
    
            self.RefreshChallenges()
            
    def UpdateStarts(self):
        self.starts = constInfo.BattlePass['starts']
        print self.starts
        self.Start_Text.SetText("Starts: %d" % self.starts)
        if self.vip != constInfo.BattlePass['premium']:
            self.vip = constInfo.BattlePass['premium']
            self.RefreshChallenges()

    def SetWeek(self, week):
        self.week = week
        self.SetDisable(week)
        
        if len(constInfo.BattlePass['week'][self.week]) == 0:
            net.SendChatPacket("/battlepass_load %d" % week)
        else:
            self.RefreshChallenges()

    def SetDisable(self, week):
        self.CleanDisable()
        if week == 1:
            self.BtnWeek1.Disable()
        elif week == 2:
            self.BtnWeek2.Disable()
        elif week == 3:
            self.BtnWeek3.Disable()
        elif week == 4:
            self.BtnWeek4.Disable()

    def CleanDisable(self):
        self.BtnWeek1.Enable()
        self.BtnWeek2.Enable()
        self.BtnWeek3.Enable()
        self.BtnWeek4.Enable()

    def OpenRewards(self):
        self.rewards = BattlePassRewardWindow()
        self.rewards.Open()

    def OnUpdate(self):
        self.Level_Text.SetText("Lv: %d" % player.GetStatus(player.LEVEL))
    
    def Destroy(self):
        self.Close()
        self.ClearDictionary()
        
    def Close(self):
        self.Hide()
        return TRUE
        
    def OnPressEscapeKey(self):
        self.Close()
        return TRUE
        
    def OnPressExitKey(self):
        self.Close()
        return TRUE

    def Open(self):
        if self.IsShow():
            self.Close()
        else:
            if len(constInfo.BattlePass['week']) <= 0:
                net.SendChatPacket("/battlepass_load 1")
            else:
                self.SetWeek(1)
            if constInfo.BattlePass['starts'] < 0:
                net.SendChatPacket("/battlepass_load_starts")
            self.SetCenterPosition()
            self.SetTop()
            self.Show()
#
class ChallengeBox(ui.ScriptWindow):
    
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.data = [0,0]
        self.week = 1
        self.isLoaded = False
        self.misionId = 0
        self.mision = 0
        self.finished = 0
        self.type = 1
        self.premium = 0
        self.starts = 5
        self.claimed = 0
        
    def LoadWindow(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "UIScript/battlepass_box.py")
        except:
            import exception
            exception.Abort("BattlePassBox.LoadWindow.LoadObject")
            
        try:
            self.challengeProgess = ChallengeProgressBar()
            self.challengeProgess.SetParent(self)
            self.challengeProgess.SetSize(300, 25)
            self.challengeProgess.SetPosition(0, 0)
            self.challengeProgess.SetProgress(15, 50)
            self.challengeProgess.Show()

            self.challengeTitle = self.GetChild("ChallengeTitle")
            self.challengeTitle.Hide()
            self.challengePoints = self.GetChild("ChallengePoints")
            self.StartsText = self.GetChild("StartsText")
            self.BtnEntregar = self.GetChild("BtnEntregar")
            self.BtnEntregar.Hide()
            self.BtnEntregar.SetEvent(self.EntregarItem)
            self.BtnClaim = self.GetChild("BtnClaim")
            self.BtnClaim.Hide()
            self.BtnClaim.SetEvent(self.ClaimMision3)
            self.ImgItem = self.GetChild("ImgItem")
            self.ImgItem.Hide()
            self.ImgStart = self.GetChild("ImgStart")
            self.BtnRecompensa = self.GetChild("BtnRecompensa")
            self.BtnRecompensa.SetEvent(self.FinishChallenge)
            self.BtnRecompensa.Hide()

            self.VipBar = ui.ExpandedImageBox()
            self.VipBar.SetParent(self)
            self.VipBar.AddFlag("not_pick")
            self.VipBar.LoadImage("interfaz/battlepass/vipbar.png")
            self.VipBar.Hide()
            
            self.toolTip = uiToolTip.ItemToolTip()
            self.toolTip.HideToolTip()
            
        except:
            import exception
            exception.Abort("ChallengeBox.LoadWindow.LoadObject")

        self.isLoaded = True

    def SetContent(self, week, misionId, mision, count, maxCount, finished, type, premium, starts, claimed):
        self.data = [count, maxCount]
        self.challengeProgess.SetProgress(count, maxCount)
        self.challengeProgess.SetWeek(week)
        self.week = week
        self.misionId = misionId
        self.mision = mision
        self.finished = finished
        self.type = type
        self.premium = premium
        self.starts = starts
        self.claimed = claimed
        
        self.StartsText.SetText("Starts %d" % starts)
        
        if (type == 2):
            self.BtnEntregar.Show()
            self.ImgItem.Show()
            self.BtnClaim.Hide()
            self.toolTip.ClearToolTip()
            metinSlot = [0,0,0,0,0]
            attrSlot = [(0, 0)] * player.ATTRIBUTE_SLOT_MAX_NUM
            self.toolTip.AddItemData(mision, metinSlot, attrSlot)
            self.toolTip.HideToolTip()
        else:
            self.BtnClaim.Hide()
            if (type == 3):
                self.BtnClaim.Show()
            self.BtnEntregar.Hide()
            self.ImgItem.Hide()

        if self.data[1] == self.data[0]:
            self.BtnRecompensa.Show()
            if self.claimed:
                self.BtnRecompensa.Disable()
            else:
                self.BtnRecompensa.Enable()
            self.BtnEntregar.Hide()
            self.ImgItem.Hide()
            self.BtnClaim.Hide()
            self.challengePoints.SetSize(65, 25)
        else:
            self.BtnRecompensa.Hide()
            self.challengePoints.SetSize(58, 25)
            
        if premium and not constInfo.BattlePass['premium']:
            self.VipBar.Show()
        else:
            self.VipBar.Hide()
            
        if (type == 1 or type == 3) and self.misionId in uibattlepasspassinfo.Challenges[self.week]:
            if self.misionId == 0:
                self.challengeProgess.SetText(uibattlepasspassinfo.Challenges[self.week][self.misionId][0])
            else:
                self.challengeProgess.SetText(uibattlepasspassinfo.Challenges[self.week][self.misionId][0] % maxCount)
        elif type == 2:
            item.SelectItem(mision)
            self.challengeProgess.SetText(uiScriptLocale.BATTLEPASS_GIVE+" %dx %s" % (maxCount, item.GetItemName()))
        else:
            self.challengeProgess.SetText("%dx" % maxCount)
            
        self.ImgStart.LoadImage(uibattlepasspassinfo.img_button_dominio[self.week][0])
        self.StartsText.SetPackedFontColor(uibattlepassinfo.img_button_dominio[self.week][1])
        
    def EntregarItem(self):
        if (self.data[1]-self.data[0]>0):
            net.SendChatPacket("/battlepass_give_item %d %d" % (self.misionId, self.mision))
            
    def ClaimMision3(self):
        if (self.data[1]-self.data[0]>0):       
            net.SendChatPacket("/battlepass_mision_type3 %d" % (self.misionId))
        
    def FinishChallenge(self):
        if (self.claimed == 0):
            net.SendChatPacket("/battlepass_complete %d" % self.misionId)

    def __del__(self):
        ui.ScriptWindow.__del__(self)
        
    def Open(self, parent, x, y):
        if not self.isLoaded:
            self.LoadWindow()

        self.SetParent(parent)
        self.SetPosition(x, y)
        self.SetWindowHorizontalAlignCenter()
        self.Show()
        
    def OnUpdate(self):
        if self.ImgItem.IsIn():
            self.toolTip.ShowToolTip()
        else:
            self.toolTip.HideToolTip()
#
class ChallengeProgressBar(ui.Window):

    BACKGROUND_COLOR = grp.GenerateColor(0.0, 0.0, 0.0, 1.0)
    DARK_COLOR = grp.GenerateColor(0.4, 0.4, 0.4, 1.0)

    def __init__(self, layer = "UI"):
        ui.Window.__init__(self, layer)

        self.width = 0
        self.height = 0       
        self.progress = 0
        self.week = 1
        self.isFinished = False
        
        self.textLine = None
        self.textLineExtra = None
        
    def __del__(self):
        ui.Window.__del__(self)

    def SetSize(self, width, height):
        ui.Window.SetSize(self, width, height)
        self.width = width
        self.height = height

    def SetProgress(self, current, max, pos=False):
        try:
            self.progress = min(math.ceil((float(current)/float(max))*100.00), 100)
        except:
            self.progress = 0
        if self.progress == 100:
            self.isFinished = True
        else:
            self.isFinished = False
        
        if not self.textLine:       
            textLine = ui.TextLine()
            textLine.SetParent(self)
            textLine.SetOutline()
            textLine.Show()
            self.textLine = textLine
        
        if current > max:
            self.textLine.SetText('%d/%d' % (max, max))
        else:
            self.textLine.SetText('%d/%d' % (current, max))
        if pos:
            self.textLine.SetPosition(40, self.GetHeight()/2)
        else:
            self.textLine.SetPosition(125, self.GetHeight()/2)
        self.textLine.SetHorizontalAlignCenter()
        self.textLine.SetWindowHorizontalAlignCenter()
        self.textLine.SetVerticalAlignCenter()
        
    def SetText(self, text):
        if not self.textLineExtra:       
            textLineExtra = ui.TextLine()
            textLineExtra.SetParent(self)
            textLineExtra.SetPosition(12, self.GetHeight()/2)
            textLineExtra.SetVerticalAlignCenter()
            textLineExtra.SetOutline()
            textLineExtra.Show()
            self.textLineExtra = textLineExtra
        
        self.textLineExtra.SetText('%s' % text)
        
    def SetProgressPosition(self, x):
        self.textLine.SetPosition(x, self.GetHeight()/2)

    def SetWeek(self, week):
        self.week = week

    def OnRender(self):
        xRender, yRender = self.GetGlobalPosition()
        
        widthRender = self.width
        heightRender = self.height
        grp.SetColor(self.BACKGROUND_COLOR)
        grp.RenderBar(xRender, yRender, widthRender, heightRender)
        grp.SetColor(self.DARK_COLOR)
        grp.RenderLine(xRender, yRender, widthRender, 0)
        grp.RenderLine(xRender, yRender, 0, heightRender)
        grp.RenderLine(xRender, yRender+heightRender, widthRender+1, 0)
        grp.RenderLine(xRender+widthRender, yRender, 0, heightRender)

        if self.isFinished:
            grp.SetColor(uibattlepassinfo.color[self.week][1])
        else:
            grp.SetColor(uibattlepassinfo.color[self.week][0])

        grp.RenderBar(xRender + 2, yRender + 2, (self.width - 3) * self.progress / 100, heightRender - 3)
#
class BattlePassRewardWindow(ui.ScriptWindow):

    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.isLoaded = False
        self.__LoadWindow()
        
    def __del__(self):
        ui.ScriptWindow.__del__(self)

    def __LoadWindow(self):
        try:
            PythonScriptLoader = ui.PythonScriptLoader()
            PythonScriptLoader.LoadScriptFile(self, "UIScript/battlepass_reward.py")
        except:
            import exception
            exception.Abort("BattlePassRewardWindow.LoadWindow.LoadObject")

        self.board = self.GetChild("board")
        self.board.SetCloseEvent(ui.__mem_func__(self.Close))
        self.Character_Text = self.GetChild("Character_Text")
        self.Level_Text = self.GetChild("Level_Text")
        self.Starts_Text = self.GetChild("Starts_Text")
        self.Character_Text.SetText("%s" % player.GetName())
        
        self.elements = {}
        
        self.elements = {
            'reward_0' : BattlePassRewardBox(),'reward_1' : BattlePassRewardBox(),'reward_2' : BattlePassRewardBox(),'reward_3' : BattlePassRewardBox(),
            'reward_4' : BattlePassRewardBox(),'reward_5' : BattlePassRewardBox(),'reward_6' : BattlePassRewardBox(),'reward_7' : BattlePassRewardBox(),
            'reward_8' : BattlePassRewardBox(),'reward_9' : BattlePassRewardBox(),
        }
        
        for i in xrange(10):
            self.elements['reward_%d' % i].Open(self.board, -9, 90+(35*i))

        self.LoadRewards()
        self.isLoaded = True

    def LoadRewards(self):
        if len(constInfo.BattlePass['rewards']) == 0:
            net.SendChatPacket("/battlepass_load_rewards")
        else:
            self.UpdateRewards()

    def UpdateRewards(self):
        self.HideRewards()
        longitud = len(constInfo.BattlePass['rewards'])
        for i in xrange(10):
            if (i<longitud):
                curMision = constInfo.BattlePass['rewards'][i]
                self.elements['reward_%d' % i].SetContent(curMision[0], curMision[1], curMision[2], curMision[3], curMision[4], curMision[5])
                self.elements['reward_%d' % i].Show()

    def HideRewards(self):
        for i in xrange(10):
            self.elements['reward_%d' % i].Hide()

    def OnUpdate(self):
        self.Level_Text.SetText("Lv: %d" % player.GetStatus(player.LEVEL))
        self.Starts_Text.SetText("Starts: %d" % constInfo.BattlePass['starts'])       
    
    def Destroy(self):
        self.Close()
        self.ClearDictionary()
        
    def Close(self):
        self.Hide()
        return TRUE
        
    def OnPressEscapeKey(self):
        self.Close()
        return TRUE
        
    def OnPressExitKey(self):
        self.Close()
        return TRUE

    def Open(self):
        if self.IsShow():
            self.Close()
        else:
            self.SetCenterPosition()
            self.SetTop()
            self.Show()
            
class BattlePassRewardBox(ui.ScriptWindow):
    def __init__(self):
        ui.ScriptWindow.__init__(self)
        self.isLoaded = False
        self.id = 0
        self.starts = 0
        self.recompensa = 0
        self.tipo = 0
        self.green = grp.GenerateColor(0.3, 0.65, 0.0, 1.0)
        self.disable = grp.GenerateColor(0.45, 0.45, 0.45, 1.0)
        
    def LoadWindow(self):
        try:
            pyScrLoader = ui.PythonScriptLoader()
            pyScrLoader.LoadScriptFile(self, "UIScript/battlepass_reward_box.py")
        except:
            import exception
            exception.Abort("BattlePassRewardBoxWindow.LoadWindow.LoadObject")
            
        self.Name_Text = self.GetChild("Name_Text")
        self.Starts_Text = self.GetChild("Starts_Text")
        self.Obtener_Text = self.GetChild("Obtener_Text")
        self.BtnObtener = self.GetChild("BtnObtener")
        self.BtnObtener.SetEvent(self.ClaimReward)

        self.toolTipDesc = uiToolTip.ToolTip()
        self.toolTipDesc.HideToolTip()
        
        self.toolTipItem = uiToolTip.ItemToolTip()
        self.toolTipItem.HideToolTip()
        
        self.isLoaded = True

    def SetContent(self, id, starts, recompensa, count, tipo, finalizado):
        self.id = id
        self.starts = starts
        self.recompensa = recompensa
        self.count = count
        self.tipo = tipo
        if tipo == 2:
            self.BtnObtener.Hide()
            if constInfo.BattlePass['starts'] >= starts:
                self.Obtener_Text.SetTextColor(self.green)
            else:
                self.Obtener_Text.SetTextColor(self.disable)
        else:
            if finalizado == 1:
                self.BtnObtener.Hide()
                self.Obtener_Text.SetTextColor(self.green)
            else:
                if constInfo.BattlePass['starts'] >= starts:
                    self.BtnObtener.Show()
                else:
                    self.Obtener_Text.SetTextColor(self.disable)
                    self.BtnObtener.Hide()

        if tipo != 1:
            if uibattlepassinfo.Rewards.has_key(id):
                self.Name_Text.SetText(uibattlepassinfo.Rewards[id][0])
            else:
                self.Name_Text.SetText(uibattlepassinfo.Rewards[1][0])
        else:
            item.SelectItem(recompensa)
            self.Name_Text.SetText("%s" % item.GetItemName())

        if tipo != 1:
            self.toolTipDesc.ClearToolTip()
            if uibattlepassinfo.Rewards.has_key(id):
                self.toolTipDesc.SetTitle(uibattlepassinfo.Rewards[id][0])
                self.toolTipDesc.AppendSpace(5)
                self.toolTipDesc.AppendTextLine(uibattlepassinfo.Rewards[id][1])
                self.toolTipDesc.Hide()
            else:
                self.toolTipDesc.SetTitle(uibattlepassinfo.Rewards[1][0])
                self.toolTipDesc.AppendSpace(5)
                self.toolTipDesc.AppendTextLine(uibattlepassinfo.Rewards[1][1])
                self.toolTipDesc.Hide()
        else:
            self.toolTipItem.ClearToolTip()
            metinSlot = [0,0,0,0,0]
            attrSlot = [(0, 0)] * player.ATTRIBUTE_SLOT_MAX_NUM
            self.toolTipItem.AddItemData(recompensa, metinSlot, attrSlot)
            self.toolTipItem.Hide()
            
        self.Starts_Text.SetText("Starts: %d" % starts)
        
    def ClaimReward(self):
        net.SendChatPacket("/battlepass_claim_reward %d" % self.id)

    def __del__(self):
        ui.ScriptWindow.__del__(self)
        
    def OnUpdate(self):
        if self.Name_Text.IsIn():
            if self.tipo != 1:
                self.toolTipDesc.ShowToolTip()
            else:
                self.toolTipItem.ShowToolTip()
        else:
            self.toolTipItem.HideToolTip()
            self.toolTipDesc.HideToolTip()

    def Open(self, parent, x, y):
        if not self.isLoaded:
            self.LoadWindow()

        self.SetParent(parent)
        self.SetPosition(x, y)
        self.SetWindowHorizontalAlignCenter()
        self.Show()
#
 
Geri
Üst