Ich wollte versuchen Das Ingameranking einzubauen und da kommt der syserr
PHP Code:
0407 14:10:52825 :: GRANNY: r:/granny/rt/granny_file_info.cpp(145): File has run-time type tag of 0x8000000f, which doesn't match this version of Granny (0x80000010). Automatic conversion will be attempted.
0407 14:11:21828 :: Traceback (most recent call last):
0407 14:11:21828 :: File "game.py", line 1492, in OnKeyDown
0407 14:11:21829 :: File "game.py", line 341, in <lambda>
0407 14:11:21829 :: File "game.py", line 2350, in __rank
0407 14:11:21829 :: AttributeError
0407 14:11:21829 :: :
0407 14:11:21829 :: 'module' object has no attribute 'OptionDialog'
0407 14:11:21829 ::
0407 14:11:21831 :: Traceback (most recent call last):
0407 14:11:21833 :: File "game.py", line 1492, in OnKeyDown
0407 14:11:21834 :: File "game.py", line 341, in <lambda>
0407 14:11:21834 :: File "game.py", line 2350, in __rank
0407 14:11:21834 :: AttributeError
0407 14:11:21834 :: :
0407 14:11:21834 :: 'module' object has no attribute 'OptionDialog'
0407 14:11:21834 ::
0407 14:11:23087 :: Traceback (most recent call last):
0407 14:11:23087 :: File "game.py", line 1492, in OnKeyDown
0407 14:11:23087 :: File "game.py", line 341, in <lambda>
0407 14:11:23087 :: File "game.py", line 2350, in __rank
0407 14:11:23087 :: AttributeError
0407 14:11:23087 :: :
0407 14:11:23087 :: 'module' object has no attribute 'OptionDialog'
0407 14:11:23087 ::
0407 14:11:23088 :: Traceback (most recent call last):
0407 14:11:23088 :: File "game.py", line 1492, in OnKeyDown
0407 14:11:23089 :: File "game.py", line 341, in <lambda>
0407 14:11:23089 :: File "game.py", line 2350, in __rank
0407 14:11:23089 :: AttributeError
0407 14:11:23089 :: :
0407 14:11:23089 :: 'module' object has no attribute 'OptionDialog
0407 14:11:23089 ::
PHP Code:
def __rank(self):
import uiingameranking
self.ingamerank = uiingameranking.OptionDialog()
self.ingamerank.Show()
PHP Code:
onPressKeyDict[app.DIK_F7] = lambda : self.__rank()
PHP Code:
import ui
import snd
import systemSetting
import net
import chat
import app
import locale
import constInfo
import chrmgr
import player
import uiWhisper
import interfacemodule
import time
RankingStart = 0
RankingEnd = 0
RankingLeftOvers = 0
RankingCount = 0
RankingPage = 1
class MenuDialog(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__Initialize()
self.__Load()
def __del__(self):
ui.ScriptWindow.__del__(self)
def __Initialize(self):
self.titleBar = 0
def Destroy(self):
self.Hide()
return TRUE
def __Load_LoadScript(self, fileName):
try:
pyScriptLoader = ui.PythonScriptLoader()
pyScriptLoader.LoadScriptFile(self, "uiscript/ingamerank.py")
except:
import exception
exception.Abort("MenuDialog.__Load_LoadScript")
def __Load_BindObject(self):
try:
self.titleBar = self.GetChild("titlebar")
self.SearchCharacterButton = self.GetChild("Charactersearchbutton")
self.CharacterNameEditline = self.GetChild("Charactersearch_editline")
self.PageOneButton = self.GetChild("Page_one")
self.PageTwoButton = self.GetChild("Page_two")
self.PageThreeButton = self.GetChild("Page_three")
self.PageFourButton = self.GetChild("Page_four")
self.PageFiveButton = self.GetChild("Page_five")
#Rankinglist:
self.RankList=[]
self.RankList.append(self.GetChild("Rank_1"))
self.RankList.append(self.GetChild("Rank_2"))
self.RankList.append(self.GetChild("Rank_3"))
self.RankList.append(self.GetChild("Rank_4"))
self.RankList.append(self.GetChild("Rank_5"))
self.RankList.append(self.GetChild("Rank_6"))
self.RankList.append(self.GetChild("Rank_7"))
self.RankList.append(self.GetChild("Rank_8"))
self.RankList.append(self.GetChild("Rank_9"))
self.RankList.append(self.GetChild("Rank_10"))
#Levellist:
self.LevelList=[]
self.LevelList.append(self.GetChild("Rank_1_Level"))
self.LevelList.append(self.GetChild("Rank_2_Level"))
self.LevelList.append(self.GetChild("Rank_3_Level"))
self.LevelList.append(self.GetChild("Rank_4_Level"))
self.LevelList.append(self.GetChild("Rank_5_Level"))
self.LevelList.append(self.GetChild("Rank_6_Level"))
self.LevelList.append(self.GetChild("Rank_7_Level"))
self.LevelList.append(self.GetChild("Rank_8_Level"))
self.LevelList.append(self.GetChild("Rank_9_Level"))
self.LevelList.append(self.GetChild("Rank_10_Level"))
#Namelist
self.NameList=[]
self.NameList.append(self.GetChild("Rank_1_Name"))
self.NameList.append(self.GetChild("Rank_2_Name"))
self.NameList.append(self.GetChild("Rank_3_Name"))
self.NameList.append(self.GetChild("Rank_4_Name"))
self.NameList.append(self.GetChild("Rank_5_Name"))
self.NameList.append(self.GetChild("Rank_6_Name"))
self.NameList.append(self.GetChild("Rank_7_Name"))
self.NameList.append(self.GetChild("Rank_8_Name"))
self.NameList.append(self.GetChild("Rank_9_Name"))
self.NameList.append(self.GetChild("Rank_10_Name"))
#GuildList
self.GuidList=[]
self.GuidList.append(self.GetChild("Rank_1_Guild"))
self.GuidList.append(self.GetChild("Rank_2_Guild"))
self.GuidList.append(self.GetChild("Rank_3_Guild"))
self.GuidList.append(self.GetChild("Rank_4_Guild"))
self.GuidList.append(self.GetChild("Rank_5_Guild"))
self.GuidList.append(self.GetChild("Rank_6_Guild"))
self.GuidList.append(self.GetChild("Rank_7_Guild"))
self.GuidList.append(self.GetChild("Rank_8_Guild"))
self.GuidList.append(self.GetChild("Rank_9_Guild"))
self.GuidList.append(self.GetChild("Rank_10_Guild"))
#EmpireList
self.EmpireList=[]
self.EmpireList.append(self.GetChild("Rank_1_Empire"))
self.EmpireList.append(self.GetChild("Rank_2_Empire"))
self.EmpireList.append(self.GetChild("Rank_3_Empire"))
self.EmpireList.append(self.GetChild("Rank_4_Empire"))
self.EmpireList.append(self.GetChild("Rank_5_Empire"))
self.EmpireList.append(self.GetChild("Rank_6_Empire"))
self.EmpireList.append(self.GetChild("Rank_7_Empire"))
self.EmpireList.append(self.GetChild("Rank_8_Empire"))
self.EmpireList.append(self.GetChild("Rank_9_Empire"))
self.EmpireList.append(self.GetChild("Rank_10_Empire"))
#ExpPointsList
self.ExpPointsList=[]
self.ExpPointsList.append(self.GetChild("Rank_1_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_2_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_3_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_4_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_5_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_6_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_7_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_8_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_9_Exp"))
self.ExpPointsList.append(self.GetChild("Rank_10_Exp"))
except:
import exception
exception.Abort("MenuDialog.__Load_BindObject")
def __Load(self):
self.__Load_LoadScript("uiscript/ingamerank.py")
self.__Load_BindObject()
self.SetCenterPosition()
self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
self.SearchCharacterButton.SetEvent(ui.__mem_func__(self.SearchCharacter))
self.PageOneButton.SetEvent(ui.__mem_func__(self.SetPageOne))
self.PageTwoButton.SetEvent(ui.__mem_func__(self.SetPageTwo))
self.PageThreeButton.SetEvent(ui.__mem_func__(self.SetPageThree))
self.PageFourButton.SetEvent(ui.__mem_func__(self.SetPageFour))
self.PageFiveButton.SetEvent(ui.__mem_func__(self.SetPageFive))
def Show(self):
ui.ScriptWindow.Show(self)
self.WarteSchleife = WaitingDialog()
self.WarteSchleife.Open(0.3)
self.WarteSchleife.SAFE_SetTimeOverEvent(self.SetCharacterCount)
def SearchCharacter(self):
global RankingStart
global RankingEnd
import urllib
Character = self.CharacterNameEditline.GetText()
CharacterSearchUrl = "http://stamminator.bnn-network.de/huh/pages/search_client.php?" + str(Character)
CharacterCountUrl = "http://stamminator.bnn-network.de/huh/pages/client_char.php"
CharacterRanking = urllib.urlopen(CharacterSearchUrl).read()
CharacterCount = urllib.urlopen(CharacterCountUrl).read()
CharacterRanking = str(CharacterRanking)
CharacterCount = str(CharacterCount)
if CharacterRanking.find("#") != -1:
AccountStats = CharacterRanking.split("#")
CharacterCount = CharacterCount.split("/")
Rank = str(AccountStats[0])
CharacterName = str(AccountStats[1])
CharacterLevel = str(AccountStats[2])
CharacterGuild = str(AccountStats[3])
if str(CharacterGuild) == "":
CharacterGuild = "keine"
CharacterCount = str(CharacterCount[0])
RankLenght = len(Rank)
if RankLenght == 1:
Ranksign1 = Rank[:0]
Ranksign2 = Rank[0:]
upperlimit = 10
lowerlimit = 0
Ranksign = 1
if int(Ranksign) < 6:
self.ButtonVisuals(int(Ranksign))
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
# self.SetPageOne()
elif RankLenght == 2:
Ranksign1 = Rank[:1]
Ranksign2 = Rank[1:]
upperlimit = int(int(int(Ranksign1) + 1)*10)
lowerlimit = int(upperlimit - 10)
if int(Ranksign2) != 0:
Ranksign = int(int(Ranksign1) + 1)
elif int(Ranksign2) == 0:
Ranksign = int(int(Ranksign1) + 0)
upperlimit = int(upperlimit - 10)
lowerlimit = int(lowerlimit - 10)
if int(Ranksign) < 6:
self.ButtonVisuals(int(Ranksign))
elif int(Ranksign) >= 6:
self.ButtonVisuals(99)
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
##non tested part:
elif RankLenght == 3:
Ranksign1 = Rank[:2]
Ranksign2 = Rank[2:]
upperlimit = int(int(int(Ranksign1) + 1)*10)
lowerlimit = int(upperlimit - 10)
if int(Ranksign2) != 0:
Ranksign = int(int(Ranksign1) + 1)
elif int(Ranksign2) == 0:
Ranksign = int(int(Ranksign1) + 0)
upperlimit = int(upperlimit - 10)
lowerlimit = int(lowerlimit - 10)
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
elif RankLenght == 4:
Ranksign1 = Rank[:3]
Ranksign2 = Rank[3:]
upperlimit = int(int(int(Ranksign1) + 1)*10)
lowerlimit = int(upperlimit - 10)
if int(Ranksign2) != 0:
Ranksign = int(int(Ranksign1) + 1)
elif int(Ranksign2) == 0:
Ranksign = int(int(Ranksign1) + 0)
upperlimit = int(upperlimit - 10)
lowerlimit = int(lowerlimit - 10)
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
chat.AppendChat(chat.CHAT_TYPE_INFO, "Rangliste: " + str(Rank) + ", Name: " + str(CharacterName) + ", Level: " + str(CharacterLevel) + ", Gilde: " + str(CharacterGuild))
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, "Der Charakter " + str(Character) + " existiert nicht.")
def SpecialPage(self, lowerlimit, upperlimit, Ranksign, Rank):
global RankingStart
global RankingEnd
global RankingCount
global RankingPage
global RankingLeftOvers
if int(RankingCount) > int(lowerlimit):
RankingStart = int(lowerlimit)
if int(RankingCount) < int(upperlimit):
RankingEnd = int(RankingCount)
else:
RankingEnd = int(upperlimit)
RankingPage = int(Ranksign)
RankingLeftOvers = int(upperlimit - RankingEnd)
self.UpdateRanking(Rank)
if int(Ranksign) < 6:
self.ButtonVisuals(int(Ranksign))
elif int(Ranksign) >= 6:
self.ButtonVisuals(99)
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, "Es existieren lediglich " + str(RankingCount) + " Charaktere.")
def SetPageOne(self):
lowerlimit = 0
upperlimit = 10
Ranksign = 1
Rank = ""
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
def SetPageTwo(self):
lowerlimit = 10
upperlimit = 20
Ranksign = 2
Rank = ""
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
def SetPageThree(self):
lowerlimit = 20
upperlimit = 30
Ranksign = 3
Rank = ""
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
def SetPageFour(self):
lowerlimit = 30
upperlimit = 40
Ranksign = 4
Rank = ""
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
def SetPageFive(self):
lowerlimit = 40
upperlimit = 50
Ranksign = 5
Rank = ""
self.SpecialPage(lowerlimit, upperlimit, Ranksign, Rank)
def ButtonVisuals(self, button):
global RankingPage
if button == 1:
self.PageOneButton.SetUpVisual("d:/ymir work/ui/public/middle_button_03.sub")
self.PageTwoButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageThreeButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFourButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFiveButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
elif button == 2:
self.PageOneButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageTwoButton.SetUpVisual("d:/ymir work/ui/public/middle_button_03.sub")
self.PageThreeButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFourButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFiveButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
elif button == 3:
self.PageOneButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageTwoButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageThreeButton.SetUpVisual("d:/ymir work/ui/public/middle_button_03.sub")
self.PageFourButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFiveButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
elif button == 4:
self.PageOneButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageTwoButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageThreeButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFourButton.SetUpVisual("d:/ymir work/ui/public/middle_button_03.sub")
self.PageFiveButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
elif button == 5:
self.PageOneButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageTwoButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageThreeButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFourButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFiveButton.SetUpVisual("d:/ymir work/ui/public/middle_button_03.sub")
elif button == 99:
self.PageOneButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageTwoButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageThreeButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFourButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
self.PageFiveButton.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
else:
return
def SetCharacterCount(self):
global RankingStart
global RankingEnd
global RankingCount
import urllib
CharacterCountUrl = "http://stamminator.bnn-network.de/huh/pages/client_char.php"
CharacterCount = urllib.urlopen(CharacterCountUrl).read()
CharacterCount = str(CharacterCount)
CharacterCount = CharacterCount.split("/")
RankingEndCount = str(CharacterCount[0])
if int(RankingEndCount) >= 10:
RankingEnd = 10
elif int(RankingEndCount) < 10:
RankingEnd = int(RankingEndCount)
RankingStart = 0
RankingCount = int(RankingEndCount)
self.PageLoop()
def PageLoop(self):
global RankingPage
if int(RankingPage) == 1:
self.SetPageOne()
elif int(RankingPage) == 2:
self.SetPageTwo()
elif int(RankingPage) == 3:
self.SetPageThree()
elif int(RankingPage) == 4:
self.SetPageFour()
elif int(RankingPage) == 5:
self.SetPageFive()
#chat.AppendChat(chat.CHAT_TYPE_INFO, "Update erfolgreich")
def UpdateRanking(self, rank):
global RankingStart
global RankingEnd
global RankingPage
import urllib
RankingScriptUrl = "http://stamminator.bnn-network.de/huh/pages/ranking_client.php"
FullRanking = urllib.urlopen(RankingScriptUrl).read()
FullRanking = str(FullRanking)
FullAccount = FullRanking.split("|")
while RankingStart < RankingEnd:
Count = int(int(int(RankingPage) - 1)*10)
Ranking = str(FullAccount[RankingStart])
AccountData = Ranking.split("#")
self.RankList[int(RankingStart - Count)].SetText(str(RankingStart+1))
self.RankList[int(RankingStart - Count)].SetFontColor(1.0, 1.0, 1.0)
self.NameList[int(RankingStart - Count)].SetText(str(AccountData[1]))
self.NameList[int(RankingStart - Count)].SetFontColor(1.0, 1.0, 1.0)
self.LevelList[int(RankingStart - Count)].SetText(str(AccountData[2]))
self.LevelList[int(RankingStart - Count)].SetFontColor(1.0, 1.0, 1.0)
if str(AccountData[3]) != "":
self.GuidList[int(RankingStart - Count)].SetText(str(AccountData[3]))
else:
self.GuidList[int(RankingStart - Count)].SetText("-")
self.GuidList[int(RankingStart - Count)].SetFontColor(1.0, 1.0, 1.0)
if str(AccountData[4]) == "1":
self.EmpireList[int(RankingStart - Count)].LoadImage("d:/ymir work/ui/public/red_empire_ranking.sub")
elif str(AccountData[4]) == "2":
self.EmpireList[int(RankingStart - Count)].LoadImage("d:/ymir work/ui/public/yellow_empire_ranking.sub")
elif str(AccountData[4]) == "3":
self.EmpireList[int(RankingStart - Count)].LoadImage("d:/ymir work/ui/public/blue_empire_ranking.sub")
else:
self.EmpireList[int(RankingStart - Count)].SetText("-")
self.ExpPointsList[int(RankingStart - Count)].SetText(str(AccountData[5]))
self.ExpPointsList[int(RankingStart - Count)].SetFontColor(1.0, 1.0, 1.0)
RankingStart = RankingStart + 1
global RankingLeftOvers
for i in xrange(int(10-RankingLeftOvers), 10):
self.RankList[i].SetText("")
self.RankList[i].SetFontColor(1.0, 1.0, 1.0)
self.NameList[i].SetText("")
self.NameList[i].SetFontColor(1.0, 1.0, 1.0)
self.LevelList[i].SetText("")
self.LevelList[i].SetFontColor(1.0, 1.0, 1.0)
self.GuidList[i].SetText("")
self.GuidList[i].SetFontColor(1.0, 1.0, 1.0)
self.ExpPointsList[i].SetText("")
self.ExpPointsList[i].SetFontColor(1.0, 1.0, 1.0)
self.EmpireList[i].LoadImage("d:/ymir work/ui/public/no_empire_ranking.sub")
if str(rank) != "":
#chat.AppendChat(chat.CHAT_TYPE_INFO, "Ranglistenplatz: " + str(rank))
colour = int(int(rank) - int(Count) - 1)
self.RankList[int(colour)].SetFontColor(1.0, 0.6352941176470588, 0)
self.NameList[int(colour)].SetFontColor(1.0, 0.6352941176470588, 0)
self.LevelList[int(colour)].SetFontColor(1.0, 0.6352941176470588, 0)
self.GuidList[int(colour)].SetFontColor(1.0, 0.6352941176470588, 0)
self.ExpPointsList[int(colour)].SetFontColor(1.0, 0.6352941176470588, 0)
self.WarteSchleife = WaitingDialog()
self.WarteSchleife.Open(60.0*10)
self.WarteSchleife.SAFE_SetTimeOverEvent(self.PageLoop)
def Close(self):
self.Hide()
return TRUE
def OnPressEscapeKey(self):
self.Hide()
return TRUE
class WaitingDialog(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadDialog()
self.eventTimeOver = lambda *arg: None
self.eventExit = lambda *arg: None
def __del__(self):
ui.ScriptWindow.__del__(self)
def __LoadDialog(self):
try:
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/WarteSchleife.py")
except:
import exception
exception.Abort("WaitingDialog.LoadDialog.BindObject")
def Open(self, waitTime):
curTime = time.clock()
self.endTime = curTime + waitTime
self.Show()
def Close(self):
self.Hide()
def Destroy(self):
self.Hide()
def SAFE_SetTimeOverEvent(self, event):
self.eventTimeOver = ui.__mem_func__(event)
def SAFE_SetExitEvent(self, event):
self.eventExit = ui.__mem_func__(event)
def OnUpdate(self):
lastTime = max(0, self.endTime - time.clock())
if 0 == lastTime:
self.Close()
self.eventTimeOver()
else:
return
def OnPressExitKey(self):
self.Close()
return TRUE
mfg