Jump to content
×
×
  • Create New...
  • 0

Search 2 Systems


NeXo

Question

  • Answers 4
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

4 answers to this question

Recommended Posts

  • 0
5 hours ago, z35 said:

If you look into more posts in that topic , you'll see what you are searching for .

i have searching in "Guides and How Tos" but i didnt find what iam searching for. Can you send me links pls?

Link to comment
  • 0

Bio System:

 

Lua-Part:

 

quest bio_system begin
	state start begin
		function get_id()
			return pc.getf("bio_system", "quest_id") + 1
		end
		function change_id()
			pc.setf("bio_system", "quest_id", bio_system.get_id())
		end
		function get_state()
			return pc.getf("bio_system", "quest_state")
		end
		function change_state()
			local cur_state = bio_system.get_state()
			local new_state = 0
			if cur_state == 0 then new_state = 1 end
			pc.setf("bio_system", "quest_state", new_state)
		end
		function quest_exists()
			return bio_system.get_id() <= table.getn(locale.BIOSYSTEM_QUEST_LIST)
		end
		function OnTimerExecute(is_loop)
			local given = pc.getqf("items_given")
			local checking = pc.getqf("items_checking") - 1
			pc.setqf("items_checking", checking)
			
			local fail = pc.getqf("items_checking_fail")
			local succ = pc.getqf("items_checking_succ")
			
			local currentQuestID = bio_system.get_id()
			local data = locale.BIOSYSTEM_QUEST_LIST[currentQuestID]
			if data["fail_chance"] >= number(1, 100) then
				fail = fail + 1
				pc.setqf("items_checking_fail", fail)
			else
				succ = succ + 1
				pc.setqf("items_checking_succ", succ)
				if given + succ >= data["item_count_need"] then
					pc.delqf("next_check_time")
					pc.setqf("items_given", given + succ)
					cmdchat("bio done,"..succ..","..data["item_count_need"]..","..checking)
					if is_loop then
						cleartimer("check_next_item_loop")
					end
					return
				end
			end
			
			if checking == 0 then
				pc.delqf("items_checking_fail")
				pc.delqf("items_checking_succ")
				pc.setqf("items_given", given + succ)
				pc.delqf("next_check_time")
				cmdchat("bio finish,"..fail..","..succ)
				if is_loop then
					cleartimer("check_next_item_loop")
				end
			else
				pc.setqf("next_check_time", data["check_item_time"] + os.time())
				if not is_loop then
					loop_timer("check_next_item_loop", data["check_item_time"])
				end
			end
		end
		
		when login with bio_system.quest_exists() begin
			local currentQuestID = bio_system.get_id()
			local data = locale.BIOSYSTEM_QUEST_LIST[currentQuestID]
			
			if data["min_level"] <= pc.get_level() then
				local qstate = bio_system.get_state()
				if qstate == 0 then
					local v = find_npc_by_vnum(20084)
					if v != 0 then
						target.vid("__TARGET__", v)
					end
				elseif qstate == 1 then
					cmdchat("bio init,"..currentQuestID)
					
					local given = pc.getqf("items_given")
					if given < data["item_count_need"] then
						local checking_count = pc.getqf("items_checking")
						if checking_count > 0 then
							local next_check_time = pc.getqf("next_check_time")
							if os.time() >= next_check_time then
								local checked = math.floor((os.time() - next_check_time) / data["check_item_time"]) + 1
								if checked > checking_count then checked = checking_count end
								
								local fail = pc.getqf("items_checking_fail")
								local succ = pc.getqf("items_checking_succ")
								
								for i = 1, checked do
									if data["fail_chance"] >= number(1, 100) then
										fail = fail + 1
									else
										succ = succ + 1
										if given + succ >= data["item_count_need"] then
											pc.delqf("next_check_time")
											pc.setqf("items_given", given + succ)
											pc.setqf("items_checking", checking_count - i)
											cmdchat("bio done,"..succ..","..data["item_count_need"]..","..(checking_count - i))
											return
										end
									end
								end
								
								pc.setqf("items_checking", checking_count - checked)
								
								if checked == checking_count then
									pc.delqf("next_check_time")
									pc.delqf("items_checking_fail")
									pc.delqf("items_checking_succ")
									pc.setqf("items_given", given + succ)
									cmdchat("bio finish,"..fail..","..succ)
								else
									pc.setqf("next_check_time", next_check_time + checked * data["check_item_time"])
									pc.setqf("items_checking_fail", fail)
									pc.setqf("items_checking_succ", succ)
									timer("check_next_item", (next_check_time + checked * data["check_item_time"]) - os.time())
								end
							else
								timer("check_next_item", next_check_time - os.time())
							end
						end
					end
				end
			end
		end
		-- levelup new quest check
		when levelup with bio_system.quest_exists() and bio_system.get_state() == 0 begin
			local currentQuestID = bio_system.get_id()
			local data = locale.BIOSYSTEM_QUEST_LIST[currentQuestID]
			
			if data["min_level"] == pc.get_level() then
				local v = find_npc_by_vnum(20084)
				if v != 0 then
					target.vid("__TARGET__", v)
				end
			end
		end
		-- dialog with bio
		when __TARGET__.target.click with bio_system.quest_exists() and bio_system.get_state() == 0 begin
			target.delete("__TARGET__")
			cmdchat("bio new,"..bio_system.get_id())
			bio_system.change_state()
		end
		when 20084.chat."Die Forschung von Zephir" with bio_system.quest_exists() and bio_system.get_state() == 1 begin
			setskin(NOWINDOW)
			
			local currentQuestID = bio_system.get_id()
			local data = locale.BIOSYSTEM_QUEST_LIST[currentQuestID]
			
			local given = pc.getqf("items_given")
			if given >= data["item_count_need"] then
				local items_left = pc.getqf("items_checking")
				if items_left > 0 then
					pc.give_item2(data["item_vnum_need"], items_left)
				end
				local items = data["reward"]["item"]
				for i = 1, table.getn(items) do
					pc.give_item2(items[i][1], items[i][2])
				end
				local attrs = data["reward"]["attr"]
				for i = 1, table.getn(attrs) do
					affect.add_collect(attrs[i][1], attrs[i][2], 60*60*24*365*60)
				end
				if data["reward"]["gold"] > 0 then
					pc.change_money(data["reward"]["gold"])
				end
				if data["reward"]["exp"] > 0 then
					pc.give_exp2(data["reward"]["exp"])
				end
				bio_system.change_state()
				bio_system.change_id()
				pc.delqf("items_given")
				pc.delqf("items_checking")
				pc.delqf("items_checking_fail")
				pc.delqf("items_checking_succ")
				cmdchat("bio reward,"..items_left)
				
				currentQuestID = bio_system.get_id()
				data = locale.BIOSYSTEM_QUEST_LIST[currentQuestID]
				if data["min_level"] <= pc.get_level() then
					local v = find_npc_by_vnum(20084)
					if v != 0 then
						target.vid("__TARGET__", v)
					end
				end
			else
				local items_checking = pc.getqf("items_checking")
				local timeLeft = 0
				if items_checking > 0 then
					timeLeft = pc.getqf("next_check_time") - os.time() + (items_checking - 1) * data["check_item_time"]
				end
				cmdchat("bio current,"..q.getcurrentquestindex()..","..data["item_vnum_need"]..","..data["item_count_need"]..","..pc.getqf("items_given")..","..pc.getqf("items_checking")..","..timeLeft)
			end
		end
		-- client command to leave items
		when button with bio_system.quest_exists() and bio_system.get_state() == 1 begin
			setskin(NOWINDOW)
			local slot = tonumber(input()) or -1
			if slot < 0 or slot >= 90 then
				return
			end
			if not item.select_cell(slot) then
				return
			end
			
			local currentQuestID = bio_system.get_id()
			local data = locale.BIOSYSTEM_QUEST_LIST[currentQuestID]
			if item.get_vnum() != data["item_vnum_need"] then
				return
			end
			
			if pc.getqf("items_given") >= data["item_count_need"] then
				notice("Du hast bereits genügend Forschungsmaterial abgegeben.")
				return
			end
			
			local cur = pc.getqf("items_checking")
			pc.setqf("items_checking", cur + item.get_count())
			if cur == 0 then
				pc.setqf("next_check_time", data["check_item_time"] + os.time())
				timer("check_next_item", data["check_item_time"])
			end
			
			item.remove_stack()
		end
		-- check an item [loop_timer]
		when check_next_item.timer begin
			bio_system.OnTimerExecute(false)
		end
		when check_next_item_loop.timer begin
			bio_system.OnTimerExecute(true)
		end
	end
