Hallo M2DL,
Ich besitze das Biologensystem von Abizu2, funktioniert alles so weit so gut, doch man kann keine Items abgeben, die auf Seite 3, 4 oder 5 liegen.
Sobald das Item z.b. Orkzahn auf Seite 1 oder 2 liegt, kann man es normal abgeben. Ich denke, da ist in der python der Biologenquest ein Fehler.
Wäre euch sehr verbunden, wenn ihr mir da weiterhelfen könnt.
uibiology.py:
Code
- import ui
- import localeInfo
- import chat
- import app
- import uiToolTip
- import mouseModule
- import snd
- import player
- import TextReader
- import dbg
- import event
- import net
- import constinfo
- BASE_PATH = "locale/de/ui/biosystem/"
- class BioSystemNewBoard(ui.ScriptWindow):
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.Load()
- constinfo.bio = True
- def __del__(self):
- constinfo.bio = False
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemNewBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.board = GetObject("board")
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("SayText"),
- "button" : GetObject("Button"),
- }
- except:
- import exception
- exception.Abort("BioSystemNewBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.main["button"].SAFE_SetEvent(self.Close)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemNewBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_new.txt" % (questID)))
- btn = self.main["button"]
- btn.SetPosition(btn.GetLeft(), self.main["say_text"].GetBottom() + 5)
- self.board.SetSize(self.GetWidth(), btn.GetBottom() + 20)
- self.SetSize(self.GetWidth(), btn.GetBottom() + 20)
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemCurrentBoard(ui.ScriptWindow):
- class QuestStateData():
- def __init__(self):
- self.itemVnum = 0
- self.itemCount = 0
- self.itemCountGiven = 0
- self.itemCountChecking = 0
- self.checkingTimeOver = 0
- def LoadInformation(self, itemVnum, itemCount, itemCountGiven, itemCountChecking, checkingTimeLeft):
- self.SetItemVnum(itemVnum)
- self.SetItemCount(itemCount)
- self.SetItemCountGiven(itemCountGiven)
- self.SetItemCountChecking(itemCountChecking)
- self.SetCheckingTimeLeft(checkingTimeLeft)
- def GetItemVnum(self):
- return self.itemVnum
- def SetItemVnum(self, itemVnum):
- self.itemVnum = int(itemVnum)
- def GetItemCount(self):
- return self.itemCount
- def SetItemCount(self, itemCount):
- self.itemCount = int(itemCount)
- def GetItemCountGiven(self):
- return self.itemCountGiven
- def SetItemCountGiven(self, itemCountGiven):
- self.itemCountGiven = int(itemCountGiven)
- def GetItemCountNeed(self):
- return self.itemCount - self.itemCountGiven
- def GetItemCountChecking(self):
- return self.itemCountChecking
- def SetItemCountChecking(self, itemCountChecking):
- self.itemCountChecking = int(itemCountChecking)
- def GetCheckingTimeLeft(self):
- return int(self.checkingTimeOver - app.GetTime() + 0.5)
- def SetCheckingTimeLeft(self, checkingTimeLeft):
- if int(checkingTimeLeft) == 0:
- self.checkingTimeOver = 0
- else:
- self.checkingTimeOver = app.GetTime() + int(checkingTimeLeft)
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.questState = self.QuestStateData()
- self.itemToolTip = uiToolTip.ItemToolTip()
- self.itemToolTip.HideToolTip()
- self.selectedItemSlot = -1
- self.lastCheckingTimeLeft = 0
- self.Load()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemCurrentBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("BioSayText"),
- "item_slot" : GetObject("ItemSlot"),
- "item_button" : GetObject("ItemLeaveButton"),
- "info_text" : GetObject("InfoText"),
- }
- except:
- import exception
- exception.Abort("BioSystemCurrentBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- wndItem = self.main["item_slot"]
- wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
- wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
- wndItem.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
- wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
- self.main["item_button"].SAFE_SetEvent(self.OnClickItemButton)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemCurrentBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.selectedItemSlot = -1
- self.main["item_slot"].SetItemSlot(0, 0, 0)
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # key words
- itemSlotCount = 0
- if self.selectedItemSlot != -1:
- itemSlotCount = player.GetItemCount(self.selectedItemSlot)
- MyTextReader.AddKeyWord("[ITEM_MAX_COUNT]", str(self.questState.GetItemCount()))
- MyTextReader.AddKeyWord("[ITEM_SLOT_COUNT]", str(itemSlotCount))
- MyTextReader.AddKeyWord("[ITEM_LEFT_COUNT]", str(self.questState.GetItemCountNeed()))
- MyTextReader.AddKeyWord("[ITEM_GIVEN_COUNT]", str(self.questState.GetItemCountGiven()))
- MyTextReader.AddKeyWord("[ITEM_CHECKING_COUNT]", str(self.questState.GetItemCountChecking()))
- secondsLeft = self.questState.GetCheckingTimeLeft()
- MyTextReader.AddKeyWord("[ITEM_CHECKING_TIME_LEFT]", localeInfo.SecondToHMS(secondsLeft))
- # refresh lastCheckingTimeLeft
- self.lastCheckingTimeLeft = secondsLeft
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_current_say.txt" % (questID)))
- self.main["info_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_current_info.txt" % (questID)))
- self.main["item_button"].SetText(self.GetTextByFile(BASE_PATH + "%d_current_button.txt" % (questID), FALSE))
- def LoadQuestInformation(self, itemVnum, itemCount, itemCountGiven, checkingCount, timeLeft):
- self.questState.LoadInformation(itemVnum, itemCount, itemCountGiven, checkingCount, timeLeft)
- self.Refresh()
- def OnSelectEmptySlot(self, slotID):
- if mouseModule.mouseController.isAttached():
- attachedSlotType = mouseModule.mouseController.GetAttachedType()
- attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
- attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
- attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
- if player.SLOT_TYPE_INVENTORY == attachedSlotType:
- if self.questState.GetItemVnum() == attachedItemIndex:
- self.selectedItemSlot = attachedSlotPos
- itemCount = attachedItemCount
- if itemCount == 1:
- itemCount = 0
- self.main["item_slot"].SetItemSlot(0, attachedItemIndex, attachedItemCount)
- self.Refresh()
- else:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du benötigst einen anderen Gegenstand.")
- mouseModule.mouseController.DeattachObject()
- def OnSelectItemSlot(self, slotID):
- if mouseModule.mouseController.isAttached():
- self.OnSelectEmptySlot(slotID)
- else:
- itemSlotIndex = self.selectedItemSlot
- selectedItemVNum = player.GetItemIndex(itemSlotIndex)
- itemCount = player.GetItemCount(itemSlotIndex)
- mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
- snd.PlaySound("sound/ui/pick.wav")
- def OnOverInItem(self, slotID):
- self.itemToolTip.ClearToolTip()
- self.itemToolTip.SetInventoryItem(self.selectedItemSlot)
- self.itemToolTip.ShowToolTip()
- def OnOverOutItem(self):
- self.itemToolTip.HideToolTip()
- def OnClickItemButton(self):
- if self.selectedItemSlot == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du musst erst einen Gegenstand zum Abgeben wählen.")
- return
- self.managerWnd.SendQuestPacket(self.selectedItemSlot)
- def OnUpdate(self):
- if self.selectedItemSlot != -1 and player.GetItemIndex(self.selectedItemSlot) != self.questState.GetItemVnum():
- self.selectedItemSlot = -1
- self.main["item_slot"].SetItemSlot(0, 0, 0)
- self.Refresh()
- if self.lastCheckingTimeLeft != 0 and self.lastCheckingTimeLeft != self.questState.GetCheckingTimeLeft():
- self.lastCheckingTimeLeft = self.questState.GetCheckingTimeLeft()
- if self.lastCheckingTimeLeft <= 0:
- self.lastCheckingTimeLeft = 0
- self.questState.SetItemCountChecking(0)
- self.questState.SetCheckingTimeLeft(0)
- self.Refresh()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemFinishBoard(ui.ScriptWindow):
- class QuestStateData():
- def __init__(self):
- self.itemCountFailed = 0
- self.itemCountSuccess = 0
- def LoadInformation(self, itemCountFailed, itemCountSuccess):
- self.SetItemCountFailed(itemCountFailed)
- self.SetItemCountSuccess(itemCountSuccess)
- def GetItemCountFailed(self):
- return self.itemCountFailed
- def SetItemCountFailed(self, itemCountFailed):
- self.itemCountFailed = int(itemCountFailed)
- def GetItemCountSuccess(self):
- return self.itemCountSuccess
- def SetItemCountSuccess(self, itemCountSuccess):
- self.itemCountSuccess = int(itemCountSuccess)
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.questState = self.QuestStateData()
- self.Load()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemFinishBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("SayText"),
- "button" : GetObject("Button"),
- }
- except:
- import exception
- exception.Abort("BioSystemFinishBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.main["button"].SAFE_SetEvent(self.Close)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemFinishBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # key words
- MyTextReader.AddKeyWord("[ITEM_FAILED_COUNT]", str(self.questState.GetItemCountFailed()))
- MyTextReader.AddKeyWord("[ITEM_SUCCESS_COUNT]", str(self.questState.GetItemCountSuccess()))
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_finish_checking.txt" % (questID)))
- def LoadQuestInformation(self, failedCount, successCount):
- self.questState.LoadInformation(failedCount, successCount)
- self.Refresh()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemDoneBoard(ui.ScriptWindow):
- class QuestStateData():
- def __init__(self):
- self.itemCountSuccess = 0
- self.itemCountMax = 0
- self.itemCountBack = 0
- def LoadInformation(self, itemCountSuccess, itemCountMax, itemCountBack):
- self.SetItemCountSuccess(itemCountSuccess)
- self.SetItemCountMax(itemCountMax)
- self.SetItemCountBack(itemCountBack)
- def GetItemCountSuccess(self):
- return self.itemCountSuccess
- def SetItemCountSuccess(self, itemCountSuccess):
- self.itemCountSuccess = int(itemCountSuccess)
- def GetItemCountMax(self):
- return self.itemCountMax
- def SetItemCountMax(self, itemCountMax):
- self.itemCountMax = int(itemCountMax)
- def GetItemCountBack(self):
- return self.itemCountBack
- def SetItemCountBack(self, itemCountBack):
- self.itemCountBack = int(itemCountBack)
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.questState = self.QuestStateData()
- self.Load()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemDoneBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("SayText"),
- "button" : GetObject("Button"),
- }
- except:
- import exception
- exception.Abort("BioSystemDoneBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.main["button"].SAFE_SetEvent(self.Close)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemDoneBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # key words
- MyTextReader.AddKeyWord("[ITEM_COUNT_SUCCESS]", str(self.questState.GetItemCountSuccess()))
- MyTextReader.AddKeyWord("[ITEM_COUNT_MAX]", str(self.questState.GetItemCountMax()))
- MyTextReader.AddKeyWord("[ITEM_COUNT_BACK]", str(self.questState.GetItemCountBack()))
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_done.txt" % (questID)))
- def LoadQuestInformation(self, successCount, maxCount, backCount):
- self.questState.LoadInformation(successCount, maxCount, backCount)
- self.Refresh()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemRewardBoard(ui.ScriptWindow):
- class QuestStateData():
- def __init__(self):
- self.itemCountBack = 0
- def LoadInformation(self, itemCountBack):
- self.SetItemCountBack(itemCountBack)
- def GetItemCountBack(self):
- return self.itemCountBack
- def SetItemCountBack(self, itemCountBack):
- self.itemCountBack = int(itemCountBack)
- def __init__(self, managerWnd):
- ui.ScriptWindow.__init__(self)
- self.managerWnd = managerWnd
- self.questState = self.QuestStateData()
- self.Load()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def __LoadScript(self, fileName):
- try:
- pyScrLoader = ui.PythonScriptLoader()
- pyScrLoader.LoadScriptFile(self, fileName)
- except:
- import exception
- exception.Abort("BioSystemRewardBoard.LoadDialog.LoadScript")
- def __BindObject(self):
- try:
- GetObject=self.GetChild
- self.titleBar = GetObject("TitleBar")
- self.main = {
- "say_text" : GetObject("SayText"),
- "button" : GetObject("Button"),
- }
- except:
- import exception
- exception.Abort("BioSystemRewardBoard.LoadDialog.BindObject")
- self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
- self.main["button"].SAFE_SetEvent(self.Close)
- def Load(self):
- self.__LoadScript("UIScript/BioSystemRewardBoard.py")
- self.__BindObject()
- def Destroy(self):
- self.Close()
- def Open(self):
- if self.managerWnd.GetQuestID() == -1:
- chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
- return
- self.Refresh(TRUE)
- self.SetCenterPosition()
- self.Show()
- def Close(self):
- self.Hide()
- def GetTextByFile(self, fileName, autoEnter = TRUE):
- MyTextReader = TextReader.TextReader(autoEnter)
- # key words
- MyTextReader.AddKeyWord("[ITEM_BACK_COUNT]", str(self.questState.GetItemCountBack()))
- # load file
- MyTextReader.LoadFile(fileName)
- return MyTextReader.GetText()
- def Refresh(self, bForce = FALSE):
- if bForce == FALSE and self.IsShow() == FALSE:
- return
- questID = self.managerWnd.GetQuestID()
- self.main["say_text"].SetText(self.GetTextByFile(BASE_PATH + "%d_reward.txt" % (questID)))
- def LoadQuestInformation(self, backCount):
- self.questState.LoadInformation(backCount)
- self.Refresh()
- def OnPressEscapeKey(self):
- self.Close()
- return TRUE
- class BioSystemManager():
- def __init__(self):
- self.wndNewBoard = BioSystemNewBoard(self)
- self.wndNewBoard.Close()
- self.wndCurrentBoard = BioSystemCurrentBoard(self)
- self.wndCurrentBoard.Close()
- self.wndFinishBoard = BioSystemFinishBoard(self)
- self.wndFinishBoard.Close()
- self.wndDoneBoard = BioSystemDoneBoard(self)
- self.wndDoneBoard.Close()
- self.wndRewardBoard = BioSystemRewardBoard(self)
- self.wndRewardBoard.Close()
- self.questIndex = 0
- self.questID = 0
- def __del__(self):
- self.wndNewBoard.Close()
- self.wndNewBoard = None
- self.wndCurrentBoard.Close()
- self.wndCurrentBoard = None
- self.wndFinishBoard.Close()
- self.wndFinishBoard = None
- self.wndDoneBoard.Close()
- self.wndDoneBoard = None
- self.wndRewardBoard.Close()
- self.wndRewardBoard = None
- def SetQuestIndex(self, index):
- self.questIndex = index
- def GetQuestIndex(self):
- return self.questIndex
- def SetQuestID(self, index):
- self.questID = index
- def GetQuestID(self):
- return self.questID
- def SendQuestPacket(self, infoString):
- if self.questIndex == 0:
- return
- event.QuestButtonClick(self.questIndex)
- if infoString:
- net.SendQuestInputStringPacket(str(infoString))
- def RecvQuestPacket(self, dataString):
- data = dataString.split(",")
- # quest init
- if data[0] == "init":
- self.SetQuestID(int(data[1]))
- # quest new
- elif data[0] == "new":
- self.wndRewardBoard.Close()
- self.SetQuestID(int(data[1]))
- self.wndNewBoard.Open()
- # quest current
- elif data[0] == "current":
- self.wndNewBoard.Close()
- self.wndFinishBoard.Close()
- self.SetQuestIndex(int(data[1]))
- self.wndCurrentBoard.LoadQuestInformation(data[2], data[3], data[4], data[5], data[6])
- self.wndCurrentBoard.Open()
- # quest finish
- elif data[0] == "finish":
- qState = self.wndCurrentBoard.questState
- qState.SetItemCountGiven(qState.GetItemCountGiven() + int(data[2]))
- self.wndCurrentBoard.Refresh()
- self.wndFinishBoard.LoadQuestInformation(data[1], data[2])
- self.wndFinishBoard.Open()
- # quest done
- elif data[0] == "done":
- self.wndCurrentBoard.Close()
- self.wndFinishBoard.Close()
- self.wndDoneBoard.LoadQuestInformation(data[1], data[2], data[3])
- self.wndDoneBoard.Open()
- # quest reward
- elif data[0] == "reward":
- self.wndDoneBoard.Close()
- self.wndRewardBoard.LoadQuestInformation(data[1])
- self.wndRewardBoard.Open()
- # unkown
- else:
- dbg.TraceError("cannot identify bio system packet type %s [%s]" % (data[0], dataString))