Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.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 background
  23. import uibiolog
  24. import uiToolTip
  25.  
  26. ITEM_MALL_BUTTON_ENABLE = True
  27.  
  28. if app.ENABLE_SASH_SYSTEM:
  29. import sash
  30.  
  31. ITEM_FLAG_APPLICABLE = 1 << 14
  32.  
  33. class CostumeWindow(ui.ScriptWindow):
  34.  
  35. def __init__(self, wndInventory):
  36. import exception
  37.  
  38. if not app.ENABLE_COSTUME_SYSTEM:
  39. exception.Abort("What do you do?")
  40. return
  41.  
  42. if not wndInventory:
  43. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  44. return
  45.  
  46. ui.ScriptWindow.__init__(self)
  47.  
  48. self.isLoaded = 0
  49. self.wndInventory = wndInventory;
  50.  
  51. self.__LoadWindow()
  52.  
  53. def __del__(self):
  54. ui.ScriptWindow.__del__(self)
  55.  
  56. def Show(self):
  57. self.__LoadWindow()
  58. self.RefreshCostumeSlot()
  59.  
  60. ui.ScriptWindow.Show(self)
  61.  
  62. def Close(self):
  63. self.Hide()
  64.  
  65. def __LoadWindow(self):
  66. if self.isLoaded == 1:
  67. return
  68.  
  69. self.isLoaded = 1
  70.  
  71. try:
  72. pyScrLoader = ui.PythonScriptLoader()
  73. pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  74. except:
  75. import exception
  76. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  77.  
  78. try:
  79. wndEquip = self.GetChild("CostumeSlot")
  80. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  81.  
  82. except:
  83. import exception
  84. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  85.  
  86. ## Equipment
  87. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  88. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  89. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  90. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  91. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  92. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  93.  
  94. self.wndEquip = wndEquip
  95.  
  96. def RefreshCostumeSlot(self):
  97. getItemVNum=player.GetItemIndex
  98.  
  99. for i in xrange(item.COSTUME_SLOT_COUNT):
  100. slotNumber = item.COSTUME_SLOT_START + i
  101. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  102.  
  103. if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  104. self.wndEquip.SetItemSlot(item.COSTUME_SLOT_WEAPON, getItemVNum(item.COSTUME_SLOT_WEAPON), 0)
  105.  
  106. self.wndEquip.RefreshSlot()
  107.  
  108. if app.ENABLE_OFFLINE_SHOP:
  109. class OfflineShopListItem(ui.ListBoxEx.Item):
  110. def __init__(self, idx, text, vidOfShop, mapIndex, posX, posY):
  111. ui.ListBoxEx.Item.__init__(self)
  112.  
  113. self.idx = idx
  114. self.vidOfShop = vidOfShop
  115. self.mapIndex = mapIndex
  116. self.posX = posX
  117. self.posY = posY
  118. self.text = text
  119.  
  120. self.mapNameOld = str(background.GetMapName(long(self.posX), long(self.posY)))
  121. self.mapName = self.realMapName(self.mapNameOld)
  122.  
  123. self.textLine = self.__CreateTextLine("%s" % (str(text)[:50]), (2, 5))
  124. self.textLineMap = self.__CreateTextLine("%s" % self.mapName, (150, 5))
  125. self.gotoShop = self.__CreateButton((280, 1), localeInfo.PL_OFFLINE_SENEDIA_19, self.gotoShopFunc)
  126. self.warpShop = self.__CreateButton((340, 1), localeInfo.PL_OFFLINE_SENEDIA_20, self.warpShopFunc)
  127. self.closeShop = self.__CreateButton((400, 1), localeInfo.PL_OFFLINE_SENEDIA_21, self.closeShopFunc)
  128.  
  129. def __del__(self):
  130. self.idx = None
  131. self.vidOfShop = None
  132. self.mapIndex = None
  133. self.posX = None
  134. self.posY = None
  135. self.text = None
  136.  
  137. if self.textLine and self.textLine.IsShow():
  138. self.textLine.Hide()
  139. self.textLine = None
  140. if self.gotoShop and self.gotoShop.IsShow():
  141. self.gotoShop.Hide()
  142. self.gotoShop = None
  143. if self.warpShop and self.warpShop.IsShow():
  144. self.warpShop.Hide()
  145. self.warpShop = None
  146. if self.closeShop and self.closeShop.IsShow():
  147. self.closeShop.Hide()
  148. self.closeShop = None
  149.  
  150. ui.ListBoxEx.Item.__del__(self)
  151.  
  152. def realMapName(self, oldName):
  153. mapNames = {
  154. "metin2_map_a1": "Shinsoo - M1", "metin2_map_b1 ": "Chunjo - M1", "metin2_map_c1": "Jinno - M1"
  155. }
  156. if oldName in mapNames:
  157. return mapNames[oldName]
  158. return oldName
  159.  
  160. def gotoShopFunc(self):
  161. net.SendChatPacket("/offlineshop_goto %s" % str(self.vidOfShop))
  162.  
  163. def warpShopFunc(self):
  164. net.SendChatPacket("/offlineshop_warp %s" % str(self.vidOfShop))
  165.  
  166. def closeShopFunc(self):
  167. net.SendChatPacket("/offlineshop_close %s" % str(self.vidOfShop))
  168.  
  169.  
  170. def SetSize(self, width, height):
  171. ui.ListBoxEx.Item.SetSize(self, 460, height + 7)
  172.  
  173. def __CreateTextLine(self, text, pos):
  174. textLine=ui.TextLine()
  175. textLine.SetParent(self)
  176. textLine.SetPosition(pos[0], pos[1])
  177. textLine.SetText(text)
  178. textLine.Show()
  179. return textLine
  180.  
  181. def __CreateButton(self, pos, buttonName, func):
  182. tmpButton = ui.Button()
  183. tmpButton.SetParent(self)
  184. tmpButton.SetPosition(pos[0], pos[1])
  185.  
  186. tmpButton.SetUpVisual('d:/ymir work/ui/public/middle_button_01.sub')
  187. tmpButton.SetOverVisual('d:/ymir work/ui/public/middle_button_02.sub')
  188. tmpButton.SetDownVisual('d:/ymir work/ui/public/middle_button_03.sub')
  189.  
  190. tmpButton.SetText(buttonName)
  191. tmpButton.SetEvent(func)
  192. tmpButton.Show()
  193.  
  194. return tmpButton
  195.  
  196. class AlchemiaWindow(ui.ScriptWindow):
  197.  
  198. def __init__(self, wndInventory):
  199. import exception
  200.  
  201. #if not app.ENABLE_COSTUME_SYSTEM:
  202. # exception.Abort("What do you do?")
  203. # return
  204.  
  205. if not wndInventory:
  206. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  207. return
  208.  
  209. ui.ScriptWindow.__init__(self)
  210.  
  211. self.isLoaded = 0
  212. self.wndInventory = wndInventory;
  213.  
  214. self.__LoadWindow()
  215.  
  216. def __del__(self):
  217. ui.ScriptWindow.__del__(self)
  218.  
  219. def Show(self):
  220. self.__LoadWindow()
  221. self.RefreshAlchemiaSlot()
  222.  
  223. ui.ScriptWindow.Show(self)
  224.  
  225. def Close(self):
  226. self.Hide()
  227. return TRUE
  228.  
  229.  
  230. def __LoadWindow(self):
  231. if self.isLoaded == 1:
  232. return
  233.  
  234. self.isLoaded = 1
  235.  
  236. try:
  237. pyScrLoader = ui.PythonScriptLoader()
  238. pyScrLoader.LoadScriptFile(self, "UIScript/AlchemiaWindow.py")
  239. except:
  240. import exception
  241. exception.Abort("AlchemiaWindow.LoadWindow.LoadObject")
  242.  
  243. try:
  244. wndEquip = self.GetChild("AlchemiaSlot")
  245. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  246.  
  247. except:
  248. import exception
  249. exception.Abort("AlchemiaWindow.LoadWindow.BindObject")
  250.  
  251. ## Equipment
  252. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  253. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  254. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  255. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  256. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  257. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  258.  
  259. self.wndEquip = wndEquip
  260.  
  261. def RefreshAlchemiaSlot(self):
  262. getItemVNum=player.GetItemIndex
  263.  
  264. for i in xrange(item.ALCHEMIA_SLOT_COUNT):
  265. slotNumber = item.ALCHEMIA_SLOT_START + i
  266. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  267.  
  268. self.wndEquip.RefreshSlot()
  269.  
  270. class OfflineShopUI(ui.BoardWithTitleBar):
  271. def __init__(self):
  272. ui.BoardWithTitleBar.__init__(self)
  273. self.LastIdx = 0
  274. self.BuildUI()
  275.  
  276. def __del__(self):
  277. ui.BoardWithTitleBar.__del__(self)
  278.  
  279. def BuildUI(self):
  280. posX = 500
  281. self.AddFlag('movable')
  282. self.AddFlag('float')
  283. self.SetSize(posX, 150)
  284. self.SetTitleName(localeInfo.PL_OFFLINE_SENEDIA_22)
  285. self.SetCloseEvent(self.OpenWindow)
  286. self.SetCenterPosition()
  287. self.Show()
  288.  
  289. self.bar = ui.Bar()
  290. self.bar.SetParent(self)
  291. self.bar.SetPosition(10, 35)
  292. self.bar.SetSize(posX - 20, 100)
  293. self.bar.SetColor(0x77000000)
  294. self.bar.Show()
  295.  
  296. self.ListBox = ui.ListBoxEx()
  297. self.ListBox.SetParent(self.bar)
  298. self.ListBox.SetPosition(0, 0)
  299. self.ListBox.SetSize(posX, 100)
  300. self.ListBox.SetViewItemCount(5)
  301. self.ListBox.Show()
  302.  
  303. self.scroll = ui.ScrollBar()
  304. self.scroll.SetParent(self.ListBox)
  305. self.scroll.SetPosition(posX-35, 0)
  306. self.scroll.SetScrollBarSize(200/2)
  307. self.scroll.Show()
  308. self.ListBox.SetScrollBar(self.scroll)
  309.  
  310. self.refresh = ui.Button()
  311. self.refresh.SetParent(self)
  312. self.refresh.SetPosition(self.GetWidth() - 50, 8)
  313. self.refresh.SetUpVisual("d:/ymir work/ui/game/guild/Refresh_Button_01.sub")
  314. self.refresh.SetOverVisual("d:/ymir work/ui/game/guild/Refresh_Button_02.sub")
  315. self.refresh.SetDownVisual("d:/ymir work/ui/game/guild/Refresh_Button_03.sub")
  316. self.refresh.SetText("")
  317. self.refresh.SetEvent(self.Refresh)
  318. self.refresh.Show()
  319.  
  320. def AppendOfflineShop(self, name, vid, mapIdx, x, y):
  321. if not self.IsShowWindow():
  322. self.LastIdx = 0
  323. self.ListBox.RemoveAllItems()
  324. self.ShowWindow()
  325.  
  326. self.LastIdx += 1
  327. self.ListBox.AppendItem(OfflineShopListItem(self.LastIdx, name, vid, mapIdx, x, y))
  328.  
  329. def Refresh(self):
  330. self.Close()
  331. net.SendChatPacket("/do_myshops")
  332.  
  333. def IsShowWindow(self):
  334. return self.IsShow()
  335.  
  336. def OpenWindow(self):
  337. if self.IsShow():
  338. self.Hide()
  339. else:
  340. self.Show()
  341.  
  342. def ShowWindow(self):
  343. self.Show()
  344.  
  345. def Close(self):
  346. self.Hide()
  347. return True
  348.  
  349. def OnPressEscapeKey(self):
  350. self.Close()
  351. return True
  352.  
  353. class OfflineShopUI(ui.BoardWithTitleBar):
  354. def __init__(self):
  355. ui.BoardWithTitleBar.__init__(self)
  356. self.LastIdx = 0
  357. self.BuildUI()
  358.  
  359. def __del__(self):
  360. ui.BoardWithTitleBar.__del__(self)
  361.  
  362. def BuildUI(self):
  363. posX = 500
  364. self.AddFlag('movable')
  365. self.AddFlag('float')
  366. self.SetSize(posX, 150)
  367. self.SetTitleName(localeInfo.PL_OFFLINE_SENEDIA_22)
  368. self.SetCloseEvent(self.OpenWindow)
  369. self.SetCenterPosition()
  370. self.Show()
  371.  
  372. self.bar = ui.Bar()
  373. self.bar.SetParent(self)
  374. self.bar.SetPosition(10, 35)
  375. self.bar.SetSize(posX - 20, 100)
  376. self.bar.SetColor(0x77000000)
  377. self.bar.Show()
  378.  
  379. self.ListBox = ui.ListBoxEx()
  380. self.ListBox.SetParent(self.bar)
  381. self.ListBox.SetPosition(0, 0)
  382. self.ListBox.SetSize(posX, 100)
  383. self.ListBox.SetViewItemCount(5)
  384. self.ListBox.Show()
  385.  
  386. self.scroll = ui.ScrollBar()
  387. self.scroll.SetParent(self.ListBox)
  388. self.scroll.SetPosition(posX-35, 0)
  389. self.scroll.SetScrollBarSize(200/2)
  390. self.scroll.Show()
  391. self.ListBox.SetScrollBar(self.scroll)
  392.  
  393. self.refresh = ui.Button()
  394. self.refresh.SetParent(self)
  395. self.refresh.SetPosition(self.GetWidth() - 50, 8)
  396. self.refresh.SetUpVisual("d:/ymir work/ui/game/guild/Refresh_Button_01.sub")
  397. self.refresh.SetOverVisual("d:/ymir work/ui/game/guild/Refresh_Button_02.sub")
  398. self.refresh.SetDownVisual("d:/ymir work/ui/game/guild/Refresh_Button_03.sub")
  399. self.refresh.SetText("")
  400. self.refresh.SetEvent(self.Refresh)
  401. self.refresh.Show()
  402.  
  403. def AppendOfflineShop(self, name, vid, mapIdx, x, y):
  404. if not self.IsShowWindow():
  405. self.LastIdx = 0
  406. self.ListBox.RemoveAllItems()
  407. self.ShowWindow()
  408.  
  409. self.LastIdx += 1
  410. self.ListBox.AppendItem(OfflineShopListItem(self.LastIdx, name, vid, mapIdx, x, y))
  411.  
  412. def Refresh(self):
  413. self.Close()
  414. net.SendChatPacket("/do_myshops")
  415.  
  416. def IsShowWindow(self):
  417. return self.IsShow()
  418.  
  419. def OpenWindow(self):
  420. if self.IsShow():
  421. self.Hide()
  422. else:
  423. self.Show()
  424.  
  425. def ShowWindow(self):
  426. self.Show()
  427.  
  428. def Close(self):
  429. self.Hide()
  430. return True
  431.  
  432. def OnPressEscapeKey(self):
  433. self.Close()
  434. return True
  435.  
  436. class BeltInventoryWindow(ui.ScriptWindow):
  437.  
  438. def __init__(self, wndInventory):
  439. import exception
  440.  
  441. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  442. exception.Abort("What do you do?")
  443. return
  444.  
  445. if not wndInventory:
  446. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  447. return
  448.  
  449. ui.ScriptWindow.__init__(self)
  450.  
  451. self.isLoaded = 0
  452. self.wndInventory = wndInventory;
  453.  
  454. self.wndBeltInventoryLayer = None
  455. self.wndBeltInventorySlot = None
  456. self.expandBtn = None
  457. self.minBtn = None
  458.  
  459. self.__LoadWindow()
  460.  
  461. def __del__(self):
  462. ui.ScriptWindow.__del__(self)
  463.  
  464. def Show(self, openBeltSlot = False):
  465. self.__LoadWindow()
  466. self.RefreshSlot()
  467.  
  468. ui.ScriptWindow.Show(self)
  469.  
  470. if openBeltSlot:
  471. self.OpenInventory()
  472. else:
  473. self.CloseInventory()
  474.  
  475. def Close(self):
  476. self.Hide()
  477.  
  478. def IsOpeningInventory(self):
  479. return self.wndBeltInventoryLayer.IsShow()
  480.  
  481. def OpenInventory(self):
  482. self.wndBeltInventoryLayer.Show()
  483. self.expandBtn.Hide()
  484.  
  485. if localeInfo.IsARABIC() == 0:
  486. self.AdjustPositionAndSize()
  487.  
  488. def CloseInventory(self):
  489. self.wndBeltInventoryLayer.Hide()
  490. self.expandBtn.Show()
  491.  
  492. if localeInfo.IsARABIC() == 0:
  493. self.AdjustPositionAndSize()
  494.  
  495. ## ?? ???? ??? ???? BASE ??? ??, ??.. ?? ?????? ?? ??? ??? ??..
  496. def GetBasePosition(self):
  497. x, y = self.wndInventory.GetGlobalPosition()
  498. return x - 148, y + 241
  499.  
  500. def AdjustPositionAndSize(self):
  501. bx, by = self.GetBasePosition()
  502.  
  503. if self.IsOpeningInventory():
  504. self.SetPosition(bx, by)
  505. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  506.  
  507. else:
  508. self.SetPosition(bx + 138, by);
  509. self.SetSize(10, self.GetHeight())
  510.  
  511. def __LoadWindow(self):
  512. if self.isLoaded == 1:
  513. return
  514.  
  515. self.isLoaded = 1
  516.  
  517. try:
  518. pyScrLoader = ui.PythonScriptLoader()
  519. pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  520. except:
  521. import exception
  522. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  523.  
  524. try:
  525. self.ORIGINAL_WIDTH = self.GetWidth()
  526. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  527. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  528. self.expandBtn = self.GetChild("ExpandBtn")
  529. self.minBtn = self.GetChild("MinimizeBtn")
  530.  
  531. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  532. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  533.  
  534. if localeInfo.IsARABIC() :
  535. self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  536. self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
  537. self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
  538.  
  539. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  540. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  541. wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  542. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  543. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  544. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", False, False)
  545.  
  546. except:
  547. import exception
  548. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  549.  
  550. ## Equipment
  551. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  552. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  553. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  554. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  555. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  556. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  557.  
  558. self.wndBeltInventorySlot = wndBeltInventorySlot
  559.  
  560. def RefreshSlot(self):
  561. getItemVNum=player.GetItemIndex
  562.  
  563. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  564. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  565. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  566. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, True)
  567.  
  568. avail = "0"
  569.  
  570. if player.IsAvailableBeltInventoryCell(slotNumber):
  571. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  572. else:
  573. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  574.  
  575. self.wndBeltInventorySlot.RefreshSlot()
  576.  
  577.  
  578. class InventoryWindow(ui.ScriptWindow):
  579.  
  580. 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", "USE_CHANGE_COSTUME_ATTR", "USE_RESET_COSTUME_ATTR")
  581.  
  582. questionDialog = None
  583. tooltipItem = None
  584. wndCostume = None
  585. wndAlchemia = None
  586. wndBelt = None
  587. dlgPickMoney = None
  588. toolTip = None
  589.  
  590. sellingSlotNumber = -1
  591. isLoaded = 0
  592. isOpenedCostumeWindowWhenClosingInventory = 0 # ???? ?? ? ???? ?????? ??-_-; ??? ??
  593. isOpenedBeltWindowWhenClosingInventory = 0 # ???? ?? ? ?? ????? ?????? ??-_-; ??? ??
  594. isOpenedAlchemiaWindowWhenClosingInventory = 0
  595.  
  596. def __init__(self):
  597. ui.ScriptWindow.__init__(self)
  598.  
  599. self.isOpenedBeltWindowWhenClosingInventory = 0 # ???? ?? ? ?? ????? ?????? ??-_-; ??? ??
  600.  
  601. self.inventoryPageIndex = 0
  602.  
  603. self.__LoadWindow()
  604.  
  605. def __del__(self):
  606. ui.ScriptWindow.__del__(self)
  607.  
  608. def Show(self):
  609. self.__LoadWindow()
  610.  
  611. ui.ScriptWindow.Show(self)
  612.  
  613. # ????? ?? ? ???? ?????? ????? ? ? ???? ?? ??? ?.
  614. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  615. self.wndCostume.Show()
  616.  
  617. if self.isOpenedAlchemiaWindowWhenClosingInventory and self.wndAlchemia:
  618. self.wndAlchemia.Show()
  619.  
  620. # ????? ?? ? ?? ????? ?????? ?? ??? ?.
  621. if self.wndBelt:
  622. self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  623.  
  624. def BindInterfaceClass(self, interface):
  625. self.interface = interface
  626.  
  627. def __LoadWindow(self):
  628. if self.isLoaded == 1:
  629. return
  630.  
  631. self.isLoaded = 1
  632.  
  633. try:
  634. pyScrLoader = ui.PythonScriptLoader()
  635.  
  636. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  637. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindowEx.py")
  638. else:
  639. if ITEM_MALL_BUTTON_ENABLE:
  640. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
  641. else:
  642. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  643. except:
  644. import exception
  645. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  646.  
  647. try:
  648. wndItem = self.GetChild("ItemSlot")
  649. wndEquip = self.GetChild("EquipmentSlot")
  650. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  651. self.wndMoney = self.GetChild("Money")
  652. self.wndMoneySlot = self.GetChild("Money_Slot")
  653. self.mallButton = self.GetChild2("MallButton")
  654. self.AlchemiaButton = self.GetChild2("AlchemiaButton")
  655. self.shopButton = self.GetChild2("ShopButton")
  656. self.DSSButton = self.GetChild2("DSSButton")
  657. self.costumeButton = self.GetChild2("CostumeButton")
  658. self.nowyButton13 = self.GetChild2("Button13")
  659.  
  660. self.SwitchBiologWindow = self.GetChild("biolog") ##chyba ze masz ju?button
  661.  
  662. self.toolTip = uiToolTip.ToolTip()
  663. self.toolTip.ClearToolTip()
  664.  
  665. self.inventoryTab = []
  666. for i in xrange(player.INVENTORY_PAGE_COUNT):
  667. self.inventoryTab.append(self.GetChild("Inventory_Tab_%02d" % (i+1)))
  668.  
  669. self.equipmentTab = []
  670. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  671. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  672.  
  673. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  674. self.costumeButton.Hide()
  675. self.costumeButton.Destroy()
  676. self.costumeButton = 0
  677.  
  678. # Belt Inventory Window
  679. self.wndBelt = None
  680.  
  681. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  682. self.wndBelt = BeltInventoryWindow(self)
  683.  
  684. except:
  685. import exception
  686. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  687.  
  688. ## Item
  689. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  690. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  691. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  692. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  693. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  694. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  695.  
  696. ## Equipment
  697. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  698. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  699. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  700. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  701. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  702. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  703.  
  704. ## PickMoneyDialog
  705. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  706. dlgPickMoney.LoadDialog()
  707. dlgPickMoney.Hide()
  708.  
  709. ## RefineDialog
  710. self.refineDialog = uiRefine.RefineDialog()
  711. self.refineDialog.Hide()
  712.  
  713. ## AttachMetinDialog
  714. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  715. self.attachMetinDialog.Hide()
  716.  
  717. ## MoneySlot
  718. self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  719.  
  720. for i in xrange(player.INVENTORY_PAGE_COUNT):
  721. self.inventoryTab[i].SetEvent(lambda arg=i: self.SetInventoryPage(arg))
  722. self.inventoryTab[0].Down()
  723.  
  724. self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  725. self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  726. self.equipmentTab[0].Down()
  727. self.equipmentTab[0].Hide()
  728. self.equipmentTab[1].Hide()
  729.  
  730. self.wndItem = wndItem
  731. self.wndEquip = wndEquip
  732. self.dlgPickMoney = dlgPickMoney
  733.  
  734. self.wndBiolog = uibiolog.BiologWindow()
  735.  
  736. # MallButton
  737. if self.mallButton:
  738. self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  739. if self.AlchemiaButton:
  740. self.AlchemiaButton.SetEvent(ui.__mem_func__(self.ClickAlchemiaButton))
  741. if self.shopButton:
  742. self.shopButton.SetEvent(ui.__mem_func__(self.ClickShopButton))
  743.  
  744. if self.DSSButton:
  745. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  746.  
  747. # Costume Button
  748. if self.costumeButton:
  749. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  750. self.nowyButton13.SetEvent(ui.__mem_func__(self.Sortowanie))
  751.  
  752. if self.SwitchBiologWindow :
  753. self.SwitchBiologWindow.SetEvent(ui.__mem_func__(self.ShowBiologWindow))
  754.  
  755. self.wndCostume = None
  756.  
  757. #####
  758. if app.ENABLE_SASH_SYSTEM:
  759. self.listAttachedSashs = []
  760. ## Refresh
  761. self.SetInventoryPage(0)
  762. self.SetEquipmentPage(0)
  763. self.RefreshItemSlot()
  764. self.RefreshStatus()
  765.  
  766. def Destroy(self):
  767. self.ClearDictionary()
  768.  
  769. self.dlgPickMoney.Destroy()
  770. self.dlgPickMoney = 0
  771.  
  772. self.refineDialog.Destroy()
  773. self.refineDialog = 0
  774.  
  775. self.attachMetinDialog.Destroy()
  776. self.attachMetinDialog = 0
  777.  
  778. self.tooltipItem = None
  779. self.wndItem = 0
  780. self.wndEquip = 0
  781. self.dlgPickMoney = 0
  782. self.wndMoney = 0
  783. self.wndMoneySlot = 0
  784. self.questionDialog = None
  785. self.mallButton = None
  786. self.shopButton = None
  787. self.DSSButton = None
  788. self.interface = None
  789. self.toolTip = None
  790. self.SwitchBiologWindow = None
  791.  
  792. if self.wndCostume:
  793. self.wndCostume.Destroy()
  794. self.wndCostume = 0
  795.  
  796. if self.wndAlchemia:
  797. self.wndAlchemia.Destroy()
  798. self.wndAlchemia = 0
  799.  
  800. if self.wndBelt:
  801. self.wndBelt.Destroy()
  802. self.wndBelt = None
  803.  
  804. self.inventoryTab = []
  805. self.equipmentTab = []
  806.  
  807. def Hide(self):
  808. if None != self.toolTip:
  809. self.toolTip.Hide()
  810. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  811. self.OnCloseQuestionDialog()
  812. return
  813. if None != self.tooltipItem:
  814. self.tooltipItem.HideToolTip()
  815.  
  816. if self.wndCostume:
  817. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow() # ???? ?? ?? ? ???? ?? ?????
  818. self.wndCostume.Close()
  819.  
  820. if self.wndAlchemia:
  821. self.isOpenedAlchemiaWindowWhenClosingInventory = self.wndAlchemia.IsShow() # ???? ?? ?? ? ???? ?? ?????
  822. self.wndAlchemia.Close()
  823.  
  824. if self.wndBelt:
  825. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # ???? ?? ?? ? ?? ????? ?? ?????
  826. print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  827. self.wndBelt.Close()
  828.  
  829. if self.dlgPickMoney:
  830. self.dlgPickMoney.Close()
  831.  
  832. wndMgr.Hide(self.hWnd)
  833.  
  834.  
  835. def Close(self):
  836. self.Hide()
  837.  
  838. def SetInventoryPage(self, page):
  839. self.inventoryPageIndex = page
  840. for i in xrange(player.INVENTORY_PAGE_COUNT):
  841. if i!=page:
  842. self.inventoryTab[i].SetUp()
  843. self.RefreshBagSlotWindow()
  844.  
  845. def SetEquipmentPage(self, page):
  846. self.equipmentPageIndex = page
  847. self.equipmentTab[1-page].SetUp()
  848. self.RefreshEquipSlotWindow()
  849.  
  850. def Sortowanie(self):
  851. net.SendChatPacket("/sort_inventory")
  852. def ClickMallButton(self):
  853. self.ClickShopButton()
  854. #print "click_mall_button"
  855. #net.SendChatPacket("/click_mall")
  856.  
  857. def ClickShopButton(self):
  858. shopoffline_gui = ui.BoardWithTitleBar()
  859. shopoffline_gui.SetSize(260, 102)
  860. shopoffline_gui.SetCenterPosition()
  861. shopoffline_gui.AddFlag('float')
  862. shopoffline_gui.SetTitleName(localeInfo.OFFLINE_GUI_1)
  863. self.shopoffline_gui = shopoffline_gui
  864.  
  865. shopoffline_button = ui.Button()
  866. shopoffline_button.SetParent(self.shopoffline_gui)
  867. shopoffline_button.SetPosition(-50, 50)
  868. shopoffline_button.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
  869. shopoffline_button.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
  870. shopoffline_button.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
  871. shopoffline_button.SetText(localeInfo.OFFLINE_GUI_2)
  872. shopoffline_button.SetWindowHorizontalAlignCenter()
  873. self.shopoffline_button = shopoffline_button
  874. shopoffline_button.SetEvent(self.OnOdbieranieYang)
  875.  
  876. shopoffline_button2 = ui.Button()
  877. shopoffline_button2.SetParent(self.shopoffline_gui)
  878. shopoffline_button2.SetPosition(50, 50)
  879. shopoffline_button2.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
  880. shopoffline_button2.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
  881. shopoffline_button2.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
  882. shopoffline_button2.SetText(localeInfo.OFFLINE_GUI_3)
  883. shopoffline_button2.SetWindowHorizontalAlignCenter()
  884. self.shopoffline_button2 = shopoffline_button2
  885. shopoffline_button2.SetEvent(self.OnOtwieraniePanelu)
  886.  
  887. self.shopoffline_gui.Show()
  888. self.shopoffline_button.Show()
  889. self.shopoffline_button2.Show()
  890.  
  891. def OnOdbieranieYang(self):
  892. self.shopoffline_gui.Hide()
  893. self.shopoffline_button.Hide()
  894. self.shopoffline_button2.Hide()
  895. event.QuestButtonClick(constInfo.OFFLINE_WYPLACANIE_YANG)
  896.  
  897. def OnOtwieraniePanelu(self):
  898. self.shopoffline_gui.Hide()
  899. self.shopoffline_button.Hide()
  900. self.shopoffline_button2.Hide()
  901. net.SendChatPacket("/do_myshops")
  902.  
  903. # DSSButton
  904. def ClickDSSButton(self):
  905. print "click_dss_button"
  906. self.interface.ToggleDragonSoulWindow()
  907.  
  908. def ClickCostumeButton(self):
  909. print "Click Costume Button"
  910. if self.wndCostume:
  911. if self.wndCostume.IsShow():
  912. self.wndCostume.Hide()
  913. else:
  914. self.wndCostume.Show()
  915. else:
  916. self.wndCostume = CostumeWindow(self)
  917. self.wndCostume.Show()
  918.  
  919. def ClickAlchemiaButton(self):
  920. if self.wndAlchemia:
  921. if self.wndAlchemia.IsShow():
  922. self.wndAlchemia.Hide()
  923. else:
  924. self.wndAlchemia.Show()
  925. else:
  926. self.wndAlchemia = AlchemiaWindow(self)
  927. self.wndAlchemia.Show()
  928.  
  929. def OpenPickMoneyDialog(self):
  930.  
  931. if mouseModule.mouseController.isAttached():
  932.  
  933. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  934. if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  935.  
  936. if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  937. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  938. snd.PlaySound("sound/ui/money.wav")
  939.  
  940. mouseModule.mouseController.DeattachObject()
  941.  
  942. else:
  943. curMoney = player.GetElk()
  944.  
  945. if curMoney <= 0:
  946. return
  947.  
  948. self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  949. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  950. self.dlgPickMoney.Open(curMoney)
  951. if app.ENABLE_OFFLINE_SHOP:
  952. self.dlgPickMoney.SetMax(11) # A?YA?? 990000 ?? 1??1??
  953. else:
  954. self.dlgPickMoney.SetMax(7) # A?YA?? 990000 ?? 1??1??
  955.  
  956. def OnPickMoney(self, money):
  957. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  958.  
  959. def OnPickItem(self, count):
  960. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  961. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  962. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  963.  
  964. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  965. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  966. return local
  967.  
  968. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  969.  
  970. def RefreshBagSlotWindow(self):
  971. getItemVNum=player.GetItemIndex
  972. getItemCount=player.GetItemCount
  973. setItemVNum=self.wndItem.SetItemSlot
  974.  
  975. for i in xrange(player.INVENTORY_PAGE_SIZE):
  976. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  977.  
  978. itemCount = getItemCount(slotNumber)
  979. # itemCount == 0?? ??? ???.
  980. if 0 == itemCount:
  981. self.wndItem.ClearSlot(i)
  982. continue
  983. elif 1 == itemCount:
  984. itemCount = 0
  985.  
  986. itemVnum = getItemVNum(slotNumber)
  987. setItemVNum(i, itemVnum, itemCount)
  988.  
  989. ## ???? (HP: #72723 ~ #72726, SP: #72727 ~ #72730) ???? - ?????? ??? ???/???? ??? ?? ??? - [hyo]
  990. if constInfo.IS_AUTO_POTION(itemVnum):
  991. # metinSocket - [0] : ??? ??, [1] : ??? ?, [2] : ?? ??
  992. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  993.  
  994. isActivated = 0 != metinSocket[0]
  995.  
  996. if isActivated:
  997. self.wndItem.ActivateSlot(i)
  998. potionType = 0;
  999. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  1000. potionType = player.AUTO_POTION_TYPE_HP
  1001. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  1002. potionType = player.AUTO_POTION_TYPE_SP
  1003.  
  1004. usedAmount = int(metinSocket[1])
  1005. totalAmount = int(metinSocket[2])
  1006. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  1007.  
  1008. else:
  1009. self.wndItem.DeactivateSlot(i)
  1010.  
  1011. if app.ENABLE_SASH_SYSTEM:
  1012. slotNumberChecked = 0
  1013. if not constInfo.IS_AUTO_POTION(itemVnum):
  1014. self.wndItem.DeactivateSlot(i)
  1015.  
  1016. for j in xrange(sash.WINDOW_MAX_MATERIALS):
  1017. (isHere, iCell) = sash.GetAttachedItem(j)
  1018. if isHere:
  1019. if iCell == slotNumber:
  1020. self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
  1021. if not slotNumber in self.listAttachedSashs:
  1022. self.listAttachedSashs.append(slotNumber)
  1023.  
  1024. slotNumberChecked = 1
  1025. else:
  1026. if slotNumber in self.listAttachedSashs and not slotNumberChecked:
  1027. self.wndItem.DeactivateSlot(i)
  1028. self.listAttachedSashs.remove(slotNumber)
  1029.  
  1030.  
  1031. self.wndItem.RefreshSlot()
  1032.  
  1033. if self.wndBelt:
  1034. self.wndBelt.RefreshSlot()
  1035.  
  1036. def RefreshEquipSlotWindow(self):
  1037. getItemVNum=player.GetItemIndex
  1038. getItemCount=player.GetItemCount
  1039. setItemVNum=self.wndEquip.SetItemSlot
  1040. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  1041. slotNumber = player.EQUIPMENT_SLOT_START + i
  1042. itemCount = getItemCount(slotNumber)
  1043. if itemCount <= 1:
  1044. itemCount = 0
  1045. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1046.  
  1047. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1048. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1049. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1050. itemCount = getItemCount(slotNumber)
  1051. if itemCount <= 1:
  1052. itemCount = 0
  1053. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1054. print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  1055.  
  1056.  
  1057.  
  1058. self.wndEquip.RefreshSlot()
  1059.  
  1060. if self.wndCostume:
  1061. self.wndCostume.RefreshCostumeSlot()
  1062.  
  1063. if self.wndAlchemia:
  1064. self.wndAlchemia.RefreshAlchemiaSlot()
  1065.  
  1066. def RefreshItemSlot(self):
  1067. self.RefreshBagSlotWindow()
  1068. self.RefreshEquipSlotWindow()
  1069.  
  1070. def RefreshStatus(self):
  1071. money = player.GetElk()
  1072. self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  1073.  
  1074. def SetItemToolTip(self, tooltipItem):
  1075. self.tooltipItem = tooltipItem
  1076.  
  1077. def SellItem(self):
  1078. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  1079. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  1080. ## ???? ??? ?? ?? ????? ?? type ??
  1081. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  1082. snd.PlaySound("sound/ui/money.wav")
  1083. self.OnCloseQuestionDialog()
  1084.  
  1085. def OnDetachMetinFromItem(self):
  1086. if None == self.questionDialog:
  1087. return
  1088.  
  1089. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1090. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1091. self.OnCloseQuestionDialog()
  1092.  
  1093. def OnCloseQuestionDialog(self):
  1094. if not self.questionDialog:
  1095. return
  1096.  
  1097. self.questionDialog.Close()
  1098. self.questionDialog = None
  1099. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1100.  
  1101. ## Slot Event
  1102. def SelectEmptySlot(self, selectedSlotPos):
  1103. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1104. return
  1105.  
  1106. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  1107.  
  1108. if mouseModule.mouseController.isAttached():
  1109.  
  1110. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1111. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1112. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1113. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1114.  
  1115. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1116. itemCount = player.GetItemCount(attachedSlotPos)
  1117. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1118. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1119.  
  1120. if item.IsRefineScroll(attachedItemIndex):
  1121. self.wndItem.SetUseMode(False)
  1122.  
  1123. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  1124. mouseModule.mouseController.RunCallBack("INVENTORY")
  1125.  
  1126. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  1127. net.SendShopBuyPacket(attachedSlotPos)
  1128.  
  1129. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1130.  
  1131. if player.ITEM_MONEY == attachedItemIndex:
  1132. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1133. snd.PlaySound("sound/ui/money.wav")
  1134.  
  1135. else:
  1136. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1137.  
  1138. elif player.SLOT_TYPE_MALL == attachedSlotType:
  1139. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1140.  
  1141. mouseModule.mouseController.DeattachObject()
  1142.  
  1143. def SelectItemSlot(self, itemSlotIndex):
  1144. if constInfo.BONUS_SWITCHER_IS_OPEN == 1:
  1145. return
  1146.  
  1147. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1148. return
  1149.  
  1150. if self.interface.wndItemShop.IsShow():
  1151. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CAN_NOT_USE_WHEN_ITEMSHOP_IS_OPEN)
  1152. return
  1153.  
  1154. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1155.  
  1156. if mouseModule.mouseController.isAttached():
  1157. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1158. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1159. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1160.  
  1161. useType = item.GetUseType(attachedItemVID)
  1162. useItem = item.GetUseType(player.GetItemIndex(itemSlotIndex))
  1163. if useType == "USE_CHANGE_ATTRIBUTE" and useItem != "USE_CHANGE_ATTRIBUTE":
  1164. item.SelectItem(player.GetItemIndex(itemSlotIndex))
  1165. if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR:
  1166. if not player.IsEquipmentSlot(itemSlotIndex):
  1167. self.interface.ShowBSWindow(itemSlotIndex, attachedItemVID, attachedSlotPos)
  1168. else:
  1169. chat.AppendChat(chat.CHAT_TYPE_INFO, "Nie możesz zmieniać bonów w założonym przedmiocie.")
  1170. else:
  1171. chat.AppendChat(chat.CHAT_TYPE_INFO, "Nie możesz zmieniać bonów w tym przedmiocie.")
  1172. else:
  1173. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1174. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1175.  
  1176. mouseModule.mouseController.DeattachObject()
  1177.  
  1178. else:
  1179.  
  1180. curCursorNum = app.GetCursor()
  1181. if app.SELL == curCursorNum:
  1182. self.__SellItem(itemSlotIndex)
  1183.  
  1184. elif app.BUY == curCursorNum:
  1185. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1186.  
  1187. elif app.IsPressed(app.DIK_LALT):
  1188. link = player.GetItemLink(itemSlotIndex)
  1189. ime.PasteString(link)
  1190.  
  1191. elif app.IsPressed(app.DIK_LSHIFT):
  1192. itemCount = player.GetItemCount(itemSlotIndex)
  1193.  
  1194. if itemCount > 1:
  1195. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1196. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1197. self.dlgPickMoney.Open(itemCount)
  1198. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1199. #else:
  1200. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1201. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1202.  
  1203. elif app.IsPressed(app.DIK_LCONTROL):
  1204. itemIndex = player.GetItemIndex(itemSlotIndex)
  1205.  
  1206. if True == item.CanAddToQuickSlotItem(itemIndex):
  1207. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1208. else:
  1209. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1210.  
  1211. else:
  1212. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1213. itemCount = player.GetItemCount(itemSlotIndex)
  1214. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1215.  
  1216. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1217. self.wndItem.SetUseMode(True)
  1218. else:
  1219. self.wndItem.SetUseMode(False)
  1220.  
  1221. snd.PlaySound("sound/ui/pick.wav")
  1222.  
  1223. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1224. if srcItemSlotPos == dstItemSlotPos:
  1225. return
  1226.  
  1227. # cyh itemseal 2013 11 08
  1228. if app.ENABLE_SOULBIND_SYSTEM and item.IsSealScroll(srcItemVID):
  1229. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1230.  
  1231. if player.GetItemIndex(srcItemSlotPos) == player.GetItemIndex(dstItemSlotPos) and not player.IsEquipmentSlot(dstItemSlotPos):
  1232. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1233. return
  1234.  
  1235. if item.IsRefineScroll(srcItemVID):
  1236. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1237. self.wndItem.SetUseMode(False)
  1238.  
  1239. elif item.IsMetin(srcItemVID):
  1240. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1241.  
  1242. elif item.IsDetachScroll(srcItemVID):
  1243. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1244.  
  1245. elif item.IsKey(srcItemVID):
  1246. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1247.  
  1248. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1249. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1250.  
  1251. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1252. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1253.  
  1254. else:
  1255. #snd.PlaySound("sound/ui/drop.wav")
  1256.  
  1257. ## ???? ?? ?? ??? ?? ???? ???? ?? ??? - [levites]
  1258. if player.IsEquipmentSlot(dstItemSlotPos):
  1259.  
  1260. ## ?? ?? ???? ?????
  1261. if item.IsEquipmentVID(srcItemVID):
  1262. self.__UseItem(srcItemSlotPos)
  1263.  
  1264. else:
  1265. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1266. #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1267.  
  1268. def __SellItem(self, itemSlotPos):
  1269. if not player.IsEquipmentSlot(itemSlotPos):
  1270. self.sellingSlotNumber = itemSlotPos
  1271. itemIndex = player.GetItemIndex(itemSlotPos)
  1272. itemCount = player.GetItemCount(itemSlotPos)
  1273.  
  1274.  
  1275. self.sellingSlotitemIndex = itemIndex
  1276. self.sellingSlotitemCount = itemCount
  1277.  
  1278. item.SelectItem(itemIndex)
  1279. ## ?? ??? ?? ??? ??
  1280. ## 20140220
  1281. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1282. popup = uiCommon.PopupDialog()
  1283. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1284. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1285. popup.Open()
  1286. self.popup = popup
  1287. return
  1288.  
  1289. itemPrice = player.GetISellItemPrice(itemSlotPos)
  1290.  
  1291. item.GetItemName(itemIndex)
  1292. itemName = item.GetItemName()
  1293.  
  1294. self.questionDialog = uiCommon.QuestionDialog()
  1295. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1296. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1297. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1298. self.questionDialog.Open()
  1299. self.questionDialog.count = itemCount
  1300.  
  1301. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1302.  
  1303. def __OnClosePopupDialog(self):
  1304. self.pop = None
  1305.  
  1306. def RefineItem(self, scrollSlotPos, targetSlotPos):
  1307.  
  1308. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1309. targetIndex = player.GetItemIndex(targetSlotPos)
  1310.  
  1311. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1312. return
  1313.  
  1314. ###########################################################
  1315. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1316. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1317. return
  1318. ###########################################################
  1319.  
  1320. ###########################################################
  1321. #net.SendRequestRefineInfoPacket(targetSlotPos)
  1322. #return
  1323. ###########################################################
  1324.  
  1325. result = player.CanRefine(scrollIndex, targetSlotPos)
  1326.  
  1327. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1328. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1329. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1330.  
  1331. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1332. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1333. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1334.  
  1335. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1336. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1337. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1338.  
  1339. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1340. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1341. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1342.  
  1343. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1344. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1345.  
  1346. if player.REFINE_OK != result:
  1347. return
  1348.  
  1349. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1350.  
  1351. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1352. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1353. targetIndex = player.GetItemIndex(targetSlotPos)
  1354. if app.ENABLE_SASH_SYSTEM:
  1355. if not player.CanDetach(scrollIndex, targetSlotPos):
  1356. item.SelectItem(scrollIndex)
  1357. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1358. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SASH_FAILURE_CLEAN)
  1359. else:
  1360. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1361.  
  1362. return
  1363. else:
  1364. if not player.CanDetach(scrollIndex, targetSlotPos):
  1365. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1366. return
  1367.  
  1368. self.questionDialog = uiCommon.QuestionDialog()
  1369. self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1370. if app.ENABLE_SASH_SYSTEM:
  1371. item.SelectItem(targetIndex)
  1372. if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_SASH:
  1373. item.SelectItem(scrollIndex)
  1374. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1375. self.questionDialog.SetText(localeInfo.SASH_DO_YOU_CLEAN)
  1376.  
  1377. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1378. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1379. self.questionDialog.Open()
  1380. self.questionDialog.sourcePos = scrollSlotPos
  1381. self.questionDialog.targetPos = targetSlotPos
  1382.  
  1383. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1384. metinIndex = player.GetItemIndex(metinSlotPos)
  1385. targetIndex = player.GetItemIndex(targetSlotPos)
  1386.  
  1387. item.SelectItem(metinIndex)
  1388. itemName = item.GetItemName()
  1389.  
  1390. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1391.  
  1392. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1393. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1394.  
  1395. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1396. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1397.  
  1398. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1399. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1400.  
  1401. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1402. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1403.  
  1404. if player.ATTACH_METIN_OK != result:
  1405. return
  1406.  
  1407. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1408.  
  1409.  
  1410.  
  1411. def OverOutItem(self):
  1412. self.wndItem.SetUsableItem(False)
  1413. if None != self.tooltipItem:
  1414. self.tooltipItem.HideToolTip()
  1415.  
  1416. def OverInItem(self, overSlotPos):
  1417. overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1418. self.wndItem.SetUsableItem(False)
  1419.  
  1420. if mouseModule.mouseController.isAttached():
  1421. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1422. if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1423.  
  1424. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1425. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1426.  
  1427. if attachedItemVNum==player.ITEM_MONEY: # @fixme005
  1428. pass
  1429. elif self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1430. self.wndItem.SetUsableItem(True)
  1431. self.ShowToolTip(overSlotPos)
  1432. return
  1433.  
  1434. self.ShowToolTip(overSlotPos)
  1435.  
  1436.  
  1437. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1438. "?? ???? ??? ? ?? ??????"
  1439.  
  1440. if item.IsRefineScroll(srcItemVNum):
  1441. return True
  1442. elif item.IsMetin(srcItemVNum):
  1443. return True
  1444. elif item.IsDetachScroll(srcItemVNum):
  1445. return True
  1446. elif item.IsKey(srcItemVNum):
  1447. return True
  1448. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1449. return True
  1450. else:
  1451. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1452. return True
  1453.  
  1454. return False
  1455.  
  1456. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1457. "?? ???? ??? ? ????"
  1458.  
  1459. if srcSlotPos == dstSlotPos:
  1460. return False
  1461.  
  1462. if player.GetItemIndex(srcSlotPos) == player.GetItemIndex(dstSlotPos) and not player.IsEquipmentSlot(dstSlotPos):
  1463. return True
  1464.  
  1465. if item.IsRefineScroll(srcItemVNum):
  1466. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1467. return True
  1468. elif item.IsMetin(srcItemVNum):
  1469. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1470. return True
  1471. elif item.IsDetachScroll(srcItemVNum):
  1472. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1473. return True
  1474. elif item.IsKey(srcItemVNum):
  1475. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1476. return True
  1477.  
  1478. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1479. return True
  1480.  
  1481. else:
  1482. useType=item.GetUseType(srcItemVNum)
  1483.  
  1484. if "USE_CLEAN_SOCKET" == useType:
  1485. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1486. return True
  1487. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1488. if self.__CanChangeItemAttrList(dstSlotPos):
  1489. return True
  1490. elif "USE_ADD_ATTRIBUTE" == useType:
  1491. if self.__CanAddItemAttr(dstSlotPos):
  1492. return True
  1493. elif "USE_ADD_ATTRIBUTE2" == useType:
  1494. if self.__CanAddItemAttr(dstSlotPos):
  1495. return True
  1496. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1497. if self.__CanAddAccessorySocket(dstSlotPos):
  1498. return True
  1499. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1500. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1501. return True;
  1502. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1503. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1504. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1505.  
  1506. item.SelectItem(dstItemVNum)
  1507.  
  1508. if item.ITEM_TYPE_BELT == item.GetItemType():
  1509. return True
  1510. elif "USE_CHANGE_COSTUME_ATTR" == useType:
  1511. if self.__CanChangeCostumeAttrList(dstSlotPos):
  1512. return True
  1513. elif "USE_RESET_COSTUME_ATTR" == useType:
  1514. if self.__CanResetCostumeAttr(dstSlotPos):
  1515. return True
  1516.  
  1517. return False
  1518.  
  1519. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1520. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1521. if dstItemVNum == 0:
  1522. return False
  1523.  
  1524. item.SelectItem(dstItemVNum)
  1525.  
  1526. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1527. return False
  1528.  
  1529. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1530. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1531. return True
  1532.  
  1533. return False
  1534.  
  1535. def __CanChangeItemAttrList(self, dstSlotPos):
  1536. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1537. if dstItemVNum == 0:
  1538. return False
  1539.  
  1540. item.SelectItem(dstItemVNum)
  1541.  
  1542. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1543. return False
  1544.  
  1545. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1546. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1547. return True
  1548.  
  1549. return False
  1550.  
  1551. def __CanChangeCostumeAttrList(self, dstSlotPos):
  1552. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1553. if dstItemVNum == 0:
  1554. return False
  1555.  
  1556. item.SelectItem(dstItemVNum)
  1557.  
  1558. if item.GetItemType() != item.ITEM_TYPE_COSTUME:
  1559. return False
  1560.  
  1561. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1562. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1563. return True
  1564.  
  1565. return False
  1566.  
  1567. def __CanResetCostumeAttr(self, dstSlotPos):
  1568. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1569. if dstItemVNum == 0:
  1570. return False
  1571.  
  1572. item.SelectItem(dstItemVNum)
  1573.  
  1574. if item.GetItemType() != item.ITEM_TYPE_COSTUME:
  1575. return False
  1576.  
  1577. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1578. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1579. return True
  1580.  
  1581. return False
  1582.  
  1583. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1584. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1585. if dstItemVNum == 0:
  1586. return False
  1587.  
  1588. item.SelectItem(dstItemVNum)
  1589.  
  1590. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1591. return False
  1592.  
  1593. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1594. return False
  1595.  
  1596. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1597. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1598.  
  1599. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1600. return False
  1601.  
  1602. if curCount>=maxCount:
  1603. return False
  1604.  
  1605. return True
  1606.  
  1607. def __CanAddAccessorySocket(self, dstSlotPos):
  1608. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1609. if dstItemVNum == 0:
  1610. return False
  1611.  
  1612. item.SelectItem(dstItemVNum)
  1613.  
  1614. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1615. return False
  1616.  
  1617. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1618. return False
  1619.  
  1620. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1621. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1622.  
  1623. ACCESSORY_SOCKET_MAX_SIZE = 3
  1624. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1625. return False
  1626.  
  1627. return True
  1628.  
  1629. def __CanAddItemAttr(self, dstSlotPos):
  1630. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1631. if dstItemVNum == 0:
  1632. return False
  1633.  
  1634. item.SelectItem(dstItemVNum)
  1635.  
  1636. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1637. return False
  1638.  
  1639. attrCount = 0
  1640. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1641. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1642. attrCount += 1
  1643.  
  1644. if attrCount<4:
  1645. return True
  1646.  
  1647. return False
  1648.  
  1649. def ShowToolTip(self, slotIndex):
  1650. if None != self.tooltipItem:
  1651. self.tooltipItem.SetInventoryItem(slotIndex)
  1652.  
  1653. def OnTop(self):
  1654. if None != self.tooltipItem:
  1655. self.tooltipItem.SetTop()
  1656.  
  1657. def OnPressEscapeKey(self):
  1658. self.Close()
  1659. return True
  1660.  
  1661. def UseItemSlot(self, slotIndex):
  1662.  
  1663. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1664. return
  1665.  
  1666. if self.interface.wndItemShop.IsShow():
  1667. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CAN_NOT_USE_WHEN_ITEMSHOP_IS_OPEN)
  1668. return
  1669.  
  1670. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1671. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1672. if self.wndDragonSoulRefine.IsShow():
  1673. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1674. return
  1675.  
  1676. if app.ENABLE_SASH_SYSTEM:
  1677. if self.isShowSashWindow():
  1678. sash.Add(player.INVENTORY, slotIndex, 255)
  1679. return
  1680.  
  1681. if constInfo.BONUS_SWITCHER_IS_OPEN == 1:
  1682. return
  1683.  
  1684. self.__UseItem(slotIndex)
  1685. mouseModule.mouseController.DeattachObject()
  1686. self.OverOutItem()
  1687.  
  1688. def __UseItem(self, slotIndex):
  1689. ItemVNum = player.GetItemIndex(slotIndex)
  1690. item.SelectItem(ItemVNum)
  1691. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1692. self.questionDialog = uiCommon.QuestionDialog()
  1693. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1694. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1695. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1696. self.questionDialog.Open()
  1697. self.questionDialog.slotIndex = slotIndex
  1698.  
  1699. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1700.  
  1701. else:
  1702. self.__SendUseItemPacket(slotIndex)
  1703. #net.SendItemUsePacket(slotIndex)
  1704.  
  1705. def __UseItemQuestionDialog_OnCancel(self):
  1706. self.OnCloseQuestionDialog()
  1707.  
  1708. def __UseItemQuestionDialog_OnAccept(self):
  1709. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1710. self.OnCloseQuestionDialog()
  1711.  
  1712. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1713. # ???? ?? ?? ?? ??? ?? ??
  1714. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1715. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1716. return
  1717.  
  1718. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1719.  
  1720. def __SendUseItemPacket(self, slotPos):
  1721. # ???? ?? ?? ?? ??? ?? ??
  1722. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1723. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1724. return
  1725.  
  1726. net.SendItemUsePacket(slotPos)
  1727.  
  1728. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1729. # ???? ?? ?? ?? ??? ?? ??
  1730. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1731. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1732. return
  1733.  
  1734. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1735.  
  1736. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  1737. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1738. self.wndDragonSoulRefine = wndDragonSoulRefine
  1739.  
  1740. if app.ENABLE_SASH_SYSTEM:
  1741. def SetSashWindow(self, wndSashCombine, wndSashAbsorption):
  1742. self.wndSashCombine = wndSashCombine
  1743. self.wndSashAbsorption = wndSashAbsorption
  1744.  
  1745. def isShowSashWindow(self):
  1746. if self.wndSashCombine:
  1747. if self.wndSashCombine.IsShow():
  1748. return 1
  1749.  
  1750. if self.wndSashAbsorption:
  1751. if self.wndSashAbsorption.IsShow():
  1752. return 1
  1753.  
  1754. return 0
  1755.  
  1756. def OnMoveWindow(self, x, y):
  1757. # print "Inventory Global Pos : ", self.GetGlobalPosition()
  1758. if self.wndBelt:
  1759. # print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  1760. self.wndBelt.AdjustPositionAndSize()
  1761.  
  1762. def OnUpdate(self):
  1763. self.CheckMouseTooltip()
  1764.  
  1765. def ShowBiologWindow(self):
  1766. self.interface.ShowBiologWindow()
  1767.  
  1768. def CheckMouseTooltip(self):
  1769. if self.SwitchBiologWindow:
  1770. if self.SwitchBiologWindow.IsIn():
  1771. self.BiologStatus()
  1772. self.toolTip.Show()
  1773. else:
  1774. self.toolTip.Hide()
  1775.  
  1776. def BiologStatus(self):
  1777. #self.toolTip.AppendSpace(5)
  1778. self.toolTip.ClearToolTip()
  1779. self.toolTip.AppendTextLine("Badania Biologa", 0xffffd700)#gold
  1780. self.toolTip.AppendTextLine("__________________________", 0xffFFFFFF)
  1781. self.toolTip.AppendSpace(5)
  1782. self.toolTip.AppendTextLine("Status misji:", 0xffFFFFFF)
  1783. self.toolTip.AppendSpace(5)
  1784.  
  1785. ################################ NAZWA ####################################### ITEM_ID ############################## ID_STATUSU
  1786. self.toolTip.AppendTextLine("Analiza Biologa I"+self.wndBiolog.CheckPrc(50709), self.wndBiolog.CheckStatus(1))
  1787. self.toolTip.AppendTextLine("Analiza Biologa II"+self.wndBiolog.CheckPrc(50711),self.wndBiolog.CheckStatus(3))
  1788. self.toolTip.AppendTextLine("Analiza Biologa III"+self.wndBiolog.CheckPrc(50712), self.wndBiolog.CheckStatus(5))
  1789. self.toolTip.AppendTextLine("Badania Biologa I"+self.wndBiolog.CheckPrc(30006), self.wndBiolog.CheckStatus(7))
  1790. self.toolTip.AppendTextLine("Badania Biologa II"+self.wndBiolog.CheckPrc(30047), self.wndBiolog.CheckStatus(9))
  1791. self.toolTip.AppendTextLine("Badania Biologa III"+self.wndBiolog.CheckPrc(30015), self.wndBiolog.CheckStatus(11))
  1792. self.toolTip.AppendTextLine("Badania Biologa IV"+self.wndBiolog.CheckPrc(30050), self.wndBiolog.CheckStatus(13))
  1793. self.toolTip.AppendTextLine("Badania Biologa V"+self.wndBiolog.CheckPrc(30165), self.wndBiolog.CheckStatus(15))
  1794. self.toolTip.AppendTextLine("Badania Biologa VI"+self.wndBiolog.CheckPrc(30166), self.wndBiolog.CheckStatus(17))
  1795. self.toolTip.AppendTextLine("Badania Biologa VII"+self.wndBiolog.CheckPrc(30167), self.wndBiolog.CheckStatus(19))
  1796. self.toolTip.AppendTextLine("Badania Biologa VIII"+self.wndBiolog.CheckPrc(30168), self.wndBiolog.CheckStatus(21))
  1797. self.toolTip.SetToolTipPosition(wndMgr.GetScreenWidth() - 320, wndMgr.GetScreenHeight() - 160) #y w do?- minus
  1798. self.toolTip.Hide()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement