Mijago switch 6-7opt probléma

Indította xTryx, 2018-08-25, 22:35:20

Sziasztok. Ötlet hogy miért forog tovább a kiválasztott optokon?
1 optot be tud optolni, de 2-nél már tovább forog.

Előre is köszi a válaszokat.



import shop
import player
import item
import ui
import net
import localeInfo
import chat
import grp
import wndMgr
import mouseModule

from uitooltip import ItemToolTip
# Switchbot by Mijago ; v 2.2.1

WEAR_NAMES = ItemToolTip.WEAR_NAMES
AFFECT_DICT = ItemToolTip.AFFECT_DICT

### Hier die Boni angeben, die auf dem Server aktiviert sind. Die angegebene Liste ist nur ein Beispiel und MUSS angepasst werden!
BONI_AVAIL = [1,2,3,4,5,6,7,9,10,12,13,14,15,16,17,18,19,20,21,22,23,27,28,29,30,31,32,33,34,37,39,41,43,44,45,48,53,71,72]

# Hier 6/7 Boni angeben!
BONI_RARE_AVAIL = [1,3,4,5,6,15,16,59,60,61,62,63,64,78,79,80,81]

# Das Switch-Item
SWITCH_VNUM = 71084
SWITCH_RARE_VNUM = 71052

# Die folgenden zahlen geben den MINMAX Bereich des Reglers an, der die Zeit angibt.
MIN_SWITCH_DELAY = 35
MAX_SWITCH_DELAY_APPEND = 120

# Max 10!!
MAX_NUM = 7

proposals = {
1: { # 1 = Weapon
"PVP (Fegyverbe)":[
[9,10],
[15,10],
[17,10],
[16,10],
[12,8],
],
"PVM (Fegyverbe)": [
[22,20],
[15,10],
],
},
2: [ # Armor
[ #BODY,
],
[ #HEAD,
],
[ #SHIELD,
],
[ #WRIST,
],
[ #FOOTS,
],
[ #NECK,
],
[ #EAR,
],
],
}

# Farben :)
# COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, 0.5)
# COLOR_INACTIVE = grp.GenerateColor(0.0, 0.0, 1.0, 0.2)
# COLOR_ACTIVE   = grp.GenerateColor(0.1, 0.6, 1.0, 0.2)
# COLOR_FINISHED = grp.GenerateColor(0.0, 0.8, 1.0, 0.3)

# COLOR_INACTIVE_RARE = grp.GenerateColor(0.0, 0.2, 1.0, 0.2)
# COLOR_ACTIVE_RARE   = grp.GenerateColor(0.2, 0.7, 1.0, 0.2)

# COLOR_HIGHLIGHT_RARE = grp.GenerateColor(0.2, 0.2, 1.0, 0.05)

# COLOR_PIN_HINT = grp.GenerateColor(0.0, 0.5, 1.0, 0.3)

# COLOR_CHECKBOX_NOT_SELECTED = grp.GenerateColor(0.0, 0.3, 1.0, 0.1)
# COLOR_CHECKBOX_SELECTED = grp.GenerateColor(0.0, 0.3, 1.0, 0.3)

# Standardfarben:
COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, 0.5)
COLOR_INACTIVE = grp.GenerateColor(1.0, 0.0, 0.0, 0.2)
COLOR_ACTIVE   = grp.GenerateColor(1.0, 0.6, 0.1, 0.2)
COLOR_FINISHED = grp.GenerateColor(0.0, 1.0, 0.0, 0.2)

COLOR_INACTIVE_RARE = grp.GenerateColor(1.0, 0.2, 0.0, 0.2)
COLOR_ACTIVE_RARE   = grp.GenerateColor(1.0, 0.7, 0.2, 0.2)

COLOR_HIGHLIGHT_RARE = grp.GenerateColor(1.0, 0.2, 0.2, 0.05)

COLOR_PIN_HINT = grp.GenerateColor(0.0, 0.5, 1.0, 0.3)


COLOR_CHECKBOX_NOT_SELECTED = grp.GenerateColor(1.0, 0.3, 0.0, 0.1)
COLOR_CHECKBOX_SELECTED = grp.GenerateColor(0.3, 1.0, 1.0, 0.3)


DISTANCE_BOTTOM = 36

class Bar(ui.Bar):
def __init__(self,layer = "UI"):
ui.Bar.__init__(self,layer)
def SetColor(self,color):
wndMgr.SetColor(self.hWnd, color)
self.color = color


class BonusSelector(ui.Bar):
def Activate(self):
self.sub_parent.resetSwitch()
self.Status_new.SetColor(COLOR_ACTIVE)
self.sub_parent.StatusBar.SetColor(COLOR_ACTIVE)
self.sub_parent.StatusText.SetText("Aktív")
self.Starter.SetText("Optolás ("+str(self.index+1)+") megállítása")
self.sub_parent.boni_active = 1
if self.sub_parent.parentWindow.parentWindow.gameWindow != None:
self.sub_parent.blockBar.swib_normal.SetColor(COLOR_ACTIVE)
pass
def Deactivate(self):
self.sub_parent.resetSwitch()
self.Status_new.SetColor(COLOR_INACTIVE)
self.sub_parent.StatusBar.SetColor(COLOR_INACTIVE)
self.sub_parent.StatusText.SetText("Inaktiv")
self.Starter.SetText("Optolás ("+str(self.index+1)+") elindítása")
self.sub_parent.boni_active = 0
if self.sub_parent.parentWindow.parentWindow.gameWindow != None:
self.sub_parent.blockBar.swib_normal.SetColor(COLOR_INACTIVE)
pass

def Activate_rare(self):
self.sub_parent.resetSwitch_rare()
self.sub_parent.StatusBar_rare.SetColor(COLOR_ACTIVE_RARE)
self.sub_parent.StatusText_rare.SetText("6/7 Aktiv")
self.Starter_rare_boni.SetText("6/7 megállítani")
self.sub_parent.boni_rare_active = 1
if self.sub_parent.parentWindow.parentWindow.gameWindow != None:
self.sub_parent.blockBar.swib_rare.SetColor(COLOR_ACTIVE_RARE)
pass
def Deactivate_rare(self):
self.sub_parent.resetSwitch_rare()
# self.Status_new.SetColor(COLOR_INACTIVE)
self.sub_parent.StatusBar_rare.SetColor(COLOR_INACTIVE_RARE)
self.sub_parent.StatusText_rare.SetText("6/7 inaktív")
self.Starter_rare_boni.SetText("6/7 aktív")
self.Starter_rare_boni.SetUp()
self.sub_parent.boni_rare_active = 0
if self.sub_parent.parentWindow.parentWindow.gameWindow != None:
self.sub_parent.blockBar.swib_rare.SetColor(COLOR_INACTIVE_RARE)
pass

def Finish(self):
self.Status_new.SetColor(COLOR_FINISHED)
self.sub_parent.StatusBar.SetColor(COLOR_FINISHED)
self.sub_parent.StatusText.SetText("Végzett")
self.Starter.SetText("Optolás ("+str(self.index+1)+") folytatása")
self.sub_parent.boni_active = 0
if self.sub_parent.parentWindow.parentWindow.gameWindow != None:
self.sub_parent.blockBar.swib_normal.SetColor(COLOR_FINISHED)
pass

def Finish_rare(self):
# self.Status_new.SetColor(COLOR_FINISHED)
self.sub_parent.StatusBar_rare.SetColor(COLOR_FINISHED)
self.sub_parent.StatusText_rare.SetText("6/7 végzett")
self.Starter_rare_boni.SetText("6/7 folytatása")
self.sub_parent.boni_rare_active = 0
if self.sub_parent.parentWindow.parentWindow.gameWindow != None:
self.sub_parent.blockBar.swib_rare.SetColor(COLOR_FINISHED)
pass
def Block(self):
self.BlockBar.Show()
self.BlockBar.sub.Show()
self.Starter.Hide()
pass
def Unblock(self):
self.BlockBar.sub.Hide()
self.BlockBar.Hide()
self.Starter.Show()
pass


def enable_rare_boni(self):
for i in range(0,4):
self.boni[6][i].Show()
self.boni[7][i].Show()
self.Starter.SetPosition(0,140+45+100)
self.bg_rare_boni.Show()
self.bg_rare_boni_but.Show()
self.Starter_rare_boni.Show()
self.sub_parent.StatusBar_rare.Show()

if self.sub_parent.parentWindow.parentWindow.gameWindow != None:
self.sub_parent.blockBar.Enable_rare(1)

def disable_rare_boni(self):
for i in range(0,4):
self.boni[6][i].Hide()
self.boni[7][i].Hide()
self.Starter.SetPosition(0,140)
self.bg_rare_boni.Hide()
self.bg_rare_boni_but.Hide()
self.Starter_rare_boni.Hide()
self.sub_parent.StatusBar_rare.Hide()
self.Deactivate_rare()
if self.sub_parent.parentWindow.parentWindow.gameWindow != None:
self.sub_parent.blockBar.Enable_rare(0)

