Advertisement
Guest User

Untitled

a guest
Sep 28th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.80 KB | None | 0 0
  1. import ui
  2. import player
  3. import mouseModule
  4. import net
  5. import app
  6. import snd
  7. import item
  8. import player
  9. import chat
  10. import grp
  11. import uiScriptLocale
  12. import uiRefine
  13. import uiAttachMetin
  14. import uiPickMoney
  15. import uiCommon
  16. import uiPrivateShopBuilder # 개인상점 열동안 ItemMove 방지
  17. import locale
  18. import constInfo
  19. import ime
  20. import wndMgr
  21. import exchange
  22. import safebox
  23. import shop
  24. import background
  25. from _weakref import proxy
  26. from switchbot import Bot
  27.  
  28. ## ITEM SIL
  29. import event
  30.  
  31. ITEM_MALL_BUTTON_ENABLE = True
  32. CHECK_ACTIVE_PICKUP = 0
  33.  
  34.  
  35. if app.ENABLE_SASH_SYSTEM:
  36. import sash
  37. ITEM_FLAG_APPLICABLE = 1 << 14
  38.  
  39. class CostumeWindow(ui.ScriptWindow):
  40.  
  41. def __init__(self, wndInventory):
  42. import exception
  43.  
  44. if not app.ENABLE_COSTUME_SYSTEM:
  45. exception.Abort("What do you do?")
  46. return
  47.  
  48. if not wndInventory:
  49. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  50. return
  51.  
  52. ui.ScriptWindow.__init__(self)
  53.  
  54. self.isLoaded = 0
  55. self.wndInventory = wndInventory;
  56.  
  57. self.__LoadWindow()
  58.  
  59. def __del__(self):
  60. ui.ScriptWindow.__del__(self)
  61.  
  62. def Show(self):
  63. self.__LoadWindow()
  64. self.RefreshCostumeSlot()
  65.  
  66. ui.ScriptWindow.Show(self)
  67.  
  68. def Close(self):
  69. self.Hide()
  70.  
  71. def __LoadWindow(self):
  72. if self.isLoaded == 1:
  73. return
  74.  
  75. self.isLoaded = 1
  76.  
  77. try:
  78. pyScrLoader = ui.PythonScriptLoader()
  79. pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  80. except:
  81. import exception
  82. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  83.  
  84. try:
  85. wndEquip = self.GetChild("CostumeSlot")
  86. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  87.  
  88. except:
  89. import exception
  90. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  91.  
  92. ## Equipment
  93. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  94. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  95. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  96. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  97. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  98. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  99.  
  100. self.wndEquip = wndEquip
  101.  
  102. def RefreshCostumeSlot(self):
  103. getItemVNum=player.GetItemIndex
  104.  
  105. for i in xrange(item.COSTUME_SLOT_COUNT):
  106. slotNumber = item.COSTUME_SLOT_START + i
  107. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  108.  
  109. self.wndEquip.RefreshSlot()
  110.  
  111. class BeltInventoryWindow(ui.ScriptWindow):
  112.  
  113. def __init__(self, wndInventory):
  114. import exception
  115.  
  116. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  117. exception.Abort("What do you do?")
  118. return
  119.  
  120. if not wndInventory:
  121. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  122. return
  123.  
  124. ui.ScriptWindow.__init__(self)
  125.  
  126. self.isLoaded = 0
  127. self.wndInventory = wndInventory;
  128.  
  129. self.wndBeltInventoryLayer = None
  130. self.wndBeltInventorySlot = None
  131. self.expandBtn = None
  132. self.minBtn = None
  133.  
  134. self.__LoadWindow()
  135.  
  136. def __del__(self):
  137. ui.ScriptWindow.__del__(self)
  138.  
  139. def Show(self, openBeltSlot = False):
  140. self.__LoadWindow()
  141. self.RefreshSlot()
  142.  
  143. ui.ScriptWindow.Show(self)
  144.  
  145. if openBeltSlot:
  146. self.OpenInventory()
  147. else:
  148. self.CloseInventory()
  149.  
  150. def Close(self):
  151. self.Hide()
  152.  
  153. def IsOpeningInventory(self):
  154. return self.wndBeltInventoryLayer.IsShow()
  155.  
  156. def OpenInventory(self):
  157. self.wndBeltInventoryLayer.Show()
  158. self.expandBtn.Hide()
  159.  
  160. self.AdjustPositionAndSize()
  161.  
  162. def CloseInventory(self):
  163. self.wndBeltInventoryLayer.Hide()
  164. self.expandBtn.Show()
  165.  
  166. self.AdjustPositionAndSize()
  167.  
  168. ## 현재 인벤토리 위치를 기준으로 BASE 위치를 계산, 리턴.. 숫자 하드코딩하기 정말 싫지만 방법이 없다..
  169. def GetBasePosition(self):
  170. x, y = self.wndInventory.GetGlobalPosition()
  171. return x - 148, y + 241
  172.  
  173. def AdjustPositionAndSize(self):
  174. bx, by = self.GetBasePosition()
  175.  
  176. if self.IsOpeningInventory():
  177. self.SetPosition(bx, by)
  178. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  179.  
  180. else:
  181. self.SetPosition(bx + 138, by);
  182. self.SetSize(10, self.GetHeight())
  183.  
  184. def __LoadWindow(self):
  185. if self.isLoaded == 1:
  186. return
  187.  
  188. self.isLoaded = 1
  189.  
  190. try:
  191. pyScrLoader = ui.PythonScriptLoader()
  192. pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  193. except:
  194. import exception
  195. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  196.  
  197. try:
  198. self.ORIGINAL_WIDTH = self.GetWidth()
  199. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  200. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  201. self.expandBtn = self.GetChild("ExpandBtn")
  202. self.minBtn = self.GetChild("MinimizeBtn")
  203.  
  204. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  205. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  206.  
  207. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  208. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  209. wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  210. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  211. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  212. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", False, False)
  213.  
  214. except:
  215. import exception
  216. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  217.  
  218. ## Equipment
  219. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  220. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  221. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  222. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  223. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  224. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  225.  
  226. self.wndBeltInventorySlot = wndBeltInventorySlot
  227.  
  228. def RefreshSlot(self):
  229. getItemVNum=player.GetItemIndex
  230.  
  231. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  232. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  233. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  234. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, True)
  235.  
  236. avail = "0"
  237.  
  238. if player.IsAvailableBeltInventoryCell(slotNumber):
  239. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  240. else:
  241. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  242.  
  243. self.wndBeltInventorySlot.RefreshSlot()
  244.  
  245.  
  246. class InventoryWindow(ui.ScriptWindow):
  247. liHighlightedItems = []
  248. 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")
  249.  
  250. questionDialog = None
  251. tooltipItem = None
  252. wndCostume = None
  253. wndBelt = None
  254. dlgPickMoney = None
  255.  
  256. sellingSlotNumber = -1
  257. isLoaded = 0
  258. isOpenedCostumeWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 코스츔이 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  259. isOpenedBeltWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  260.  
  261. def __init__(self):
  262. ui.ScriptWindow.__init__(self)
  263. self.OpenBoniSwitcherEvent = lambda : None
  264. self.__LoadWindow()
  265.  
  266. #Protectie inventar
  267. def ParolaInventarWnd(self):
  268. self.ParolaInventar = ui.BoardWithTitleBar()
  269. self.ParolaInventar.SetSize(420, 70)
  270. self.ParolaInventar.SetCenterPosition()
  271. self.ParolaInventar.AddFlag('movable')
  272. self.ParolaInventar.AddFlag('float')
  273. self.ParolaInventar.SetTitleName('Securitate inventar')
  274. self.ParolaInventar.SetCloseEvent(self.InchidereParolaInventar)
  275. self.ParolaInventar.Show()
  276.  
  277. self.TextParola = ui.TextLine()
  278. self.TextParola.SetParent(self.ParolaInventar)
  279. self.TextParola.SetDefaultFontName()
  280. self.TextParola.SetPosition(50, 35)
  281. self.TextParola.SetFeather()
  282. self.TextParola.SetText("Parola inventar:")
  283. self.TextParola.SetOutline()
  284. self.TextParola.Show()
  285.  
  286. self.SlotParola = ui.SlotBar()
  287. self.SlotParola.SetParent(self.ParolaInventar)
  288. self.SlotParola.SetSize(160, 15)
  289. self.SlotParola.SetPosition(30, 35)
  290. self.SlotParola.SetWindowHorizontalAlignCenter()
  291. self.SlotParola.Show()
  292.  
  293. self.CampParola = ui.EditLine()
  294. self.CampParola.SetParent(self.SlotParola)
  295. self.CampParola.SetSize(160, 15)
  296. self.CampParola.SetPosition(4, 1)
  297. self.CampParola.SetMax(30)
  298. self.CampParola.SetNumberMode()
  299. self.CampParola.SetFocus()
  300. self.CampParola.Show()
  301.  
  302. self.ButonParolaOK = ui.Button()
  303. self.ButonParolaOK.SetParent(self.ParolaInventar)
  304. self.ButonParolaOK.SetEvent(self.VerificareParola)
  305. self.ButonParolaOK.SetPosition(340, 35)
  306. self.ButonParolaOK.SetUpVisual("d:/ymir work/acceptare_0.tga")
  307. self.ButonParolaOK.SetOverVisual("d:/ymir work/acceptare_1.tga")
  308. self.ButonParolaOK.SetDownVisual("d:/ymir work/acceptare_2.tga")
  309. self.ButonParolaOK.SetText("")
  310. self.ButonParolaOK.SetToolTipText("Ok")
  311. self.ButonParolaOK.Show()
  312.  
  313. self.CampParola.SetReturnEvent(ui.__mem_func__(self.VerificareParola))
  314.  
  315. def VerificareParola(self):
  316. self.ParolaInventar.Hide()
  317. activare_skill2 = constInfo.SECURIATE_QUESTINDEX
  318. constInfo.LouieWork = self.CampParola.GetText()
  319. event.QuestButtonClick(activare_skill2)
  320.  
  321. def InchidereParolaInventar(self):
  322. self.ParolaInventar.Hide()
  323. #gata prot
  324.  
  325. def __del__(self):
  326. ui.ScriptWindow.__del__(self)
  327.  
  328. ##prot
  329. def Show(self):
  330. if constInfo.SECURIATE_CONT == 0:
  331. self.__LoadWindow()
  332.  
  333. ui.ScriptWindow.Show(self)
  334.  
  335. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  336. self.wndCostume.Show()
  337. if self.wndBelt:
  338. self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  339. else:
  340. self.ParolaInventarWnd()
  341. #End prot
  342.  
  343. def BindInterfaceClass(self, interface):
  344. self.interface = interface
  345.  
  346. def __LoadWindow(self):
  347. if self.isLoaded == 1:
  348. return
  349.  
  350. self.isLoaded = 1
  351.  
  352. try:
  353. pyScrLoader = ui.PythonScriptLoader()
  354.  
  355. if ITEM_MALL_BUTTON_ENABLE:
  356. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
  357. else:
  358. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  359. except:
  360. import exception
  361. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  362.  
  363. try:
  364. wndItem = self.GetChild("ItemSlot")
  365. wndEquip = self.GetChild("EquipmentSlot")
  366. # wndBorrar = self.GetChild("BorrarSlot")
  367. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  368. self.wndMoney = self.GetChild("Money")
  369. self.wndMoneySlot = self.GetChild("Money_Slot")
  370. self.mallButton = self.GetChild2("MallButton")
  371. self.DSSButton = self.GetChild2("DSSButton")
  372. self.costumeButton = self.GetChild2("CostumeButton")
  373.  
  374. if app.ENABLE_SPECIAL_STORAGE:
  375. self.SpecialStorageButton = self.GetChild2("SpecialStorageButton")
  376.  
  377. self.just4metin_noaptezi = self.GetChild2("noaptezi")
  378. self.just4metin_iesire = self.GetChild2("iesire")
  379. self.Telep = self.GetChild2("Telep")
  380. self.switchbot = self.GetChild2("switch")
  381. self.pickup = self.GetChild2("pickup")
  382. #Protectie inventar
  383. self.Key = self.GetChild2("Key")
  384. #Protectie inventar
  385. self.Alaska_py = self.GetChild2("Alaska_py")
  386. # self.borrar_items = self.GetChild2("BorrarItems")
  387.  
  388. self.inventoryTab = []
  389. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  390. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  391. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  392. self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  393.  
  394. self.equipmentTab = []
  395. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  396. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  397. self.equipmentTab.append(self.GetChild("Equipment_Tab_03"))
  398. self.equipmentTab.append(self.GetChild("Equipment_Tab_04"))
  399.  
  400. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  401. self.costumeButton.Hide()
  402. self.costumeButton.Destroy()
  403. self.costumeButton = 0
  404.  
  405. # Belt Inventory Window
  406. self.wndBelt = None
  407.  
  408. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  409. self.wndBelt = BeltInventoryWindow(self)
  410. except:
  411. import exception
  412. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  413.  
  414. ## Item
  415. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  416. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  417. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  418. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  419. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  420. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  421.  
  422. ## Equipment
  423. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  424. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  425. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  426. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  427. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  428. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  429.  
  430. ## ITEM SIL
  431.  
  432. self.GetChild("Sil_Slot").SetSelectEmptySlotEvent(ui.__mem_func__(self.SilEmptySlot))
  433.  
  434. ## ITEM SIL
  435.  
  436.  
  437. ## PickMoneyDialog
  438. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  439. dlgPickMoney.LoadDialog()
  440. dlgPickMoney.Hide()
  441.  
  442. ## RefineDialog
  443. self.refineDialog = uiRefine.RefineDialog()
  444. self.refineDialog.Hide()
  445.  
  446. ## AttachMetinDialog
  447. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  448. self.attachMetinDialog.Hide()
  449. self.drag = ui.Bar()
  450. self.drag.SetPosition(13+50,538)
  451. self.drag.SetParent(self)
  452. self.drag.SetColor(grp.GenerateColor(0.0, 0.0, 0.0, 0.0))
  453. self.drag.SetSize(32,32)
  454. self.drag.OnMouseLeftButtonUp = lambda: self.Add_Item()
  455. self.drag.Show()
  456.  
  457. # wndBorrar.SetOverInItemEvent(ui.__mem_func__(self.OverBorrarIn))
  458. # wndBorrar.SetOverOutItemEvent(ui.__mem_func__(self.OverBorrarOut))
  459.  
  460. # self.RemoveQuestion = uiCommon.QuestionDialog()
  461. # self.RemoveQuestion.SetAcceptEvent(lambda arg = TRUE: self.Borrar_Item(arg))
  462. # self.RemoveQuestion.SetCancelEvent(lambda arg = FALSE: self.Borrar_Item(arg))
  463. # self.RemoveQuestion.Close()
  464.  
  465. ## MoneySlot
  466. self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  467.  
  468. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  469. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  470. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  471. self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  472. self.inventoryTab[0].Down()
  473.  
  474. self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  475. self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  476. self.equipmentTab[2].SetEvent(lambda arg=2: self.SetEquipmentPage(arg))
  477. self.equipmentTab[3].SetEvent(lambda arg=3: self.SetEquipmentPage(arg))
  478. self.equipmentTab[0].Down()
  479.  
  480. self.equipmentTab[0].Hide()
  481. self.equipmentTab[1].Hide()
  482. self.equipmentTab[2].Hide()
  483. self.equipmentTab[3].Hide()
  484.  
  485. self.wndItem = wndItem
  486. self.wndEquip = wndEquip
  487. self.dlgPickMoney = dlgPickMoney
  488.  
  489. # MallButton
  490. if self.mallButton:
  491. self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  492.  
  493. if self.DSSButton:
  494. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  495.  
  496. if app.ENABLE_SPECIAL_STORAGE:
  497. if self.SpecialStorageButton:
  498. self.SpecialStorageButton.SetEvent(ui.__mem_func__(self.ClickSpecialStorage))
  499.  
  500. # Costume Button
  501. if self.costumeButton:
  502. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  503.  
  504. #Telep
  505. if self.Telep:
  506. self.Telep.SetEvent(ui.__mem_func__(self.ClickTelep))
  507.  
  508. #Iesire
  509. if self.just4metin_iesire:
  510. self.just4metin_iesire.SetEvent(ui.__mem_func__(self.ClickIesire))
  511.  
  512. #Noapte Zi
  513. if self.just4metin_noaptezi:
  514. self.just4metin_noaptezi.SetEvent(ui.__mem_func__(self.ClickNoaptezi))
  515.  
  516. if self.switchbot:
  517. self.switchbot.SetEvent(ui.__mem_func__(self.ClickSwitch))
  518.  
  519. if self.pickup:
  520. self.pickup.SetEvent(ui.__mem_func__(self.ClickPickup))
  521.  
  522. #PROTECTIE INVENTAR
  523. if self.Key:
  524. self.Key.SetEvent(ui.__mem_func__(self.ClickKey))
  525. #PROTECTIE INVENTAR
  526.  
  527. #Bonusuri
  528. if self.Alaska_py:
  529. self.Alaska_py.SetEvent(ui.__mem_func__(self.ClickAlaska_py))
  530.  
  531. self.wndCostume = None
  532. self.listUnusableSlot = []
  533.  
  534. #####
  535.  
  536. if app.ENABLE_SASH_SYSTEM:
  537. self.listAttachedSashs = []
  538.  
  539. ## Refresh
  540. self.SetInventoryPage(0)
  541. self.SetEquipmentPage(0)
  542. self.RefreshItemSlot()
  543. self.RefreshStatus()
  544.  
  545. def Destroy(self):
  546. self.ClearDictionary()
  547.  
  548. self.dlgPickMoney.Destroy()
  549. self.dlgPickMoney = 0
  550.  
  551. self.refineDialog.Destroy()
  552. self.refineDialog = 0
  553.  
  554. self.attachMetinDialog.Destroy()
  555. self.attachMetinDialog = 0
  556.  
  557. self.tooltipItem = None
  558. self.wndItem = 0
  559. self.wndEquip = 0
  560. self.dlgPickMoney = 0
  561. self.wndMoney = 0
  562. self.wndMoneySlot = 0
  563. self.questionDialog = None
  564. self.mallButton = None
  565. self.DSSButton = None
  566. self.interface = None
  567. self.switchbot = None
  568.  
  569. if app.ENABLE_SPECIAL_STORAGE:
  570. self.SpecialStorageButton = None
  571.  
  572. self.switchbot = Bot()
  573. self.switchbot.Hide()
  574.  
  575. if self.wndCostume:
  576. self.wndCostume.Destroy()
  577. self.wndCostume = 0
  578.  
  579. if self.wndBelt:
  580. self.wndBelt.Destroy()
  581. self.wndBelt = None
  582.  
  583. self.inventoryTab = []
  584. self.equipmentTab = []
  585.  
  586. def SilEmptySlot(self):
  587. if mouseModule.mouseController.isAttached():
  588. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  589. itemIndex = player.GetItemIndex(attachedSlotPos)
  590. if player.SLOT_TYPE_INVENTORY == mouseModule.mouseController.GetAttachedType():
  591. item.SelectItem(itemIndex)
  592. itemDropQuestionDialog = uiCommon.QuestionDialog()
  593. miktar_pls = player.GetItemCount(attachedSlotPos)
  594. if miktar_pls != 1:
  595. itemDropQuestionDialog.SetText(("%dx %s sigur vrei sa stergi itemul?" % (miktar_pls, item.GetItemName())))
  596. else:
  597. itemDropQuestionDialog.SetText(("%s sigur vrei sa stergi itemul?" % (item.GetItemName())))
  598. itemDropQuestionDialog.SetAcceptEvent(lambda arg = TRUE: self.SilItem(arg, attachedSlotPos))
  599. itemDropQuestionDialog.SetCancelEvent(lambda arg = FALSE: self.SilItem(arg, attachedSlotPos))
  600. itemDropQuestionDialog.Open()
  601. self.itemDropQuestionDialog = itemDropQuestionDialog
  602. mouseModule.mouseController.DeattachObject()
  603. else:
  604. warn = uiCommon.PopupDialog()
  605. warn.SetText("Acest item nu exista.")
  606. warn.Open()
  607.  
  608. def SilItem(self, answer, attachedSlotPos):
  609. if not self.itemDropQuestionDialog:
  610. return
  611. if answer:
  612. constInfo.ItemSil_Slot = attachedSlotPos
  613. event.QuestButtonClick(constInfo.ItemSil_Index)
  614. snd.PlaySound('sound/ui/drop.wav')
  615.  
  616. self.itemDropQuestionDialog.Close()
  617. self.itemDropQuestionDialog = None
  618.  
  619. def Hide(self):
  620. if None != self.tooltipItem:
  621. self.tooltipItem.HideToolTip()
  622.  
  623. if self.wndCostume:
  624. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow() # 인벤토리 창이 닫힐 때 코스츔이 열려 있었는가?
  625. self.wndCostume.Close()
  626.  
  627. if self.wndBelt:
  628. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # 인벤토리 창이 닫힐 때 벨트 인벤토리도 열려 있었는가?
  629. print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  630. self.wndBelt.Close()
  631.  
  632. if self.dlgPickMoney:
  633. self.dlgPickMoney.Close()
  634.  
  635. self.OnCloseQuestionDialog()
  636.  
  637. wndMgr.Hide(self.hWnd)
  638.  
  639.  
  640. def Close(self):
  641. self.Hide()
  642.  
  643. # def OverBorrarIn(self):
  644. # self.ShowToolTip(0)
  645.  
  646. # def OverBorrarOut(self):
  647. # self.tooltipItem.HideToolTip()
  648.  
  649. # def Add_Item(self):
  650. # if mouseModule.mouseController.isAttached():
  651. # attachedSlotType = mouseModule.mouseController.GetAttachedType()
  652. # attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  653. # attachedSlotVnum = mouseModule.mouseController.GetAttachedItemIndex()
  654.  
  655. # item.SelectItem(attachedSlotVnum)
  656. # if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  657. # item.SelectItem(attachedSlotVnum)
  658. # self.RemoveQuestion.SetText("Sigur doresti sa stergi "+str(item.GetItemName())+"?")
  659. # self.RemoveQuestion.Open()
  660. # constInfo.BorrarItems["BORRAR"] = ""
  661. # constInfo.BorrarItems["BORRAR"] = "BORRAR|"+str(attachedSlotPos)+"|"+str(attachedSlotVnum)
  662. # chat.AppendChat(1, constInfo.BorrarItems["BORRAR"])
  663.  
  664. # mouseModule.mouseController.DeattachObject()
  665.  
  666. # def Borrar_Item(self, arg):
  667. # if arg:
  668. # event.QuestButtonClick(constInfo.BorrarItems["QID"])
  669.  
  670. # self.RemoveQuestion.Close()
  671.  
  672. def SetInventoryPage(self, page):
  673. self.inventoryPageIndex = page
  674. self.inventoryTab[0].SetUp()
  675. self.inventoryTab[1].SetUp()
  676. self.inventoryTab[2].SetUp()
  677. self.inventoryTab[3].SetUp()
  678. if len(self.inventoryTab) >=page:
  679. self.inventoryTab[page].Down()
  680. self.RefreshBagSlotWindow()
  681.  
  682. def SetEquipmentPage(self, page):
  683. self.equipmentPageIndex = page
  684. self.equipmentTab[0].SetUp()
  685. self.equipmentTab[1].SetUp()
  686. self.equipmentTab[2].SetUp()
  687. self.equipmentTab[3].SetUp()
  688. if len(self.equipmentTab) >=page:
  689. self.equipmentTab[page].Down()
  690. self.RefreshEquipSlotWindow()
  691.  
  692. def ClickMallButton(self):
  693. print "click_mall_button"
  694. net.SendChatPacket("/click_mall")
  695.  
  696. # DSSButton
  697. def ClickDSSButton(self):
  698. print "click_dss_button"
  699. self.interface.ToggleDragonSoulWindow()
  700.  
  701. if app.ENABLE_SPECIAL_STORAGE:
  702. def ClickSpecialStorage(self):
  703. self.interface.ToggleSpecialStorageWindow()
  704.  
  705. #PROTECTIE INVENTAR
  706. def ClickKey(self):
  707. import event
  708. qid = constInfo.mallkeyqin
  709. event.QuestButtonClick(qid)
  710. #PROTECTIE INVENTAR
  711.  
  712. def ClickCostumeButton(self):
  713. print "Click Costume Button"
  714. if self.wndCostume:
  715. if self.wndCostume.IsShow():
  716. self.wndCostume.Hide()
  717. else:
  718. self.wndCostume.Show()
  719. else:
  720. self.wndCostume = CostumeWindow(self)
  721. self.wndCostume.Show()
  722.  
  723. #Noapte Zi
  724. def ClickNoaptezi(self):
  725. if constInfo.Night == 0:
  726. background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
  727. background.SetEnvironmentData(1)
  728. constInfo.Night = 1
  729. else:
  730. background.SetEnvironmentData(0)
  731. constInfo.Night = 0
  732. snd.PlaySound('sound/ui/pick.wav')
  733.  
  734. #Iesire
  735. def ClickIesire(self):
  736. import app
  737. app.Exit()
  738.  
  739. def ClickPickup(self):
  740. global CHECK_ACTIVE_PICKUP
  741. if CHECK_ACTIVE_PICKUP == 0:
  742. CHECK_ACTIVE_PICKUP = 1
  743. constInfo.ENABLE_PICKUP = 1
  744. chat.AppendChat(chat.CHAT_TYPE_NOTICE, "|cFF00ff33[Metin2Aze]: Ai activat sistemul de auto pick-up.|h|cFFFFFFFF|h")
  745. else:
  746. CHECK_ACTIVE_PICKUP = 0
  747. constInfo.ENABLE_PICKUP = 0
  748. chat.AppendChat(chat.CHAT_TYPE_NOTICE, "|cFFDC143C[Metin2Aze]: Ai dezactivat sistemul de auto pick-up.|h|cFFFFFFFF|h")
  749.  
  750.  
  751. def ClickSwitch(self):
  752. import switchbot
  753. switchbot.Bot().Show()
  754.  
  755. #Telep
  756. def ClickTelep(self):
  757. import event
  758. qid = constInfo.Telepqin
  759. event.QuestButtonClick(qid)
  760.  
  761. def ClickAlaska_py(self):
  762. import uibonuspage
  763. uibonuspage.BonusBoardDialog().Show()
  764.  
  765. def ClickAlaska_py(self):
  766. import uiPaginaBonusuri
  767. self.Pagina = uiPaginaBonusuri.BonusPage()
  768. if constInfo.Bonusuri == 0:
  769. constInfo.Bonusuri = 1
  770. self.Pagina.Show()
  771. else:
  772. constInfo.Bonusuri = 0
  773. self.Pagina.Hide()
  774.  
  775. def OpenPickMoneyDialog(self):
  776.  
  777. if mouseModule.mouseController.isAttached():
  778.  
  779. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  780. if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  781.  
  782. if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  783. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  784. snd.PlaySound("sound/ui/money.wav")
  785.  
  786. mouseModule.mouseController.DeattachObject()
  787.  
  788. else:
  789. curMoney = player.GetElk()
  790.  
  791. if curMoney <= 0:
  792. return
  793.  
  794. self.dlgPickMoney.SetTitleName(locale.PICK_MONEY_TITLE)
  795. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  796. self.dlgPickMoney.Open(curMoney)
  797. self.dlgPickMoney.SetMax(7) # 인벤토리 990000 제한 버그 수정
  798.  
  799. def OnPickMoney(self, money):
  800. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  801.  
  802. def OnPickItem(self, count):
  803. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  804. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  805. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  806.  
  807. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  808.  
  809. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or player.IsBeltInventorySlot(local):
  810. return local
  811.  
  812. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  813.  
  814. def RefreshBagSlotWindow(self):
  815. is_activated = 0
  816. getItemVNum=player.GetItemIndex
  817. getItemCount=player.GetItemCount
  818. setItemVNum=self.wndItem.SetItemSlot
  819.  
  820. for i in xrange(player.INVENTORY_PAGE_SIZE):
  821. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  822. itemCount = getItemCount(slotNumber)
  823. if 0 == itemCount:
  824. self.wndItem.ClearSlot(i)
  825. continue
  826. elif 1 == itemCount:
  827. itemCount = 0
  828.  
  829. itemVnum = getItemVNum(slotNumber)
  830. setItemVNum(i, itemVnum, itemCount)
  831. if itemVnum == 0 and slotNumber in self.liHighlightedItems:
  832. self.liHightlightedItems.remove(slotNumber)
  833. if exchange.isTrading() and item.IsAntiFlag(item.ANTIFLAG_GIVE):
  834. self.wndItem.SetUnusableSlot(i)
  835. self.listUnusableSlot.append(i)
  836. elif not exchange.isTrading() and item.IsAntiFlag(item.ANTIFLAG_GIVE) and slotNumber in self.listUnusableSlot:
  837. self.wndItem.SetUsableSlot(i)
  838. self.listUnusableSlot.remove(i)
  839. if constInfo.IS_AUTO_POTION(itemVnum):
  840. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  841. if slotNumber >= player.INVENTORY_PAGE_SIZE:
  842. slotNumber -= player.INVENTORY_PAGE_SIZE
  843.  
  844. isActivated = 0 != metinSocket[0]
  845. if isActivated:
  846. self.wndItem.ActivateSlot(i)
  847. potionType = 0;
  848. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  849. potionType = player.AUTO_POTION_TYPE_HP
  850. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  851. potionType = player.AUTO_POTION_TYPE_SP
  852.  
  853. usedAmount = int(metinSocket[1])
  854. totalAmount = int(metinSocket[2])
  855. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  856. else:
  857. self.wndItem.DeactivateSlot(i)
  858. elif itemVnum >= 53001 and itemVnum <= 55750:
  859. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]# <!> globalSlotNumber may be different <!>
  860. isActivated = 0 != metinSocket[1]
  861. if isActivated:
  862. self.wndItem.ActivateSlot(i)
  863. else:
  864. self.wndItem.DeactivateSlot(i)
  865.  
  866. if app.ENABLE_SASH_SYSTEM:
  867. slotNumberChecked = 0
  868. if not constInfo.IS_AUTO_POTION(itemVnum):
  869. self.wndItem.DeactivateSlot(i)
  870.  
  871. for j in xrange(sash.WINDOW_MAX_MATERIALS):
  872. (isHere, iCell) = sash.GetAttachedItem(j)
  873. if isHere:
  874. if iCell == slotNumber:
  875. self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
  876. if not slotNumber in self.listAttachedSashs:
  877. self.listAttachedSashs.append(slotNumber)
  878.  
  879. slotNumberChecked = 1
  880. else:
  881. if slotNumber in self.listAttachedSashs and not slotNumberChecked:
  882. self.wndItem.DeactivateSlot(i)
  883. self.listAttachedSashs.remove(slotNumber)
  884. else:
  885. self.wndItem.DeactivateSlot(slotNumber)
  886.  
  887. self.__RefreshHighlights()
  888.  
  889. self.wndItem.RefreshSlot()
  890. if self.wndBelt:
  891. self.wndBelt.RefreshSlot()
  892.  
  893. def RefreshEquipSlotWindow(self):
  894. getItemVNum=player.GetItemIndex
  895. getItemCount=player.GetItemCount
  896. setItemVNum=self.wndEquip.SetItemSlot
  897. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  898. slotNumber = player.EQUIPMENT_SLOT_START + i
  899. itemCount = getItemCount(slotNumber)
  900. if itemCount <= 1:
  901. itemCount = 0
  902. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  903.  
  904. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  905. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  906. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  907. itemCount = getItemCount(slotNumber)
  908. if itemCount <= 1:
  909. itemCount = 0
  910. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  911. print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  912.  
  913.  
  914.  
  915. self.wndEquip.RefreshSlot()
  916.  
  917. if self.wndCostume:
  918. self.wndCostume.RefreshCostumeSlot()
  919.  
  920. def RefreshItemSlot(self):
  921. self.RefreshBagSlotWindow()
  922. self.RefreshEquipSlotWindow()
  923.  
  924. def RefreshStatus(self):
  925. money = player.GetElk()
  926. if money <= 100000000:
  927. self.wndMoney.SetFontColor(40, 246, 239)
  928. elif money >= 100000001 and money <= 1000000000:
  929. self.wndMoney.SetFontColor(53, 246, 40)
  930. elif money >= 1000000001 and money <= 1500000000:
  931. self.wndMoney.SetFontColor(232, 246, 40)
  932. elif money >= 1500000001 and money <= 1000000000000:
  933. self.wndMoney.SetFontColor(246, 177, 40)
  934. elif money >= 1000000000001:
  935. self.wndMoney.SetFontColor(255, 17, 0)
  936. self.wndMoney.SetText(locale.NumberToMoneyString(money))
  937.  
  938. def SetItemToolTip(self, tooltipItem):
  939. self.tooltipItem = tooltipItem
  940.  
  941. def SellItem(self):
  942. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  943. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  944. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count)
  945. snd.PlaySound("sound/ui/money.wav")
  946. self.OnCloseQuestionDialog()
  947.  
  948. def OnDetachMetinFromItem(self):
  949. if None == self.questionDialog:
  950. return
  951.  
  952. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  953. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  954. self.OnCloseQuestionDialog()
  955.  
  956. def OnCloseQuestionDialog(self):
  957. if self.questionDialog:
  958. self.questionDialog.Close()
  959.  
  960. self.questionDialog = None
  961.  
  962. ## Slot Event
  963. def SelectEmptySlot(self, selectedSlotPos):
  964. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
  965. return
  966.  
  967. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  968.  
  969. if mouseModule.mouseController.isAttached():
  970. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  971. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  972. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  973. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  974. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  975.  
  976. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  977. itemCount = player.GetItemCount(attachedSlotPos)
  978. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  979.  
  980. if item.IsRefineScroll(attachedItemIndex):
  981. self.wndItem.SetUseMode(False)
  982.  
  983. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  984. mouseModule.mouseController.RunCallBack("INVENTORY")
  985.  
  986. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  987. net.SendShopBuyPacket(attachedSlotPos)
  988.  
  989. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  990.  
  991. if player.ITEM_MONEY == attachedItemIndex:
  992. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  993. snd.PlaySound("sound/ui/money.wav")
  994.  
  995. else:
  996. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  997.  
  998. elif player.SLOT_TYPE_MALL == attachedSlotType:
  999. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1000.  
  1001. elif app.ENABLE_SPECIAL_STORAGE and player.SLOT_TYPE_UPGRADE_INVENTORY == attachedSlotType:
  1002. net.SendSpecialMovePacket(player.UPGRADE_INVENTORY, attachedSlotPos, selectedSlotPos, attachedCount)
  1003.  
  1004. elif app.ENABLE_SPECIAL_STORAGE and player.SLOT_TYPE_BOOK_INVENTORY == attachedSlotType:
  1005. net.SendSpecialMovePacket(player.BOOK_INVENTORY, attachedSlotPos, selectedSlotPos, attachedCount)
  1006.  
  1007. elif app.ENABLE_SPECIAL_STORAGE and player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType:
  1008. net.SendSpecialMovePacket(player.STONE_INVENTORY, attachedSlotPos, selectedSlotPos, attachedCount)
  1009.  
  1010. mouseModule.mouseController.DeattachObject()
  1011.  
  1012. def SelectItemSlot(self, itemSlotIndex):
  1013. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
  1014. return
  1015.  
  1016. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1017.  
  1018. if mouseModule.mouseController.isAttached():
  1019. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1020. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1021. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1022.  
  1023. if app.ENABLE_SPECIAL_STORAGE:
  1024. if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType:
  1025. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1026. else:
  1027. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1028. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1029.  
  1030. mouseModule.mouseController.DeattachObject()
  1031.  
  1032. else:
  1033.  
  1034. curCursorNum = app.GetCursor()
  1035. if app.SELL == curCursorNum:
  1036. self.__SellItem(itemSlotIndex)
  1037.  
  1038. elif app.BUY == curCursorNum:
  1039. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.SHOP_BUY_INFO)
  1040.  
  1041. elif app.IsPressed(app.DIK_LALT):
  1042. link = player.GetItemLink(itemSlotIndex)
  1043. ime.PasteString(link)
  1044.  
  1045. elif app.IsPressed(app.DIK_LSHIFT):
  1046. itemCount = player.GetItemCount(itemSlotIndex)
  1047.  
  1048. if itemCount > 1:
  1049. self.dlgPickMoney.SetTitleName(locale.PICK_ITEM_TITLE)
  1050. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1051. self.dlgPickMoney.Open(itemCount)
  1052. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1053. #else:
  1054. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1055. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1056.  
  1057. elif app.IsPressed(app.DIK_LCONTROL):
  1058. itemIndex = player.GetItemIndex(itemSlotIndex)
  1059.  
  1060. if True == item.CanAddToQuickSlotItem(itemIndex):
  1061. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1062. else:
  1063. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1064.  
  1065. else:
  1066. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1067. itemCount = player.GetItemCount(itemSlotIndex)
  1068. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1069.  
  1070. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1071. self.wndItem.SetUseMode(True)
  1072. else:
  1073. self.wndItem.SetUseMode(False)
  1074.  
  1075. snd.PlaySound("sound/ui/pick.wav")
  1076.  
  1077. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1078. if app.ENABLE_SPECIAL_STORAGE:
  1079. if srcItemSlotPos == dstItemSlotPos and not item.IsMetin(srcItemVID):
  1080. return
  1081. else:
  1082. if srcItemSlotPos == dstItemSlotPos:
  1083. return
  1084.  
  1085. if item.IsRefineScroll(srcItemVID):
  1086. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1087. self.wndItem.SetUseMode(False)
  1088.  
  1089. elif item.IsMetin(srcItemVID):
  1090. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1091.  
  1092. elif item.IsDetachScroll(srcItemVID):
  1093. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1094.  
  1095. elif item.IsKey(srcItemVID):
  1096. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1097.  
  1098. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1099. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1100.  
  1101. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1102. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1103.  
  1104. else:
  1105. #snd.PlaySound("sound/ui/drop.wav")
  1106.  
  1107. ## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites]
  1108. if player.IsEquipmentSlot(dstItemSlotPos):
  1109.  
  1110. ## 들고 있는 아이템이 장비일때만
  1111. if item.IsEquipmentVID(srcItemVID):
  1112. self.__UseItem(srcItemSlotPos)
  1113.  
  1114. else:
  1115. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1116. #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1117.  
  1118. def __SellItem(self, itemSlotPos):
  1119. if not player.IsEquipmentSlot(itemSlotPos):
  1120. self.sellingSlotNumber = itemSlotPos
  1121. itemIndex = player.GetItemIndex(itemSlotPos)
  1122. itemCount = player.GetItemCount(itemSlotPos)
  1123.  
  1124.  
  1125. self.sellingSlotitemIndex = itemIndex
  1126. self.sellingSlotitemCount = itemCount
  1127.  
  1128. item.SelectItem(itemIndex)
  1129. itemPrice = item.GetISellItemPrice()
  1130.  
  1131. if item.Is1GoldItem():
  1132. itemPrice = itemCount / itemPrice / 5
  1133. else:
  1134. itemPrice = itemPrice * itemCount / 5
  1135.  
  1136. item.GetItemName(itemIndex)
  1137. itemName = item.GetItemName()
  1138.  
  1139. self.questionDialog = uiCommon.QuestionDialog()
  1140. self.questionDialog.SetText(locale.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1141. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1142. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1143. self.questionDialog.Open()
  1144. self.questionDialog.count = itemCount
  1145.  
  1146. def RefineItem(self, scrollSlotPos, targetSlotPos):
  1147.  
  1148. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1149. targetIndex = player.GetItemIndex(targetSlotPos)
  1150.  
  1151. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1152. return
  1153.  
  1154. ###########################################################
  1155. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1156. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1157. return
  1158. ###########################################################
  1159.  
  1160. ###########################################################
  1161. #net.SendRequestRefineInfoPacket(targetSlotPos)
  1162. #return
  1163. ###########################################################
  1164.  
  1165. result = player.CanRefine(scrollIndex, targetSlotPos)
  1166.  
  1167. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1168. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1169. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_NO_MORE_SOCKET)
  1170.  
  1171. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1172. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1173. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1174.  
  1175. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1176. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1177. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1178.  
  1179. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1180. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1181. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1182.  
  1183. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1184. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_EQUIP_ITEM)
  1185.  
  1186. if player.REFINE_OK != result:
  1187. return
  1188.  
  1189. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1190.  
  1191. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1192. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1193. targetIndex = player.GetItemIndex(targetSlotPos)
  1194. if app.ENABLE_SASH_SYSTEM:
  1195. if not player.CanDetach(scrollIndex, targetSlotPos):
  1196. item.SelectItem(scrollIndex)
  1197. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1198. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.SASH_FAILURE_CLEAN)
  1199. else:
  1200. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1201.  
  1202. return
  1203. else:
  1204. if not player.CanDetach(scrollIndex, targetSlotPos):
  1205. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1206. return
  1207.  
  1208. self.questionDialog = uiCommon.QuestionDialog()
  1209. self.questionDialog.SetText(locale.REFINE_DO_YOU_SEPARATE_METIN)
  1210. if app.ENABLE_SASH_SYSTEM:
  1211. item.SelectItem(targetIndex)
  1212. if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_SASH:
  1213. item.SelectItem(scrollIndex)
  1214. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1215. self.questionDialog.SetText(locale.SASH_DO_YOU_CLEAN)
  1216.  
  1217. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1218. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1219. self.questionDialog.Open()
  1220. self.questionDialog.sourcePos = scrollSlotPos
  1221. self.questionDialog.targetPos = targetSlotPos
  1222.  
  1223. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1224. if app.ENABLE_SPECIAL_STORAGE:
  1225. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1226. if player.INVENTORY == attachedSlotType:
  1227. metinIndex = player.GetItemIndex(metinSlotPos)
  1228. else:
  1229. metinIndex = player.GetItemIndex(player.STONE_INVENTORY, metinSlotPos)
  1230. else:
  1231. metinIndex = player.GetItemIndex(metinSlotPos)
  1232.  
  1233. targetIndex = player.GetItemIndex(targetSlotPos)
  1234.  
  1235. item.SelectItem(metinIndex)
  1236. itemName = item.GetItemName()
  1237.  
  1238. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1239.  
  1240. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1241. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1242.  
  1243. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1244. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_NO_SOCKET(itemName))
  1245.  
  1246. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1247. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1248.  
  1249. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1250. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.REFINE_FAILURE_EQUIP_ITEM)
  1251.  
  1252. if player.ATTACH_METIN_OK != result:
  1253. return
  1254.  
  1255. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1256.  
  1257.  
  1258.  
  1259. def OverOutItem(self):
  1260. self.wndItem.SetUsableItem(False)
  1261. if None != self.tooltipItem:
  1262. self.tooltipItem.HideToolTip()
  1263.  
  1264. def OverInItem(self, overSlotPos):
  1265. overSlotPosGlobal = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1266. self.wndItem.SetUsableItem(False)
  1267.  
  1268. if overSlotPosGlobal in self.liHighlightedItems:
  1269. self.liHighlightedItems.remove(overSlotPosGlobal)
  1270. self.wndItem.DeactivateSlot(overSlotPos)
  1271.  
  1272. if mouseModule.mouseController.isAttached():
  1273. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1274. if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1275.  
  1276. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1277. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1278.  
  1279. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPosGlobal):
  1280. self.wndItem.SetUsableItem(True)
  1281. self.ShowToolTip(overSlotPosGlobal)
  1282. return
  1283.  
  1284. self.ShowToolTip(overSlotPosGlobal)
  1285.  
  1286.  
  1287. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1288. "다른 아이템에 사용할 수 있는 아이템인가?"
  1289.  
  1290. if item.IsRefineScroll(srcItemVNum):
  1291. return True
  1292. elif item.IsMetin(srcItemVNum):
  1293. return True
  1294. elif item.IsDetachScroll(srcItemVNum):
  1295. return True
  1296. elif item.IsKey(srcItemVNum):
  1297. return True
  1298. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1299. return True
  1300. else:
  1301. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1302. return True
  1303.  
  1304. return False
  1305.  
  1306. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1307. "대상 아이템에 사용할 수 있는가?"
  1308.  
  1309. if app.ENABLE_SPECIAL_STORAGE:
  1310. if srcSlotPos == dstSlotPos and not item.IsMetin(srcItemVNum):
  1311. return False
  1312. else:
  1313. if srcSlotPos == dstSlotPos:
  1314. return False
  1315.  
  1316. if item.IsRefineScroll(srcItemVNum):
  1317. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1318. return True
  1319. elif item.IsMetin(srcItemVNum):
  1320. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1321. return True
  1322. elif item.IsDetachScroll(srcItemVNum):
  1323. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1324. return True
  1325. elif item.IsKey(srcItemVNum):
  1326. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1327. return True
  1328.  
  1329. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1330. return True
  1331.  
  1332. else:
  1333. useType=item.GetUseType(srcItemVNum)
  1334.  
  1335. if "USE_CLEAN_SOCKET" == useType:
  1336. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1337. return True
  1338. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1339. if self.__CanChangeItemAttrList(dstSlotPos):
  1340. return True
  1341. elif "USE_ADD_ATTRIBUTE" == useType:
  1342. if self.__CanAddItemAttr(dstSlotPos):
  1343. return True
  1344. elif "USE_ADD_ATTRIBUTE2" == useType:
  1345. if self.__CanAddItemAttr(dstSlotPos):
  1346. return True
  1347. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1348. if self.__CanAddAccessorySocket(dstSlotPos):
  1349. return True
  1350. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1351. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1352. return True;
  1353. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1354. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1355. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1356.  
  1357. item.SelectItem(dstItemVNum)
  1358.  
  1359. if item.ITEM_TYPE_BELT == item.GetItemType():
  1360. return True
  1361.  
  1362. return False
  1363.  
  1364. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1365. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1366. if dstItemVNum == 0:
  1367. return False
  1368.  
  1369. item.SelectItem(dstItemVNum)
  1370.  
  1371. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1372. return False
  1373.  
  1374. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1375. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1376. return True
  1377.  
  1378. return False
  1379.  
  1380. def __CanChangeItemAttrList(self, dstSlotPos):
  1381. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1382. if dstItemVNum == 0:
  1383. return False
  1384.  
  1385. item.SelectItem(dstItemVNum)
  1386.  
  1387. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1388. return False
  1389.  
  1390. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1391. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1392. return True
  1393.  
  1394. return False
  1395.  
  1396. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1397. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1398. if dstItemVNum == 0:
  1399. return False
  1400.  
  1401. item.SelectItem(dstItemVNum)
  1402.  
  1403. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1404. return False
  1405.  
  1406. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1407. return False
  1408.  
  1409. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1410. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1411.  
  1412. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1413. return False
  1414.  
  1415. if curCount>=maxCount:
  1416. return False
  1417.  
  1418. return True
  1419.  
  1420. def __CanAddAccessorySocket(self, dstSlotPos):
  1421. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1422. if dstItemVNum == 0:
  1423. return False
  1424.  
  1425. item.SelectItem(dstItemVNum)
  1426.  
  1427. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1428. return False
  1429.  
  1430. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1431. return False
  1432.  
  1433. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1434. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1435.  
  1436. ACCESSORY_SOCKET_MAX_SIZE = 3
  1437. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1438. return False
  1439.  
  1440. return True
  1441.  
  1442. def __CanAddItemAttr(self, dstSlotPos):
  1443. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1444. if dstItemVNum == 0:
  1445. return False
  1446.  
  1447. item.SelectItem(dstItemVNum)
  1448.  
  1449. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1450. return False
  1451.  
  1452. attrCount = 0
  1453. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1454. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1455. attrCount += 1
  1456.  
  1457. if attrCount<4:
  1458. return True
  1459.  
  1460. return False
  1461.  
  1462. def ShowToolTip(self, slotIndex):
  1463. if None != self.tooltipItem:
  1464. self.tooltipItem.SetInventoryItem(slotIndex)
  1465.  
  1466. def OnTop(self):
  1467. if None != self.tooltipItem:
  1468. self.tooltipItem.SetTop()
  1469.  
  1470. def OnPressEscapeKey(self):
  1471. self.Close()
  1472. return True
  1473.  
  1474. def UseItemSlot(self, slotIndex):
  1475.  
  1476. curCursorNum = app.GetCursor()
  1477. if app.SELL == curCursorNum:
  1478. return
  1479.  
  1480. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS():
  1481. return
  1482.  
  1483. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1484.  
  1485. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1486. if self.wndDragonSoulRefine.IsShow():
  1487. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1488. return
  1489.  
  1490. if app.ENABLE_SASH_SYSTEM:
  1491. if self.isShowSashWindow():
  1492. sash.Add(player.INVENTORY, slotIndex, 255)
  1493. return
  1494.  
  1495. self.__UseItem(slotIndex)
  1496. mouseModule.mouseController.DeattachObject()
  1497. self.OverOutItem()
  1498.  
  1499. def SetOpenBoniSwitcherEvent(self, event):
  1500. self.OpenBoniSwitcherEvent = ui.__mem_func__(event)
  1501.  
  1502. def __UseItem(self, slotIndex):
  1503. ItemVNum = player.GetItemIndex(slotIndex)
  1504. item.SelectItem(ItemVNum)
  1505. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1506. self.questionDialog = uiCommon.QuestionDialog()
  1507. self.questionDialog.SetText(locale.INVENTORY_REALLY_USE_ITEM)
  1508. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1509. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1510. self.questionDialog.Open()
  1511. self.questionDialog.slotIndex = slotIndex
  1512.  
  1513. elif player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GIFTBOX:
  1514. if app.ENABLE_SHOW_CHEST_DROP:
  1515. if self.interface:
  1516. if self.interface.dlgChestDrop:
  1517. if not self.interface.dlgChestDrop.IsShow():
  1518. self.interface.dlgChestDrop.Open(slotIndex)
  1519. net.SendChestDropInfo(slotIndex)
  1520.  
  1521. else:
  1522. self.__SendUseItemPacket(slotIndex)
  1523.  
  1524. def __UseItemQuestionDialog_OnCancel(self):
  1525. self.OnCloseQuestionDialog()
  1526.  
  1527. def __UseItemQuestionDialog_OnAccept(self):
  1528. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1529.  
  1530. if self.questionDialog:
  1531. self.questionDialog.Close()
  1532. self.questionDialog = None
  1533.  
  1534. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1535. # 개인상점 열고 있는 동안 아이템 사용 방지
  1536. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1537. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1538. return
  1539.  
  1540. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1541.  
  1542. def __SendUseItemPacket(self, slotPos):
  1543. # 개인상점 열고 있는 동안 아이템 사용 방지
  1544. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1545. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1546. return
  1547.  
  1548. net.SendItemUsePacket(slotPos)
  1549.  
  1550. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1551. # 개인상점 열고 있는 동안 아이템 사용 방지
  1552. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1553. chat.AppendChat(chat.CHAT_TYPE_INFO, locale.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1554. return
  1555.  
  1556. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1557.  
  1558. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  1559. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1560. self.wndDragonSoulRefine = wndDragonSoulRefine
  1561.  
  1562. if app.ENABLE_SASH_SYSTEM:
  1563. def SetSashWindow(self, wndSashCombine, wndSashAbsorption):
  1564. self.wndSashCombine = wndSashCombine
  1565. self.wndSashAbsorption = wndSashAbsorption
  1566.  
  1567. def isShowSashWindow(self):
  1568. if self.wndSashCombine:
  1569. if self.wndSashCombine.IsShow():
  1570. return 1
  1571.  
  1572. if self.wndSashAbsorption:
  1573. if self.wndSashAbsorption.IsShow():
  1574. return 1
  1575.  
  1576. return 0
  1577.  
  1578. def OnMoveWindow(self, x, y):
  1579. # print "Inventory Global Pos : ", self.GetGlobalPosition()
  1580. if self.wndBelt:
  1581. # print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  1582. self.wndBelt.AdjustPositionAndSize()
  1583.  
  1584. def HighlightSlot(self, slot):
  1585. if not slot in self.liHighlightedItems:
  1586. self.liHighlightedItems.append(slot)
  1587.  
  1588. def __RefreshHighlights(self):
  1589. for i in xrange(player.INVENTORY_PAGE_SIZE):
  1590. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1591. if slotNumber in self.liHighlightedItems:
  1592. self.wndItem.ActivateSlot(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement