Advertisement
Guest User

Untitled

a guest
May 20th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.85 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 localeInfo
  18. import constInfo
  19. import ime
  20. import wndMgr
  21. import event
  22. import uifastequip
  23. import uimarbleshop
  24. import uikosz
  25. import uiinne
  26. import uilocalization
  27.  
  28. ITEM_MALL_BUTTON_ENABLE = True
  29.  
  30. if app.ENABLE_SASH_SYSTEM:
  31. import sash
  32.  
  33. ITEM_FLAG_APPLICABLE = 1 << 14
  34.  
  35. class CostumeWindow(ui.ScriptWindow):
  36.  
  37. def __init__(self, wndInventory):
  38. import exception
  39.  
  40. if not app.ENABLE_COSTUME_SYSTEM:
  41. exception.Abort("What do you do?")
  42. return
  43.  
  44. if not wndInventory:
  45. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  46. return
  47.  
  48. ui.ScriptWindow.__init__(self)
  49.  
  50. self.isLoaded = 0
  51. self.wndInventory = wndInventory;
  52.  
  53. self.__LoadWindow()
  54.  
  55. def __del__(self):
  56. ui.ScriptWindow.__del__(self)
  57.  
  58. def Show(self):
  59. self.__LoadWindow()
  60. self.RefreshCostumeSlot()
  61.  
  62. ui.ScriptWindow.Show(self)
  63.  
  64. def Close(self):
  65. self.Hide()
  66.  
  67. def __LoadWindow(self):
  68. if self.isLoaded == 1:
  69. return
  70.  
  71. self.isLoaded = 1
  72.  
  73. try:
  74. pyScrLoader = ui.PythonScriptLoader()
  75. pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  76. except:
  77. import exception
  78. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  79.  
  80. try:
  81. wndEquip = self.GetChild("CostumeSlot")
  82. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  83.  
  84. except:
  85. import exception
  86. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  87.  
  88. ## Equipment
  89. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  90. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  91. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  92. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  93. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  94. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  95.  
  96. self.wndEquip = wndEquip
  97.  
  98. def RefreshCostumeSlot(self):
  99. getItemVNum=player.GetItemIndex
  100.  
  101. for i in xrange(item.COSTUME_SLOT_COUNT):
  102. slotNumber = item.COSTUME_SLOT_START + i
  103. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  104.  
  105. self.wndEquip.RefreshSlot()
  106.  
  107. class BeltInventoryWindow(ui.ScriptWindow):
  108.  
  109. def __init__(self, wndInventory):
  110. import exception
  111.  
  112. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  113. exception.Abort("What do you do?")
  114. return
  115.  
  116. if not wndInventory:
  117. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  118. return
  119.  
  120. ui.ScriptWindow.__init__(self)
  121.  
  122. self.isLoaded = 0
  123. self.wndInventory = wndInventory;
  124.  
  125. self.wndBeltInventoryLayer = None
  126. self.wndBeltInventorySlot = None
  127. self.expandBtn = None
  128. self.minBtn = None
  129.  
  130. self.__LoadWindow()
  131.  
  132. def __del__(self):
  133. ui.ScriptWindow.__del__(self)
  134.  
  135. def Show(self, openBeltSlot = FALSE):
  136. self.__LoadWindow()
  137. self.RefreshSlot()
  138.  
  139. ui.ScriptWindow.Show(self)
  140.  
  141. if openBeltSlot:
  142. self.OpenInventory()
  143. else:
  144. self.CloseInventory()
  145.  
  146. def Close(self):
  147. self.Hide()
  148.  
  149. def IsOpeningInventory(self):
  150. return self.wndBeltInventoryLayer.IsShow()
  151.  
  152. def OpenInventory(self):
  153. self.wndBeltInventoryLayer.Show()
  154. self.expandBtn.Hide()
  155.  
  156. if localeInfo.IsARABIC() == 0:
  157. self.AdjustPositionAndSize()
  158.  
  159. def CloseInventory(self):
  160. self.wndBeltInventoryLayer.Hide()
  161. self.expandBtn.Show()
  162.  
  163. if localeInfo.IsARABIC() == 0:
  164. self.AdjustPositionAndSize()
  165.  
  166. ## ÇöŔç ŔÎşĄĹ丮 Ŕ§Äˇ¸¦ ±âÁŘŔ¸·Î BASE Ŕ§Äˇ¸¦ °č»ę, ¸®ĹĎ.. ĽýŔÚ ÇϵĺÄÚµůÇϱâ Á¤¸» ˝ČÁö¸¸ ąćąýŔĚ ľř´Ů..
  167. def GetBasePosition(self):
  168. x, y = self.wndInventory.GetGlobalPosition()
  169. return x - 148, y + 241
  170.  
  171. def AdjustPositionAndSize(self):
  172. bx, by = self.GetBasePosition()
  173.  
  174. if self.IsOpeningInventory():
  175. self.SetPosition(bx, by)
  176. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  177.  
  178. else:
  179. self.SetPosition(bx + 138, by);
  180. self.SetSize(10, self.GetHeight())
  181.  
  182. def __LoadWindow(self):
  183. if self.isLoaded == 1:
  184. return
  185.  
  186. self.isLoaded = 1
  187.  
  188. try:
  189. pyScrLoader = ui.PythonScriptLoader()
  190. pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  191. except:
  192. import exception
  193. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  194.  
  195. try:
  196. self.ORIGINAL_WIDTH = self.GetWidth()
  197. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  198. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  199. self.expandBtn = self.GetChild("ExpandBtn")
  200. self.minBtn = self.GetChild("MinimizeBtn")
  201.  
  202. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  203. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  204.  
  205. if localeInfo.IsARABIC() :
  206. self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  207. self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
  208. self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
  209.  
  210. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  211. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  212. wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  213. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  214. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  215. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE)
  216.  
  217. except:
  218. import exception
  219. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  220.  
  221. ## Equipment
  222. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  223. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  224. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  225. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  226. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  227. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  228.  
  229. self.wndBeltInventorySlot = wndBeltInventorySlot
  230.  
  231. def RefreshSlot(self):
  232. getItemVNum=player.GetItemIndex
  233.  
  234. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  235. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  236. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  237. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, TRUE)
  238.  
  239. avail = "0"
  240.  
  241. if player.IsAvailableBeltInventoryCell(slotNumber):
  242. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  243. else:
  244. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  245.  
  246. self.wndBeltInventorySlot.RefreshSlot()
  247.  
  248.  
  249. class InventoryWindow(ui.ScriptWindow):
  250.  
  251. 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")
  252.  
  253. questionDialog = None
  254. tooltipItem = None
  255. wndCostume = None
  256. wndBelt = None
  257. dlgPickMoney = None
  258.  
  259. sellingSlotNumber = -1
  260. isLoaded = 0
  261. isOpenedCostumeWindowWhenClosingInventory = 0 # ŔÎşĄĹ丮 ´ÝŔ» ¶§ ÄÚ˝şĂőŔĚ ż­·ÁŔÖľú´ÂÁö ż©şÎ-_-; ł×ŔĚąÖ ¤¸¤µ
  262. isOpenedBeltWindowWhenClosingInventory = 0 # ŔÎşĄĹ丮 ´ÝŔ» ¶§ ş§Ć® ŔÎşĄĹ丮°ˇ ż­·ÁŔÖľú´ÂÁö ż©şÎ-_-; ł×ŔĚąÖ ¤¸¤µ
  263.  
  264. def __init__(self):
  265. self.itemkosz = None
  266.  
  267. ui.ScriptWindow.__init__(self)
  268.  
  269. self.isOpenedBeltWindowWhenClosingInventory = 0 # ŔÎşĄĹ丮 ´ÝŔ» ¶§ ş§Ć® ŔÎşĄĹ丮°ˇ ż­·ÁŔÖľú´ÂÁö ż©şÎ-_-; ł×ŔĚąÖ ¤¸¤µ
  270.  
  271. self.__LoadWindow()
  272.  
  273. def __del__(self):
  274. ui.ScriptWindow.__del__(self)
  275.  
  276. def Show(self):
  277. self.__LoadWindow()
  278.  
  279. ui.ScriptWindow.Show(self)
  280.  
  281. # ŔÎşĄĹ丮¸¦ ´ÝŔ» ¶§ ÄÚ˝şĂőŔĚ ż­·ÁŔÖľú´Ů¸é ŔÎşĄĹ丮¸¦ ż­ ¶§ ÄÚ˝şĂőµµ °°ŔĚ ż­µµ·Ď ÇÔ.
  282. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  283. self.wndCostume.Show()
  284.  
  285. # ŔÎşĄĹ丮¸¦ ´ÝŔ» ¶§ ş§Ć® ŔÎşĄĹ丮°ˇ ż­·ÁŔÖľú´Ů¸é °°ŔĚ ż­µµ·Ď ÇÔ.
  286. if self.wndBelt:
  287. self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  288.  
  289. def BindInterfaceClass(self, interface):
  290. self.interface = interface
  291.  
  292. def __LoadWindow(self):
  293. if self.isLoaded == 1:
  294. return
  295.  
  296. self.isLoaded = 1
  297.  
  298. try:
  299. pyScrLoader = ui.PythonScriptLoader()
  300.  
  301. if ITEM_MALL_BUTTON_ENABLE:
  302. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
  303. else:
  304. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  305. except:
  306. import exception
  307. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  308.  
  309. try:
  310. wndItem = self.GetChild("ItemSlot")
  311. wndEquip = self.GetChild("EquipmentSlot")
  312. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  313. self.wndMoney = self.GetChild("Money")
  314. self.wndMoneySlot = self.GetChild("Money_Slot")
  315. self.wndPremium = self.GetChild("Premium")
  316. self.wndPremiumSlot = self.GetChild("Premium_Slot")
  317. self.mallButton = self.GetChild2("MallButton")
  318. self.DSSButton = self.GetChild2("DSSButton")
  319. self.costumeButton = self.GetChild2("CostumeButton")
  320. self.teleportButton = self.GetChild2("TeleportButton")
  321. self.kucykButton = self.GetChild2("KucykButton")
  322. self.uifastequip = self.GetChild2("ZmianaButton")
  323. self.depoButton = self.GetChild2("DepoButton")
  324. self.polyexitButton = self.GetChild2("PolyexitButton")
  325. self.uimarbleshop = self.GetChild2("PolyButton")
  326. self.sklepButton = self.GetChild2("SklepButton")
  327. self.blokadaexpButton = self.GetChild2("BlokadaexpButton")
  328. self.dopalaczeButton = self.GetChild2("DopalaczeButton")
  329. self.koszButton = self.GetChild2("KoszButton")
  330. self.uiinne = self.GetChild2("InneButton")
  331.  
  332. self.inventoryTab = []
  333. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  334. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  335. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  336. self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  337.  
  338. self.equipmentTab = []
  339. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  340. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  341.  
  342. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  343. self.costumeButton.Hide()
  344. self.costumeButton.Destroy()
  345. self.costumeButton = 0
  346.  
  347. # Belt Inventory Window
  348. self.wndBelt = None
  349.  
  350. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  351. self.wndBelt = BeltInventoryWindow(self)
  352.  
  353. except:
  354. import exception
  355. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  356.  
  357. ## Item
  358. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  359. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  360. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  361. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  362. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  363. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  364.  
  365. ## Equipment
  366. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  367. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  368. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  369. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  370. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  371. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  372.  
  373. ## PickMoneyDialog
  374. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  375. dlgPickMoney.LoadDialog()
  376. dlgPickMoney.Hide()
  377.  
  378. ## RefineDialog
  379. self.refineDialog = uiRefine.RefineDialog()
  380. self.refineDialog.Hide()
  381.  
  382. ## AttachMetinDialog
  383. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  384. self.attachMetinDialog.Hide()
  385.  
  386. ## MoneySlot
  387. self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  388. self.koszButton.SetEvent(ui.__mem_func__(self.Okno4))
  389.  
  390. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  391. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  392. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  393. self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  394. self.inventoryTab[0].Down()
  395. self.inventoryPageIndex = 0
  396.  
  397. self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  398. self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  399. self.equipmentTab[0].Down()
  400. self.equipmentTab[0].Hide()
  401. self.equipmentTab[1].Hide()
  402.  
  403. self.wndItem = wndItem
  404. self.wndEquip = wndEquip
  405. self.dlgPickMoney = dlgPickMoney
  406.  
  407. # MallButton
  408. if self.mallButton:
  409. self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  410.  
  411. # TeleportButton
  412. if self.teleportButton:
  413. self.teleportButton.SetEvent(ui.__mem_func__(self.ClickTeleportButton))
  414.  
  415. # KucykButton
  416. if self.kucykButton:
  417. self.kucykButton.SetEvent(ui.__mem_func__(self.ClickKucykButton))
  418.  
  419. # ZmianaButton
  420. if self.uifastequip:
  421. self.uifastequip.SetEvent(ui.__mem_func__(self.ClickZmianaButton))
  422.  
  423. # DepoButton
  424. if self.depoButton:
  425. self.depoButton.SetEvent(ui.__mem_func__(self.ClickDepoButton))
  426.  
  427. # PolyexitButton
  428. if self.polyexitButton:
  429. self.polyexitButton.SetEvent(ui.__mem_func__(self.ClickPolyexitButton))
  430.  
  431. # PolyButton
  432. if self.uimarbleshop:
  433. self.uimarbleshop.SetEvent(ui.__mem_func__(self.ClickPolyButton))
  434.  
  435. # SklepButton
  436. if self.sklepButton:
  437. self.sklepButton.SetEvent(ui.__mem_func__(self.ClickSklepButton))
  438.  
  439. # BlokadaexpButton
  440. if self.blokadaexpButton:
  441. self.blokadaexpButton.SetEvent(ui.__mem_func__(self.ClickBlokadaexpButton))
  442.  
  443. # Dopalacze
  444. self.dopalaczeButton.SetEvent(ui.__mem_func__(self.ClickDopalaczeButton))
  445.  
  446. # InneButton
  447. if self.uiinne:
  448. self.uiinne.SetEvent(ui.__mem_func__(self.ClickInneButton))
  449.  
  450. if self.DSSButton:
  451. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  452.  
  453. # Costume Button
  454. if self.costumeButton:
  455. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  456.  
  457. self.wndCostume = None
  458.  
  459. #####
  460.  
  461. ## Refresh
  462. if app.ENABLE_SASH_SYSTEM:
  463. self.listAttachedSashs = []
  464. self.SetInventoryPage(0)
  465. self.SetEquipmentPage(0)
  466. self.RefreshItemSlot()
  467. self.RefreshStatus()
  468.  
  469. def Destroy(self):
  470. self.ClearDictionary()
  471.  
  472. self.dlgPickMoney.Destroy()
  473. self.dlgPickMoney = 0
  474.  
  475. self.refineDialog.Destroy()
  476. self.refineDialog = 0
  477.  
  478. self.attachMetinDialog.Destroy()
  479. self.attachMetinDialog = 0
  480.  
  481. self.tooltipItem = None
  482. self.wndItem = 0
  483. self.wndEquip = 0
  484. self.dlgPickMoney = 0
  485. self.wndMoney = 0
  486. self.wndMoneySlot = 0
  487. self.wndPremium = 0
  488. self.wndPremiumSlot = 0
  489. self.questionDialog = None
  490. self.mallButton = None
  491. self.DSSButton = None
  492. self.interface = None
  493. self.teleportButton = None
  494. self.kucykButton = None
  495. self.depoButton = None
  496. self.polyexitButton = None
  497. self.sklepButton = None
  498. self.blokadaexpButton = None
  499.  
  500. if self.wndCostume:
  501. self.wndCostume.Destroy()
  502. self.wndCostume = 0
  503.  
  504. if self.wndBelt:
  505. self.wndBelt.Destroy()
  506. self.wndBelt = None
  507.  
  508. self.inventoryTab = []
  509. self.equipmentTab = []
  510.  
  511. def Hide(self):
  512. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  513. self.OnCloseQuestionDialog()
  514. return
  515. if None != self.tooltipItem:
  516. self.tooltipItem.HideToolTip()
  517.  
  518. if self.wndCostume:
  519. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow() # ŔÎşĄĹ丮 âŔĚ ´ÝČú ¶§ ÄÚ˝şĂőŔĚ ż­·Á ŔÖľú´Â°ˇ?
  520. self.wndCostume.Close()
  521.  
  522. if self.wndBelt:
  523. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # ŔÎşĄĹ丮 âŔĚ ´ÝČú ¶§ ş§Ć® ŔÎşĄĹ丮µµ ż­·Á ŔÖľú´Â°ˇ?
  524. print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  525. self.wndBelt.Close()
  526.  
  527. if self.dlgPickMoney:
  528. self.dlgPickMoney.Close()
  529.  
  530. wndMgr.Hide(self.hWnd)
  531.  
  532.  
  533. def Close(self):
  534. self.Hide()
  535.  
  536. def SetInventoryPage(self, page):
  537. self.inventoryTab[self.inventoryPageIndex].SetUp()
  538. self.inventoryPageIndex = page
  539. self.inventoryTab[self.inventoryPageIndex].Down()
  540. self.RefreshBagSlotWindow()
  541.  
  542. def SetEquipmentPage(self, page):
  543. self.equipmentPageIndex = page
  544. self.equipmentTab[1-page].SetUp()
  545. self.RefreshEquipSlotWindow()
  546.  
  547. def ClickMallButton(self):
  548. self.choix = ui.BoardWithTitleBar()
  549. self.choix.SetSize(210, 80)
  550. self.choix.SetCenterPosition()
  551. self.choix.AddFlag('float')
  552. self.choix.AddFlag('movable')
  553. self.choix.SetTitleName("Magazyny")
  554. self.choix.Show()
  555.  
  556. self.EntrepotIs = ui.Button()
  557. self.EntrepotIs.SetEvent(self.OpenIs)
  558. self.EntrepotIs.SetParent(self.choix)
  559. self.EntrepotIs.SetPosition(35, 40)
  560. self.EntrepotIs.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
  561. self.EntrepotIs.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
  562. self.EntrepotIs.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
  563. self.EntrepotIs.SetText("ItemShop")
  564. self.EntrepotIs.SetToolTipText("Otwórz ItemShop")
  565. self.EntrepotIs.Show()
  566.  
  567. self.Magasinier = ui.Button()
  568. self.Magasinier.SetEvent(self._normal_mall)
  569. self.Magasinier.SetParent(self.choix)
  570. self.Magasinier.SetPosition(105, 40)
  571. self.Magasinier.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
  572. self.Magasinier.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
  573. self.Magasinier.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
  574. self.Magasinier.SetText("Depozyt")
  575. self.Magasinier.SetToolTipText("Otwórz Depozyt")
  576. self.Magasinier.Show()
  577.  
  578. # DSSButton
  579. def ClickDSSButton(self):
  580. print "click_dss_button"
  581. self.interface.ToggleDragonSoulWindow()
  582.  
  583. def ClickCostumeButton(self):
  584. print "Click Costume Button"
  585. if self.wndCostume:
  586. if self.wndCostume.IsShow():
  587. self.wndCostume.Hide()
  588. else:
  589. self.wndCostume.Show()
  590. else:
  591. self.wndCostume = CostumeWindow(self)
  592. self.wndCostume.Show()
  593.  
  594. def OpenPickMoneyDialog(self):
  595.  
  596. if mouseModule.mouseController.isAttached():
  597.  
  598. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  599. if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  600.  
  601. if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  602. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  603. snd.PlaySound("sound/ui/money.wav")
  604.  
  605. mouseModule.mouseController.DeattachObject()
  606.  
  607. else:
  608. curMoney = player.GetElk()
  609.  
  610. if curMoney <= 0:
  611. return
  612.  
  613. #self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  614. #self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  615. #self.dlgPickMoney.Open(curMoney)
  616. #self.dlgPickMoney.SetMax(7) # ŔÎşĄĹ丮 990000 Á¦ÇŃ ąö±× ĽöÁ¤
  617.  
  618. #PANEL_BOCZNY_START
  619.  
  620. def ClickTeleportButton(self):
  621. event.QuestButtonClick(constInfo.Teleport)
  622.  
  623. def ClickKucykButton(self):
  624. event.QuestButtonClick(constInfo.Kucyk)
  625.  
  626. def ClickDepoButton(self):
  627. event.QuestButtonClick(constInfo.Depo)
  628.  
  629. def ClickPolyexitButton(self):
  630. event.QuestButtonClick(constInfo.Polyexit)
  631.  
  632. def ClickSklepButton(self):
  633. event.QuestButtonClick(constInfo.Sklep)
  634.  
  635. def ClickBlokadaexpButton(self):
  636. event.QuestButtonClick(constInfo.Blokadaexp)
  637.  
  638. # PANEL_BOCZNY_END
  639.  
  640. def OnPickMoney(self, money):
  641. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  642.  
  643. def OnPickItem(self, count):
  644. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  645. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  646. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  647.  
  648. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  649. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  650. return local
  651.  
  652. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  653.  
  654. def RefreshBagSlotWindow(self):
  655. getItemVNum=player.GetItemIndex
  656. getItemCount=player.GetItemCount
  657. setItemVNum=self.wndItem.SetItemSlot
  658.  
  659. for i in xrange(player.INVENTORY_PAGE_SIZE):
  660. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  661.  
  662. itemCount = getItemCount(slotNumber)
  663. # itemCount == 0ŔĚ¸é ĽŇÄĎŔ» şńżî´Ů.
  664. if 0 == itemCount:
  665. self.wndItem.ClearSlot(i)
  666. continue
  667. elif 1 == itemCount:
  668. itemCount = 0
  669.  
  670. itemVnum = getItemVNum(slotNumber)
  671. setItemVNum(i, itemVnum, itemCount)
  672.  
  673. ## ŔÚµżą°ľŕ (HP: #72723 ~ #72726, SP: #72727 ~ #72730) ĆŻĽöĂł¸® - ľĆŔĚĹŰŔεĄµµ ˝˝·Ôżˇ Č°ĽşČ­/şńČ°ĽşČ­ ÇĄ˝Ă¸¦ Ŕ§ÇŃ ŔŰľ÷ŔÓ - [hyo]
  674. if constInfo.IS_AUTO_POTION(itemVnum):
  675. # metinSocket - [0] : Č°ĽşČ­ ż©şÎ, [1] : »çżëÇŃ ľç, [2] : ĂÖ´ë żë·®
  676. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  677.  
  678. if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  679. slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  680.  
  681. isActivated = 0 != metinSocket[0]
  682.  
  683. if isActivated:
  684. self.wndItem.ActivateSlot(slotNumber)
  685. potionType = 0;
  686. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  687. potionType = player.AUTO_POTION_TYPE_HP
  688. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  689. potionType = player.AUTO_POTION_TYPE_SP
  690.  
  691. usedAmount = int(metinSocket[1])
  692. totalAmount = int(metinSocket[2])
  693. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  694.  
  695. else:
  696. self.wndItem.DeactivateSlot(slotNumber)
  697.  
  698. if app.ENABLE_SASH_SYSTEM:
  699. slotNumberChecked = 0
  700. if not constInfo.IS_AUTO_POTION(itemVnum):
  701. self.wndItem.DeactivateSlot(i)
  702.  
  703. for j in xrange(sash.WINDOW_MAX_MATERIALS):
  704. (isHere, iCell) = sash.GetAttachedItem(j)
  705. if isHere:
  706. if iCell == slotNumber:
  707. self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
  708. if not slotNumber in self.listAttachedSashs:
  709. self.listAttachedSashs.append(slotNumber)
  710.  
  711. slotNumberChecked = 1
  712. else:
  713. if slotNumber in self.listAttachedSashs and not slotNumberChecked:
  714. self.wndItem.DeactivateSlot(i)
  715. self.listAttachedSashs.remove(slotNumber)
  716.  
  717. self.wndItem.RefreshSlot()
  718.  
  719. if self.wndBelt:
  720. self.wndBelt.RefreshSlot()
  721.  
  722. def RefreshEquipSlotWindow(self):
  723. getItemVNum=player.GetItemIndex
  724. getItemCount=player.GetItemCount
  725. setItemVNum=self.wndEquip.SetItemSlot
  726. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  727. slotNumber = player.EQUIPMENT_SLOT_START + i
  728. itemCount = getItemCount(slotNumber)
  729. if itemCount <= 1:
  730. itemCount = 0
  731. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  732.  
  733. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  734. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  735. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  736. itemCount = getItemCount(slotNumber)
  737. if itemCount <= 1:
  738. itemCount = 0
  739. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  740. print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  741.  
  742.  
  743.  
  744. self.wndEquip.RefreshSlot()
  745.  
  746. if self.wndCostume:
  747. self.wndCostume.RefreshCostumeSlot()
  748.  
  749. def RefreshItemSlot(self):
  750. self.RefreshBagSlotWindow()
  751. self.RefreshEquipSlotWindow()
  752.  
  753. def RefreshStatus(self):
  754. money = player.GetElk()
  755. self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  756.  
  757. def UpdatePremiumInSlot(self):
  758. import constInfo
  759. value = str(constInfo.ACHIEVEMENT_POINTS)
  760. self.wndPremium.SetText(localeInfo.NumberToMoneyString(value)[:-5] + " PA")
  761.  
  762. def SetItemToolTip(self, tooltipItem):
  763. self.tooltipItem = tooltipItem
  764.  
  765. def SellItem(self):
  766. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  767. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  768. ## żëČĄĽ®µµ Ćȸ®°Ô ÇĎ´Â ±â´É Ăß°ˇÇϸ鼭 ŔÎŔÚ type Ăß°ˇ
  769. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  770. snd.PlaySound("sound/ui/money.wav")
  771. self.OnCloseQuestionDialog()
  772.  
  773. def OnDetachMetinFromItem(self):
  774. if None == self.questionDialog:
  775. return
  776.  
  777. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  778. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  779. self.OnCloseQuestionDialog()
  780.  
  781. def OnCloseQuestionDialog(self):
  782. if not self.questionDialog:
  783. return
  784.  
  785. self.questionDialog.Close()
  786. self.questionDialog = None
  787. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  788.  
  789. ## Slot Event
  790. def SelectEmptySlot(self, selectedSlotPos):
  791. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
  792. return
  793.  
  794. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  795.  
  796. if mouseModule.mouseController.isAttached():
  797.  
  798. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  799. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  800. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  801. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  802.  
  803. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  804. itemCount = player.GetItemCount(attachedSlotPos)
  805. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  806. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  807.  
  808. if item.IsRefineScroll(attachedItemIndex):
  809. self.wndItem.SetUseMode(False)
  810.  
  811. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  812. mouseModule.mouseController.RunCallBack("INVENTORY")
  813.  
  814. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  815. if constInfo.IsItemShop == 0:
  816. net.SendShopBuyPacket(attachedSlotPos)
  817. else:
  818. import uiShop
  819. self.wndShop = uiShop.ShopDialog()
  820. self.wndShop.BuyFromIS(attachedSlotPos)
  821.  
  822. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  823.  
  824. if player.ITEM_MONEY == attachedItemIndex:
  825. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  826. snd.PlaySound("sound/ui/money.wav")
  827.  
  828. else:
  829. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  830.  
  831. elif player.SLOT_TYPE_MALL == attachedSlotType:
  832. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  833.  
  834. mouseModule.mouseController.DeattachObject()
  835.  
  836. def SelectItemSlot(self, itemSlotIndex):
  837. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  838. return
  839.  
  840. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  841.  
  842. if itemSlotIndex in self.itemkosz.itemlist2:
  843. return
  844.  
  845. if mouseModule.mouseController.isAttached():
  846. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  847. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  848. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  849.  
  850. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  851. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  852.  
  853. mouseModule.mouseController.DeattachObject()
  854.  
  855. else:
  856.  
  857. curCursorNum = app.GetCursor()
  858. if app.SELL == curCursorNum:
  859. self.__SellItem(itemSlotIndex)
  860.  
  861. elif app.BUY == curCursorNum:
  862. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  863.  
  864. elif app.IsPressed(app.DIK_LALT):
  865. link = player.GetItemLink(itemSlotIndex)
  866. ime.PasteString(link)
  867.  
  868. elif app.IsPressed(app.DIK_LSHIFT):
  869. itemCount = player.GetItemCount(itemSlotIndex)
  870.  
  871. if itemCount > 1:
  872. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  873. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  874. self.dlgPickMoney.Open(itemCount)
  875. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  876. #else:
  877. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  878. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  879.  
  880. elif app.IsPressed(app.DIK_LCONTROL):
  881. itemIndex = player.GetItemIndex(itemSlotIndex)
  882.  
  883. if True == item.CanAddToQuickSlotItem(itemIndex):
  884. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  885. else:
  886. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  887.  
  888. else:
  889. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  890. itemCount = player.GetItemCount(itemSlotIndex)
  891. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  892.  
  893. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  894. self.wndItem.SetUseMode(True)
  895. else:
  896. self.wndItem.SetUseMode(False)
  897.  
  898. snd.PlaySound("sound/ui/pick.wav")
  899.  
  900. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  901. if srcItemSlotPos == dstItemSlotPos:
  902. return
  903.  
  904. elif item.IsRefineScroll(srcItemVID):
  905. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  906. self.wndItem.SetUseMode(False)
  907.  
  908. elif item.IsMetin(srcItemVID):
  909. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  910.  
  911. elif item.IsDetachScroll(srcItemVID):
  912. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  913.  
  914. elif item.IsKey(srcItemVID):
  915. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  916.  
  917. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  918. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  919.  
  920. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  921. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  922.  
  923. else:
  924. #snd.PlaySound("sound/ui/drop.wav")
  925.  
  926. ## Ŕ̵ż˝ĂŲ °÷ŔĚ ŔĺÂř ˝˝·ÔŔĎ °ćżě ľĆŔĚĹŰŔ» »çżëÇŘĽ­ ŔĺÂř ˝ĂŲ´Ů - [levites]
  927. if player.IsEquipmentSlot(dstItemSlotPos):
  928.  
  929. ## µé°í ŔÖ´Â ľĆŔĚĹŰŔĚ ŔĺşńŔ϶§¸¸
  930. if item.IsEquipmentVID(srcItemVID):
  931. self.__UseItem(srcItemSlotPos)
  932.  
  933. else:
  934. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  935. #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  936.  
  937. def __SellItem(self, itemSlotPos):
  938. if not player.IsEquipmentSlot(itemSlotPos):
  939. self.sellingSlotNumber = itemSlotPos
  940. itemIndex = player.GetItemIndex(itemSlotPos)
  941. itemCount = player.GetItemCount(itemSlotPos)
  942.  
  943.  
  944. self.sellingSlotitemIndex = itemIndex
  945. self.sellingSlotitemCount = itemCount
  946.  
  947. item.SelectItem(itemIndex)
  948. ## ľČĆĽ ÇĂ·ą±× °Ë»ç şüÁ®Ľ­ Ăß°ˇ
  949. ## 20140220
  950. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  951. popup = uiCommon.PopupDialog()
  952. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  953. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  954. popup.Open()
  955. self.popup = popup
  956. return
  957.  
  958. itemPrice = item.GetISellItemPrice()
  959.  
  960. if item.Is1GoldItem():
  961. itemPrice = itemCount / itemPrice / 5
  962. else:
  963. itemPrice = itemPrice * itemCount / 5
  964.  
  965. item.GetItemName(itemIndex)
  966. itemName = item.GetItemName()
  967.  
  968. self.questionDialog = uiCommon.QuestionDialog()
  969. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  970. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  971. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  972. self.questionDialog.Open()
  973. self.questionDialog.count = itemCount
  974.  
  975. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  976.  
  977. def __OnClosePopupDialog(self):
  978. self.pop = None
  979.  
  980. def RefineItem(self, scrollSlotPos, targetSlotPos):
  981.  
  982. scrollIndex = player.GetItemIndex(scrollSlotPos)
  983. targetIndex = player.GetItemIndex(targetSlotPos)
  984.  
  985. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  986. return
  987.  
  988. ###########################################################
  989. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  990. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  991. return
  992. ###########################################################
  993.  
  994. ###########################################################
  995. #net.SendRequestRefineInfoPacket(targetSlotPos)
  996. #return
  997. ###########################################################
  998.  
  999. result = player.CanRefine(scrollIndex, targetSlotPos)
  1000.  
  1001. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1002. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1003. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1004.  
  1005. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1006. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1007. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1008.  
  1009. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1010. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1011. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1012.  
  1013. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1014. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1015. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1016.  
  1017. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1018. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1019.  
  1020. if player.REFINE_OK != result:
  1021. return
  1022.  
  1023. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1024.  
  1025. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1026. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1027. targetIndex = player.GetItemIndex(targetSlotPos)
  1028. if app.ENABLE_SASH_SYSTEM:
  1029. if not player.CanDetach(scrollIndex, targetSlotPos):
  1030. item.SelectItem(scrollIndex)
  1031. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1032. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SASH_FAILURE_CLEAN)
  1033. else:
  1034. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1035.  
  1036. return
  1037. else:
  1038. if not player.CanDetach(scrollIndex, targetSlotPos):
  1039. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1040. return
  1041.  
  1042. self.questionDialog = uiCommon.QuestionDialog()
  1043. self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1044. if app.ENABLE_SASH_SYSTEM:
  1045. item.SelectItem(targetIndex)
  1046. if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_SASH:
  1047. item.SelectItem(scrollIndex)
  1048. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1049. self.questionDialog.SetText(localeInfo.SASH_DO_YOU_CLEAN)
  1050.  
  1051. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1052. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1053. self.questionDialog.Open()
  1054. self.questionDialog.sourcePos = scrollSlotPos
  1055. self.questionDialog.targetPos = targetSlotPos
  1056.  
  1057. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1058. metinIndex = player.GetItemIndex(metinSlotPos)
  1059. targetIndex = player.GetItemIndex(targetSlotPos)
  1060.  
  1061. item.SelectItem(metinIndex)
  1062. itemName = item.GetItemName()
  1063.  
  1064. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1065.  
  1066. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1067. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1068.  
  1069. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1070. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1071.  
  1072. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1073. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1074.  
  1075. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1076. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1077.  
  1078. if player.ATTACH_METIN_OK != result:
  1079. return
  1080.  
  1081. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1082.  
  1083.  
  1084.  
  1085. def OverOutItem(self):
  1086. self.wndItem.SetUsableItem(False)
  1087. if None != self.tooltipItem:
  1088. self.tooltipItem.HideToolTip()
  1089.  
  1090. def OverInItem(self, overSlotPos):
  1091. overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1092. self.wndItem.SetUsableItem(False)
  1093.  
  1094. if mouseModule.mouseController.isAttached():
  1095. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1096. if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1097.  
  1098. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1099. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1100.  
  1101. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1102. self.wndItem.SetUsableItem(True)
  1103. self.ShowToolTip(overSlotPos)
  1104. return
  1105.  
  1106. self.ShowToolTip(overSlotPos)
  1107.  
  1108.  
  1109. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1110. "´Ů¸Ą ľĆŔĚĹŰżˇ »çżëÇŇ Ľö ŔÖ´Â ľĆŔĚĹŰŔΰˇ?"
  1111.  
  1112. if item.IsRefineScroll(srcItemVNum):
  1113. return True
  1114. elif item.IsMetin(srcItemVNum):
  1115. return True
  1116. elif item.IsDetachScroll(srcItemVNum):
  1117. return True
  1118. elif item.IsKey(srcItemVNum):
  1119. return True
  1120. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1121. return True
  1122. else:
  1123. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1124. return True
  1125.  
  1126. return False
  1127.  
  1128. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1129. "´ë»ó ľĆŔĚĹŰżˇ »çżëÇŇ Ľö Ŕִ°ˇ?"
  1130.  
  1131. if srcSlotPos == dstSlotPos:
  1132. return False
  1133.  
  1134. if item.IsRefineScroll(srcItemVNum):
  1135. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1136. return True
  1137. elif item.IsMetin(srcItemVNum):
  1138. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1139. return True
  1140. elif item.IsDetachScroll(srcItemVNum):
  1141. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1142. return True
  1143. elif item.IsKey(srcItemVNum):
  1144. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1145. return True
  1146.  
  1147. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1148. return True
  1149.  
  1150. else:
  1151. useType=item.GetUseType(srcItemVNum)
  1152.  
  1153. if "USE_CLEAN_SOCKET" == useType:
  1154. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1155. return True
  1156. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1157. if self.__CanChangeItemAttrList(dstSlotPos):
  1158. return True
  1159. elif "USE_ADD_ATTRIBUTE" == useType:
  1160. if self.__CanAddItemAttr(dstSlotPos):
  1161. return True
  1162. elif "USE_ADD_ATTRIBUTE2" == useType:
  1163. if self.__CanAddItemAttr(dstSlotPos):
  1164. return True
  1165. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1166. if self.__CanAddAccessorySocket(dstSlotPos):
  1167. return True
  1168. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1169. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1170. return TRUE;
  1171. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1172. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1173. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1174.  
  1175. item.SelectItem(dstItemVNum)
  1176.  
  1177. if item.ITEM_TYPE_BELT == item.GetItemType():
  1178. return True
  1179.  
  1180. return False
  1181.  
  1182. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1183. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1184. if dstItemVNum == 0:
  1185. return False
  1186.  
  1187. item.SelectItem(dstItemVNum)
  1188.  
  1189. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1190. return False
  1191.  
  1192. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1193. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1194. return True
  1195.  
  1196. return False
  1197.  
  1198. def __CanChangeItemAttrList(self, dstSlotPos):
  1199. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1200. if dstItemVNum == 0:
  1201. return False
  1202.  
  1203. item.SelectItem(dstItemVNum)
  1204.  
  1205. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1206. return False
  1207.  
  1208. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1209. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1210. return True
  1211.  
  1212. return False
  1213.  
  1214. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1215. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1216. if dstItemVNum == 0:
  1217. return False
  1218.  
  1219. item.SelectItem(dstItemVNum)
  1220.  
  1221. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1222. return False
  1223.  
  1224. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1225. return False
  1226.  
  1227. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1228. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1229.  
  1230. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1231. return False
  1232.  
  1233. if curCount>=maxCount:
  1234. return False
  1235.  
  1236. return True
  1237.  
  1238. def __CanAddAccessorySocket(self, dstSlotPos):
  1239. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1240. if dstItemVNum == 0:
  1241. return False
  1242.  
  1243. item.SelectItem(dstItemVNum)
  1244.  
  1245. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1246. return False
  1247.  
  1248. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1249. return False
  1250.  
  1251. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1252. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1253.  
  1254. ACCESSORY_SOCKET_MAX_SIZE = 3
  1255. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1256. return False
  1257.  
  1258. return True
  1259.  
  1260. def __CanAddItemAttr(self, dstSlotPos):
  1261. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1262. if dstItemVNum == 0:
  1263. return False
  1264.  
  1265. item.SelectItem(dstItemVNum)
  1266.  
  1267. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1268. return False
  1269.  
  1270. attrCount = 0
  1271. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1272. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1273. attrCount += 1
  1274.  
  1275. if attrCount<4:
  1276. return True
  1277.  
  1278. return False
  1279.  
  1280. def ShowToolTip(self, slotIndex):
  1281. if None != self.tooltipItem:
  1282. self.tooltipItem.SetInventoryItem(slotIndex)
  1283.  
  1284. def OnTop(self):
  1285. if None != self.tooltipItem:
  1286. self.tooltipItem.SetTop()
  1287.  
  1288. def OnPressEscapeKey(self):
  1289. self.Close()
  1290. return True
  1291.  
  1292. def UseItemSlot(self, slotIndex):
  1293. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1294. return
  1295.  
  1296. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1297. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1298. if self.wndDragonSoulRefine.IsShow():
  1299. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1300. return
  1301.  
  1302. if app.ENABLE_SASH_SYSTEM:
  1303. if self.isShowSashWindow():
  1304. sash.Add(player.INVENTORY, slotIndex, 255)
  1305. return
  1306.  
  1307. self.__UseItem(slotIndex)
  1308. mouseModule.mouseController.DeattachObject()
  1309. self.OverOutItem()
  1310.  
  1311. def __UseItem(self, slotIndex):
  1312. ItemVNum = player.GetItemIndex(slotIndex)
  1313. item.SelectItem(ItemVNum)
  1314. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1315. self.questionDialog = uiCommon.QuestionDialog()
  1316. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1317. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1318. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1319. self.questionDialog.Open()
  1320. self.questionDialog.slotIndex = slotIndex
  1321.  
  1322. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1323.  
  1324. else:
  1325. self.__SendUseItemPacket(slotIndex)
  1326. #net.SendItemUsePacket(slotIndex)
  1327.  
  1328. def __UseItemQuestionDialog_OnCancel(self):
  1329. self.OnCloseQuestionDialog()
  1330.  
  1331. def __UseItemQuestionDialog_OnAccept(self):
  1332. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1333. self.OnCloseQuestionDialog()
  1334.  
  1335. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1336. # °łŔλóÁˇ ż­°í ŔÖ´Â µżľČ ľĆŔĚĹŰ »çżë ąćÁö
  1337. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1338. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1339. return
  1340.  
  1341. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1342.  
  1343. def __SendUseItemPacket(self, slotPos):
  1344. # °łŔλóÁˇ ż­°í ŔÖ´Â µżľČ ľĆŔĚĹŰ »çżë ąćÁö
  1345. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1346. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1347. return
  1348.  
  1349. net.SendItemUsePacket(slotPos)
  1350.  
  1351. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1352. # °łŔλóÁˇ ż­°í ŔÖ´Â µżľČ ľĆŔĚĹŰ »çżë ąćÁö
  1353. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1354. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1355. return
  1356.  
  1357. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1358.  
  1359. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  1360. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1361. self.wndDragonSoulRefine = wndDragonSoulRefine
  1362.  
  1363. if app.ENABLE_SASH_SYSTEM:
  1364. def SetSashWindow(self, wndSashCombine, wndSashAbsorption):
  1365. self.wndSashCombine = wndSashCombine
  1366. self.wndSashAbsorption = wndSashAbsorption
  1367.  
  1368. def isShowSashWindow(self):
  1369. if self.wndSashCombine:
  1370. if self.wndSashCombine.IsShow():
  1371. return 1
  1372.  
  1373. if self.wndSashAbsorption:
  1374. if self.wndSashAbsorption.IsShow():
  1375. return 1
  1376.  
  1377. return 0
  1378.  
  1379. def OnMoveWindow(self, x, y):
  1380. # print "Inventory Global Pos : ", self.GetGlobalPosition()
  1381. if self.wndBelt:
  1382. # print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  1383. self.wndBelt.AdjustPositionAndSize()
  1384.  
  1385. # PANEL_BOCZNY_START
  1386.  
  1387. def TeleportButton(self):
  1388. import event
  1389. import constInfo
  1390. qid = constInfo.Teleport
  1391. event.QuestButtonClick(qid)
  1392.  
  1393. def KucykButton(self):
  1394. import event
  1395. import constInfo
  1396. qid = constInfo.Kucyk
  1397. event.QuestButtonClick(qid)
  1398.  
  1399. def ClickZmianaButton(self):
  1400. self.uifastequip = uifastequip.changeequip()
  1401. self.uifastequip.Show()
  1402.  
  1403. def ClickPolyButton(self):
  1404. self.uimarbleshop = uimarbleshop.MarbleShopWindow()
  1405. self.uimarbleshop.Show()
  1406.  
  1407. def Okno4(self):
  1408. if self.itemkosz:
  1409. self.itemkosz.OpenDialog()
  1410. constInfo.kosz = 1
  1411.  
  1412. def ClickDopalaczeButton(self):
  1413. chat.AppendChat(chat.CHAT_TYPE_INFO, "[Informacja] Dopalacze zosta? aktywowane!")
  1414. tabela = [27102, 27105, 39017, 39018, 39019, 39020, 39024, 39025, 50821, 50822, 50823, 50824, 50825, 50826, 50813, 50814, 50815, 50816, 50817, 50818, 50819, 50820]
  1415. for i in xrange(player.INVENTORY_PAGE_SIZE*4): #4 Iloś?stron w ekwipunku
  1416. Vnum = player.GetItemIndex(i)
  1417. for x in xrange(len(tabela)):
  1418. if Vnum == int(tabela[x]):
  1419. net.SendItemUsePacket(i)
  1420. tabela.remove(tabela[x])
  1421. break
  1422.  
  1423. def ClickInneButton(self):
  1424. self.uiinne = uiinne.inneOkno()
  1425. self.uiinne.Show()
  1426.  
  1427. def OpenIs(self):
  1428. self.EntrepotIs.Hide()
  1429. self.choix.Hide()
  1430. self.Magasinier.Hide()
  1431. net.SendChatPacket("/click_mall")
  1432.  
  1433. def _normal_mall(self):
  1434. self.EntrepotIs.Hide()
  1435. self.Magasinier.Hide()
  1436. self.choix.Hide()
  1437. net.SendChatPacket("/click_safebox")
  1438.  
  1439. # PANEL_BOCZNY_END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement