Jump to content
External pictures are being replaced... ×
×
×
  • Create New...
  • 0

Help to implement?


MORTE

Question

import app
import player
import chat
import net
import time
import ui

class Potador1(ui.ScriptWindow):

	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.LoadPotador1()
	
	def __del__(self):
		ui.ScriptWindow.__del__(self)
	def LoadPotador1(self):
	
		self.LoadMainForm()
		self.FaceButton()
		
	def LoadMainForm(self):
		global OnOff1
		self.Board = ui.BoardWithTitleBar()
		self.Board.SetSize(200, 110)
		self.Board.SetPosition(wndMgr.GetScreenWidth()-500, wndMgr.GetScreenHeight()-400)
		self.Board.AddFlag("movable")
		self.Board.AddFlag("float")
		self.Board.SetTitleName("Potador1 By Chaplin :D")
		self.Board.SetCloseEvent(self.Board.Hide)
		self.Board.Show()

		self.Potador1Message = ui.TextLine()
		self.Potador1Message.SetParent(self.Board)
		self.Potador1Message.SetPosition(75, 40)
		self.Potador1Message.SetText("Escolha:")
		self.Potador1Message.Show()
	
		self.Potador1On = ui.Button()
		self.Potador1On.SetParent(self.Board)
		self.Potador1On.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		self.Potador1On.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		self.Potador1On.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		self.Potador1On.SetText("Potar")
		self.Potador1On.SetPosition(10, 70)
		self.Potador1On.SetEvent(self.Potador1)
		self.Potador1On.Show()
		
		self.Potador1Off = ui.Button()
		self.Potador1Off.SetParent(self.Board)
		self.Potador1Off.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		self.Potador1Off.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		self.Potador1Off.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		self.Potador1Off.SetText("Parar")
		self.Potador1Off.SetPosition(100, 70)
		self.Potador1Off.SetEvent(self.Potador1Stop)
		self.Potador1Off.Show()
		
		
	def FaceButton(self):
	
		global Potador1Button
		Potador1Button = ui.Button()
		Potador1Button.SetText("")
		Potador1Button.SetPosition(wndMgr.GetScreenWidth()-100,wndMgr.GetScreenHeight()-475)
		Potador1Button.SetSize(88, 21)
		Potador1Button.SetEvent(self.Board.Show)
		Potador1Button.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		Potador1Button.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		Potador1Button.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		Potador1Button.Show()
		
		global Potador1Text
		Potador1Text = ui.TextLine()
		Potador1Text.SetParent(Potador1Button)
		Potador1Text.SetVerticalAlignCenter()
		Potador1Text.SetHorizontalAlignCenter()
		Potador1Text.SetPosition(43,10)
		Potador1Text.SetText("Potador1")
		Potador1Text.Show()
		
	def Potador1(self):
		chat.AppendChat(chat.CHAT_TYPE_NOTICE, "Pontando...")
#		app.SetMinFog(70000)
#		app.SetCameraMaxDistance(12000)
		self.Potador1Start()

	def Potador1Start(self):
		for i in xrange(90):
			itemVNum = player.GetItemIndex(i)
			if itemVNum == int(70020):
				net.SendItemUsePacket(i)
				break
		self.Delay = WaitingDialog()
		temp = 0.01
		self.Delay.Open(float(temp))
		self.Delay.SAFE_SetTimeOverEvent(self.Potador1Start)		

	def Potador1Stop(self):
		chat.AppendChat(chat.CHAT_TYPE_NOTICE, "Parou de Potar...")
		StopDelay = 999999
		self.Delay.Open(int(StopDelay))

StartDialog = Potador1()
StartDialog.Show()

class Potador2(ui.ScriptWindow):

	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.LoadPotador2()
	
	def __del__(self):
		ui.ScriptWindow.__del__(self)
	def LoadPotador2(self):
	
		self.LoadMainForm()
		self.FaceButton()
		
	def LoadMainForm(self):
		global OnOff2
		self.Board = ui.BoardWithTitleBar()
		self.Board.SetSize(200, 110)
		self.Board.SetPosition(wndMgr.GetScreenWidth()-500, wndMgr.GetScreenHeight()-400)
		self.Board.AddFlag("movable")
		self.Board.AddFlag("float")
		self.Board.SetTitleName("Potador2 By Chaplin :D")
		self.Board.SetCloseEvent(self.Board.Hide)
		self.Board.Show()

		self.Potador2Message = ui.TextLine()
		self.Potador2Message.SetParent(self.Board)
		self.Potador2Message.SetPosition(75, 40)
		self.Potador2Message.SetText("Escolha:")
		self.Potador2Message.Show()
	
		

		self.Potador2On = ui.Button()
		self.Potador2On.SetParent(self.Board)
		self.Potador2On.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		self.Potador2On.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		self.Potador2On.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		self.Potador2On.SetText("Potar")
		self.Potador2On.SetPosition(10, 70)
		self.Potador2On.SetEvent(self.Potador2)
		self.Potador2On.Show()
		
		self.Potador2Off = ui.Button()
		self.Potador2Off.SetParent(self.Board)
		self.Potador2Off.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		self.Potador2Off.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		self.Potador2Off.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		self.Potador2Off.SetText("Parar")
		self.Potador2Off.SetPosition(100, 70)
		self.Potador2Off.SetEvent(self.Potador2Stop)
		self.Potador2Off.Show()
		
		
	def FaceButton(self):
	
		global Potador2Button
		Potador2Button = ui.Button()
		Potador2Button.SetText("")
		Potador2Button.SetPosition(wndMgr.GetScreenWidth()-100,wndMgr.GetScreenHeight()-450)
		Potador2Button.SetSize(88, 21)
		Potador2Button.SetEvent(self.Board.Show)
		Potador2Button.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		Potador2Button.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		Potador2Button.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		Potador2Button.Show()
		
		global Potador2Text
		Potador2Text = ui.TextLine()
		Potador2Text.SetParent(Potador2Button)
		Potador2Text.SetVerticalAlignCenter()
		Potador2Text.SetHorizontalAlignCenter()
		Potador2Text.SetPosition(43,10)
		Potador2Text.SetText("Potador2")
		Potador2Text.Show()
		
	def Potador2(self):
		chat.AppendChat(chat.CHAT_TYPE_NOTICE, "Pontando...")
#		app.SetMinFog(70000)
#		app.SetCameraMaxDistance(12000)
		self.Potador2Start()

	def Potador2Start(self):
		for i in xrange(90):
			itemVNum = player.GetItemIndex(90-i)
			if itemVNum == int(70020):
				net.SendItemUsePacket(90-i)
				net.SendItemUsePacket(90-i)
				break
		self.Delay = WaitingDialog()
		temp = 0.0001
		self.Delay.Open(float(temp))
		self.Delay.SAFE_SetTimeOverEvent(self.Potador2Start)		

	def Potador2Stop(self):
		chat.AppendChat(chat.CHAT_TYPE_NOTICE, "Parou de Potar...")
		
		StopDelay = 999999
		self.Delay.Open(int(StopDelay))

		
class WaitingDialog(ui.ScriptWindow):

	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.eventTimeOver = lambda *arg: None
		self.eventExit = lambda *arg: None

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

	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
		
StartDialog = Potador2()
StartDialog.Show()

 

Link to comment
Share on other sites

  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

1 answer 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
  • Recently Browsing   0 members

    • No registered users viewing this page.


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.