def __init__(self,sub_parent):
ui.Bar.__init__(self, "UI")
self.sub_parent = sub_parent
self.index = sub_parent.index
self.SetColor(COLOR_BG)
self.SetSize(500,225+10+100)
self.boni = {}
self.Status_new = ui.Bar()
self.Status_new.SetParent(self)
self.Status_new.SetColor(COLOR_INACTIVE)
self.Status_new.SetSize(500,5)
self.Status_new.Show()


self.bg_rare_boni = ui.Bar()
self.bg_rare_boni.SetColor(COLOR_HIGHLIGHT_RARE)
self.bg_rare_boni.SetParent(self)
self.bg_rare_boni.SetPosition(0,132)
self.bg_rare_boni.SetSize(500,51)
self.bg_rare_boni.Hide()

self.bg_rare_boni_but = ui.Bar()
self.bg_rare_boni_but.SetColor(COLOR_HIGHLIGHT_RARE)
self.bg_rare_boni_but.SetParent(self)
self.bg_rare_boni_but.SetPosition(400,133+50)
self.bg_rare_boni_but.SetSize(100,25)
self.bg_rare_boni_but.Hide()

self.EnableRareBoni = CheckBox("6/7 opt Bekapcsolás")
self.EnableRareBoni.SetParent(self)
self.EnableRareBoni.SetPosition(10,185+100)
self.EnableRareBoni.eventUp   = self.disable_rare_boni
self.EnableRareBoni.eventDown = self.enable_rare_boni
self.EnableRareBoni.Show()

self.Starter = ui.ToggleButton()
self.Starter.SetWindowHorizontalAlignCenter()
self.Starter.SetParent(self)
self.Starter.SetUpVisual("d:/ymir work/ui/public/XLarge_Button_01.sub")
self.Starter.SetOverVisual("d:/ymir work/ui/public/XLarge_button_02.sub")
self.Starter.SetDownVisual("d:/ymir work/ui/public/XLarge_button_03.sub")
self.Starter.SetPosition(0,140)
self.Starter.SetText("Optolás kezdése")
self.Starter.SetToggleDownEvent(self.Activate)
self.Starter.SetToggleUpEvent(self.Deactivate)
self.Starter.Show()

self.Starter_rare_boni = ui.ToggleButton()
self.Starter_rare_boni.SetWindowHorizontalAlignCenter()
self.Starter_rare_boni.SetParent(self)
self.Starter_rare_boni.SetUpVisual("d:/ymir work/ui/public/Large_Button_01.sub")
self.Starter_rare_boni.SetOverVisual("d:/ymir work/ui/public/Large_button_02.sub")
self.Starter_rare_boni.SetDownVisual("d:/ymir work/ui/public/Large_button_03.sub")
self.Starter_rare_boni.SetPosition(200,140+45)
self.Starter_rare_boni.SetText("6/7 optforgatás kezdése")
self.Starter_rare_boni.SetToggleDownEvent(self.Activate_rare)
self.Starter_rare_boni.SetToggleUpEvent(self.Deactivate_rare)
self.Starter_rare_boni.Hide()

for i in range(7,5,-1):
vas = i
self.boni[vas] = {}
self.boni[vas][0] = ui.TextLine()
self.boni[vas][0].SetParent(self)
self.boni[vas][0].SetText("Bónusz "+str(vas))
self.boni[vas][0].SetPosition(15,10+25*(vas-1))
self.boni[vas][0].Hide()
self.boni[vas][1] = DropDown(self,"- Nincsen -")
self.boni[vas][1].SetPosition(70,10+25*(vas-1))
for x in AFFECT_DICT:
if x in BONI_RARE_AVAIL:
self.boni[vas][1].AppendItem(str(AFFECT_DICT[x](0)),x)
self.boni[vas][1].SetSize(330,20)
self.boni[vas][1].Hide()
self.boni[vas][2] = ui.Bar("UI")
self.boni[vas][2].SetParent(self)
self.boni[vas][2].SetPosition(410,10+25*(vas-1))
self.boni[vas][2].SetColor(0xC0000000)
self.boni[vas][2].SetSize(80,20)
self.boni[vas][2].Hide()
self.boni[vas][3] = Edit2("0",14)
self.boni[vas][3].SetParent(self.boni[vas][2])
self.boni[vas][3].SetNumberMode()
self.boni[vas][3].SetSize(80,20)
self.boni[vas][3].SetPosition(4,3)
self.boni[vas][3].Hide()