end

Python-Part:

 

import ui
import localeInfo
import chat
import app
import uiToolTip
import mouseModule
import snd
import player
import TextReader
import dbg
import event
import net

BASE_PATH = "locale/de/ui/biosystem/"

class BioSystemNewBoard(ui.ScriptWindow):

	def __init__(self, managerWnd):
		ui.ScriptWindow.__init__(self)

		self.managerWnd = managerWnd

		dbg.TraceError("LoadNew")
		self.Load()
		dbg.TraceError("LoadedNew")

	def __del__(self):
		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):
		dbg.TraceError("OpenNewWnd")

		if self.managerWnd.GetQuestID() == -1:
			chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine aktive Biologenaufgabe.")
			return

		dbg.TraceError("ShowNewWnd")

		self.Refresh(TRUE)
		self.SetCenterPosition()
		self.Show()

		dbg.TraceError("Shown")

	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:
			dbg.TraceError("BioSystemManager.SendQuestPacket: cannot send info string")
			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))

 

Soulstone-System:

 

Lua-Part:

 

quest training_grandmaster_skill begin
	state start begin
	when 50513.use begin
		setskin(NOWINDOW)
		local vnum = tonumber(input()) or 0
		if vnum <= 0 then
			cmdchat("SoulStoneResult -1")
			return
		end
		
		local seelicount = pc.count_item(50513)
		if seelicount == 0 then
			cmdchat("SoulStoneResult -1")
			return
		end
		
		if pc.get_skill_group() == 0 then
			cmdchat("SoulStoneResult -1")
			return
		end

		local result = training_grandmaster_skill.BuildGrandMasterSkillList(pc.get_job(), pc.get_skill_group())

		local vnum_list = result[1]
		local name_list = result[2]

		if table.getn(vnum_list) == 0 then
			cmdchat("SoulStoneResult -1")
			return
		end

		local index = -1
		for i = 1, table.getn(vnum_list) do
			if vnum_list[i] == vnum then
				index = i
				break
			end
		end
		if index == -1 then
			cmdchat("SoulStoneResult -1")
			return
		end

		local skill_name=name_list[index]
		local skill_vnum=vnum_list[index]
		local skill_level = pc.get_skill_level(skill_vnum)
		local cur_alignment = pc.get_real_alignment()
		local need_alignment = 1000+500*(skill_level-30)
		
		if cur_alignment<-19000+need_alignment then
			notice("Du hast zu wenig Rangpunkte.")
			cmdchat("SoulStoneResult -1")
			return
		end

		if get_time() < pc.getqf("next_time") then -- and not is_test_server() then
			if pc.is_skill_book_no_delay() then
				pc.remove_skill_book_no_delay()
			else
				notice("Du hast heute bereits einen Seelenstein gelesen!")
				cmdchat("SoulStoneResult -1")
				return
			end
		end
		pc.setqf("next_time", get_time()+time_hour_to_sec(number(8, 12)))
		
		pc.remove_item(50513)
		
		if pc.learn_grand_master_skill(skill_vnum) then
			cmdchat("SoulStoneResult 1")
			pc.change_alignment(-need_alignment)
		else
			cmdchat("SoulStoneResult 0")
			pc.change_alignment(-number(need_alignment/3, need_alignment/2))
		end
	end
	function BuildGrandMasterSkillList(job, group)
		GRAND_MASTER_SKILL_LEVEL = 30
		PERFECT_MASTER_SKILL_LEVEL = 40

		local skill_list = special.active_skill_list[job+1][group]
		local ret_vnum_list = {}
		local ret_name_list = {}

		-- test_chat(string.format("job=%d, group=%d", job, group))

		table.foreach(skill_list, 
		function(i, skill_vnum) 
		local skill_level = pc.get_skill_level(skill_vnum)

		-- test_chat(string.format("[%d]=%d", skill_vnum, skill_level))
		if skill_level >= GRAND_MASTER_SKILL_LEVEL and skill_level < PERFECT_MASTER_SKILL_LEVEL then

			table.insert(ret_vnum_list, skill_vnum)
			local name=locale.GM_SKILL_NAME_DICT[skill_vnum]
			if name == nil then name=skill_vnum end
			table.insert(ret_name_list, name)
		end
		end)
		return {ret_vnum_list, ret_name_list}


		--return {ret_vnum_list, ret_name_list}
	end
	



 	when 50512.use begin
	local regencount = pc.count_item(50512)
		say_title("Perfekter Meister")
		if pc.get_skill_group() == 0 then
		say("Du hast keine Fertigkeiten "..pc.get_skill_group())
		return
		end
		local result = training_grandmaster_skill.BuildGrandMasterSkillList(pc.get_job(), pc.get_skill_group())

		local vnum_list = result[1]
		local name_list = result[2]

		if table.getn(vnum_list) == 0 then
		say("Du hast keine Fertigkeiten")
		return
		end

		say("Fertigkeit Auswählen")
		say("")

		local menu_list = {}
		table.foreach(name_list, function(i, name) table.insert(menu_list, name) end)
		table.insert(menu_list, "Abbrechen") 
		local s=select_table(menu_list)
		if table.getn(menu_list) == s then
		return
		end

		local skill_name=name_list[s]
		local skill_vnum=vnum_list[s]
		local skill_level = pc.get_skill_level(skill_vnum)
	say("Der Regenbogenstein wird die gewählte Fertigkeit")
	say("sofort auf P setzen")
	say("Möchtest du forfahren?")
		local s=select("Lesen", "Abbrechen")	
		if s==2 then
		return
		end
		if pc.count_item(50512) != regencount then
		say("stfu buguser!")
		return
		end
	pc.remove_item(50512, 1)
	pc.set_skill_level(skill_vnum, 59)
	say("Herzlichen Glückwunsch![ENTER]")
	say("Der Skill "..skill_name.." wurde auf P gesetzt!")
	say_reward(" "..skill_name.." P")
	end
	end
