|
You last visited: Today at 22:30
Advertisement
Verkaufsdialog bug?
Discussion on Verkaufsdialog bug? within the Metin2 Private Server forum part of the Metin2 category.
02/28/2018, 00:40
|
#1
|
elite*gold: 0
Join Date: Feb 2011
Posts: 7
Received Thanks: 0
|
Verkaufsdialog bug?
Hallo erstmal,
vorweg möchte ich sagen, dass ich schon länger nach einer lösung suche. Da ich aber nicht weiß wie ich diesen "bug" nennen soll oder wie der heißt, habe ich nichts gefunden was mir helfen könnte.
Hier das problem ..
Es wird nur das Item auf der 1. Seite und 2. Slot im Dialog angezeigt.
Gruß FettKopf
|
|
|
03/08/2018, 23:17
|
#2
|
elite*gold: 0
Join Date: Feb 2011
Posts: 7
Received Thanks: 0
|
Hat niemand eine Idee woran es liegen könnte?
|
|
|
08/11/2020, 18:30
|
#3
|
elite*gold: 313
Join Date: Apr 2013
Posts: 585
Received Thanks: 122
|
Der Thread ist zwar älter dennoch finde ich nichts hierzu. Ich schlage mich
mit dem selben Problem rum. Kennt ja jemand eine Lösung zu bzw. wieso es
so ist und wie man das fixxen kann ?
kind regards
|
|
|
08/11/2020, 18:36
|
#4
|
elite*gold: 0
Join Date: Sep 2015
Posts: 685
Received Thanks: 551
|
Poste mal deine def SellAttachedItem(self): aus der uishop.py oder lad die uishop.py hoch.
|
|
|
08/11/2020, 21:30
|
#5
|
elite*gold: 313
Join Date: Apr 2013
Posts: 585
Received Thanks: 122
|
Quote:
Originally Posted by ThaRielFliege
Poste mal deine def SellAttachedItem(self): aus der uishop.py oder lad die uishop.py hoch.
|
hier die ganze uishop.py und danke für die Antwort!
PHP Code:
import net
import player
import item
import snd
import shop
import net
import wndMgr
import app
import chat
import ui
import uiCommon
import mouseModule
import localeInfo
import constInfo
###################################################################################################
## Shop
class ShopDialog(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
self.tooltipItem = 0
self.xShopStart = 0
self.yShopStart = 0
self.questionDialog = None
self.popup = None
self.itemBuyQuestionDialog = None
def __del__(self):
ui.ScriptWindow.__del__(self)
def __GetRealIndex(self, i):
return self.tabIdx * shop.SHOP_SLOT_COUNT + i
def Refresh(self):
getItemID=shop.GetItemID
getItemCount=shop.GetItemCount
setItemID=self.itemSlotWindow.SetItemSlot
for i in xrange(shop.SHOP_SLOT_COUNT):
idx = self.__GetRealIndex(i)
itemCount = getItemCount(idx)
if itemCount <= 1:
itemCount = 0
setItemID(i, getItemID(idx), itemCount)
wndMgr.RefreshSlot(self.itemSlotWindow.GetWindowHandle())
def SetItemData(self, pos, itemID, itemCount, itemPrice):
shop.SetItemData(pos, itemID, itemCount, itemPrice)
def LoadDialog(self):
try:
PythonScriptLoader = ui.PythonScriptLoader()
PythonScriptLoader.LoadScriptFile(self, "UIScript/shopdialog.py")
except:
import exception
exception.Abort("ShopDialog.LoadDialog.LoadObject")
smallTab1 = None
smallTab2 = None
smallTab3 = None
middleTab1 = None
middleTab2 = None
try:
GetObject = self.GetChild
self.itemSlotWindow = GetObject("ItemSlot")
self.btnBuy = GetObject("BuyButton")
self.btnSell = GetObject("SellButton")
self.btnClose = GetObject("CloseButton")
self.titleBar = GetObject("TitleBar")
middleTab1 = GetObject("MiddleTab1")
middleTab2 = GetObject("MiddleTab2")
smallTab1 = GetObject("SmallTab1")
smallTab2 = GetObject("SmallTab2")
smallTab3 = GetObject("SmallTab3")
except:
import exception
exception.Abort("ShopDialog.LoadDialog.BindObject")
self.itemSlotWindow.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
self.itemSlotWindow.SAFE_SetButtonEvent("LEFT", "EMPTY", self.SelectEmptySlot)
self.itemSlotWindow.SAFE_SetButtonEvent("LEFT", "EXIST", self.SelectItemSlot)
self.itemSlotWindow.SAFE_SetButtonEvent("RIGHT", "EXIST", self.UnselectItemSlot)
self.itemSlotWindow.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
self.itemSlotWindow.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
self.btnBuy.SetToggleUpEvent(ui.__mem_func__(self.CancelShopping))
self.btnBuy.SetToggleDownEvent(ui.__mem_func__(self.OnBuy))
self.btnSell.SetToggleUpEvent(ui.__mem_func__(self.CancelShopping))
self.btnSell.SetToggleDownEvent(ui.__mem_func__(self.OnSell))
self.btnClose.SetEvent(ui.__mem_func__(self.AskClosePrivateShop))
self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
self.smallRadioButtonGroup = ui.RadioButtonGroup.Create([[smallTab1, lambda : self.OnClickTabButton(0), None], [smallTab2, lambda : self.OnClickTabButton(1), None], [smallTab3, lambda : self.OnClickTabButton(2), None]])
self.middleRadioButtonGroup = ui.RadioButtonGroup.Create([[middleTab1, lambda : self.OnClickTabButton(0), None], [middleTab2, lambda : self.OnClickTabButton(1), None]])
self.__HideMiddleTabs()
self.__HideSmallTabs()
self.tabIdx = 0
self.coinType = shop.SHOP_COIN_TYPE_GOLD
self.Refresh()
def __ShowBuySellButton(self):
self.btnBuy.Show()
self.btnSell.Show()
def __ShowMiddleTabs(self):
self.middleRadioButtonGroup.Show()
def __ShowSmallTabs(self):
self.smallRadioButtonGroup.Show()
def __HideBuySellButton(self):
self.btnBuy.Hide()
self.btnSell.Hide()
def __HideMiddleTabs(self):
self.middleRadioButtonGroup.Hide()
def __HideSmallTabs(self):
self.smallRadioButtonGroup.Hide()
def __SetTabNames(self):
if shop.GetTabCount() == 2:
self.middleRadioButtonGroup.SetText(0, shop.GetTabName(0))
self.middleRadioButtonGroup.SetText(1, shop.GetTabName(1))
elif shop.GetTabCount() == 3:
self.smallRadioButtonGroup.SetText(0, shop.GetTabName(0))
self.smallRadioButtonGroup.SetText(1, shop.GetTabName(1))
self.smallRadioButtonGroup.SetText(2, shop.GetTabName(2))
def Destroy(self):
self.Close()
self.ClearDictionary()
self.tooltipItem = 0
self.itemSlotWindow = 0
self.btnBuy = 0
self.btnSell = 0
self.btnClose = 0
self.titleBar = 0
self.questionDialog = None
self.popup = None
def Open(self, vid):
isPrivateShop = FALSE
isMainPlayerPrivateShop = FALSE
import chr
if chr.IsNPC(vid):
isPrivateShop = FALSE
else:
isPrivateShop = TRUE
if player.IsMainCharacterIndex(vid):
isMainPlayerPrivateShop = TRUE
self.btnBuy.Hide()
self.btnSell.Hide()
self.btnClose.Show()
else:
isMainPlayerPrivateShop = FALSE
self.btnBuy.Show()
self.btnSell.Show()
self.btnClose.Hide()
shop.Open(isPrivateShop, isMainPlayerPrivateShop)
self.tabIdx = 0
if isPrivateShop:
self.__HideMiddleTabs()
self.__HideSmallTabs()
else:
if shop.GetTabCount() == 1:
self.__ShowBuySellButton()
self.__HideMiddleTabs()
self.__HideSmallTabs()
elif shop.GetTabCount() == 2:
self.__HideBuySellButton()
self.__ShowMiddleTabs()
self.__HideSmallTabs()
self.__SetTabNames()
self.middleRadioButtonGroup.OnClick(0)
elif shop.GetTabCount() == 3:
self.__HideBuySellButton()
self.__HideMiddleTabs()
self.__ShowSmallTabs()
self.__SetTabNames()
self.middleRadioButtonGroup.OnClick(1)
self.Refresh()
self.SetTop()
self.Show()
(self.xShopStart, self.yShopStart, z) = player.GetMainCharacterPosition()
def Close(self):
if self.itemBuyQuestionDialog:
self.itemBuyQuestionDialog.Close()
self.itemBuyQuestionDialog = None
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
if self.questionDialog:
self.OnCloseQuestionDialog()
shop.Close()
net.SendShopEndPacket()
self.CancelShopping()
self.tooltipItem.HideToolTip()
self.Hide()
def GetIndexFromSlotPos(self, slotPos):
return self.tabIdx * shop.SHOP_SLOT_COUNT + slotPos
def OnClickTabButton(self, idx):
self.tabIdx = idx
self.Refresh()
def AskClosePrivateShop(self):
questionDialog = uiCommon.QuestionDialog()
questionDialog.SetText(localeInfo.PRIVATE_SHOP_CLOSE_QUESTION)
questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnClosePrivateShop))
questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
questionDialog.Open()
self.questionDialog = questionDialog
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
return TRUE
def OnClosePrivateShop(self):
net.SendChatPacket("/close_shop")
self.OnCloseQuestionDialog()
return TRUE
def OnPressEscapeKey(self):
self.Close()
return TRUE
def OnPressExitKey(self):
self.Close()
return TRUE
def OnBuy(self):
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
app.SetCursor(app.BUY)
self.btnSell.SetUp()
def OnSell(self):
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_SELL_INFO)
app.SetCursor(app.SELL)
self.btnBuy.SetUp()
def CancelShopping(self):
self.btnBuy.SetUp()
self.btnSell.SetUp()
app.SetCursor(app.NORMAL)
def __OnClosePopupDialog(self):
self.pop = None
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
## 용혼석 팔리는 기능 추가.
def SellAttachedItem(self):
if shop.IsPrivateShop():
mouseModule.mouseController.DeattachObject()
return
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedCount = mouseModule.mouseController.GetAttachedItemCount()
if localeInfo.IsBRAZIL() == 0:
attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType:
if localeInfo.IsBRAZIL():
itemIndex = player.GetItemIndex(attachedSlotPos)
item.SelectItem(itemIndex)
else:
item.SelectItem(attachedItemIndex)
if item.IsAntiFlag(item.ANTIFLAG_SELL):
popup = uiCommon.PopupDialog()
popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
popup.SetAcceptEvent(self.__OnClosePopupDialog)
popup.Open()
self.popup = popup
return
itemtype = player.INVENTORY
if localeInfo.IsBRAZIL() == 0:
if player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType:
itemtype = player.DRAGON_SOUL_INVENTORY
if player.IsValuableItem(itemtype, attachedSlotPos):
itemPrice = item.GetISellItemPrice()
if item.Is1GoldItem():
itemPrice = attachedCount / itemPrice / 5
else:
itemPrice = itemPrice * max(1, attachedCount) / 5
itemName = item.GetItemName()
questionDialog = uiCommon.QuestionDialog()
questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, attachedCount, itemPrice))
questionDialog.SetAcceptEvent(lambda arg1=attachedSlotPos, arg2=attachedCount, arg3 = itemtype: self.OnSellItem(arg1, arg2, arg3))
questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
questionDialog.Open()
self.questionDialog = questionDialog
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
else:
self.OnSellItem(attachedSlotPos, attachedCount, itemtype)
else:
snd.PlaySound("sound/ui/loginfail.wav")
mouseModule.mouseController.DeattachObject()
def OnSellItem(self, slotPos, count, itemtype):
net.SendShopSellPacketNew(slotPos, count, itemtype)
snd.PlaySound("sound/ui/money.wav")
self.OnCloseQuestionDialog()
def OnCloseQuestionDialog(self):
if not self.questionDialog:
return
self.questionDialog.Close()
self.questionDialog = None
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
def SelectEmptySlot(self, selectedSlotPos):
isAttached = mouseModule.mouseController.isAttached()
if isAttached:
self.SellAttachedItem()
def UnselectItemSlot(self, selectedSlotPos):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
return
if shop.IsPrivateShop():
self.AskBuyItem(selectedSlotPos)
else:
net.SendShopBuyPacket(self.__GetRealIndex(selectedSlotPos))
def SelectItemSlot(self, selectedSlotPos):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
return
isAttached = mouseModule.mouseController.isAttached()
selectedSlotPos = self.__GetRealIndex(selectedSlotPos)
if isAttached:
self.SellAttachedItem()
else:
if TRUE == shop.IsMainPlayerPrivateShop():
return
curCursorNum = app.GetCursor()
if app.BUY == curCursorNum:
self.AskBuyItem(selectedSlotPos)
elif app.SELL == curCursorNum:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_SELL_INFO)
else:
selectedItemID = shop.GetItemID(selectedSlotPos)
itemCount = shop.GetItemCount(selectedSlotPos)
type = player.SLOT_TYPE_SHOP
if shop.IsPrivateShop():
type = player.SLOT_TYPE_PRIVATE_SHOP
mouseModule.mouseController.AttachObject(self, type, selectedSlotPos, selectedItemID, itemCount)
mouseModule.mouseController.SetCallBack("INVENTORY", ui.__mem_func__(self.DropToInventory))
snd.PlaySound("sound/ui/pick.wav")
def DropToInventory(self):
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
self.AskBuyItem(attachedSlotPos)
def AskBuyItem(self, slotPos):
slotPos = self.__GetRealIndex(slotPos)
itemIndex = shop.GetItemID(slotPos)
itemPrice = shop.GetItemPrice(slotPos)
itemCount = shop.GetItemCount(slotPos)
item.SelectItem(itemIndex)
itemName = item.GetItemName()
itemBuyQuestionDialog = uiCommon.QuestionDialog()
itemBuyQuestionDialog.SetText(localeInfo.DO_YOU_BUY_ITEM(itemName, itemCount, localeInfo.NumberToMoneyString(itemPrice)))
itemBuyQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerBuyItem(arg))
itemBuyQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerBuyItem(arg))
itemBuyQuestionDialog.Open()
itemBuyQuestionDialog.pos = slotPos
self.itemBuyQuestionDialog = itemBuyQuestionDialog
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
def AnswerBuyItem(self, flag):
if flag:
pos = self.itemBuyQuestionDialog.pos
net.SendShopBuyPacket(pos)
self.itemBuyQuestionDialog.Close()
self.itemBuyQuestionDialog = None
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
def SetItemToolTip(self, tooltipItem):
self.tooltipItem = tooltipItem
def OverInItem(self, slotIndex):
slotIndex = self.__GetRealIndex(slotIndex)
if mouseModule.mouseController.isAttached():
return
if 0 != self.tooltipItem:
if shop.SHOP_COIN_TYPE_GOLD == shop.GetTabCoinType(self.tabIdx):
self.tooltipItem.SetShopItem(slotIndex)
else:
self.tooltipItem.SetShopItemBySecondaryCoin(slotIndex)
def OverOutItem(self):
if 0 != self.tooltipItem:
self.tooltipItem.HideToolTip()
def OnUpdate(self):
USE_SHOP_LIMIT_RANGE = 1000
(x, y, z) = player.GetMainCharacterPosition()
if abs(x - self.xShopStart) > USE_SHOP_LIMIT_RANGE or abs(y - self.yShopStart) > USE_SHOP_LIMIT_RANGE:
self.Close()
class MallPageDialog(ui.ScriptWindow):
def __init__(self):
ui.ScriptWindow.__init__(self)
def __del__(self):
ui.ScriptWindow.__del__(self)
def Destroy(self):
self.ClearDictionary()
def Open(self):
scriptLoader = ui.PythonScriptLoader()
scriptLoader.LoadScriptFile(self, "uiscript/mallpagedialog.py")
self.GetChild("titlebar").SetCloseEvent(ui.__mem_func__(self.Close))
(x, y)=self.GetGlobalPosition()
x+=10
y+=30
MALL_PAGE_WIDTH = 600
MALL_PAGE_HEIGHT = 480
app.ShowWebPage(
"http://metin2.co.kr/08_mall/game_mall/login_fail.htm",
(x, y, x+MALL_PAGE_WIDTH, y+MALL_PAGE_HEIGHT))
self.Lock()
self.Show()
def Close(self):
app.HideWebPage()
self.Unlock()
self.Hide()
def OnPressEscapeKey(self):
self.Close()
return TRUE
|
|
|
08/11/2020, 21:59
|
#6
|
elite*gold: 0
Join Date: Sep 2015
Posts: 685
Received Thanks: 551
|
Tausch das:
HTML Code:
if localeInfo.IsBRAZIL():
itemIndex = player.GetItemIndex(attachedSlotPos)
item.SelectItem(itemIndex)
else:
item.SelectItem(attachedItemIndex)
damit aus:
HTML Code:
if player.SLOT_TYPE_INVENTORY == attachedSlotType:
itemIndex = player.GetItemIndex(attachedSlotPos)
item.SelectItem(itemIndex)
|
|
|
08/11/2020, 22:06
|
#7
|
elite*gold: 313
Join Date: Apr 2013
Posts: 585
Received Thanks: 122
|
Quote:
Originally Posted by ThaRielFliege
Tausch das:
HTML Code:
if localeInfo.IsBRAZIL():
itemIndex = player.GetItemIndex(attachedSlotPos)
item.SelectItem(itemIndex)
else:
item.SelectItem(attachedItemIndex)
damit aus:
HTML Code:
if player.SLOT_TYPE_INVENTORY == attachedSlotType:
itemIndex = player.GetItemIndex(attachedSlotPos)
item.SelectItem(itemIndex)
|
Leider immernoch, egal welches Item auf Slot 2 liegt wird angezeigt
|
|
|
08/11/2020, 22:20
|
#8
|
elite*gold: 0
Join Date: Sep 2015
Posts: 685
Received Thanks: 551
|
Lad mal deine mousemodule.py hoch.
Ich hab das vor ewigkeiten mal gefixxt weiß nur nicht mehr genau an was es lag, war glaube weil er den slot nicht richtig bekommen hat.
|
|
|
08/11/2020, 22:21
|
#9
|
elite*gold: 313
Join Date: Apr 2013
Posts: 585
Received Thanks: 122
|
Quote:
Originally Posted by ThaRielFliege
Lad mal deine mousemodule.py hoch.
Ich hab das vor ewigkeiten mal gefixxt weiß nur nicht mehr genau an was es lag, war glaube weil er den slot nicht richtig bekommen hat.
|
Hier die mousemodule.py , und echt danke man dass du mir da hilfst !
PHP Code:
import app
import grp
import grpImage
import item
import wndMgr
import player
import skill
import dbg
import grpText
import ui
import systemSetting
import localeInfo
## Mouse Controler
## 마우스 커서를 제어하며 마우스 커서에 Attach되어 움직이는 Object들까지 제어할 수 있다.
class CursorImage(object):
def __init__(self):
self.handle = 0
def __init__(self, imageName):
self.handle = 0
self.LoadImage(imageName)
def __del__(self):
grpImage.Delete(self.handle)
def LoadImage(self, imageName):
try:
self.handle = grpImage.Generate(imageName)
except:
import sys
dbg.TraceError("%s %s" % (sys.exc_info()[0], sys.exc_info()[1]))
self.handle = 0
def DeleteImage(self):
if self.handle:
grpImage.Delete(self.handle)
def IsImage(self):
if self.handle:
return TRUE
return FALSE
def SetPosition(self, x, y):
if self.handle:
grpImage.SetPosition(self.handle, x, y)
def Render(self):
if self.handle:
grpImage.Render(self.handle)
class CMouseController(object):
def __init__(self):
self.x = 0
self.y = 0
self.IsSoftwareCursor = FALSE
self.curCursorName = ""
self.curCursorImage = 0
self.cursorPosX = 0
self.cursorPosY = 0
self.AttachedIconHandle = 0
self.AttachedOwner = 0
self.AttachedFlag = FALSE
self.AttachedType = 0
self.AttachedSlotNumber = 0
self.AttachedCount = 1
self.AttachedIconHalfWidth = 0
self.AttachedIconHalfHeight = 0
self.LastAttachedSlotNumber = 0
self.countNumberLine = None
self.DeattachObject()
self.callbackDict = {}
def __del__(self):
self.callbackDict = {}
def Create(self):
self.IsSoftwareCursor = systemSetting.IsSoftwareCursor()
self.cursorDict = {
app.NORMAL : CursorImage("D:/Ymir Work/UI/Cursor/cursor.sub"),
app.ATTACK : CursorImage("D:/Ymir Work/UI/Cursor/cursor_attack.sub"),
app.TARGET : CursorImage("D:/Ymir Work/UI/Cursor/cursor_attack.sub"),
app.TALK : CursorImage("D:/Ymir Work/UI/Cursor/cursor_talk.sub"),
app.CANT_GO : CursorImage("D:/Ymir Work/UI/Cursor/cursor_no.sub"),
app.PICK : CursorImage("D:/Ymir Work/UI/Cursor/cursor_pick.sub"),
app.DOOR : CursorImage("D:/Ymir Work/UI/Cursor/cursor_door.sub"),
app.CHAIR : CursorImage("D:/Ymir Work/UI/Cursor/cursor_chair.sub"),
app.MAGIC : CursorImage("D:/Ymir Work/UI/Cursor/cursor_chair.sub"),
app.BUY : CursorImage("D:/Ymir Work/UI/Cursor/cursor_buy.sub"),
app.SELL : CursorImage("D:/Ymir Work/UI/Cursor/cursor_sell.sub"),
app.CAMERA_ROTATE : CursorImage("D:/Ymir Work/UI/Cursor/cursor_camera_rotate.sub"),
app.HSIZE : CursorImage("D:/Ymir Work/UI/Cursor/cursor_hsize.sub"),
app.VSIZE : CursorImage("D:/Ymir Work/UI/Cursor/cursor_vsize.sub"),
app.HVSIZE : CursorImage("D:/Ymir Work/UI/Cursor/cursor_hvsize.sub"),
}
self.cursorPosDict = {
app.NORMAL : (0, 0),
app.TARGET : (0, 0),
app.ATTACK : (0, 0),
app.TALK : (0, 0),
app.CANT_GO : (0, 0),
app.PICK : (0, 0),
app.DOOR : (0, 0),
app.CHAIR : (0, 0),
app.MAGIC : (0, 0),
app.BUY : (0, 0),
app.SELL : (0, 0),
app.CAMERA_ROTATE : (0, 0),
app.HSIZE : (-16, -16),
app.VSIZE : (-16, -16),
app.HVSIZE : (-16, -16),
}
app.SetCursor(app.NORMAL)
"""
AttachedCountTextLineHandle = grpText.Generate()
grpText.SetFontName(AttachedCountTextLineHandle, localeInfo.UI_DEF_FONT_SMALL)
grpText.SetText(AttachedCountTextLineHandle, "1234")
grpText.SetPosition(AttachedCountTextLineHandle, 100, 100)
grpText.SetOutline(AttachedCountTextLineHandle, TRUE)
grpText.SetFontColor(AttachedCountTextLineHandle, 1.0, 1.0, 1.0)
grpText.SetHorizontalAlign(AttachedCountTextLineHandle, wndMgr.TEXT_HORIZONTAL_ALIGN_CENTER)
self.AttachedCountTextLineHandle = AttachedCountTextLineHandle
"""
self.countNumberLine = ui.NumberLine("CURTAIN")
self.countNumberLine.SetHorizontalAlignCenter()
self.countNumberLine.Hide()
return TRUE
# Cursor Control
def ChangeCursor(self, cursorNum):
try:
self.curCursorNum = cursorNum
self.curCursorImage = self.cursorDict[cursorNum]
(self.cursorPosX, self.cursorPosY) = self.cursorPosDict[cursorNum]
if FALSE == self.curCursorImage.IsImage():
self.curCursorNum = app.NORMAL
self.curCursorImage = self.cursorDict[app.NORMAL]
except KeyError:
dbg.TraceError("mouseModule.MouseController.SetCursor - 잘못된 커서 번호 [%d]" % cursorNum)
self.curCursorName = app.NORMAL
self.curCursorImage = self.cursorDict[app.NORMAL]
# Attaching
def AttachObject(self, Owner, Type, SlotNumber, ItemIndex, count = 0):
self.LastAttachedSlotNumber = self.AttachedSlotNumber
self.AttachedFlag = TRUE
self.AttachedOwner = Owner
self.AttachedType = Type
self.AttachedSlotNumber = SlotNumber
self.AttachedItemIndex = ItemIndex
self.AttachedCount = count
self.countNumberLine.SetNumber("")
self.countNumberLine.Hide()
if count > 1:
self.countNumberLine.SetNumber(str(count))
self.countNumberLine.Show()
try:
width = 1
height = 1
if Type == player.SLOT_TYPE_INVENTORY or\
Type == player.SLOT_TYPE_PRIVATE_SHOP or\
Type == player.SLOT_TYPE_SHOP or\
Type == player.SLOT_TYPE_SAFEBOX or\
Type == player.SLOT_TYPE_MALL or\
Type == player.SLOT_TYPE_DRAGON_SOUL_INVENTORY:
item.SelectItem(self.AttachedItemIndex)
self.AttachedIconHandle = item.GetIconInstance()
if not self.AttachedIconHandle:
self.AttachedIconHandle = 0
self.DeattachObject()
return
(width, height) = item.GetItemSize()
elif Type == player.SLOT_TYPE_SKILL:
skillGrade = player.GetSkillGrade(SlotNumber)
self.AttachedIconHandle = skill.GetIconInstanceNew(self.AttachedItemIndex, skillGrade)
elif Type == player.SLOT_TYPE_EMOTION:
image = player.GetEmotionIconImage(ItemIndex)
self.AttachedIconHandle = grpImage.GenerateFromHandle(image)
elif Type == player.SLOT_TYPE_QUICK_SLOT:
(quickSlotType, position) = player.GetGlobalQuickSlot(SlotNumber)
if quickSlotType == player.SLOT_TYPE_INVENTORY:
itemIndex = player.GetItemIndex(position)
item.SelectItem(itemIndex)
self.AttachedIconHandle = item.GetIconInstance()
(width, height) = item.GetItemSize()
elif quickSlotType == player.SLOT_TYPE_SKILL:
skillIndex = player.GetSkillIndex(position)
skillGrade = player.GetSkillGrade(position)
self.AttachedIconHandle = skill.GetIconInstanceNew(skillIndex, skillGrade)
elif quickSlotType == player.SLOT_TYPE_EMOTION:
image = player.GetEmotionIconImage(position)
self.AttachedIconHandle = grpImage.GenerateFromHandle(image)
if not self.AttachedIconHandle:
self.DeattachObject()
return
self.AttachedIconHalfWidth = grpImage.GetWidth(self.AttachedIconHandle) / 2
self.AttachedIconHalfHeight = grpImage.GetHeight(self.AttachedIconHandle) / 2
self.AttachedIconHalfWidth = grpImage.GetWidth(self.AttachedIconHandle) / 2
self.AttachedIconHalfHeight = grpImage.GetHeight(self.AttachedIconHandle) / 2
wndMgr.AttachIcon(self.AttachedType, self.AttachedItemIndex, self.AttachedSlotNumber, width, height)
except Exception, e:
dbg.TraceError("mouseModule.py: AttachObject : " + str(e))
self.AttachedIconHandle = 0
def IsAttachedMoney(self):
if TRUE == self.isAttached():
if player.ITEM_MONEY == self.GetAttachedItemIndex():
return TRUE
return FALSE
def GetAttachedMoneyAmount(self):
if TRUE == self.isAttached():
if player.ITEM_MONEY == self.GetAttachedItemIndex():
return self.GetAttachedItemCount()
return 0
def AttachMoney(self, owner, type, count):
self.LastAttachedSlotNumber = self.AttachedSlotNumber
self.AttachedFlag = TRUE
self.AttachedOwner = owner
self.AttachedType = type
self.AttachedSlotNumber = -1
self.AttachedItemIndex = player.ITEM_MONEY
self.AttachedCount = count
self.AttachedIconHandle = grpImage.Generate("icon/item/money.tga")
self.AttachedIconHalfWidth = grpImage.GetWidth(self.AttachedIconHandle) / 2
self.AttachedIconHalfHeight = grpImage.GetHeight(self.AttachedIconHandle) / 2
wndMgr.AttachIcon(self.AttachedType, self.AttachedItemIndex, self.AttachedSlotNumber, 1, 1)
if count > 1:
self.countNumberLine.SetNumber(str(count))
self.countNumberLine.Show()
#grpText.SetText(self.AttachedCountTextLineHandle, str(count))
def DeattachObject(self):
self.ClearCallBack()
self.LastAttachedSlotNumber = self.AttachedSlotNumber
if self.AttachedIconHandle != 0:
if self.AttachedType == player.SLOT_TYPE_INVENTORY or\
self.AttachedType == player.SLOT_TYPE_PRIVATE_SHOP or\
self.AttachedType == player.SLOT_TYPE_SHOP or\
self.AttachedType == player.SLOT_TYPE_SAFEBOX or\
self.AttachedType == player.SLOT_TYPE_MALL:
item.DeleteIconInstance(self.AttachedIconHandle)
elif self.AttachedType == player.SLOT_TYPE_SKILL:
skill.DeleteIconInstance(self.AttachedIconHandle)
elif self.AttachedType == player.SLOT_TYPE_EMOTION:
grpImage.Delete(self.AttachedIconHandle)
self.AttachedFlag = FALSE
self.AttachedType = -1
self.AttachedItemIndex = -1
self.AttachedSlotNumber = -1
self.AttachedIconHandle = 0
wndMgr.SetAttachingFlag(FALSE)
if self.countNumberLine:
self.countNumberLine.Hide()
def isAttached(self):
return self.AttachedFlag
def GetAttachedOwner(self):
if FALSE == self.isAttached():
return 0
return self.AttachedOwner
def GetAttachedType(self):
if FALSE == self.isAttached():
return player.SLOT_TYPE_NONE
return self.AttachedType
def GetAttachedSlotNumber(self):
if FALSE == self.isAttached():
return 0
return self.AttachedSlotNumber
def GetLastAttachedSlotNumber(self):
return self.LastAttachedSlotNumber
def GetAttachedItemIndex(self):
if FALSE == self.isAttached():
return 0
return self.AttachedItemIndex
def GetAttachedItemCount(self):
if FALSE == self.isAttached():
return 0
return self.AttachedCount
# Update
def Update(self, x, y):
self.x = x
self.y = y
if TRUE == self.isAttached():
if 0 != self.AttachedIconHandle:
grpImage.SetDiffuseColor(self.AttachedIconHandle, 1.0, 1.0, 1.0, 0.5)
grpImage.SetPosition(self.AttachedIconHandle, self.x - self.AttachedIconHalfWidth, self.y - self.AttachedIconHalfHeight)
self.countNumberLine.SetPosition(self.x, self.y - self.AttachedIconHalfHeight - 3)
if self.IsSoftwareCursor:
if 0 != self.curCursorImage:
self.curCursorImage.SetPosition(self.x + self.cursorPosX, self.y + self.cursorPosY)
# Render
def Render(self):
if TRUE == self.isAttached():
if 0 != self.AttachedIconHandle:
grpImage.Render(self.AttachedIconHandle)
if self.IsSoftwareCursor:
if TRUE == app.IsShowCursor():
if 0 != self.curCursorImage:
self.curCursorImage.Render()
else:
if FALSE == app.IsShowCursor():
if TRUE == app.IsLiarCursorOn():
if 0 != self.curCursorImage:
self.curCursorImage.SetPosition(self.x + self.cursorPosX, self.y + self.cursorPosY)
self.curCursorImage.Render()
def SetCallBack(self, type, event=lambda *arg:None):
self.callbackDict[type] = event
def RunCallBack(self, type, *arg):
if not self.callbackDict.has_key(type):
self.DeattachObject()
return
self.callbackDict[type]()
def ClearCallBack(self):
self.callbackDict = {}
mouseController = CMouseController()
|
|
|
08/11/2020, 22:32
|
#10
|
elite*gold: 0
Join Date: Sep 2015
Posts: 685
Received Thanks: 551
|
oke uiinventory brauch ich noch
|
|
|
08/11/2020, 22:35
|
#11
|
elite*gold: 313
Join Date: Apr 2013
Posts: 585
Received Thanks: 122
|
Quote:
Originally Posted by ThaRielFliege
oke uiinventory brauch ich noch
|
PHP Code:
import ui
import player
import mouseModule
import net
import app
import snd
import item
import player
import chat
import grp
import uiScriptLocale
import uiRefine
import uiAttachMetin
import uiPickMoney
import uiCommon
import uiPrivateShopBuilder # 개인상점 열동안 ItemMove 방지
import localeInfo
import constInfo
import ime
import wndMgr
ITEM_MALL_BUTTON_ENABLE = TRUE
ITEM_FLAG_APPLICABLE = 1 << 14
class CostumeWindow(ui.ScriptWindow):
def __init__(self, wndInventory):
import exception
if not app.ENABLE_COSTUME_SYSTEM:
exception.Abort("What do you do?")
return
if not wndInventory:
exception.Abort("wndInventory parameter must be set to InventoryWindow")
return
ui.ScriptWindow.__init__(self)
self.isLoaded = 0
self.wndInventory = wndInventory;
self.__LoadWindow()
def __del__(self):
ui.ScriptWindow.__del__(self)
def Show(self):
self.__LoadWindow()
self.RefreshCostumeSlot()
ui.ScriptWindow.Show(self)
def Close(self):
self.Hide()
def __LoadWindow(self):
if self.isLoaded == 1:
return
self.isLoaded = 1
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
except:
import exception
exception.Abort("CostumeWindow.LoadWindow.LoadObject")
try:
wndEquip = self.GetChild("CostumeSlot")
self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
except:
import exception
exception.Abort("CostumeWindow.LoadWindow.BindObject")
## Equipment
wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
self.wndEquip = wndEquip
def RefreshCostumeSlot(self):
getItemVNum=player.GetItemIndex
for i in xrange(item.COSTUME_SLOT_COUNT):
slotNumber = item.COSTUME_SLOT_START + i
self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
self.wndEquip.RefreshSlot()
class BeltInventoryWindow(ui.ScriptWindow):
def __init__(self, wndInventory):
import exception
if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
exception.Abort("What do you do?")
return
if not wndInventory:
exception.Abort("wndInventory parameter must be set to InventoryWindow")
return
ui.ScriptWindow.__init__(self)
self.isLoaded = 0
self.wndInventory = wndInventory;
self.wndBeltInventoryLayer = None
self.wndBeltInventorySlot = None
self.expandBtn = None
self.minBtn = None
self.__LoadWindow()
def __del__(self):
ui.ScriptWindow.__del__(self)
def Show(self, openBeltSlot = FALSE):
self.__LoadWindow()
self.RefreshSlot()
ui.ScriptWindow.Show(self)
if openBeltSlot:
self.OpenInventory()
else:
self.CloseInventory()
def Close(self):
self.Hide()
def IsOpeningInventory(self):
return self.wndBeltInventoryLayer.IsShow()
def OpenInventory(self):
self.wndBeltInventoryLayer.Show()
self.expandBtn.Hide()
if localeInfo.IsARABIC() == 0:
self.AdjustPositionAndSize()
def CloseInventory(self):
self.wndBeltInventoryLayer.Hide()
self.expandBtn.Show()
if localeInfo.IsARABIC() == 0:
self.AdjustPositionAndSize()
## 현재 인벤토리 위치를 기준으로 BASE 위치를 계산, 리턴.. 숫자 하드코딩하기 정말 싫지만 방법이 없다..
def GetBasePosition(self):
x, y = self.wndInventory.GetGlobalPosition()
return x - 148, y + 241
def AdjustPositionAndSize(self):
bx, by = self.GetBasePosition()
if self.IsOpeningInventory():
self.SetPosition(bx, by)
self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
else:
self.SetPosition(bx + 138, by);
self.SetSize(10, self.GetHeight())
def __LoadWindow(self):
if self.isLoaded == 1:
return
self.isLoaded = 1
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
except:
import exception
exception.Abort("CostumeWindow.LoadWindow.LoadObject")
try:
self.ORIGINAL_WIDTH = self.GetWidth()
wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
self.expandBtn = self.GetChild("ExpandBtn")
self.minBtn = self.GetChild("MinimizeBtn")
self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
if localeInfo.IsARABIC() :
self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
slotNumber = item.BELT_INVENTORY_SLOT_START + i
wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
"d:/ymir work/ui/game/quest/slot_button_01.sub",\
"d:/ymir work/ui/game/quest/slot_button_01.sub",\
"d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE)
except:
import exception
exception.Abort("CostumeWindow.LoadWindow.BindObject")
## Equipment
wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
self.wndBeltInventorySlot = wndBeltInventorySlot
def RefreshSlot(self):
getItemVNum=player.GetItemIndex
for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
slotNumber = item.BELT_INVENTORY_SLOT_START + i
self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, TRUE)
avail = "0"
if player.IsAvailableBeltInventoryCell(slotNumber):
self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
else:
self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
self.wndBeltInventorySlot.RefreshSlot()
class InventoryWindow(ui.ScriptWindow):
USE_TYPE_TUPLE = ("USE_CLEAN_SOCKET", "USE_CHANGE_ATTRIBUTE", "USE_ADD_ATTRIBUTE", "USE_ADD_ATTRIBUTE2", "USE_ADD_ACCESSORY_SOCKET", "USE_PUT_INTO_ACCESSORY_SOCKET", "USE_PUT_INTO_BELT_SOCKET", "USE_PUT_INTO_RING_SOCKET")
questionDialog = None
tooltipItem = None
wndCostume = None
wndBelt = None
dlgPickMoney = None
sellingSlotNumber = -1
isLoaded = 0
isOpenedCostumeWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 코스츔이 열려있었는지 여부-_-; 네이밍 ㅈㅅ
isOpenedBeltWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
def __init__(self):
ui.ScriptWindow.__init__(self)
self.isOpenedBeltWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
self.__LoadWindow()
def __del__(self):
ui.ScriptWindow.__del__(self)
def Show(self):
self.__LoadWindow()
ui.ScriptWindow.Show(self)
# 인벤토리를 닫을 때 코스츔이 열려있었다면 인벤토리를 열 때 코스츔도 같이 열도록 함.
if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
self.wndCostume.Show()
# 인벤토리를 닫을 때 벨트 인벤토리가 열려있었다면 같이 열도록 함.
if self.wndBelt:
self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
def BindInterfaceClass(self, interface):
self.interface = interface
def __LoadWindow(self):
if self.isLoaded == 1:
return
self.isLoaded = 1
try:
pyScrLoader = ui.PythonScriptLoader()
if ITEM_MALL_BUTTON_ENABLE:
pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
else:
pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
except:
import exception
exception.Abort("InventoryWindow.LoadWindow.LoadObject")
try:
wndItem = self.GetChild("ItemSlot")
wndEquip = self.GetChild("EquipmentSlot")
self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
self.wndMoney = self.GetChild("Money")
self.wndMoneySlot = self.GetChild("Money_Slot")
self.mallButton = self.GetChild2("MallButton")
self.DSSButton = self.GetChild2("DSSButton")
self.costumeButton = self.GetChild2("CostumeButton")
self.inventoryTab = []
self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
self.equipmentTab = []
self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
self.costumeButton.Hide()
self.costumeButton.Destroy()
self.costumeButton = 0
# Belt Inventory Window
self.wndBelt = None
if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
self.wndBelt = BeltInventoryWindow(self)
except:
import exception
exception.Abort("InventoryWindow.LoadWindow.BindObject")
## Item
wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
## Equipment
wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
## PickMoneyDialog
dlgPickMoney = uiPickMoney.PickMoneyDialog()
dlgPickMoney.LoadDialog()
dlgPickMoney.Hide()
## RefineDialog
self.refineDialog = uiRefine.RefineDialog()
self.refineDialog.Hide()
## AttachMetinDialog
self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
self.attachMetinDialog.Hide()
## MoneySlot
self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
self.inventoryTab[0].Down()
self.inventoryPageIndex = 0
self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
self.equipmentTab[0].Down()
self.equipmentTab[0].Hide()
self.equipmentTab[1].Hide()
self.wndItem = wndItem
self.wndEquip = wndEquip
self.dlgPickMoney = dlgPickMoney
# MallButton
if self.mallButton:
self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
if self.DSSButton:
#self.DSSButton.Hide()
self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
# Costume Button
if self.costumeButton:
self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
self.wndCostume = None
#####
## Refresh
self.SetInventoryPage(0)
self.SetEquipmentPage(0)
self.RefreshItemSlot()
self.RefreshStatus()
def Destroy(self):
self.ClearDictionary()
self.dlgPickMoney.Destroy()
self.dlgPickMoney = 0
self.refineDialog.Destroy()
self.refineDialog = 0
self.attachMetinDialog.Destroy()
self.attachMetinDialog = 0
self.tooltipItem = None
self.wndItem = 0
self.wndEquip = 0
self.dlgPickMoney = 0
self.wndMoney = 0
self.wndMoneySlot = 0
self.questionDialog = None
self.mallButton = None
self.DSSButton = None
self.interface = None
if self.wndCostume:
self.wndCostume.Destroy()
self.wndCostume = 0
if self.wndBelt:
self.wndBelt.Destroy()
self.wndBelt = None
self.inventoryTab = []
self.equipmentTab = []
def Hide(self):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
self.OnCloseQuestionDialog()
return
if None != self.tooltipItem:
self.tooltipItem.HideToolTip()
if self.wndCostume:
self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow() # 인벤토리 창이 닫힐 때 코스츔이 열려 있었는가?
self.wndCostume.Close()
if self.wndBelt:
self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # 인벤토리 창이 닫힐 때 벨트 인벤토리도 열려 있었는가?
print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
self.wndBelt.Close()
if self.dlgPickMoney:
self.dlgPickMoney.Close()
wndMgr.Hide(self.hWnd)
def Close(self):
self.Hide()
# def SetInventoryPage(self, page):
# self.inventoryTab[self.inventoryPageIndex].SetUp()
# self.inventoryPageIndex = page
# self.RefreshBagSlotWindow()
def SetInventoryPage(self, page):
self.inventoryTab[self.inventoryPageIndex].SetUp()
self.inventoryPageIndex = page
self.inventoryTab[self.inventoryPageIndex].Down()
self.RefreshBagSlotWindow()
def SetEquipmentPage(self, page):
self.equipmentPageIndex = page
self.equipmentTab[1-page].SetUp()
self.RefreshEquipSlotWindow()
def ClickMallButton(self):
import event
qid = constInfo.mallqin
event.QuestButtonClick(qid)
# DSSButton
def ClickDSSButton(self):
print "click_dss_button"
self.interface.ToggleDragonSoulWindow()
def ClickCostumeButton(self):
print "Click Costume Button"
if self.wndCostume:
if self.wndCostume.IsShow():
self.wndCostume.Hide()
else:
self.wndCostume.Show()
else:
self.wndCostume = CostumeWindow(self)
self.wndCostume.Show()
def OpenPickMoneyDialog(self):
if mouseModule.mouseController.isAttached():
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
snd.PlaySound("sound/ui/money.wav")
mouseModule.mouseController.DeattachObject()
else:
curMoney = player.GetElk()
if curMoney <= 0:
return
self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
self.dlgPickMoney.Open(curMoney)
self.dlgPickMoney.SetMax(7) # 인벤토리 990000 제한 버그 수정
def OnPickMoney(self, money):
mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
def OnPickItem(self, count):
itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
selectedItemVNum = player.GetItemIndex(itemSlotIndex)
mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
return local
return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
def RefreshBagSlotWindow(self):
getItemVNum=player.GetItemIndex
getItemCount=player.GetItemCount
setItemVNum=self.wndItem.SetItemSlot
for i in xrange(player.INVENTORY_PAGE_SIZE):
slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
itemCount = getItemCount(slotNumber)
# itemCount == 0이면 소켓을 비운다.
if 0 == itemCount:
self.wndItem.ClearSlot(i)
continue
elif 1 == itemCount:
itemCount = 0
itemVnum = getItemVNum(slotNumber)
setItemVNum(i, itemVnum, itemCount)
## 자동물약 (HP: #72723 ~ #72726, SP: #72727 ~ #72730) 특수처리 - 아이템인데도 슬롯에 활성화/비활성화 표시를 위한 작업임 - [hyo]
if constInfo.IS_AUTO_POTION(itemVnum):
# metinSocket - [0] : 활성화 여부, [1] : 사용한 양, [2] : 최대 용량
metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
if slotNumber >= player.INVENTORY_PAGE_SIZE:
slotNumber -= player.INVENTORY_PAGE_SIZE
isActivated = 0 != metinSocket[0]
if isActivated:
self.wndItem.ActivateSlot(slotNumber)
potionType = 0;
if constInfo.IS_AUTO_POTION_HP(itemVnum):
potionType = player.AUTO_POTION_TYPE_HP
elif constInfo.IS_AUTO_POTION_SP(itemVnum):
potionType = player.AUTO_POTION_TYPE_SP
usedAmount = int(metinSocket[1])
totalAmount = int(metinSocket[2])
player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
else:
self.wndItem.DeactivateSlot(slotNumber)
self.wndItem.RefreshSlot()
if self.wndBelt:
self.wndBelt.RefreshSlot()
def RefreshEquipSlotWindow(self):
getItemVNum=player.GetItemIndex
getItemCount=player.GetItemCount
setItemVNum=self.wndEquip.SetItemSlot
for i in xrange(player.EQUIPMENT_PAGE_COUNT):
slotNumber = player.EQUIPMENT_SLOT_START + i
itemCount = getItemCount(slotNumber)
if itemCount <= 1:
itemCount = 0
setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
itemCount = getItemCount(slotNumber)
if itemCount <= 1:
itemCount = 0
setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
self.wndEquip.RefreshSlot()
if self.wndCostume:
self.wndCostume.RefreshCostumeSlot()
def RefreshItemSlot(self):
self.RefreshBagSlotWindow()
self.RefreshEquipSlotWindow()
def RefreshStatus(self):
money = player.GetElk()
self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
def SetItemToolTip(self, tooltipItem):
self.tooltipItem = tooltipItem
def SellItem(self):
if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
## 용혼석도 팔리게 하는 기능 추가하면서 인자 type 추가
net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
snd.PlaySound("sound/ui/money.wav")
self.OnCloseQuestionDialog()
def OnDetachMetinFromItem(self):
if None == self.questionDialog:
return
#net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
self.OnCloseQuestionDialog()
def OnCloseQuestionDialog(self):
if not self.questionDialog:
return
self.questionDialog.Close()
self.questionDialog = None
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
## Slot Event
def SelectEmptySlot(self, selectedSlotPos):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
return
selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
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:
itemCount = player.GetItemCount(attachedSlotPos)
attachedCount = mouseModule.mouseController.GetAttachedItemCount()
self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
if item.IsRefineScroll(attachedItemIndex):
self.wndItem.SetUseMode(FALSE)
elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
mouseModule.mouseController.RunCallBack("INVENTORY")
elif player.SLOT_TYPE_SHOP == attachedSlotType:
net.SendShopBuyPacket(attachedSlotPos)
elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
if player.ITEM_MONEY == attachedItemIndex:
net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
snd.PlaySound("sound/ui/money.wav")
else:
net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
elif player.SLOT_TYPE_MALL == attachedSlotType:
net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
mouseModule.mouseController.DeattachObject()
def SelectItemSlot(self, itemSlotIndex):
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
return
itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
if mouseModule.mouseController.isAttached():
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
if player.SLOT_TYPE_INVENTORY == attachedSlotType:
self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
mouseModule.mouseController.DeattachObject()
else:
curCursorNum = app.GetCursor()
if app.SELL == curCursorNum:
self.__SellItem(itemSlotIndex)
elif app.BUY == curCursorNum:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
elif app.IsPressed(app.DIK_LALT):
link = player.GetItemLink(itemSlotIndex)
ime.PasteString(link)
elif app.IsPressed(app.DIK_LSHIFT):
itemCount = player.GetItemCount(itemSlotIndex)
if itemCount > 1:
self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
self.dlgPickMoney.Open(itemCount)
self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
#else:
#selectedItemVNum = player.GetItemIndex(itemSlotIndex)
#mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
elif app.IsPressed(app.DIK_LCONTROL):
itemIndex = player.GetItemIndex(itemSlotIndex)
if TRUE == item.CanAddToQuickSlotItem(itemIndex):
player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
else:
selectedItemVNum = player.GetItemIndex(itemSlotIndex)
itemCount = player.GetItemCount(itemSlotIndex)
mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
self.wndItem.SetUseMode(TRUE)
else:
self.wndItem.SetUseMode(FALSE)
snd.PlaySound("sound/ui/pick.wav")
def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
if srcItemSlotPos == dstItemSlotPos:
return
elif item.IsRefineScroll(srcItemVID):
self.RefineItem(srcItemSlotPos, dstItemSlotPos)
self.wndItem.SetUseMode(FALSE)
elif item.IsMetin(srcItemVID):
self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
elif item.IsDetachScroll(srcItemVID):
self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
elif item.IsKey(srcItemVID):
self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
else:
#snd.PlaySound("sound/ui/drop.wav")
## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites]
if player.IsEquipmentSlot(dstItemSlotPos):
## 들고 있는 아이템이 장비일때만
if item.IsEquipmentVID(srcItemVID):
self.__UseItem(srcItemSlotPos)
else:
self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
#net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
def __SellItem(self, itemSlotPos):
if not player.IsEquipmentSlot(itemSlotPos):
self.sellingSlotNumber = itemSlotPos
itemIndex = player.GetItemIndex(itemSlotPos)
itemCount = player.GetItemCount(itemSlotPos)
self.sellingSlotitemIndex = itemIndex
self.sellingSlotitemCount = itemCount
item.SelectItem(itemIndex)
## 안티 플레그 검사 빠져서 추가
## 20140220
if item.IsAntiFlag(item.ANTIFLAG_SELL):
popup = uiCommon.PopupDialog()
popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
popup.SetAcceptEvent(self.__OnClosePopupDialog)
popup.Open()
self.popup = popup
return
itemPrice = item.GetISellItemPrice()
if item.Is1GoldItem():
itemPrice = itemCount / itemPrice / 5
else:
itemPrice = itemPrice * itemCount / 5
item.GetItemName(itemIndex)
itemName = item.GetItemName()
self.questionDialog = uiCommon.QuestionDialog()
self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
self.questionDialog.Open()
self.questionDialog.count = itemCount
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
def __OnClosePopupDialog(self):
self.pop = None
def RefineItem(self, scrollSlotPos, targetSlotPos):
scrollIndex = player.GetItemIndex(scrollSlotPos)
targetIndex = player.GetItemIndex(targetSlotPos)
if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
return
###########################################################
self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
#net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
return
###########################################################
###########################################################
#net.SendRequestRefineInfoPacket(targetSlotPos)
#return
###########################################################
result = player.CanRefine(scrollIndex, targetSlotPos)
if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
#snd.PlaySound("sound/ui/jaeryun_fail.wav")
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
#snd.PlaySound("sound/ui/jaeryun_fail.wav")
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
#snd.PlaySound("sound/ui/jaeryun_fail.wav")
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
#snd.PlaySound("sound/ui/jaeryun_fail.wav")
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
if player.REFINE_OK != result:
return
self.refineDialog.Open(scrollSlotPos, targetSlotPos)
def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
scrollIndex = player.GetItemIndex(scrollSlotPos)
targetIndex = player.GetItemIndex(targetSlotPos)
if not player.CanDetach(scrollIndex, targetSlotPos):
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
return
self.questionDialog = uiCommon.QuestionDialog()
self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
self.questionDialog.Open()
self.questionDialog.sourcePos = scrollSlotPos
self.questionDialog.targetPos = targetSlotPos
def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
metinIndex = player.GetItemIndex(metinSlotPos)
targetIndex = player.GetItemIndex(targetSlotPos)
item.SelectItem(metinIndex)
itemName = item.GetItemName()
result = player.CanAttachMetin(metinIndex, targetSlotPos)
if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
if player.ATTACH_METIN_OK != result:
return
self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
def OverOutItem(self):
self.wndItem.SetUsableItem(FALSE)
if None != self.tooltipItem:
self.tooltipItem.HideToolTip()
def OverInItem(self, overSlotPos):
overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
self.wndItem.SetUsableItem(FALSE)
if mouseModule.mouseController.isAttached():
attachedItemType = mouseModule.mouseController.GetAttachedType()
if player.SLOT_TYPE_INVENTORY == attachedItemType:
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
self.wndItem.SetUsableItem(TRUE)
self.ShowToolTip(overSlotPos)
return
self.ShowToolTip(overSlotPos)
def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
"다른 아이템에 사용할 수 있는 아이템인가?"
if item.IsRefineScroll(srcItemVNum):
return TRUE
elif item.IsMetin(srcItemVNum):
return TRUE
elif item.IsDetachScroll(srcItemVNum):
return TRUE
elif item.IsKey(srcItemVNum):
return TRUE
elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
return TRUE
else:
if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
return TRUE
return FALSE
def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
"대상 아이템에 사용할 수 있는가?"
if srcSlotPos == dstSlotPos:
return FALSE
if item.IsRefineScroll(srcItemVNum):
if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
return TRUE
elif item.IsMetin(srcItemVNum):
if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
return TRUE
elif item.IsDetachScroll(srcItemVNum):
if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
return TRUE
elif item.IsKey(srcItemVNum):
if player.CanUnlock(srcItemVNum, dstSlotPos):
return TRUE
elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
return TRUE
else:
useType=item.GetUseType(srcItemVNum)
if "USE_CLEAN_SOCKET" == useType:
if self.__CanCleanBrokenMetinStone(dstSlotPos):
return TRUE
elif "USE_CHANGE_ATTRIBUTE" == useType:
if self.__CanChangeItemAttrList(dstSlotPos):
return TRUE
elif "USE_ADD_ATTRIBUTE" == useType:
if self.__CanAddItemAttr(dstSlotPos):
return TRUE
elif "USE_ADD_ATTRIBUTE2" == useType:
if self.__CanAddItemAttr(dstSlotPos):
return TRUE
elif "USE_ADD_ACCESSORY_SOCKET" == useType:
if self.__CanAddAccessorySocket(dstSlotPos):
return TRUE
elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
return TRUE;
elif "USE_PUT_INTO_BELT_SOCKET" == useType:
dstItemVNum = player.GetItemIndex(dstSlotPos)
print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
item.SelectItem(dstItemVNum)
if item.ITEM_TYPE_BELT == item.GetItemType():
return TRUE
return FALSE
def __CanCleanBrokenMetinStone(self, dstSlotPos):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
return FALSE
item.SelectItem(dstItemVNum)
if item.ITEM_TYPE_WEAPON != item.GetItemType():
return FALSE
for i in xrange(player.METIN_SOCKET_MAX_NUM):
if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
return TRUE
return FALSE
def __CanChangeItemAttrList(self, dstSlotPos):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
return FALSE
item.SelectItem(dstItemVNum)
if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
return FALSE
for i in xrange(player.METIN_SOCKET_MAX_NUM):
if player.GetItemAttribute(dstSlotPos, i) != 0:
return TRUE
return FALSE
def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
return FALSE
item.SelectItem(dstItemVNum)
if item.GetItemType() != item.ITEM_TYPE_ARMOR:
return FALSE
if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
return FALSE
curCount = player.GetItemMetinSocket(dstSlotPos, 0)
maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
return FALSE
if curCount>=maxCount:
return FALSE
return TRUE
def __CanAddAccessorySocket(self, dstSlotPos):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
return FALSE
item.SelectItem(dstItemVNum)
if item.GetItemType() != item.ITEM_TYPE_ARMOR:
return FALSE
if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
return FALSE
curCount = player.GetItemMetinSocket(dstSlotPos, 0)
maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
ACCESSORY_SOCKET_MAX_SIZE = 3
if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
return FALSE
return TRUE
def __CanAddItemAttr(self, dstSlotPos):
dstItemVNum = player.GetItemIndex(dstSlotPos)
if dstItemVNum == 0:
return FALSE
item.SelectItem(dstItemVNum)
if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
return FALSE
attrCount = 0
for i in xrange(player.METIN_SOCKET_MAX_NUM):
if player.GetItemAttribute(dstSlotPos, i) != 0:
attrCount += 1
if attrCount<4:
return TRUE
return FALSE
def ShowToolTip(self, slotIndex):
if None != self.tooltipItem:
self.tooltipItem.SetInventoryItem(slotIndex)
def OnTop(self):
if None != self.tooltipItem:
self.tooltipItem.SetTop()
def OnPressEscapeKey(self):
self.Close()
return TRUE
def UseItemSlot(self, slotIndex):
curCursorNum = app.GetCursor()
if app.SELL == curCursorNum:
return
if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
return
slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
if app.ENABLE_DRAGON_SOUL_SYSTEM:
if self.wndDragonSoulRefine.IsShow():
self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
return
################################################################## Noa
if app.IsPressed(app.DIK_LSHIFT):
ItemVNum = player.GetItemIndex(slotIndex)
item.SelectItem(ItemVNum)
if item.GetItemType()==23 and item.GetItemSubType()==0:
itemCount = player.GetItemCount(slotIndex)
if itemCount > 1:
self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_OPEN)
self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnUseTreasure))
self.dlgPickMoney.Open(itemCount)
self.dlgPickMoney.itemGlobalSlotIndex = slotIndex
else:
self.__UseItem(slotIndex)
##################################################################
mouseModule.mouseController.DeattachObject()
self.OverOutItem()
################################################################## Noa
def OnUseTreasure(self,value):
if value:
for x in xrange(value):
net.SendItemUsePacket(self.dlgPickMoney.itemGlobalSlotIndex)
##################################################################
self.__UseItem(slotIndex)
mouseModule.mouseController.DeattachObject()
self.OverOutItem()
def __UseItem(self, slotIndex):
ItemVNum = player.GetItemIndex(slotIndex)
item.SelectItem(ItemVNum)
if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
self.questionDialog = uiCommon.QuestionDialog()
self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
self.questionDialog.Open()
self.questionDialog.slotIndex = slotIndex
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
else:
self.__SendUseItemPacket(slotIndex)
#net.SendItemUsePacket(slotIndex)
def __UseItemQuestionDialog_OnCancel(self):
self.OnCloseQuestionDialog()
def __UseItemQuestionDialog_OnAccept(self):
self.__SendUseItemPacket(self.questionDialog.slotIndex)
self.OnCloseQuestionDialog()
def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
# 개인상점 열고 있는 동안 아이템 사용 방지
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
return
net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
def __SendUseItemPacket(self, slotPos):
# 개인상점 열고 있는 동안 아이템 사용 방지
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
return
net.SendItemUsePacket(slotPos)
def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
# 개인상점 열고 있는 동안 아이템 사용 방지
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
return
net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
if app.ENABLE_DRAGON_SOUL_SYSTEM:
self.wndDragonSoulRefine = wndDragonSoulRefine
def OnMoveWindow(self, x, y):
# print "Inventory Global Pos : ", self.GetGlobalPosition()
if self.wndBelt:
# print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
self.wndBelt.AdjustPositionAndSize()
hier bitteschön
|
|
|
08/12/2020, 00:09
|
#12
|
elite*gold: 0
Join Date: Sep 2015
Posts: 685
Received Thanks: 551
|
Für die, die den Bug auch haben einfach die 2 funktionen in der uishop.py ersetzen.
HTML Code:
def SellAttachedItem(self):
if shop.IsPrivateShop():
mouseModule.mouseController.DeattachObject()
return
attachedSlotType = mouseModule.mouseController.GetAttachedType()
attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
attachedCount = mouseModule.mouseController.GetAttachedItemCount()
if player.SLOT_TYPE_INVENTORY == attachedSlotType:
itemIndex = player.GetItemIndex(attachedSlotPos)
item.SelectItem(itemIndex)
if item.IsAntiFlag(item.ANTIFLAG_SELL):
popup = uiCommon.PopupDialog()
popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
popup.SetAcceptEvent(self.__OnClosePopupDialog)
popup.Open()
self.popup = popup
return
if player.IsValuableItem(attachedSlotPos):
itemPrice = item.GetISellItemPrice()
if item.Is1GoldItem():
itemPrice = attachedCount / itemPrice / 5
else:
itemPrice = itemPrice * max(1, attachedCount) / 5
itemName = item.GetItemName()
questionDialog = uiCommon.QuestionDialog()
questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, attachedCount, itemPrice))
questionDialog.SetAcceptEvent(lambda arg1=attachedSlotPos, arg2=attachedCount: self.OnSellItem(arg1, arg2))
questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
questionDialog.Open()
self.questionDialog = questionDialog
constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
else:
self.OnSellItem(attachedSlotPos, attachedCount)
else:
snd.PlaySound("sound/ui/loginfail.wav")
mouseModule.mouseController.DeattachObject()
def OnSellItem(self, slotPos, count):
net.SendShopSellPacketNew(slotPos, count)
snd.PlaySound("sound/ui/money.wav")
self.OnCloseQuestionDialog()
|
|
|
All times are GMT +1. The time now is 22:30.
|
|