Jump to content
  • 0

bonusboard


darkfun3

Question


hey guys where do i put this file uibonusboard.py. It's a bonus board that i found where can i put and make it appear when you press F7

import player 
import ui 

################################################################################################ 
## Bis auf 18 Bonis pro Seite erweiterbar. Wenn mehr erwuenscht, dann die boardWidth erhoehen. 
## Copyright by ProfEnte.                                                                       
################################################################################################ 

boardWidth = 350 
boardTitel = "Bonusboard" 
pageTitles = ["Spieler vs. Monster", "Spieler vs. Spieler", "Status"] 

playerPointList = [[ 
    ## Spieler vs Monster: 
    ["Stark ggn Teufel",48], 
    ["Stark ggn Untote",47], 
    ["Stark ggn Tiere",44], 
    ["Stark ggn Orks",45], 
    ["Stark ggn Esoterische",46], 
    ["Stark gegen Monster",53], 
    ], 
    ## Spieler vs Spieler: 
    [ 
    ["Schwertverteidigung",69], 
    ["Zweihandverteidigung",70], 
    ["Dolchverteidigung",71], 
    ["Pfeilwiderstand",74], 
    ["Magieverteidigung",77], 
    ["Glockenverteidigung",72], 
    ["Faecherverteidigung",73], 
    ["Pfeilangriff ausweichen",68], 
    ["Nahkampf abblocken",67], 
    ["Stark gg Krieger",54], 
    ["Stark gg Ninjas",55], 
    ["Stark gg Suras",56], 
    ["Stark gg Schamanen",57], 
    ["Abwehr gg Krieger",59], 
    ["Abwehr gg Ninjas",60], 
    ["Abwehr gg Suras",61], 
    ["Abwehr gg Schamanen",62], 
    ["Stark gg Halbmenschen",43], 
    ], 
    ## Status: 
    [ 
    ["Angriffswert",53], 
    ["Max. TP",1], 
    ["TP-Regeneration",32], 
    ["TP-Absorbierung",63], 
    ["EXP-Bonus",83], 
    ["Yang-Drop",84], 
    ["Item-Drop",85], 
    ["Durchbohrender Treffer",41], 
    ["Kritischer Treffer",40], 
    ["Ohnmachtschance",38], 
    ["Vergiftungschance",37], 
    ], 
] 

class Bonusboard(ui.ScriptWindow): 
    def __init__(self): 
        ui.ScriptWindow.__init__(self) 
        self.isLoaded = FALSE 
        self.Wnd = [[],[],[]] 
        self.Btn = [] 
        self.Page = 0 
         
    def __LoadScript(self): 
        global boardWidth 
        self.Board = ui.BoardWithTitleBar() 
        self.Board.SetSize(boardWidth,460) 
        self.Board.SetCenterPosition() 
        self.Board.AddFlag("movable") 
        self.Board.AddFlag("float") 
        self.Board.SetTitleName("Bonusboard") 
        self.Board.SetCloseEvent(self.Close) 
        self.Board.Show() 
         
        global playerPointList 
         
        for i in range(3): 
            x = 0 
            y = 0 
            for a in range(len(playerPointList[i])): 
                if a == 10+10*x: 
                    x = x+1 
                    y = 0 
                     
                self.CreateBonusBox(i,45+150*x,30+40*y) 
                y = y+1 
             
        for i in range(len(pageTitles)): 
            self.CreateChangeButton(30+100*i,425,pageTitles[i],i) 
             
        self.isLoaded = TRUE 

    def __del__(self): 
        ui.ScriptWindow.__del__(self) 
         
    def Destroy(self): 
        self.Hide() 
        self.Board.Hide() 
        self.ClearDictionary() 
         
    def Open(self): 
        if FALSE == self.isLoaded: 
            self.__LoadScript() 
        self.ChangeWnd(0) 
        self.SetTop() 
        self.Show() 
        self.Board.Show() 
         
    def ChangeWnd(self,page): 
        global pageTitles 
        global boardTitel 
        oldWnd = self.Wnd[self.Page] 
        wnd = self.Wnd[/page][page] 
         
        for i in range(len((oldWnd))): 
            for a in range(3): 
                oldWnd[i][a].Hide() 
             
        for i in range(len((wnd))): 
            for a in range(3): 
                wnd[i][a].Show() 

        self.Page = page 
         
        self.Board.SetTitleName(boardTitel + " - " + pageTitles[/page][page]) 
             
         
    def CreateChangeButton(self,x,y,text,idx): 
        btn = ui.Button() 
        btn.SetParent(self.Board) 
        btn.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub") 
        btn.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub") 
        btn.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub") 
        btn.SetText(text) 
        btn.SetPosition(x, y) 
        btn.SetEvent(self.ChangeWnd,idx) 
        btn.Show() 
         
        self.Btn.append(btn) 
         
    def CreateBonusBox(self,page,x,y): 
        desc = ui.TextLine() 
        desc.SetParent(self.Board) 
        desc.SetPosition(x,y) 
        desc.Hide() 
         
        slotBar = ui.SlotBar() 
        slotBar.SetParent(self.Board) 
        slotBar.SetSize(100,15) 
        slotBar.SetPosition(x,y+15) 
        slotBar.Hide() 
         
        attrValue = ui.TextLine() 
        attrValue.SetParent(slotBar) 
        attrValue.SetPosition(2,2) 
        attrValue.Hide() 
         
        self.Wnd[/page][page].append([desc,attrValue,slotBar]) 
         
    def OnUpdate(self): 
        global playerPointList 
        page = self.Page 
        wnd = self.Wnd[/page][page] 
        count = 0 
        _playerPointList = playerPointList[/page][page] 
         
        for a in range(len(_playerPointList)): 
            wnd[count][0].SetText(_playerPointList[a][0]) 
            wnd[count][1].SetText(str(player.GetStatus(_playerPointList[a][1]))) 
            count = count+1 
         
    def Close(self): 
        self.Hide() 
        self.Board.Hide() 

    def OnPressEscapeKey(self): 
        self.Close() 
        return TRUE 

    def OnPressExitKey(self): 
        self.Close() 
        return TRUE  
Link to comment
  • Answers 9
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

9 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.