Tipologie server:-
*Resursă folosită:Extra Refine System Vegas
*ServerFiles utilizat:-
*Syserr:
0429 00:46:30338 ::
uiRefine.py(line:231) __LoadScript
ui.py(line:5035) LoadScriptFile
RefineDialog.__LoadScript.LoadObject - <type 'exceptions.KeyError'>:'window'
0429 00:46:30338 :: ============================================================================================================
0429 00:46:30338 :: Abort!!!!
Poză:
*Detalii suplimentare:
https://www.virustotal.com/gui/file/24f ... /detection
uirefine.py
###################################################################
# title_name : Extra Refine System
# date_created : 2016.09.20
# filename : uiRefine.py
# author : VegaS
# version : 0.1.6
#
import app
import grp
import net
import player
import item
import ui
import uiToolTip
import mouseModule
import localeInfo
import uiCommon
import constInfo
import snd
import wndMgr
import chat
import uiScriptLocale
REFINE_VNUM = [
player.REFINE_VNUM_POTION_LOW,
player.REFINE_VNUM_POTION_MEDIUM,
player.REFINE_VNUM_POTION_EXTRA
]
REFINE_PERCENTAGE = [
player.REFINE_PERCENTAGE_LOW,
player.REFINE_PERCENTAGE_MEDIUM,
player.REFINE_PERCENTAGE_EXTRA
]
REFINE_MODE = {
0 : 0,
1 : 0,
2 : 0
}
REFINE_TOTAL_PERCENTAGE = {
"update" : 0
}
def IS_UPGRADE_ITEM(itemVnum):
for i in xrange(3):
if itemVnum == REFINE_VNUM:
return TRUE
return FALSE
class RefineDialog(ui.ScriptWindow):
makeSocketSuccessPercentage = ( 100, 33, 20, 15, 10, 5, 0 )
upgradeStoneSuccessPercentage = ( 30, 29, 28, 27, 26, 25, 24, 23, 22 )
upgradeArmorSuccessPercentage = ( 99, 66, 33, 33, 33, 33, 33, 33, 33 )
upgradeAccessorySuccessPercentage = ( 99, 88, 77, 66, 33, 33, 33, 33, 33 )
upgradeSuccessPercentage = ( 99, 66, 33, 33, 33, 33, 33, 33, 33 )
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadScript()
self.scrollItemPos = 0
self.targetItemPos = 0
def __LoadScript(self):
self.__LoadQuestionDialog()
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "uiscript/refinedialog.py")
except:
import exception
exception.Abort("RefineDialog.__LoadScript.LoadObject")
try:
self.board = self.GetChild("Board")
self.titleBar = self.GetChild("TitleBar")
self.successPercentage = self.GetChild("SuccessPercentage")
self.GetChild("AcceptButton").SetEvent(self.OpenQuestionDialog)
self.GetChild("CancelButton").SetEvent(self.Close)
except:
import exception
exception.Abort("RefineDialog.__LoadScript.BindObject")
if constInfo.ENABLE_REFINE_PCT:
self.successPercentage.Show()
else:
self.successPercentage.Hide()
toolTip = uiToolTip.ItemToolTip()
toolTip.SetParent(self)
toolTip.SetPosition(15, 38)
toolTip.SetFollow(FALSE)
toolTip.Show()
self.toolTip = toolTip
self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
def __del__(self):
ui.ScriptWindow.__del__(self)
def __LoadQuestionDialog(self):
self.dlgQuestion = ui.ScriptWindow()
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self.dlgQuestion, "uiscript/questiondialog2.py")
except:
import exception
exception.Abort("RefineDialog.__LoadQuestionDialog.LoadScript")
try:
GetObject=self.dlgQuestion.GetChild
GetObject("message1").SetText(localeInfo.REFINE_DESTROY_WARNING)
GetObject("message2").SetText(localeInfo.REFINE_WARNING2)
GetObject("accept").SetEvent(ui.__mem_func__(self.Accept))
GetObject("cancel").SetEvent(ui.__mem_func__(self.dlgQuestion.Hide))
except:
import exception
exception.Abort("SelectCharacterWindow.__LoadQuestionDialog.BindObject")
def Destroy(self):
self.ClearDictionary()
self.board = 0
self.successPercentage = 0
self.titleBar = 0
self.toolTip = 0
self.dlgQuestion = 0
def GetRefineSuccessPercentage(self, scrollSlotIndex, itemSlotIndex):
if -1 != scrollSlotIndex:
if player.IsRefineGradeScroll(scrollSlotIndex):
curGrade = player.GetItemGrade(itemSlotIndex)
itemIndex = player.GetItemIndex(itemSlotIndex)
item.SelectItem(itemIndex)
itemType = item.GetItemType()
itemSubType = item.GetItemSubType()
if item.ITEM_TYPE_METIN == itemType:
if curGrade >= len(self.upgradeStoneSuccessPercentage):
return 0
return self.upgradeStoneSuccessPercentage[curGrade]
elif item.ITEM_TYPE_ARMOR == itemType:
if item.ARMOR_BODY == itemSubType:
if curGrade >= len(self.upgradeArmorSuccessPercentage):
return 0
return self.upgradeArmorSuccessPercentage[curGrade]
else:
if curGrade >= len(self.upgradeAccessorySuccessPercentage):
return 0
return self.upgradeAccessorySuccessPercentage[curGrade]
else:
if curGrade >= len(self.upgradeSuccessPercentage):
return 0
return self.upgradeSuccessPercentage[curGrade]
for i in xrange(player.METIN_SOCKET_MAX_NUM+1):
if 0 == player.GetItemMetinSocket(itemSlotIndex, i):
break
return self.makeSocketSuccessPercentage
def Open(self, scrollItemPos, targetItemPos):
self.scrollItemPos = scrollItemPos
self.targetItemPos = targetItemPos
percentage = self.GetRefineSuccessPercentage(scrollItemPos, targetItemPos)
if 0 == percentage:
return
self.successPercentage.SetText(localeInfo.REFINE_SUCCESS_PROBALITY % (percentage))
itemIndex = player.GetItemIndex(targetItemPos)
self.toolTip.ClearToolTip()
if app.WJ_ENABLE_TRADABLE_ICON:
self.SetCantMouseEventSlot(targetItemPos)
metinSlot = []
for i in xrange(player.METIN_SOCKET_MAX_NUM):
metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
self.toolTip.AddItemData(itemIndex, metinSlot)
self.UpdateDialog()
self.SetTop()
self.Show()
def UpdateDialog(self):
newWidth = self.toolTip.GetWidth() + 30
newHeight = self.toolTip.GetHeight() + 98
self.board.SetSize(newWidth, newHeight)
self.titleBar.SetWidth(newWidth-15)
self.SetSize(newWidth, newHeight)
(x, y) = self.GetLocalPosition()
self.SetPosition(x, y)
def OpenQuestionDialog(self):
percentage = self.GetRefineSuccessPercentage(-1, self.targetItemPos)
if 100 == percentage:
self.Accept()
return
self.dlgQuestion.SetTop()
self.dlgQuestion.Show()
def Accept(self):
net.SendItemUseToItemPacket(self.scrollItemPos, self.targetItemPos)
def Close(self):
if self.dlgQuestion:
self.dlgQuestion.Close()
self.dlgQuestion = None
self.Hide()
def OnPressEscapeKey(self):
self.Close()
return TRUE
class RefineDialogNew(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__Initialize()
self.isLoaded = FALSE
if app.WJ_ENABLE_TRADABLE_ICON:
self.wndInventory = None
def __Initialize(self):
self.dlgQuestion = None
self.children = []
self.vnum = 0
self.targetItemPos = 0
self.dialogHeight = 0
self.percentage = 0
self.total_percentage = 0
self.cost = 0
self.type = 0
if app.WJ_ENABLE_TRADABLE_ICON:
self.lockedItem = (-1,-1)
def __LoadScript(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "uiscript/refinedialog.py")
except:
import exception
exception.Abort("RefineDialog.__LoadScript.LoadObject")
try:
self.board = self.GetChild("Board")
self.titleBar = self.GetChild("TitleBar")
self.probText = self.GetChild("SuccessPercentage")
self.probIncreaseText = self.GetChild("SuccessPercentageIncreased")
self.costText = self.GetChild("Cost")
self.slot = self.GetChild("Slot")
self.designMode = self.GetChild("DesignIncrease")
self.button_accept = self.GetChild("AcceptButton")
self.GetChild("AcceptButton").SetEvent(self.OpenQuestionDialog)
self.GetChild("CancelButton").SetEvent(self.CancelRefine)
except:
import exception
exception.Abort("RefineDialog.__LoadScript.BindObject")
self.slot.SetSelectEmptySlotEvent(ui.__mem_func__(self.__OnSelectEmptySlot))
self.slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.__OnSelectItemSlot))
self.slot.SetUseSlotEvent(ui.__mem_func__(self.__OnSelectItemSlot))
self.slot.SetOverInItemEvent(ui.__mem_func__(self.__OnOverInItem))
self.slot.SetOverOutItemEvent(ui.__mem_func__(self.__OnOverOutItem))
self.toolTipNext = uiToolTip.ItemToolTip()
self.toolTipNext.HideToolTip()
self.toolTipCur = uiToolTip.ItemToolTip()
self.toolTipCur.HideToolTip()
self.tooltipMode = uiToolTip.ItemToolTip()
self.tooltipMode.HideToolTip()
self.toolTipMaterial = uiToolTip.ItemToolTip()
self.toolTipMaterial.HideToolTip()
self.slotCurrent, self.slotAfter, self.numberSlotImage, self.imgPotion = {}, {}, {}, {}
posY = 61
for i in xrange(3):
self.slotCurrent = ui.MakeImageBox(self, "d:/ymir work/ui/public/Slot_Base.sub", 25 * 2-20, posY)
self.slotAfter = ui.MakeImageBox(self, "d:/ymir work/ui/public/Slot_Base.sub", 105 * 2 - 20, posY)
posY += 32
xPos = 25
name = "icon/item/potion_refine_hide_"
for i in xrange(3):
self.numberSlotImage = ui.MakeImageBox(self.designMode, "d:/ymir work/ui/public/Slot_Base.sub", xPos, 25)
self.imgPotion = ui.MakeImageBox(self.designMode, name + str(i+1) + ".tga", xPos + 1, 25)
xPos += 75
self.itemImageCur = ui.MakeImageBox(self, "d:/ymir work/ui/public/Slot_Base.sub", 49-20, 60)
self.itemImageNext = ui.MakeImageBox(self, "d:/ymir work/ui/public/Slot_Base.sub", 105 * 2 - 20, 60)
self.materialList = []
self.titleBar.SetCloseEvent(ui.__mem_func__(self.CancelRefine))
self.isLoaded = TRUE
if app.ENABLE_REFINE_RENEWAL:
self.checkBox = ui.CheckBox()
self.checkBox.SetParent(self)
self.checkBox.SetPosition(0, 65)
self.checkBox.SetWindowHorizontalAlignCenter()
self.checkBox.SetWindowVerticalAlignBottom()
self.checkBox.SetEvent(ui.__mem_func__(self.AutoRefine), "ON_CHECK", True)
self.checkBox.SetEvent(ui.__mem_func__(self.AutoRefine), "ON_UNCKECK", False)
self.checkBox.SetCheckStatus(constInfo.IS_AUTO_REFINE)
self.checkBox.SetTextInfo(uiScriptLocale.UPGRADE)
self.checkBox.Show()
def __del__(self):
ui.ScriptWindow.__del__(self)
def __MakeItemSlot(self,c):
itemslot = ui.SlotWindow()
itemslot.SetParent(self)
itemslot.SetSize(32, 32)
itemslot.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
itemslot.AppendSlot(c, 0, 0, 32, 32)
itemslot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
itemslot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
itemslot.RefreshSlot()
itemslot.Show()
self.children.append(itemslot)
return itemslot
def __MakeThinBoard(self):
thinBoard = ui.ThinBoard()
thinBoard.SetParent(self)
thinBoard.Show()
self.children.append(thinBoard)
return thinBoard
def Destroy(self):
self.ClearDictionary()
self.dlgQuestion = None
self.board = 0
self.probText = 0
self.probIncreaseText = 0
self.costText = 0
self.titleBar = 0
self.toolTipNext = 0
self.toolTipCur = 0
self.itemImageCur = 0
self.itemImageNext = 0
self.children = []
self.materialList = []
self.toolTipMaterial = 0
self.slotCurrent = None
self.slotAfter = None
self.numberSlotImage = None
self.imgPotion = None
REFINE_TOTAL_PERCENTAGE["update"] = 0
if app.WJ_ENABLE_TRADABLE_ICON:
self.wndInventory = None
self.lockedItem = (-1,-1)
if app.ENABLE_REFINE_RENEWAL:
def __InitializeOpen(self):
self.children = []
self.vnum = 0
self.targetItemPos = 0
self.dialogHeight = 0
self.cost = 0
self.percentage = 0
self.type = 0
self.xRefineStart = 0
self.yRefineStart = 0
def Open(self, targetItemPos, nextGradeItemVnum, cost, prob, type):
if FALSE == self.isLoaded:
self.__LoadScript()
if app.ENABLE_REFINE_RENEWAL:
self.__InitializeOpen()
else:
self.__Initialize()
self.targetItemPos = targetItemPos
self.vnum = nextGradeItemVnum
self.cost = cost
self.percentage = prob
if constInfo.ADDPERCENT > 0:
self.percentage += constInfo.ADDPERCENT
constInfo.ADDPERCENT = 0
self.type = type
self.Clear()
# Arata / Ascunde percentul de upgrade!
if constInfo.ENABLE_REFINE_PCT:
self.probText.SetText(localeInfo.REFINE_CURRENT_PERCENTAGE % (self.percentage))
self.costText.SetText("%s" % (localeInfo.NumberToMoneyString(self.cost)))
self.toolTipNext.ClearToolTip()
self.toolTipCur.ClearToolTip()
metinSlot = []
for i in xrange(player.METIN_SOCKET_MAX_NUM):
metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
attrSlot = []
for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
attrSlot.append(player.GetItemAttribute(targetItemPos, i))
self.toolTipCur.SetInventoryItem(targetItemPos)
self.toolTipNext.AddRefineItemData(nextGradeItemVnum, metinSlot, attrSlot)
curItemIndex = player.GetItemIndex(targetItemPos)
if curItemIndex != 0:
item.SelectItem(curItemIndex)
try:
self.itemImageCur.LoadImage(item.GetIconImageFileName())
except:
dbg.TraceError("Refine.CurrentItem.LoadImage - Failed to find item data")
item.SelectItem(nextGradeItemVnum)
self.itemImageNext.LoadImage(item.GetIconImageFileName())
self.dialogHeight = 62+200
self.UpdateDialog()
self.SetTop()
self.Show()
def Clear(self):
for it in xrange(3):
REFINE_MODE[it] = 0
self.slot.ClearSlot(it)
REFINE_TOTAL_PERCENTAGE["update"] = 0
def Close(self):
self.dlgQuestion = None
self.Clear()
self.Hide()
def AppendMaterial(self, vnum, count):
grid = self.__MakeItemSlot(len(self.materialList))
grid.SetPosition(15, self.dialogHeight)
grid.SetItemSlot(len(self.materialList), vnum, 0)
self.materialList.append(vnum)
thinBoard = self.__MakeThinBoard()
thinBoard.SetPosition(15+35, self.dialogHeight)
thinBoard.SetSize(191, 20)
textLine = ui.TextLine()
textLine.SetParent(thinBoard)
textLine.SetFontName(localeInfo.UI_DEF_FONT)
if player.SetItemCount(vnum) < count:
# textLine.SetPackedFontColor(0xffFF0033)
textLine.SetPackedFontColor(0xffdddddd)
else:
textLine.SetPackedFontColor(0xffdddddd)
# textLine.SetText("%s x%d |cFFffce00(%d)" % (item.GetItemName(), count, player.GetItemCountByVnum(vnum)))
textLine.SetText("%s x%d" % (item.GetItemName(), count))
textLine.SetOutline()
textLine.SetFeather(False)
textLine.SetWindowVerticalAlignCenter()
textLine.SetVerticalAlignCenter()
textLine.SetPosition(15, 0)
textLine.Show()
self.children.append(textLine)
self.dialogHeight += 34
self.UpdateDialog()
def UpdateDialog(self):
self.board.SetSize(255, 350+100+35)
self.titleBar.SetWidth(255-15)
self.SetSize(255, 350+100+35)
(x, y) = self.GetLocalPosition()
self.SetPosition(x, y)
def OpenQuestionDialog(self):
totalPerc = self.percentage + REFINE_TOTAL_PERCENTAGE["update"]
if 100 == totalPerc:
self.Accept()
return
if 5 == self.type:
self.Accept()
return
dlgQuestion = uiCommon.QuestionDialog2()
dlgQuestion.SetText2(localeInfo.REFINE_WARNING2)
dlgQuestion.SetAcceptEvent(ui.__mem_func__(self.Accept))
dlgQuestion.SetCancelEvent(ui.__mem_func__(dlgQuestion.Close))
if 3 == self.type:
dlgQuestion.SetText1(localeInfo.REFINE_DESTROY_WARNING_WITH_BONUS_PERCENT_1)
dlgQuestion.SetText2(localeInfo.REFINE_DESTROY_WARNING_WITH_BONUS_PERCENT_2)
elif 2 == self.type:
dlgQuestion.SetText1(localeInfo.REFINE_DOWN_GRADE_WARNING)
else:
dlgQuestion.SetText1(localeInfo.REFINE_DESTROY_WARNING)
dlgQuestion.Open()
self.dlgQuestion = dlgQuestion
def Accept(self):
totalPerc = self.percentage + REFINE_TOTAL_PERCENTAGE["update"]
net.SendRefinePacket(self.targetItemPos, self.type, REFINE_MODE[0], REFINE_MODE[1], REFINE_MODE[2], totalPerc)
if not app.ENABLE_REFINE_RENEWAL:
self.Close()
if app.ENABLE_REFINE_RENEWAL:
def AutoRefine(self, checkType, autoFlag):
constInfo.IS_AUTO_REFINE = autoFlag
def CheckRefine(self, isFail):
if constInfo.IS_AUTO_REFINE == True:
if constInfo.AUTO_REFINE_TYPE == 1:
if constInfo.AUTO_REFINE_DATA["ITEM"][0] != -1 and constInfo.AUTO_REFINE_DATA["ITEM"][1] != -1:
scrollIndex = player.GetItemIndex(constInfo.AUTO_REFINE_DATA["ITEM"][0])
itemIndex = player.GetItemIndex(constInfo.AUTO_REFINE_DATA["ITEM"][1])
# chat.AppendChat(chat.CHAT_TYPE_INFO, "%d %d" % (itemIndex, int(itemIndex %10)))
if scrollIndex == 0 or (itemIndex % 10 == 8 and not isFail):
self.Close()
else:
net.SendItemUseToItemPacket(constInfo.AUTO_REFINE_DATA["ITEM"][0], constInfo.AUTO_REFINE_DATA["ITEM"][1])
elif constInfo.AUTO_REFINE_TYPE == 2:
npcData = constInfo.AUTO_REFINE_DATA["NPC"]
if npcData[0] != 0 and npcData[1] != -1 and npcData[2] != -1 and npcData[3] != 0:
itemIndex = player.GetItemIndex(npcData[1], npcData[2])
if (itemIndex % 10 == 8 and not isFail) or isFail:
self.Close()
else:
net.SendGiveItemPacket(npcData[0], npcData[1], npcData[2], npcData[3])
else:
self.Close()
else:
self.Close()
def OnUpdate(self):
if self.itemImageCur:
if self.itemImageCur.IsIn():
self.toolTipCur.ShowToolTip()
else:
self.toolTipCur.HideToolTip()
if self.itemImageNext:
if self.itemImageNext.IsIn():
self.toolTipNext.ShowToolTip()
else:
self.toolTipNext.HideToolTip()
self.probIncreaseText.SetText(localeInfo.REFINE_INCREASE_PERCENTAGE % (REFINE_TOTAL_PERCENTAGE["update"]))
def CancelRefine(self):
net.SendRefinePacket(255, 255, 0, 0, 0, 0)
self.Close()
if app.ENABLE_REFINE_RENEWAL:
constInfo.AUTO_REFINE_TYPE = 0
constInfo.AUTO_REFINE_DATA = {
"ITEM" : [-1, -1],
"NPC" : [0, -1, -1, 0]
}
def OnPressEscapeKey(self):
self.CancelRefine()
return TRUE
if app.WJ_ENABLE_TRADABLE_ICON:
def SetCanMouseEventSlot(self, slotIndex):
itemInvenPage = slotIndex / player.INVENTORY_PAGE_SIZE
localSlotPos = slotIndex - (itemInvenPage * player.INVENTORY_PAGE_SIZE)
self.lockedItem = (-1, -1)
if itemInvenPage == self.wndInventory.GetInventoryPageIndex():
self.wndInventory.wndItem.SetCanMouseEventSlot(localSlotPos)
def SetCantMouseEventSlot(self, slotIndex):
itemInvenPage = slotIndex / player.INVENTORY_PAGE_SIZE
localSlotPos = slotIndex - (itemInvenPage * player.INVENTORY_PAGE_SIZE)
self.lockedItem = (itemInvenPage, localSlotPos)
if itemInvenPage == self.wndInventory.GetInventoryPageIndex():
self.wndInventory.wndItem.SetCantMouseEventSlot(localSlotPos)
def SetInven(self, wndInventory):
from _weakref import proxy
self.wndInventory = proxy(wndInventory)
def RefreshLockedSlot(self):
if self.wndInventory:
itemInvenPage, itemSlotPos = self.lockedItem
if self.wndInventory.GetInventoryPageIndex() == itemInvenPage:
self.wndInventory.wndItem.SetCantMouseEventSlot(itemSlotPos)
self.wndInventory.wndItem.RefreshSlot()
def OverInItem(self, slot):
if self.toolTipMaterial:
self.toolTipMaterial.SetItemToolTip(self.materialList[slot])
def OverOutItem(self):
if self.toolTipMaterial:
self.toolTipMaterial.HideToolTip()
def __OnSelectEmptySlot(self, selectedSlotPos):
isAttached = mouseModule.mouseController.isAttached()
if isAttached:
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
mouseModule.mouseController.DeattachObject()
if player.SLOT_TYPE_INVENTORY != attachedSlotType:
return
if IS_UPGRADE_ITEM(player.GetItemIndex(attachedSlotPos)):
#fix 12.01.2017
item.SelectItem(self.vnum)
if item.GetItemType() == item.ITEM_TYPE_METIN:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ADD_PERC_STONES)
return
if attachedItemCount > 1 or attachedItemCount <= 0:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ITEM_COUNT)
return
for it in xrange(3):
if selectedSlotPos == it and attachedItemIndex != REFINE_VNUM[it]:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ITEM_VNUM)
return
for it in xrange(3):
if selectedSlotPos == it:
if self.percentage + REFINE_TOTAL_PERCENTAGE["update"] + REFINE_PERCENTAGE[it] > 100:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ITEM_OVERFLOW_PERCENTAGE)
return
REFINE_MODE[it] = 1
REFINE_TOTAL_PERCENTAGE["update"] += REFINE_PERCENTAGE[it]
self.slot.ClearSlot(selectedSlotPos)
self.slot.SetItemSlot(selectedSlotPos, player.GetItemIndex(attachedSlotPos), player.GetItemCount(attachedSlotPos))
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ITEM_VNUM)
def __OnSelectItemSlot(self, selectedSlotPos):
for it in xrange(3):
if selectedSlotPos == it:
self.slot.ClearSlot(selectedSlotPos)
REFINE_MODE[it] = 0
REFINE_TOTAL_PERCENTAGE["update"] -= REFINE_PERCENTAGE[it]
def __OnOverInItem(self, slotIndex):
for it in xrange(3):
if slotIndex == it:
self.tooltipMode.SetItemToolTip(REFINE_VNUM[it])
def __OnOverOutItem(self):
if self.tooltipMode:
self.tooltipMode.HideToolTip()
# title_name : Extra Refine System
# date_created : 2016.09.20
# filename : uiRefine.py
# author : VegaS
# version : 0.1.6
#
import app
import grp
import net
import player
import item
import ui
import uiToolTip
import mouseModule
import localeInfo
import uiCommon
import constInfo
import snd
import wndMgr
import chat
import uiScriptLocale
REFINE_VNUM = [
player.REFINE_VNUM_POTION_LOW,
player.REFINE_VNUM_POTION_MEDIUM,
player.REFINE_VNUM_POTION_EXTRA
]
REFINE_PERCENTAGE = [
player.REFINE_PERCENTAGE_LOW,
player.REFINE_PERCENTAGE_MEDIUM,
player.REFINE_PERCENTAGE_EXTRA
]
REFINE_MODE = {
0 : 0,
1 : 0,
2 : 0
}
REFINE_TOTAL_PERCENTAGE = {
"update" : 0
}
def IS_UPGRADE_ITEM(itemVnum):
for i in xrange(3):
if itemVnum == REFINE_VNUM:
return TRUE
return FALSE
class RefineDialog(ui.ScriptWindow):
makeSocketSuccessPercentage = ( 100, 33, 20, 15, 10, 5, 0 )
upgradeStoneSuccessPercentage = ( 30, 29, 28, 27, 26, 25, 24, 23, 22 )
upgradeArmorSuccessPercentage = ( 99, 66, 33, 33, 33, 33, 33, 33, 33 )
upgradeAccessorySuccessPercentage = ( 99, 88, 77, 66, 33, 33, 33, 33, 33 )
upgradeSuccessPercentage = ( 99, 66, 33, 33, 33, 33, 33, 33, 33 )
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__LoadScript()
self.scrollItemPos = 0
self.targetItemPos = 0
def __LoadScript(self):
self.__LoadQuestionDialog()
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "uiscript/refinedialog.py")
except:
import exception
exception.Abort("RefineDialog.__LoadScript.LoadObject")
try:
self.board = self.GetChild("Board")
self.titleBar = self.GetChild("TitleBar")
self.successPercentage = self.GetChild("SuccessPercentage")
self.GetChild("AcceptButton").SetEvent(self.OpenQuestionDialog)
self.GetChild("CancelButton").SetEvent(self.Close)
except:
import exception
exception.Abort("RefineDialog.__LoadScript.BindObject")
if constInfo.ENABLE_REFINE_PCT:
self.successPercentage.Show()
else:
self.successPercentage.Hide()
toolTip = uiToolTip.ItemToolTip()
toolTip.SetParent(self)
toolTip.SetPosition(15, 38)
toolTip.SetFollow(FALSE)
toolTip.Show()
self.toolTip = toolTip
self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
def __del__(self):
ui.ScriptWindow.__del__(self)
def __LoadQuestionDialog(self):
self.dlgQuestion = ui.ScriptWindow()
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self.dlgQuestion, "uiscript/questiondialog2.py")
except:
import exception
exception.Abort("RefineDialog.__LoadQuestionDialog.LoadScript")
try:
GetObject=self.dlgQuestion.GetChild
GetObject("message1").SetText(localeInfo.REFINE_DESTROY_WARNING)
GetObject("message2").SetText(localeInfo.REFINE_WARNING2)
GetObject("accept").SetEvent(ui.__mem_func__(self.Accept))
GetObject("cancel").SetEvent(ui.__mem_func__(self.dlgQuestion.Hide))
except:
import exception
exception.Abort("SelectCharacterWindow.__LoadQuestionDialog.BindObject")
def Destroy(self):
self.ClearDictionary()
self.board = 0
self.successPercentage = 0
self.titleBar = 0
self.toolTip = 0
self.dlgQuestion = 0
def GetRefineSuccessPercentage(self, scrollSlotIndex, itemSlotIndex):
if -1 != scrollSlotIndex:
if player.IsRefineGradeScroll(scrollSlotIndex):
curGrade = player.GetItemGrade(itemSlotIndex)
itemIndex = player.GetItemIndex(itemSlotIndex)
item.SelectItem(itemIndex)
itemType = item.GetItemType()
itemSubType = item.GetItemSubType()
if item.ITEM_TYPE_METIN == itemType:
if curGrade >= len(self.upgradeStoneSuccessPercentage):
return 0
return self.upgradeStoneSuccessPercentage[curGrade]
elif item.ITEM_TYPE_ARMOR == itemType:
if item.ARMOR_BODY == itemSubType:
if curGrade >= len(self.upgradeArmorSuccessPercentage):
return 0
return self.upgradeArmorSuccessPercentage[curGrade]
else:
if curGrade >= len(self.upgradeAccessorySuccessPercentage):
return 0
return self.upgradeAccessorySuccessPercentage[curGrade]
else:
if curGrade >= len(self.upgradeSuccessPercentage):
return 0
return self.upgradeSuccessPercentage[curGrade]
for i in xrange(player.METIN_SOCKET_MAX_NUM+1):
if 0 == player.GetItemMetinSocket(itemSlotIndex, i):
break
return self.makeSocketSuccessPercentage
def Open(self, scrollItemPos, targetItemPos):
self.scrollItemPos = scrollItemPos
self.targetItemPos = targetItemPos
percentage = self.GetRefineSuccessPercentage(scrollItemPos, targetItemPos)
if 0 == percentage:
return
self.successPercentage.SetText(localeInfo.REFINE_SUCCESS_PROBALITY % (percentage))
itemIndex = player.GetItemIndex(targetItemPos)
self.toolTip.ClearToolTip()
if app.WJ_ENABLE_TRADABLE_ICON:
self.SetCantMouseEventSlot(targetItemPos)
metinSlot = []
for i in xrange(player.METIN_SOCKET_MAX_NUM):
metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
self.toolTip.AddItemData(itemIndex, metinSlot)
self.UpdateDialog()
self.SetTop()
self.Show()
def UpdateDialog(self):
newWidth = self.toolTip.GetWidth() + 30
newHeight = self.toolTip.GetHeight() + 98
self.board.SetSize(newWidth, newHeight)
self.titleBar.SetWidth(newWidth-15)
self.SetSize(newWidth, newHeight)
(x, y) = self.GetLocalPosition()
self.SetPosition(x, y)
def OpenQuestionDialog(self):
percentage = self.GetRefineSuccessPercentage(-1, self.targetItemPos)
if 100 == percentage:
self.Accept()
return
self.dlgQuestion.SetTop()
self.dlgQuestion.Show()
def Accept(self):
net.SendItemUseToItemPacket(self.scrollItemPos, self.targetItemPos)
def Close(self):
if self.dlgQuestion:
self.dlgQuestion.Close()
self.dlgQuestion = None
self.Hide()
def OnPressEscapeKey(self):
self.Close()
return TRUE
class RefineDialogNew(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.__Initialize()
self.isLoaded = FALSE
if app.WJ_ENABLE_TRADABLE_ICON:
self.wndInventory = None
def __Initialize(self):
self.dlgQuestion = None
self.children = []
self.vnum = 0
self.targetItemPos = 0
self.dialogHeight = 0
self.percentage = 0
self.total_percentage = 0
self.cost = 0
self.type = 0
if app.WJ_ENABLE_TRADABLE_ICON:
self.lockedItem = (-1,-1)
def __LoadScript(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "uiscript/refinedialog.py")
except:
import exception
exception.Abort("RefineDialog.__LoadScript.LoadObject")
try:
self.board = self.GetChild("Board")
self.titleBar = self.GetChild("TitleBar")
self.probText = self.GetChild("SuccessPercentage")
self.probIncreaseText = self.GetChild("SuccessPercentageIncreased")
self.costText = self.GetChild("Cost")
self.slot = self.GetChild("Slot")
self.designMode = self.GetChild("DesignIncrease")
self.button_accept = self.GetChild("AcceptButton")
self.GetChild("AcceptButton").SetEvent(self.OpenQuestionDialog)
self.GetChild("CancelButton").SetEvent(self.CancelRefine)
except:
import exception
exception.Abort("RefineDialog.__LoadScript.BindObject")
self.slot.SetSelectEmptySlotEvent(ui.__mem_func__(self.__OnSelectEmptySlot))
self.slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.__OnSelectItemSlot))
self.slot.SetUseSlotEvent(ui.__mem_func__(self.__OnSelectItemSlot))
self.slot.SetOverInItemEvent(ui.__mem_func__(self.__OnOverInItem))
self.slot.SetOverOutItemEvent(ui.__mem_func__(self.__OnOverOutItem))
self.toolTipNext = uiToolTip.ItemToolTip()
self.toolTipNext.HideToolTip()
self.toolTipCur = uiToolTip.ItemToolTip()
self.toolTipCur.HideToolTip()
self.tooltipMode = uiToolTip.ItemToolTip()
self.tooltipMode.HideToolTip()
self.toolTipMaterial = uiToolTip.ItemToolTip()
self.toolTipMaterial.HideToolTip()
self.slotCurrent, self.slotAfter, self.numberSlotImage, self.imgPotion = {}, {}, {}, {}
posY = 61
for i in xrange(3):
self.slotCurrent = ui.MakeImageBox(self, "d:/ymir work/ui/public/Slot_Base.sub", 25 * 2-20, posY)
self.slotAfter = ui.MakeImageBox(self, "d:/ymir work/ui/public/Slot_Base.sub", 105 * 2 - 20, posY)
posY += 32
xPos = 25
name = "icon/item/potion_refine_hide_"
for i in xrange(3):
self.numberSlotImage = ui.MakeImageBox(self.designMode, "d:/ymir work/ui/public/Slot_Base.sub", xPos, 25)
self.imgPotion = ui.MakeImageBox(self.designMode, name + str(i+1) + ".tga", xPos + 1, 25)
xPos += 75
self.itemImageCur = ui.MakeImageBox(self, "d:/ymir work/ui/public/Slot_Base.sub", 49-20, 60)
self.itemImageNext = ui.MakeImageBox(self, "d:/ymir work/ui/public/Slot_Base.sub", 105 * 2 - 20, 60)
self.materialList = []
self.titleBar.SetCloseEvent(ui.__mem_func__(self.CancelRefine))
self.isLoaded = TRUE
if app.ENABLE_REFINE_RENEWAL:
self.checkBox = ui.CheckBox()
self.checkBox.SetParent(self)
self.checkBox.SetPosition(0, 65)
self.checkBox.SetWindowHorizontalAlignCenter()
self.checkBox.SetWindowVerticalAlignBottom()
self.checkBox.SetEvent(ui.__mem_func__(self.AutoRefine), "ON_CHECK", True)
self.checkBox.SetEvent(ui.__mem_func__(self.AutoRefine), "ON_UNCKECK", False)
self.checkBox.SetCheckStatus(constInfo.IS_AUTO_REFINE)
self.checkBox.SetTextInfo(uiScriptLocale.UPGRADE)
self.checkBox.Show()
def __del__(self):
ui.ScriptWindow.__del__(self)
def __MakeItemSlot(self,c):
itemslot = ui.SlotWindow()
itemslot.SetParent(self)
itemslot.SetSize(32, 32)
itemslot.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
itemslot.AppendSlot(c, 0, 0, 32, 32)
itemslot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
itemslot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
itemslot.RefreshSlot()
itemslot.Show()
self.children.append(itemslot)
return itemslot
def __MakeThinBoard(self):
thinBoard = ui.ThinBoard()
thinBoard.SetParent(self)
thinBoard.Show()
self.children.append(thinBoard)
return thinBoard
def Destroy(self):
self.ClearDictionary()
self.dlgQuestion = None
self.board = 0
self.probText = 0
self.probIncreaseText = 0
self.costText = 0
self.titleBar = 0
self.toolTipNext = 0
self.toolTipCur = 0
self.itemImageCur = 0
self.itemImageNext = 0
self.children = []
self.materialList = []
self.toolTipMaterial = 0
self.slotCurrent = None
self.slotAfter = None
self.numberSlotImage = None
self.imgPotion = None
REFINE_TOTAL_PERCENTAGE["update"] = 0
if app.WJ_ENABLE_TRADABLE_ICON:
self.wndInventory = None
self.lockedItem = (-1,-1)
if app.ENABLE_REFINE_RENEWAL:
def __InitializeOpen(self):
self.children = []
self.vnum = 0
self.targetItemPos = 0
self.dialogHeight = 0
self.cost = 0
self.percentage = 0
self.type = 0
self.xRefineStart = 0
self.yRefineStart = 0
def Open(self, targetItemPos, nextGradeItemVnum, cost, prob, type):
if FALSE == self.isLoaded:
self.__LoadScript()
if app.ENABLE_REFINE_RENEWAL:
self.__InitializeOpen()
else:
self.__Initialize()
self.targetItemPos = targetItemPos
self.vnum = nextGradeItemVnum
self.cost = cost
self.percentage = prob
if constInfo.ADDPERCENT > 0:
self.percentage += constInfo.ADDPERCENT
constInfo.ADDPERCENT = 0
self.type = type
self.Clear()
# Arata / Ascunde percentul de upgrade!
if constInfo.ENABLE_REFINE_PCT:
self.probText.SetText(localeInfo.REFINE_CURRENT_PERCENTAGE % (self.percentage))
self.costText.SetText("%s" % (localeInfo.NumberToMoneyString(self.cost)))
self.toolTipNext.ClearToolTip()
self.toolTipCur.ClearToolTip()
metinSlot = []
for i in xrange(player.METIN_SOCKET_MAX_NUM):
metinSlot.append(player.GetItemMetinSocket(targetItemPos, i))
attrSlot = []
for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM):
attrSlot.append(player.GetItemAttribute(targetItemPos, i))
self.toolTipCur.SetInventoryItem(targetItemPos)
self.toolTipNext.AddRefineItemData(nextGradeItemVnum, metinSlot, attrSlot)
curItemIndex = player.GetItemIndex(targetItemPos)
if curItemIndex != 0:
item.SelectItem(curItemIndex)
try:
self.itemImageCur.LoadImage(item.GetIconImageFileName())
except:
dbg.TraceError("Refine.CurrentItem.LoadImage - Failed to find item data")
item.SelectItem(nextGradeItemVnum)
self.itemImageNext.LoadImage(item.GetIconImageFileName())
self.dialogHeight = 62+200
self.UpdateDialog()
self.SetTop()
self.Show()
def Clear(self):
for it in xrange(3):
REFINE_MODE[it] = 0
self.slot.ClearSlot(it)
REFINE_TOTAL_PERCENTAGE["update"] = 0
def Close(self):
self.dlgQuestion = None
self.Clear()
self.Hide()
def AppendMaterial(self, vnum, count):
grid = self.__MakeItemSlot(len(self.materialList))
grid.SetPosition(15, self.dialogHeight)
grid.SetItemSlot(len(self.materialList), vnum, 0)
self.materialList.append(vnum)
thinBoard = self.__MakeThinBoard()
thinBoard.SetPosition(15+35, self.dialogHeight)
thinBoard.SetSize(191, 20)
textLine = ui.TextLine()
textLine.SetParent(thinBoard)
textLine.SetFontName(localeInfo.UI_DEF_FONT)
if player.SetItemCount(vnum) < count:
# textLine.SetPackedFontColor(0xffFF0033)
textLine.SetPackedFontColor(0xffdddddd)
else:
textLine.SetPackedFontColor(0xffdddddd)
# textLine.SetText("%s x%d |cFFffce00(%d)" % (item.GetItemName(), count, player.GetItemCountByVnum(vnum)))
textLine.SetText("%s x%d" % (item.GetItemName(), count))
textLine.SetOutline()
textLine.SetFeather(False)
textLine.SetWindowVerticalAlignCenter()
textLine.SetVerticalAlignCenter()
textLine.SetPosition(15, 0)
textLine.Show()
self.children.append(textLine)
self.dialogHeight += 34
self.UpdateDialog()
def UpdateDialog(self):
self.board.SetSize(255, 350+100+35)
self.titleBar.SetWidth(255-15)
self.SetSize(255, 350+100+35)
(x, y) = self.GetLocalPosition()
self.SetPosition(x, y)
def OpenQuestionDialog(self):
totalPerc = self.percentage + REFINE_TOTAL_PERCENTAGE["update"]
if 100 == totalPerc:
self.Accept()
return
if 5 == self.type:
self.Accept()
return
dlgQuestion = uiCommon.QuestionDialog2()
dlgQuestion.SetText2(localeInfo.REFINE_WARNING2)
dlgQuestion.SetAcceptEvent(ui.__mem_func__(self.Accept))
dlgQuestion.SetCancelEvent(ui.__mem_func__(dlgQuestion.Close))
if 3 == self.type:
dlgQuestion.SetText1(localeInfo.REFINE_DESTROY_WARNING_WITH_BONUS_PERCENT_1)
dlgQuestion.SetText2(localeInfo.REFINE_DESTROY_WARNING_WITH_BONUS_PERCENT_2)
elif 2 == self.type:
dlgQuestion.SetText1(localeInfo.REFINE_DOWN_GRADE_WARNING)
else:
dlgQuestion.SetText1(localeInfo.REFINE_DESTROY_WARNING)
dlgQuestion.Open()
self.dlgQuestion = dlgQuestion
def Accept(self):
totalPerc = self.percentage + REFINE_TOTAL_PERCENTAGE["update"]
net.SendRefinePacket(self.targetItemPos, self.type, REFINE_MODE[0], REFINE_MODE[1], REFINE_MODE[2], totalPerc)
if not app.ENABLE_REFINE_RENEWAL:
self.Close()
if app.ENABLE_REFINE_RENEWAL:
def AutoRefine(self, checkType, autoFlag):
constInfo.IS_AUTO_REFINE = autoFlag
def CheckRefine(self, isFail):
if constInfo.IS_AUTO_REFINE == True:
if constInfo.AUTO_REFINE_TYPE == 1:
if constInfo.AUTO_REFINE_DATA["ITEM"][0] != -1 and constInfo.AUTO_REFINE_DATA["ITEM"][1] != -1:
scrollIndex = player.GetItemIndex(constInfo.AUTO_REFINE_DATA["ITEM"][0])
itemIndex = player.GetItemIndex(constInfo.AUTO_REFINE_DATA["ITEM"][1])
# chat.AppendChat(chat.CHAT_TYPE_INFO, "%d %d" % (itemIndex, int(itemIndex %10)))
if scrollIndex == 0 or (itemIndex % 10 == 8 and not isFail):
self.Close()
else:
net.SendItemUseToItemPacket(constInfo.AUTO_REFINE_DATA["ITEM"][0], constInfo.AUTO_REFINE_DATA["ITEM"][1])
elif constInfo.AUTO_REFINE_TYPE == 2:
npcData = constInfo.AUTO_REFINE_DATA["NPC"]
if npcData[0] != 0 and npcData[1] != -1 and npcData[2] != -1 and npcData[3] != 0:
itemIndex = player.GetItemIndex(npcData[1], npcData[2])
if (itemIndex % 10 == 8 and not isFail) or isFail:
self.Close()
else:
net.SendGiveItemPacket(npcData[0], npcData[1], npcData[2], npcData[3])
else:
self.Close()
else:
self.Close()
def OnUpdate(self):
if self.itemImageCur:
if self.itemImageCur.IsIn():
self.toolTipCur.ShowToolTip()
else:
self.toolTipCur.HideToolTip()
if self.itemImageNext:
if self.itemImageNext.IsIn():
self.toolTipNext.ShowToolTip()
else:
self.toolTipNext.HideToolTip()
self.probIncreaseText.SetText(localeInfo.REFINE_INCREASE_PERCENTAGE % (REFINE_TOTAL_PERCENTAGE["update"]))
def CancelRefine(self):
net.SendRefinePacket(255, 255, 0, 0, 0, 0)
self.Close()
if app.ENABLE_REFINE_RENEWAL:
constInfo.AUTO_REFINE_TYPE = 0
constInfo.AUTO_REFINE_DATA = {
"ITEM" : [-1, -1],
"NPC" : [0, -1, -1, 0]
}
def OnPressEscapeKey(self):
self.CancelRefine()
return TRUE
if app.WJ_ENABLE_TRADABLE_ICON:
def SetCanMouseEventSlot(self, slotIndex):
itemInvenPage = slotIndex / player.INVENTORY_PAGE_SIZE
localSlotPos = slotIndex - (itemInvenPage * player.INVENTORY_PAGE_SIZE)
self.lockedItem = (-1, -1)
if itemInvenPage == self.wndInventory.GetInventoryPageIndex():
self.wndInventory.wndItem.SetCanMouseEventSlot(localSlotPos)
def SetCantMouseEventSlot(self, slotIndex):
itemInvenPage = slotIndex / player.INVENTORY_PAGE_SIZE
localSlotPos = slotIndex - (itemInvenPage * player.INVENTORY_PAGE_SIZE)
self.lockedItem = (itemInvenPage, localSlotPos)
if itemInvenPage == self.wndInventory.GetInventoryPageIndex():
self.wndInventory.wndItem.SetCantMouseEventSlot(localSlotPos)
def SetInven(self, wndInventory):
from _weakref import proxy
self.wndInventory = proxy(wndInventory)
def RefreshLockedSlot(self):
if self.wndInventory:
itemInvenPage, itemSlotPos = self.lockedItem
if self.wndInventory.GetInventoryPageIndex() == itemInvenPage:
self.wndInventory.wndItem.SetCantMouseEventSlot(itemSlotPos)
self.wndInventory.wndItem.RefreshSlot()
def OverInItem(self, slot):
if self.toolTipMaterial:
self.toolTipMaterial.SetItemToolTip(self.materialList[slot])
def OverOutItem(self):
if self.toolTipMaterial:
self.toolTipMaterial.HideToolTip()
def __OnSelectEmptySlot(self, selectedSlotPos):
isAttached = mouseModule.mouseController.isAttached()
if isAttached:
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
mouseModule.mouseController.DeattachObject()
if player.SLOT_TYPE_INVENTORY != attachedSlotType:
return
if IS_UPGRADE_ITEM(player.GetItemIndex(attachedSlotPos)):
#fix 12.01.2017
item.SelectItem(self.vnum)
if item.GetItemType() == item.ITEM_TYPE_METIN:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ADD_PERC_STONES)
return
if attachedItemCount > 1 or attachedItemCount <= 0:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ITEM_COUNT)
return
for it in xrange(3):
if selectedSlotPos == it and attachedItemIndex != REFINE_VNUM[it]:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ITEM_VNUM)
return
for it in xrange(3):
if selectedSlotPos == it:
if self.percentage + REFINE_TOTAL_PERCENTAGE["update"] + REFINE_PERCENTAGE[it] > 100:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ITEM_OVERFLOW_PERCENTAGE)
return
REFINE_MODE[it] = 1
REFINE_TOTAL_PERCENTAGE["update"] += REFINE_PERCENTAGE[it]
self.slot.ClearSlot(selectedSlotPos)
self.slot.SetItemSlot(selectedSlotPos, player.GetItemIndex(attachedSlotPos), player.GetItemCount(attachedSlotPos))
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_ERROR_ITEM_VNUM)
def __OnSelectItemSlot(self, selectedSlotPos):
for it in xrange(3):
if selectedSlotPos == it:
self.slot.ClearSlot(selectedSlotPos)
REFINE_MODE[it] = 0
REFINE_TOTAL_PERCENTAGE["update"] -= REFINE_PERCENTAGE[it]
def __OnOverInItem(self, slotIndex):
for it in xrange(3):
if slotIndex == it:
self.tooltipMode.SetItemToolTip(REFINE_VNUM[it])
def __OnOverOutItem(self):
if self.tooltipMode:
self.tooltipMode.HideToolTip()
refinedialog.py
import uiScriptLocale
import grp
import localeInfo
BOARD_X = 255
BOARD_Y = 450+35
COLOR_LINE = 0xff5b5e5e
COLOR_PERCENTAGE = 0xffaaf698
LARGE_VALUE_FILE = "d:/ymir work/ui/public/Parameter_Slot_05.sub"
window = {
"name" : "RefineDialog",
"style" : ("movable", "float",),
"x" : SCREEN_WIDTH - 400,
"y" : 70 * 800 / SCREEN_HEIGHT,
"width" : 0,
"height" : 0,
"children" :
(
{
"name" : "Board",
"type" : "board",
"style" : ("attach",),
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0,
"children" :
(
{
"name" : "TitleBar",
"type" : "titlebar",
"style" : ("attach",),
"x" : 8,
"y" : 8,
"width" : 0,
"color" : "red",
"children" :
(
{
"name" : "TitleName",
"type" : "text",
"text" : uiScriptLocale.REFINE_TTILE,
"horizontal_align" : "center",
"text_horizontal_align" : "center",
"x" : 0,
"y" : 3,
},
),
},
{
"name" : "Background",
"type" : "bar",
"x" : 7,
"y" : 32,
"width" : BOARD_X-20,
"height" : BOARD_Y-40,
"color" : grp.GenerateColor(0.0, 0.0, 0.0, 0.5),
},
{
"name" : "AttachNextItem",
"type" : "image",
"x" : 130-10,
"y" : 100,
"image" : "d:/ymir work/ui/game/windows/attach_metin_arrow.sub",
},
{
"name": "test",
"type":"horizontalbar",
"x": 12,
"y": 240,
"width": 235,
"children" :
(
{
"name": "needItems",
"type": "text",
"x": 5,
"y": 1,
"text": localeInfo.REFINE_NEED_ITEMS,
},
),
},
{
"name": "ContentDesign",
"type":"horizontalbar",
"x": 12,
"y": 35,
"width": 235,
"children" :
(
{
"name": "curItem",
"type": "text",
"x": 5,
"y": 1,
"text": localeInfo.REFINE_CURRENT_ITEM,
},
{
"name": "nextItem",
"type": "text",
"x": 130,
"y": 1,
"text": localeInfo.REFINE_NEXT_ITEM,
},
# {
# "name" : "LINE_LEFT",
# "type" : "line",
# "x" : 0,
# "y" : 20,
# "width" : 0,
# "height" : BOARD_Y-67,
# "color" : COLOR_LINE,
# },
# {
# "name" : "LINE_RIGHT",
# "type" : "line",
# "x" : BOARD_X-26,
# "y" : 20,
# "width" : 0,
# "height" : BOARD_Y-67,
# "color" : COLOR_LINE,
# },
# {
# "name" : "LINE_DOWN",
# "type" : "line",
# "x" : 0,
# "y" : BOARD_Y-48,
# "width" : BOARD_X-26,
# "height" : 0,
# "color" : COLOR_LINE,
# },
# {
# "name" : "LINE_UP",
# "type" : "line",
# "x" : 0,
# "y" : 20,
# "width" : BOARD_X-26,
# "height" : 0,
# "color" : COLOR_LINE,
# },
),
},
{
"name": "DesignIncrease",
"type":"horizontalbar",
"x": 12,
"y": 172,
"width": 235,
"children" :
(
{
"name": "SuccessPercentage",
"type": "text",
"x": 5,
"y": 2,
"text": "",
},
{
"name": "SuccessPercentageIncreased",
"type": "text",
"x": 165,
"y": 2,
"color" : 0xffe2ff75,
"text": "",
},
{
"name" : "low",
"type" : "text",
"x" : 38,
"y" : 30,
"color" : COLOR_PERCENTAGE,
"fontname": "Tahoma:16",
# "text" : localeInfo.REFINE_PERCENTAGE_LOW,
},
{
"name" : "medium",
"type" : "text",
"x" : 38+80,
"y" : 30,
"color" : COLOR_PERCENTAGE,
"fontname": "Tahoma:16",
# "text" : localeInfo.REFINE_PERCENTAGE_MEDIUM,
},
{
"name" : "extra",
"type" : "text",
"x" : 38+80+80,
"y" : 30,
"color" : COLOR_PERCENTAGE,
"fontname": "Tahoma:16",
# "text" : localeInfo.REFINE_PERCENTAGE_EXTRA,
},
),
},
{
"name" : "LINE_LEFT",
"type" : "line",
"x" : 8,
"y" : 30,
"width" : 0,
"height" : BOARD_Y-40,
"color" : COLOR_LINE,
},
{
"name" : "LINE_RIGHT",
"type" : "line",
"x" : BOARD_X-10,
"y" : 30,
"width" : 0,
"height" : BOARD_Y-40,
"color" : COLOR_LINE,
},
{
"name" : "LINE_UP",
"type" : "line",
"x" : 8,
"y" : 30,
"width" : BOARD_X-17,
"height" : 0,
"color" : COLOR_LINE,
},
{
"name" : "LINE_DOWN",
"type" : "line",
"x" : 8,
"y" : BOARD_Y-10,
"width" : BOARD_X-17,
"height" : 0,
"color" : COLOR_LINE,
},
# {
# "name" : "SEPARATOR_ITEM_RIGHT",
# "type" : "line",
# "x" : 240,
# "y" : 55,
# "width" : 0,
# "height" : BOARD_X/2-140,
# "color" : COLOR_LINE,
# },
# {
# "name" : "SEPARATOR_ITEM_UPGRADE_LEFT",
# "type" : "line",
# "x" : 249,
# "y" : 55,
# "width" : 0,
# "height" : BOARD_X/2-67,
# "color" : COLOR_LINE,
# },
# {
# "name" : "SEPARATOR_ITEM_DOWN",
# "type" : "line",
# "x" : 12,
# "y" : BOARD_Y-85,
# "width" : BOARD_X/2-21,
# "height" : 0,
# "color" : COLOR_LINE,
# },
{
"name" : "Slot",
"type" : "slot",
"x" : 0,
"y" : 185,
"width" : 200+40,
"height" : 100,
"slot" : (
{
"index": 0,
"x": 20+19,
"y": 12,
"width": 32,
"height": 32
},
{
"index": 1,
"x": 20 + 80+15,
"y": 12,
"width": 32,
"height": 32
},
{
"index": 2,
"x": 20 + 80 + 80+10,
"y": 12,
"width": 32,
"height": 32
},
),
},
{
"name": "DesignCost",
"type":"horizontalbar",
"x": 14,
"y": 400-30+25+5,
"width": 225,
"children" :
(
{
"name": "textLine",
"type": "text",
"x": 5,
"y": 2,
"text": localeInfo.REFINE_COST_UPGRADE,
},
),
},
{
"name" : "SlotCost",
"type" : "button",
"x" : 0,
"y" : 32+30+20-20-10,
"horizontal_align":"center",
"vertical_align":"bottom",
"default_image" : LARGE_VALUE_FILE,
"over_image" : LARGE_VALUE_FILE,
"down_image" : LARGE_VALUE_FILE,
"children" :
(
{
"name":"Money_Icon",
"type": "image",
"x": -18,
"y": 2,
"image": "d:/ymir work/ui/game/windows/money_icon.sub",
},
{
"name" : "Cost",
"type" : "text",
"x" : 3,
"y" : 3,
"horizontal_align" : "right",
"text_horizontal_align" : "right",
"text" : "",
},
),
},
{
"name" : "AcceptButton",
"type" : "button",
"x" : 90-45-5,
"y" : 400+15+35+3,
"text" : uiScriptLocale.OK,
"default_image" : "d:/ymir work/ui/public/Large_Button_01.sub",
"over_image" : "d:/ymir work/ui/public/Large_Button_02.sub",
"down_image" : "d:/ymir work/ui/public/Large_Button_03.sub",
},
{
"name" : "CancelButton",
"type" : "button",
"x" : 90+45-5,
"y" : 400+15+35+3,
"text" : uiScriptLocale.CANCEL,
"default_image" : "d:/ymir work/ui/public/Large_Button_01.sub",
"over_image" : "d:/ymir work/ui/public/Large_Button_02.sub",
"down_image" : "d:/ymir work/ui/public/Large_Button_03.sub",
},
),
},
),
}
import grp
import localeInfo
BOARD_X = 255
BOARD_Y = 450+35
COLOR_LINE = 0xff5b5e5e
COLOR_PERCENTAGE = 0xffaaf698
LARGE_VALUE_FILE = "d:/ymir work/ui/public/Parameter_Slot_05.sub"
window = {
"name" : "RefineDialog",
"style" : ("movable", "float",),
"x" : SCREEN_WIDTH - 400,
"y" : 70 * 800 / SCREEN_HEIGHT,
"width" : 0,
"height" : 0,
"children" :
(
{
"name" : "Board",
"type" : "board",
"style" : ("attach",),
"x" : 0,
"y" : 0,
"width" : 0,
"height" : 0,
"children" :
(
{
"name" : "TitleBar",
"type" : "titlebar",
"style" : ("attach",),
"x" : 8,
"y" : 8,
"width" : 0,
"color" : "red",
"children" :
(
{
"name" : "TitleName",
"type" : "text",
"text" : uiScriptLocale.REFINE_TTILE,
"horizontal_align" : "center",
"text_horizontal_align" : "center",
"x" : 0,
"y" : 3,
},
),
},
{
"name" : "Background",
"type" : "bar",
"x" : 7,
"y" : 32,
"width" : BOARD_X-20,
"height" : BOARD_Y-40,
"color" : grp.GenerateColor(0.0, 0.0, 0.0, 0.5),
},
{
"name" : "AttachNextItem",
"type" : "image",
"x" : 130-10,
"y" : 100,
"image" : "d:/ymir work/ui/game/windows/attach_metin_arrow.sub",
},
{
"name": "test",
"type":"horizontalbar",
"x": 12,
"y": 240,
"width": 235,
"children" :
(
{
"name": "needItems",
"type": "text",
"x": 5,
"y": 1,
"text": localeInfo.REFINE_NEED_ITEMS,
},
),
},
{
"name": "ContentDesign",
"type":"horizontalbar",
"x": 12,
"y": 35,
"width": 235,
"children" :
(
{
"name": "curItem",
"type": "text",
"x": 5,
"y": 1,
"text": localeInfo.REFINE_CURRENT_ITEM,
},
{
"name": "nextItem",
"type": "text",
"x": 130,
"y": 1,
"text": localeInfo.REFINE_NEXT_ITEM,
},
# {
# "name" : "LINE_LEFT",
# "type" : "line",
# "x" : 0,
# "y" : 20,
# "width" : 0,
# "height" : BOARD_Y-67,
# "color" : COLOR_LINE,
# },
# {
# "name" : "LINE_RIGHT",
# "type" : "line",
# "x" : BOARD_X-26,
# "y" : 20,
# "width" : 0,
# "height" : BOARD_Y-67,
# "color" : COLOR_LINE,
# },
# {
# "name" : "LINE_DOWN",
# "type" : "line",
# "x" : 0,
# "y" : BOARD_Y-48,
# "width" : BOARD_X-26,
# "height" : 0,
# "color" : COLOR_LINE,
# },
# {
# "name" : "LINE_UP",
# "type" : "line",
# "x" : 0,
# "y" : 20,
# "width" : BOARD_X-26,
# "height" : 0,
# "color" : COLOR_LINE,
# },
),
},
{
"name": "DesignIncrease",
"type":"horizontalbar",
"x": 12,
"y": 172,
"width": 235,
"children" :
(
{
"name": "SuccessPercentage",
"type": "text",
"x": 5,
"y": 2,
"text": "",
},
{
"name": "SuccessPercentageIncreased",
"type": "text",
"x": 165,
"y": 2,
"color" : 0xffe2ff75,
"text": "",
},
{
"name" : "low",
"type" : "text",
"x" : 38,
"y" : 30,
"color" : COLOR_PERCENTAGE,
"fontname": "Tahoma:16",
# "text" : localeInfo.REFINE_PERCENTAGE_LOW,
},
{
"name" : "medium",
"type" : "text",
"x" : 38+80,
"y" : 30,
"color" : COLOR_PERCENTAGE,
"fontname": "Tahoma:16",
# "text" : localeInfo.REFINE_PERCENTAGE_MEDIUM,
},
{
"name" : "extra",
"type" : "text",
"x" : 38+80+80,
"y" : 30,
"color" : COLOR_PERCENTAGE,
"fontname": "Tahoma:16",
# "text" : localeInfo.REFINE_PERCENTAGE_EXTRA,
},
),
},
{
"name" : "LINE_LEFT",
"type" : "line",
"x" : 8,
"y" : 30,
"width" : 0,
"height" : BOARD_Y-40,
"color" : COLOR_LINE,
},
{
"name" : "LINE_RIGHT",
"type" : "line",
"x" : BOARD_X-10,
"y" : 30,
"width" : 0,
"height" : BOARD_Y-40,
"color" : COLOR_LINE,
},
{
"name" : "LINE_UP",
"type" : "line",
"x" : 8,
"y" : 30,
"width" : BOARD_X-17,
"height" : 0,
"color" : COLOR_LINE,
},
{
"name" : "LINE_DOWN",
"type" : "line",
"x" : 8,
"y" : BOARD_Y-10,
"width" : BOARD_X-17,
"height" : 0,
"color" : COLOR_LINE,
},
# {
# "name" : "SEPARATOR_ITEM_RIGHT",
# "type" : "line",
# "x" : 240,
# "y" : 55,
# "width" : 0,
# "height" : BOARD_X/2-140,
# "color" : COLOR_LINE,
# },
# {
# "name" : "SEPARATOR_ITEM_UPGRADE_LEFT",
# "type" : "line",
# "x" : 249,
# "y" : 55,
# "width" : 0,
# "height" : BOARD_X/2-67,
# "color" : COLOR_LINE,
# },
# {
# "name" : "SEPARATOR_ITEM_DOWN",
# "type" : "line",
# "x" : 12,
# "y" : BOARD_Y-85,
# "width" : BOARD_X/2-21,
# "height" : 0,
# "color" : COLOR_LINE,
# },
{
"name" : "Slot",
"type" : "slot",
"x" : 0,
"y" : 185,
"width" : 200+40,
"height" : 100,
"slot" : (
{
"index": 0,
"x": 20+19,
"y": 12,
"width": 32,
"height": 32
},
{
"index": 1,
"x": 20 + 80+15,
"y": 12,
"width": 32,
"height": 32
},
{
"index": 2,
"x": 20 + 80 + 80+10,
"y": 12,
"width": 32,
"height": 32
},
),
},
{
"name": "DesignCost",
"type":"horizontalbar",
"x": 14,
"y": 400-30+25+5,
"width": 225,
"children" :
(
{
"name": "textLine",
"type": "text",
"x": 5,
"y": 2,
"text": localeInfo.REFINE_COST_UPGRADE,
},
),
},
{
"name" : "SlotCost",
"type" : "button",
"x" : 0,
"y" : 32+30+20-20-10,
"horizontal_align":"center",
"vertical_align":"bottom",
"default_image" : LARGE_VALUE_FILE,
"over_image" : LARGE_VALUE_FILE,
"down_image" : LARGE_VALUE_FILE,
"children" :
(
{
"name":"Money_Icon",
"type": "image",
"x": -18,
"y": 2,
"image": "d:/ymir work/ui/game/windows/money_icon.sub",
},
{
"name" : "Cost",
"type" : "text",
"x" : 3,
"y" : 3,
"horizontal_align" : "right",
"text_horizontal_align" : "right",
"text" : "",
},
),
},
{
"name" : "AcceptButton",
"type" : "button",
"x" : 90-45-5,
"y" : 400+15+35+3,
"text" : uiScriptLocale.OK,
"default_image" : "d:/ymir work/ui/public/Large_Button_01.sub",
"over_image" : "d:/ymir work/ui/public/Large_Button_02.sub",
"down_image" : "d:/ymir work/ui/public/Large_Button_03.sub",
},
{
"name" : "CancelButton",
"type" : "button",
"x" : 90+45-5,
"y" : 400+15+35+3,
"text" : uiScriptLocale.CANCEL,
"default_image" : "d:/ymir work/ui/public/Large_Button_01.sub",
"over_image" : "d:/ymir work/ui/public/Large_Button_02.sub",
"down_image" : "d:/ymir work/ui/public/Large_Button_03.sub",
},
),
},
),
}