for i in range(0,5):
vas = 5-i
self.boni[vas] = {}
self.boni[vas][0] = ui.TextLine()
self.boni[vas][0].SetParent(self)
self.boni[vas][0].SetText("Bónusz "+str(vas))
self.boni[vas][0].SetPosition(15,10+25*(vas-1))
self.boni[vas][0].Show()
self.boni[vas][1] = DropDown(self,"- Nincsen -")
self.boni[vas][1].SetPosition(70,10+25*(vas-1))
for x in AFFECT_DICT:
if x in BONI_AVAIL:
self.boni[vas][1].AppendItem(str(AFFECT_DICT[x](0)),x)
self.boni[vas][1].SetSize(330,20)
self.boni[vas][1].Show()
self.boni[vas][2] = ui.Bar("UI")
self.boni[vas][2].SetParent(self)
self.boni[vas][2].SetPosition(410,10+25*(vas-1))
self.boni[vas][2].SetColor(0xC0000000)
self.boni[vas][2].SetSize(80,20)
self.boni[vas][2].Show()
self.boni[vas][3] = Edit2("0",14)
self.boni[vas][3].SetParent(self.boni[vas][2])
self.boni[vas][3].SetNumberMode()
self.boni[vas][3].SetSize(80,20)
self.boni[vas][3].SetPosition(4,3)
self.boni[vas][3].Show()

self.but_propose = DropDown(self,'Javaslat',0)
self.but_propose.SetParent(self)
self.but_propose.SetPosition(380,210+100)
self.but_propose.OnChange=self.change_boni
self.but_propose.Show()

self.BlockBar = ui.Bar()
self.BlockBar.SetParent(self)
self.BlockBar.SetColor(COLOR_INACTIVE)
self.BlockBar.SetPosition(0,5)
self.BlockBar.SetSize(500,170-5+35+2)
self.BlockBar.Hide()

self.BlockBar.sub = ui.Bar()
self.BlockBar.sub.SetParent(self)
self.BlockBar.sub.SetColor(COLOR_INACTIVE)
self.BlockBar.sub.SetPosition(500-122,5+170-5+35+2)
self.BlockBar.sub.SetSize(122,30)
self.BlockBar.sub.Hide()

self.BlockText = ui.TextLine()
self.BlockText.SetParent(self.BlockBar)
self.BlockText.SetWindowHorizontalAlignCenter()
self.BlockText.SetHorizontalAlignCenter()
self.BlockText.SetPosition(0,140)
self.BlockText.SetText("Ezt nem tudod forgatni.")
self.BlockText.Show()


self.prepare_propose()

def change_boni(self):
use = self.but_propose.DropList.GetSelectedItem().value
bon = 1
item.SelectItem(self.sub_parent.vnum)
for x in use:
# TODO: Check if bonus exists on item!!
ok = 1
for i in xrange(item.ITEM_APPLY_MAX_NUM):
(affectType, affectValue) = item.GetAffect(i)
if affectType == x[0]:
ok = 0
if ok == 0:
continue
y = self.boni[bon][1]
y.SelectByAffectId(x[0])
self.boni[bon][1].act.SetText(y.DropList.GetSelectedItem().textBox.GetText())
self.boni[bon][3].SetText(str(x[1]))
bon+=1

for x in range(bon,6):
y = self.boni[x][1].DropList
y.SelectIndex(0)
self.boni[x][1].act.SetText(y.GetSelectedItem().textBox.GetText())
self.boni[x][3].SetText("0")


def prepare_propose(self):
self.but_propose.DropList.RemoveAllItems()
self.but_propose.maxh = 95
self.but_propose.c = 0
self.but_propose.AppendItem("Alap",[])

item.SelectItem(self.sub_parent.vnum)
type = item.GetItemType()

use = proposals[type]
if type == 2:
use = use[item.GetItemSubType()]

for prop in use:
self.but_propose.AppendItem(prop,use[prop])

Én úgy tudtam csak a 6-7 forgatása bugos, esetleg nincs túl gyorsra állítva?

a 6-7-re értettem az nem akar működni. 1-5ig jó

Jah vagy úgy... me csak annyit írtál h 1 optot beforgat :-\ :-X
Am őszintén én nem foglalkoztam vele, túl komplikált a kód (meg sok is ;D) egyszerűbbnek tartottam írni 1 sajátot mint ezt javítgatni, főleg h a fene se tudja mi okozza.
1x átfutottam rajta de nemigen láttam semmit :-\

Ahh. Értem :( Esetleg valami másik public switch létezik 6-7-el?

Csomó létezik, de 6-7 nem annyira bonyolult, jóval könnyebben újra lehet írni mint az 1-5-öt.