end

Python-Part:

 

import ui
import net
import chat
import playerSettingModule
import chr
import skill
import player
import app

MAX_SKILL_COUNT = 6

ITEM_SOULSTONE_VNUM = 50513
ITEM_EXORZISMUS_VNUM = 71001
ITEM_PROBABILITY_VNUM = 71094

class SoulStoneBoard(ui.ScriptWindow):

	class BlockTextLineShower(ui.Window):

		def __init__(self):
			ui.Window.__init__(self)

			self.scrollBar = ui.ScrollBar()
			self.scrollBar.SetParent(self)
			self.scrollBar.SetScrollEvent(self.OnScroll)

			self.lastLineColor = {"r":0.0,"g":0.0,"b":0.0}

			self.Clear()

		def SetSize(self, width, height):
			ui.Window.SetSize(self, width, height)
			self.scrollBar.SetScrollBarSize(self.GetHeight())
			self.scrollBar.SetPosition(width - self.scrollBar.GetWidth(), 0)

		def SetLastLineColor(self, r, g, b):
			self.lastLineColor = {"r":float(r),"g":float(g),"b":float(b)}

		def Clear(self):
			self.textLineList = []
			self.textBlocks = []
			self.currentBlock = 0
			self.lastShowTime = 0
			self.y = 0
			self.basePos = 0
			self.canWrite = FALSE
			self.scrollBar.Hide()

		def GetBaseY(self):
			return self.basePos * 17

		def IsWriting(self):
			return self.canWrite == TRUE

		def OnScroll(self):
			pos = self.scrollBar.GetPos()
			self.__SetBasePos(pos * (len(self.textLineList) - 1 - (self.GetHeight() / 17)))

		def __SetBasePos(self, basePos):
			if int(basePos) == self.basePos:
				return
			self.basePos = int(basePos)
			self.RefreshLines()

		def AddBlock(self, text, resetShowTime = FALSE):
			self.textBlocks.append(text + "[ENTER]")
			self.canWrite = TRUE
			if resetShowTime == TRUE:
				self.lastShowTime = app.GetTime()

		def __AddTextLine(self):
			textLine = ui.TextLine()
			textLine.SetParent(self)
			textLine.SetPosition(0, self.y)
			textLine.SetWindowHorizontalAlignCenter()
			textLine.SetHorizontalAlignCenter()
			textLine.REAL_Y = self.y
			textLine.Show()
			self.textLineList.append(textLine)

			self.y += 17

			return self.textLineList[len(self.textLineList) - 1]

		def __WriteBlock(self):
			if self.canWrite == FALSE:
				return

			text = self.textBlocks[self.currentBlock]
			pos = text.find("[ENTER]")

			line = None

			while pos > -1:
				currentText = text[:pos]
				text = text[pos+len("[ENTER]"):]
				pos = text.find("[ENTER]")

				writtenText = ""
				line = self.__AddTextLine()
				while currentText != "":
					subpos = currentText.find(" ")
					if subpos == -1:
						addText = currentText
						currentText = ""
					else:
						addText = currentText[:subpos]
						currentText = currentText[subpos+len(" "):]

					line.SetText(writtenText + " " + addText)
					if len(writtenText) > 0 and line.GetTextWidth() > self.GetWidth() - self.scrollBar.GetWidth() - 20:
						line.SetText(writtenText)
						line = self.__AddTextLine()
						line.SetText(addText)
						writtenText = addText
					else:
						writtenText += " " + addText

			if pos == -1 and line != None and len(self.textBlocks) == self.currentBlock+1:
				line.SetFontColor(self.lastLineColor["r"], self.lastLineColor["g"], self.lastLineColor["b"])

			if len(self.textLineList) > 0:
				if (len(self.textLineList) - 1) * 17 + self.textLineList[len(self.textLineList) - 1].GetTextHeight() > self.GetHeight():
					self.scrollBar.Show()
					self.scrollBar.SetPos(1.0)
				else:
					self.scrollBar.Hide()

			self.currentBlock += 1

			self.RefreshLines()

			if self.currentBlock == len(self.textBlocks):
				self.canWrite = FALSE

		def RefreshLines(self):
			for i in xrange(len(self.textLineList)):
				line = self.textLineList[i]
				if line.REAL_Y < self.GetBaseY() or line.REAL_Y + line.GetTextHeight() > self.GetBaseY() + self.GetHeight():
					line.Hide()
				else:
					line.SetPosition(0, line.REAL_Y - self.GetBaseY())
					line.Show()

		def OnUpdate(self):
			if self.canWrite == TRUE:
				if app.GetTime() - 1.2 > self.lastShowTime:
					self.__WriteBlock()
					self.lastShowTime = app.GetTime()

	ITEM_EXORZISMUS_SLOT = 0
	ITEM_PROBABILITY_SLOT = 1

	ITEM_VNUM_BY_SLOT_INDEX = {
		ITEM_EXORZISMUS_SLOT : ITEM_EXORZISMUS_VNUM,
		ITEM_PROBABILITY_SLOT : ITEM_PROBABILITY_VNUM,
	}

	def __init__(self):
		ui.ScriptWindow.__init__(self)

		self.selectedInventoryIndex = -1

		self.skillIndexList = []
		self.activeSkillIndex = {"slot":-1,"real":0,}
		self.itemSlotActive = {self.ITEM_EXORZISMUS_SLOT : FALSE, self.ITEM_PROBABILITY_SLOT : FALSE, }
		self.hasAffect = {self.ITEM_EXORZISMUS_SLOT : FALSE, self.ITEM_PROBABILITY_SLOT : FALSE, }
		self.waitForResult = FALSE

		self.__Load()

	def __del__(self):
		ui.ScriptWindow.__del__(self)
		print " -------------------------------------- DELETE SOUL STONE BOARD"

	def Destroy(self):
		self.ClearDictionary()
		print " -------------------------------------- DESTROY SOUL STONE BOARD"

	def __Load_LoadScript(self, fileName):
		try:
			pyScriptLoader = ui.PythonScriptLoader()
			pyScriptLoader.LoadScriptFile(self, fileName)
		except:
			import exception
			exception.Abort("SoulStoneBoard.__Load_LoadScript")

	def __Load_BindObject(self):
		try:
			GetObject = self.GetChild
			self.board = GetObject("board")
			self.main = {
				"skill_slot" : GetObject("skill_slot"),
				"item_slot" : GetObject("item_slot"),
				"button" : GetObject("button"),
			}
		except:
			import exception
			exception.Abort("SoulStoneBoard.__Load_BindObject")

		self.board.SetCloseEvent(self.Close)

		self.main["skill_slot"].SAFE_SetButtonEvent("LEFT", "EXIST", self.OnClickSkillSlot)
		self.main["skill_slot"].SAFE_SetButtonEvent("RIGHT", "EXIST", self.OnClickSkillSlot)

		self.main["item_slot"].SetItemSlot(self.ITEM_EXORZISMUS_SLOT, ITEM_EXORZISMUS_VNUM)
		self.main["item_slot"].SetItemSlot(self.ITEM_PROBABILITY_SLOT, ITEM_PROBABILITY_VNUM)
		self.main["item_slot"].SAFE_SetButtonEvent("LEFT", "EXIST", self.OnClickItemSlot)
		self.main["item_slot"].SAFE_SetButtonEvent("RIGHT", "EXIST", self.OnClickItemSlot)

		self.main["button"].SAFE_SetEvent(self.OnClickButton)

		self.rapidTextLine = self.BlockTextLineShower()
		self.rapidTextLine.SetParent(self)
		self.rapidTextLine.SetPosition(0, 38 + 32 + 10 + 32 + 10 + 10)
		self.rapidTextLine.SetSize(self.GetWidth() - 20 * 2, 80)
		self.rapidTextLine.SetWindowHorizontalAlignCenter()
		self.rapidTextLine.Show()

	def __Load(self):
		self.__Load_LoadScript("uiscript/soulstoneboard.py")
		self.__Load_BindObject()

	def Open(self, soulStoneIndex = -1):
		if net.GetMainActorSkillGroup() == 0:
			chat.AppendChat(chat.CHAT_TYPE_INFO, "Du musst erst eine Klasse wählen.")
			return
		self.RefreshSkill()
		if len(self.skillIndexList) == 0:
			chat.AppendChat(chat.CHAT_TYPE_INFO, "Du benötigst eine Fertigkeit auf Großmeister um einen Seelenstein zu benutzen.")
			return
		self.selectedInventoryIndex = soulStoneIndex
		self.rapidTextLine.Clear()
		self.SetSize(self.GetWidth(), 150)
		self.main["button"].SetPosition(self.main["button"].GetLeft(), self.GetHeight() - 21 - 15)
		self.Show()

	def Close(self):
		self.Hide()

	def SetSize(self, width, height):
		ui.Window.SetSize(self, width, height)
		try:
			self.board.SetSize(width, height)
		except AttributeError:
			pass

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

	def SetAffectExoFlag(self, flag):
		self.hasAffect[self.ITEM_EXORZISMUS_SLOT] = flag
		self.CheckItem()

	def SetAffectProbFlag(self, flag):
		self.hasAffect[self.ITEM_PROBABILITY_SLOT] = flag
		self.CheckItem()

	def CheckSkillChange(self):
		skillIndexList = []

		for i in xrange(MAX_SKILL_COUNT):

			skillIndex = player.GetSkillIndex(i + 1)
			skillGrade = player.GetSkillGrade(i + 1)

			if 0 != skillIndex and skillGrade == 2:
				skillIndexList.append(skillIndex)

		if len(skillIndexList) != len(self.skillIndexList):
			return TRUE

		for i in xrange(len(skillIndexList)):
			if skillIndexList[i] != self.skillIndexList[i]:
				return TRUE

		return FALSE

	def RefreshSkill(self):
		if not self.CheckSkillChange():
			return

		hiddenSlots = 0
		skillCount = 0
		self.skillIndexList = []

		findActiveSlot = FALSE

		for i in xrange(MAX_SKILL_COUNT):

			self.main["skill_slot"].DeactivateSlot(i)

			skillIndex = player.GetSkillIndex(i + 1)
			skillGrade = player.GetSkillGrade(i + 1)
			skillLevel = player.GetSkillLevel(i + 1)

			if 0 == skillIndex or skillGrade != 2: # skillGrade != SKILL_GRADE_GRANDMASTER
				self.main["skill_slot"].ClearSlot(MAX_SKILL_COUNT - hiddenSlots - 1)
				self.main["skill_slot"].HideSlotBaseImage(MAX_SKILL_COUNT - hiddenSlots - 1)
				hiddenSlots += 1
				continue

			self.main["skill_slot"].SetSkillSlotNew(skillCount, skillIndex, skillGrade, skillLevel)
			self.main["skill_slot"].SetSlotCountNew(skillCount, skillGrade, skillLevel)
			self.main["skill_slot"].SetCoverButton(skillCount)

			self.main["skill_slot"].ShowSlotBaseImage(skillCount)

			if self.activeSkillIndex["real"] == skillIndex:
				findActiveSlot = TRUE
				self.activeSkillIndex["slot"] = skillCount

				self.main["skill_slot"].ActivateSlot(skillCount)

			skillCount += 1
			self.skillIndexList.append(skillIndex)

		if findActiveSlot == FALSE:
			self.activeSkillIndex = {"slot":-1,"real":0,}

		if skillCount == 0:
			return

		self.main["skill_slot"].SetSize(32 * skillCount + (5 * skillCount - 1), self.main["skill_slot"].GetHeight())
		self.main["skill_slot"].UpdateRect()

	def OnClickSkillSlot(self, index):
		if self.activeSkillIndex["slot"] != -1:
			self.main["skill_slot"].DeactivateSlot(self.activeSkillIndex["slot"])
			if self.activeSkillIndex["slot"] == index:
				self.activeSkillIndex = {"slot":-1,"real":0,}
				return

		self.activeSkillIndex = {"slot":index,"real":self.skillIndexList[index],}
		self.main["skill_slot"].ActivateSlot(index)

	def OnClickItemSlot(self, index):
		if self.itemSlotActive[index] == TRUE:
			self.main["item_slot"].DeactivateSlot(index)
			self.itemSlotActive[index] = FALSE
		else:
			if self.FindInInventory(self.ITEM_VNUM_BY_SLOT_INDEX[index]) == -1:
				chat.AppendChat(chat.CHAT_TYPE_INFO, "Du besitzt diesen Gegenstand nicht.")
				return
			self.main["item_slot"].ActivateSlot(index)
			self.itemSlotActive[index] = TRUE

	def FindInInventory(self, vnum):
		for i in xrange(player.INVENTORY_PAGE_SIZE * player.INVENTORY_PAGE_COUNT):
			if player.GetItemIndex(i) == vnum:
				return i
		return -1

	def CheckItem(self):
		for key in self.itemSlotActive:
			if self.itemSlotActive[key] == TRUE and self.hasAffect[key] == FALSE:
				if self.FindInInventory(self.ITEM_VNUM_BY_SLOT_INDEX[key]) == -1:
					self.main["item_slot"].DeactivateSlot(key)
					self.itemSlotActive[key] = FALSE
			elif self.itemSlotActive[key] == FALSE and self.itemSlotActive[key] == TRUE:
				self.main["item_slot"].ActivateSlot(key)
				self.itemSlotActive[key] = TRUE

	def OnUpdate(self):
		self.RefreshSkill()
		self.CheckItem()

	def OnClickButton(self):
		if self.waitForResult == TRUE:
			return

		if self.rapidTextLine.IsWriting():
			chat.AppendChat(chat.CHAT_TYPE_INFO, "Warte noch etwas, bevor du den nächsten Seelenstein einsetzt.")
			return

		if self.activeSkillIndex["real"] == 0:
			chat.AppendChat(chat.CHAT_TYPE_INFO, "Du musst erst eine Fertigkeit wählen.")
			return

		if self.selectedInventoryIndex == -1:
			soulStonePos = self.FindInInventory(ITEM_SOULSTONE_VNUM)
		else:
			soulStonePos = self.selectedInventoryIndex
			if player.GetItemIndex(soulStonePos) != ITEM_SOULSTONE_VNUM:
				soulStonePos = self.FindInInventory(ITEM_SOULSTONE_VNUM)
		if soulStonePos == -1:
			chat.AppendChat(chat.CHAT_TYPE_INFO, "Du benötigst einen Seelenstein.")
			return
		if self.itemSlotActive[self.ITEM_EXORZISMUS_SLOT] == TRUE and self.hasAffect[self.ITEM_EXORZISMUS_SLOT] == FALSE:
			pos = self.FindInInventory(ITEM_EXORZISMUS_VNUM)
			if pos == -1:
				chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast keine Exorzismus-Schriftrolle.")
				return
			net.SendItemUsePacket(pos)
		if self.itemSlotActive[self.ITEM_PROBABILITY_SLOT] == TRUE and self.hasAffect[self.ITEM_PROBABILITY_SLOT] == FALSE:
			pos = self.FindInInventory(ITEM_PROBABILITY_VNUM)
			if pos == -1:
				chat.AppendChat(chat.CHAT_TYPE_INFO, "Du hast kein konzentriertes Lesen.")
				return
			net.SendItemUsePacket(pos)
		net.SendItemUsePacket(soulStonePos)
		net.SendQuestInputStringPacket(str(self.activeSkillIndex["real"]))
		self.main["button"].Disable()
		self.waitForResult = TRUE

	def OnRecvResult(self, result):
		if self.waitForResult == FALSE:
			return

		self.main["button"].Enable()
		self.waitForResult = FALSE

		if int(result) == -1:
			return

		self.SetSize(self.GetWidth(), 255)
		self.main["button"].SetPosition(self.main["button"].GetLeft(), self.GetHeight() - 21 - 15)

		self.rapidTextLine.Clear()
		if int(result) != 0:
			self.rapidTextLine.SetLastLineColor(0.1, 0.8, 0.1)
		else:
			self.rapidTextLine.SetLastLineColor(0.8, 0.1, 0.1)

		if int(result) != 0:
			data = pack_open("locale/de/soulstone_win.txt", "r").readlines()
		else:
			data = pack_open("locale/de/soulstone_loss.txt", "r").readlines()

		for line in data:
			if line.replace("\n", "") != "":
				self.rapidTextLine.AddBlock(line.replace("\n", ""))

👑 Premium International Lua Developer 👑

 My service topic: https://bit.ly/2UPly54

 

Ignorant people have the obligation to compensate their ignorance by paying whoever helps them.

Syreldar

Link to comment
  • 0
5 hours ago, NeXo said:

i have searching in "Guides and How Tos" but i didnt find what iam searching for. Can you send me links pls?

I meant at the link you provided , but nevermind, Syreldar pasted here.

Link to comment

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


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.