MrP0wers

Untitled

Mar 25th, 2026
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.20 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
  17. import uiToolTip
  18. import localeInfo
  19. import constInfo
  20. import ime
  21. import wndMgr
  22.  
  23. if app.ENABLE_ALIGN:
  24. import uialignment
  25.  
  26. if app.EXCHANGE_CHECKIN_UPDATE:
  27. import exchange
  28.  
  29. from uiToolTip import ItemToolTip, ToolTip
  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. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  87. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  88. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  89. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  90. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  91. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  92.  
  93. self.wndEquip = wndEquip
  94.  
  95. def RefreshCostumeSlot(self):
  96. getItemVNum = player.GetItemIndex
  97.  
  98. for i in xrange(item.COSTUME_SLOT_COUNT):
  99. slotNumber = item.COSTUME_SLOT_START + i
  100. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  101.  
  102. self.wndEquip.RefreshSlot()
  103.  
  104. class BeltInventoryWindow(ui.ScriptWindow):
  105.  
  106. def __init__(self, wndInventory):
  107. import exception
  108.  
  109. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  110. exception.Abort("What do you do?")
  111. return
  112.  
  113. if not wndInventory:
  114. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  115. return
  116.  
  117. ui.ScriptWindow.__init__(self)
  118.  
  119. self.isLoaded = 0
  120. self.wndInventory = wndInventory;
  121.  
  122. self.wndBeltInventoryLayer = None
  123. self.wndBeltInventorySlot = None
  124. self.expandBtn = None
  125. self.minBtn = None
  126.  
  127. self.__LoadWindow()
  128.  
  129. def __del__(self):
  130. ui.ScriptWindow.__del__(self)
  131.  
  132. def Show(self, openBeltSlot = FALSE):
  133. self.__LoadWindow()
  134. self.RefreshSlot()
  135.  
  136. ui.ScriptWindow.Show(self)
  137.  
  138. if openBeltSlot:
  139. self.OpenInventory()
  140. else:
  141. self.CloseInventory()
  142.  
  143. def Close(self):
  144. self.Hide()
  145.  
  146. def IsOpeningInventory(self):
  147. return self.wndBeltInventoryLayer.IsShow()
  148.  
  149. def OpenInventory(self):
  150. self.wndBeltInventoryLayer.Show()
  151. self.expandBtn.Hide()
  152.  
  153. if localeInfo.IsARABIC() == 0:
  154. self.AdjustPositionAndSize()
  155.  
  156. def CloseInventory(self):
  157. self.wndBeltInventoryLayer.Hide()
  158. self.expandBtn.Show()
  159.  
  160. if localeInfo.IsARABIC() == 0:
  161. self.AdjustPositionAndSize()
  162.  
  163. def GetBasePosition(self):
  164. x, y = self.wndInventory.GetGlobalPosition()
  165. return x - 148, y + 241
  166.  
  167. def AdjustPositionAndSize(self):
  168. bx, by = self.GetBasePosition()
  169.  
  170. if self.IsOpeningInventory():
  171. self.SetPosition(bx, by)
  172. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  173.  
  174. else:
  175. self.SetPosition(bx + 138, by);
  176. self.SetSize(10, self.GetHeight())
  177.  
  178. def __LoadWindow(self):
  179. if self.isLoaded == 1:
  180. return
  181.  
  182. self.isLoaded = 1
  183.  
  184. try:
  185. pyScrLoader = ui.PythonScriptLoader()
  186. pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  187.  
  188. except:
  189. import exception
  190. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  191.  
  192. try:
  193. self.ORIGINAL_WIDTH = self.GetWidth()
  194. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  195. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  196. self.expandBtn = self.GetChild("ExpandBtn")
  197. self.minBtn = self.GetChild("MinimizeBtn")
  198.  
  199. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  200. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  201.  
  202. if localeInfo.IsARABIC() :
  203. self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  204. self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
  205. self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
  206.  
  207. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  208. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  209. wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  210. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  211. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  212. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE)
  213.  
  214. except:
  215. import exception
  216. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  217.  
  218. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  219. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  220. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  221. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  222. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  223. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  224.  
  225. self.wndBeltInventorySlot = wndBeltInventorySlot
  226.  
  227. def RefreshSlot(self):
  228. getItemVNum=player.GetItemIndex
  229.  
  230. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  231. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  232. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  233. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, TRUE)
  234.  
  235. avail = "0"
  236.  
  237. if player.IsAvailableBeltInventoryCell(slotNumber):
  238. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  239. else:
  240. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  241.  
  242. self.wndBeltInventorySlot.RefreshSlot()
  243.  
  244. class SideBarInventoryWindow(ui.ScriptWindow):
  245.  
  246. BUTTON_TOOLTIP2 = {
  247. "wndSwitchBot" : "Switchbot",
  248. "wndTeleport" : "Teleport",
  249. "wndSafebox" : "Depozit",
  250. "wndAlign" : "Align",
  251. }
  252.  
  253. def __init__(self, wndInventory):
  254. import exception
  255.  
  256. if not wndInventory:
  257. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  258. return
  259.  
  260. ui.ScriptWindow.__init__(self)
  261.  
  262. self.isLoaded = 0
  263. self.wndInventory = wndInventory
  264.  
  265. self.toolTip2 = None
  266. self.buttonToolTipDict2 = None
  267.  
  268. self.__LoadWindow()
  269.  
  270. def __del__(self):
  271. ui.ScriptWindow.__del__(self)
  272.  
  273. def Show(self):
  274. self.__LoadWindow()
  275.  
  276. ui.ScriptWindow.Show(self)
  277.  
  278. def Close(self):
  279. self.Hide()
  280.  
  281. def bind_interface(self, interface):
  282. self.interface = interface
  283.  
  284. def __LoadWindow(self):
  285. if self.isLoaded == 1:
  286. return
  287.  
  288. self.isLoaded = 1
  289.  
  290. try:
  291. pyScrLoader = ui.PythonScriptLoader()
  292. pyScrLoader.LoadScriptFile(self, "UIscript/inventory_sidebar.py")
  293.  
  294. if app.ENABLE_SWITCHBOT:
  295. self.wndSwitchBot = self.GetChild2("Switchbot")
  296.  
  297. if app.ENABLE_TELEPORTPANEL:
  298. self.wndTeleport = self.GetChild2("TeleportButton")
  299.  
  300. if app.ENABLE_SAFE_BOX:
  301. self.wndSafebox = self.GetChild2("Depozit")
  302.  
  303. if app.ENABLE_ALIGN:
  304. self.wndAlign = self.GetChild2("Align")
  305.  
  306. except:
  307. import exception
  308. exception.Abort("SidebarWindow.LoadWindow.LoadObject")
  309.  
  310. self.AdjustPosition()
  311.  
  312. if app.ENABLE_SWITCHBOT:
  313. if self.wndSwitchBot:
  314. self.wndSwitchBot.SetEvent(ui.__mem_func__(self.Click_Switchbot))
  315.  
  316. if app.ENABLE_TELEPORTPANEL:
  317. if self.wndTeleport:
  318. self.wndTeleport.SetEvent(ui.__mem_func__(self.ClickTeleportButton))
  319.  
  320. if app.ENABLE_SAFE_BOX:
  321. if self.wndSafebox:
  322. self.wndSafebox.SetEvent(ui.__mem_func__(self.Click_Depozit))
  323.  
  324. if app.ENABLE_ALIGN:
  325. if self.wndAlign:
  326. self.wndAlign.SetEvent(ui.__mem_func__(self.Click_Align))
  327.  
  328. self.toolTip2 = uiToolTip.ToolTip()
  329.  
  330. self.buttonToolTipDict2 = {
  331. "wndSwitchBot" : self.GetChild2("Switchbot"),
  332. "wndTeleport" : self.GetChild2("TeleportButton"),
  333. "wndSafebox" : self.GetChild2("Depozit"),
  334. "wndAlign" : self.GetChild2("Align"),
  335. }
  336.  
  337. for (buttonToolTipKey, buttonToolTip) in self.buttonToolTipDict2.items():
  338. buttonToolTip.ShowToolTip = lambda arg = buttonToolTipKey: self.__OverInButton2(arg)
  339. buttonToolTip.HideToolTip = lambda arg = buttonToolTipKey: self.__OverOutButton2()
  340.  
  341. def GetBasePosition(self):
  342. x, y = self.wndInventory.GetGlobalPosition()
  343. return x, y
  344.  
  345. def AdjustPosition(self):
  346. bx, by = self.GetBasePosition()
  347. self.SetPosition(bx - 40, by + 3)
  348.  
  349. if app.ENABLE_SWITCHBOT:
  350. def Click_Switchbot(self):
  351. self.interface.ToggleSwitchbotWindow()
  352.  
  353. if app.ENABLE_TELEPORTPANEL:
  354. def ClickTeleportButton(self):
  355. self.interface.ToggleTeleportPanel()
  356.  
  357. if app.ENABLE_SAFE_BOX:
  358. def Click_Depozit(self):
  359. self.interface.ToggleSelectSafeboxInfoWindow()
  360.  
  361. if app.ENABLE_ALIGN:
  362. def Click_Align(self):
  363. self.uialignment = uialignment.AlignmentWindow()
  364. self.uialignment.Show()
  365.  
  366. def __OverInButton2(self, stat):
  367. self.__ShowToolTip2(self.BUTTON_TOOLTIP2[stat])
  368.  
  369. def __OverOutButton2(self):
  370. self.__HideToolTip2()
  371.  
  372. def __ShowToolTip2(self, statDesc):
  373. arglen = len(str(statDesc))
  374. self.toolTip2.SetThinBoardSize(8 * arglen)
  375. self.toolTip2.ClearToolTip()
  376. self.toolTip2.AppendTextLine(statDesc)
  377. self.toolTip2.Show()
  378.  
  379. def __HideToolTip2(self):
  380. self.toolTip2.Hide()
  381.  
  382. class InventoryWindow(ui.ScriptWindow):
  383.  
  384. BUTTON_TOOLTIP = {
  385. "Equipment_Base" : "Equipment",
  386. "Costume_Base" : "Costume",
  387. "PAGE_1" : "1. Inventar",
  388. "PAGE_2" : "2. Inventar",
  389. "PAGE_3" : "3. Inventar",
  390. "PAGE_4" : "4. Inventar",
  391. "PAGE_5" : "5. Inventar",
  392. "PAGE_6" : "6. Inventar",
  393. "PAGE_7" : "7. Inventar",
  394. "PAGE_8" : "8. Inventar",
  395. "PAGE_9" : "9. Inventar",
  396. "PAGE_10" : "10. Inventar",
  397. "PAGE_11" : "11. Inventar",
  398. "PAGE_12" : "12. Inventar",
  399. }
  400.  
  401. 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")
  402.  
  403. questionDialog = None
  404. tooltipItem = None
  405. wndCostume = None
  406. wndBelt = None
  407. dlgPickMoney = None
  408. wndExpandedMoneyBar = None
  409. wndGem = None
  410. wndSideBar = None
  411.  
  412. sellingSlotNumber = -1
  413. isLoaded = 0
  414. isOpenedCostumeWindowWhenClosingInventory = 0
  415. isOpenedBeltWindowWhenClosingInventory = 0
  416.  
  417. def __init__(self):
  418. ui.ScriptWindow.__init__(self)
  419.  
  420. self.isOpenedBeltWindowWhenClosingInventory = 0
  421.  
  422. if app.ENABLE_COINS_SYSTEM:
  423. self.coins = 0
  424. self.jd = 0
  425. self.euro = 0
  426.  
  427. self.toolTip = None
  428.  
  429. self.equipmentPageIndex = 0
  430.  
  431. self.__LoadWindow()
  432.  
  433. def __del__(self):
  434. ui.ScriptWindow.__del__(self)
  435.  
  436. if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  437. self.wndExpandedMoneyBar = None
  438.  
  439. def Show(self):
  440. self.__LoadWindow()
  441.  
  442. ui.ScriptWindow.Show(self)
  443.  
  444. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  445. self.wndCostume.Show()
  446.  
  447. if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  448. if self.wndExpandedMoneyBar:
  449. self.wndExpandedMoneyBar.Show()
  450.  
  451. if self.wndSideBar:
  452. self.wndSideBar.Show()
  453.  
  454. if self.wndBelt:
  455. self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  456.  
  457. def BindInterfaceClass(self, interface):
  458. self.interface = interface
  459. self.wndSideBar.bind_interface(interface)
  460.  
  461. def __LoadWindow(self):
  462. if self.isLoaded == 1:
  463. return
  464.  
  465. self.isLoaded = 1
  466.  
  467. try:
  468. pyScrLoader = ui.PythonScriptLoader()
  469. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  470.  
  471. except:
  472. import exception
  473. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  474.  
  475. try:
  476.  
  477. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  478. self.visibleButtonList = []
  479. self.visibleButtonList.append(self.GetChild("BodyToolTipButton"))
  480. self.visibleButtonList.append(self.GetChild("HairToolTipButton"))
  481. self.visibleButtonList.append(self.GetChild("WeaponToolTipButton"))
  482.  
  483. wndItem = self.GetChild("ItemSlot")
  484. wndEquip = self.GetChild("EquipmentSlot")
  485. wndCostume = self.GetChild("CostumeSlot")
  486.  
  487. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  488. self.wndMoney = self.GetChild("Money")
  489. self.wndMoneySlot = self.GetChild("Money_Slot")
  490. self.mallButton = self.GetChild2("MallButton")
  491. self.DSSButton = self.GetChild2("DSSButton")
  492. self.costumeButton = self.GetChild2("CostumeButton")
  493.  
  494. mask1 = self.GetChild("Equipment_Base")
  495. mask2 = self.GetChild("Costume_Base")
  496.  
  497. if app.ENABLE_COINS_SYSTEM:
  498. self.wndCoins = self.GetChild("Coins")
  499. self.wndCoinsSlot = self.GetChild("Coins_Slot")
  500.  
  501. self.wndJD = self.GetChild("JD")
  502. self.wndJDSlot = self.GetChild("JD_Slot")
  503.  
  504. self.wndEuro = self.GetChild("Euro")
  505. self.wndEuroSlot = self.GetChild("Euro_Slot")
  506.  
  507. if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  508. if app.ENABLE_COINS_SYSTEM:
  509. self.wndCoinsIcon = self.GetChild("Coins_Icon")
  510. self.wndCoinsIcon.Hide()
  511. self.wndCoinsSlot.Hide()
  512.  
  513. self.wndJDIcon = self.GetChild("JD_Icon")
  514. self.wndJDIcon.Hide()
  515. self.wndJDSlot.Hide()
  516.  
  517. self.wndEuroIcon = self.GetChild("Euro_Icon")
  518. self.wndEuroIcon.Hide()
  519. self.wndEuroSlot.Hide()
  520.  
  521. self.inventoryTab = []
  522. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  523. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  524. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  525. self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  526. self.inventoryTab.append(self.GetChild("Inventory_Tab_05"))
  527. self.inventoryTab.append(self.GetChild("Inventory_Tab_06"))
  528. self.inventoryTab.append(self.GetChild("Inventory_Tab_07"))
  529. self.inventoryTab.append(self.GetChild("Inventory_Tab_08"))
  530. self.inventoryTab.append(self.GetChild("Inventory_Tab_09"))
  531. self.inventoryTab.append(self.GetChild("Inventory_Tab_10"))
  532. self.inventoryTab.append(self.GetChild("Inventory_Tab_11"))
  533. self.inventoryTab.append(self.GetChild("Inventory_Tab_12"))
  534.  
  535. self.equipmentTab = []
  536. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  537. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  538.  
  539. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  540. self.costumeButton.Hide()
  541. self.costumeButton.Destroy()
  542. self.costumeButton = 0
  543.  
  544. self.wndBelt = None
  545.  
  546. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  547. self.wndBelt = BeltInventoryWindow(self)
  548.  
  549. self.wndSideBar = SideBarInventoryWindow(self)
  550.  
  551. except:
  552. import exception
  553. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  554.  
  555.  
  556. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  557. self.visibleButtonList[0].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 1, 0)
  558. self.visibleButtonList[1].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 2, 0)
  559. self.visibleButtonList[2].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 3, 0)
  560.  
  561. self.visibleButtonList[0].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 1, 1)
  562. self.visibleButtonList[1].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 2, 1)
  563. self.visibleButtonList[2].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 3, 1)
  564.  
  565. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  566. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  567. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  568. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  569. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  570. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  571.  
  572. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  573. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  574. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  575. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  576. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  577. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  578.  
  579. wndCostume.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  580. wndCostume.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  581. wndCostume.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  582. wndCostume.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  583. wndCostume.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  584. wndCostume.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  585.  
  586. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  587. dlgPickMoney.LoadDialog()
  588. dlgPickMoney.Hide()
  589.  
  590. self.refineDialog = uiRefine.RefineDialog()
  591. self.refineDialog.Hide()
  592.  
  593. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  594. self.attachMetinDialog.Hide()
  595.  
  596. self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  597.  
  598. self.inventoryTab[0].SetEvent(lambda arg = 0: self.SetInventoryPage(arg))
  599. self.inventoryTab[1].SetEvent(lambda arg = 1: self.SetInventoryPage(arg))
  600. self.inventoryTab[2].SetEvent(lambda arg = 2: self.SetInventoryPage(arg))
  601. self.inventoryTab[3].SetEvent(lambda arg = 3: self.SetInventoryPage(arg))
  602. self.inventoryTab[4].SetEvent(lambda arg = 4: self.SetInventoryPage(arg))
  603. self.inventoryTab[5].SetEvent(lambda arg = 5: self.SetInventoryPage(arg))
  604. self.inventoryTab[6].SetEvent(lambda arg = 6: self.SetInventoryPage(arg))
  605. self.inventoryTab[7].SetEvent(lambda arg = 7: self.SetInventoryPage(arg))
  606. self.inventoryTab[8].SetEvent(lambda arg = 8: self.SetInventoryPage(arg))
  607. self.inventoryTab[9].SetEvent(lambda arg = 9: self.SetInventoryPage(arg))
  608. self.inventoryTab[10].SetEvent(lambda arg = 10: self.SetInventoryPage(arg))
  609. self.inventoryTab[11].SetEvent(lambda arg = 11: self.SetInventoryPage(arg))
  610. self.inventoryTab[0].Down()
  611.  
  612. self.equipmentTab[0].SetEvent(lambda arg = 0: self.SetEquipmentPage(arg))
  613. self.equipmentTab[1].SetEvent(lambda arg = 1: self.SetEquipmentPage(arg))
  614. self.equipmentTab[0].Down()
  615. self.equipmentPageIndex = 0
  616.  
  617. self.wndItem = wndItem
  618. self.wndEquip = wndEquip
  619. self.dlgPickMoney = dlgPickMoney
  620.  
  621. self.pannelWindow = ui.BoardWithTitleBar()
  622. self.pannelWindow.SetSize(190, 120)
  623. self.pannelWindow.SetCenterPosition()
  624. self.pannelWindow.AddFlag('float')
  625. self.pannelWindow.AddFlag('movable')
  626. self.pannelWindow.SetTitleName("Management Depozit")
  627.  
  628. self.pannelWindow2 = ui.ThinBoard()
  629. self.pannelWindow2.SetParent(self.pannelWindow)
  630. self.pannelWindow2.SetPosition(10,32)
  631. self.pannelWindow2.SetSize(190-20, 120-44)
  632.  
  633. self.pannelWindow3 = ui.BoardDepozit()
  634. self.pannelWindow3.SetParent(self.pannelWindow)
  635. self.pannelWindow3.SetPosition(18,40)
  636. self.pannelWindow3.SetSize(190-36, 120-60)
  637.  
  638. self.mallWindow = ui.Button()
  639. self.mallWindow.SetEvent(self.OpenIs)
  640. self.mallWindow.SetParent(self.pannelWindow3)
  641. self.mallWindow.SetPosition(2, 2)
  642. self.mallWindow.SetUpVisual("d:/ymir work/ui/game/custom_inventory/button_01.tga")
  643. self.mallWindow.SetOverVisual("d:/ymir work/ui/game/custom_inventory/button_02.tga")
  644. self.mallWindow.SetDownVisual("d:/ymir work/ui/game/custom_inventory/button_03.tga")
  645. self.mallWindow.SetText("Depozit Item-Shop")
  646.  
  647. self.safeboxWindow = ui.Button()
  648. self.safeboxWindow.SetEvent(self._normal_mall)
  649. self.safeboxWindow.SetParent(self.pannelWindow3)
  650. self.safeboxWindow.SetPosition(2, 2+30)
  651. self.safeboxWindow.SetUpVisual("d:/ymir work/ui/game/custom_inventory/button_01.tga")
  652. self.safeboxWindow.SetOverVisual("d:/ymir work/ui/game/custom_inventory/button_02.tga")
  653. self.safeboxWindow.SetDownVisual("d:/ymir work/ui/game/custom_inventory/button_03.tga")
  654. self.safeboxWindow.SetText("Depozit Obiecte")
  655.  
  656. self.wndCostume = wndCostume
  657.  
  658. self.mask1 = mask1
  659. self.mask2 = mask2
  660.  
  661. if self.mallButton:
  662. self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  663.  
  664. if self.DSSButton:
  665. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  666.  
  667. if self.costumeButton:
  668. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  669.  
  670.  
  671. self.toolTip = uiToolTip.ToolTip()
  672.  
  673. self.buttonToolTipDict = {
  674. "Equipment_Base" : self.GetChild("Equipment_Tab_01"),
  675. "Costume_Base" : self.GetChild("Equipment_Tab_02"),
  676. "PAGE_1" : self.GetChild("Inventory_Tab_01"),
  677. "PAGE_2" : self.GetChild("Inventory_Tab_02"),
  678. "PAGE_3" : self.GetChild("Inventory_Tab_03"),
  679. "PAGE_4" : self.GetChild("Inventory_Tab_04"),
  680. "PAGE_5" : self.GetChild("Inventory_Tab_05"),
  681. "PAGE_6" : self.GetChild("Inventory_Tab_06"),
  682. "PAGE_7" : self.GetChild("Inventory_Tab_07"),
  683. "PAGE_8" : self.GetChild("Inventory_Tab_08"),
  684. "PAGE_9" : self.GetChild("Inventory_Tab_09"),
  685. "PAGE_10" : self.GetChild("Inventory_Tab_10"),
  686. "PAGE_11" : self.GetChild("Inventory_Tab_11"),
  687. "PAGE_12" : self.GetChild("Inventory_Tab_12"),
  688. }
  689.  
  690. for (buttonToolTipKey, buttonToolTip) in self.buttonToolTipDict.items():
  691. buttonToolTip.ShowToolTip = lambda arg = buttonToolTipKey: self.__OverInButton(arg)
  692. buttonToolTip.HideToolTip = lambda arg = buttonToolTipKey: self.__OverOutButton()
  693.  
  694. if app.ENABLE_HIGHLIGHT_SYSTEM:
  695. self.listHighlightedSlot = []
  696.  
  697. self.inventoryPageIndex = 0
  698.  
  699. self.SetInventoryPage(0)
  700. self.SetEquipmentPage(0)
  701. self.RefreshItemSlot()
  702. self.RefreshStatus()
  703.  
  704. def Destroy(self):
  705. self.ClearDictionary()
  706.  
  707. self.dlgPickMoney.Destroy()
  708. self.dlgPickMoney = 0
  709.  
  710. self.refineDialog.Destroy()
  711. self.refineDialog = 0
  712.  
  713. self.attachMetinDialog.Destroy()
  714. self.attachMetinDialog = 0
  715.  
  716. self.tooltipItem = None
  717. self.wndCostume = 0
  718. self.wndItem = 0
  719. self.wndEquip = 0
  720. self.dlgPickMoney = 0
  721. self.wndMoney = 0
  722. self.wndMoneySlot = 0
  723. self.questionDialog = None
  724. self.mallButton = None
  725. self.DSSButton = None
  726. self.interface = None
  727.  
  728. if app.ENABLE_COINS_SYSTEM:
  729. self.coins = 0
  730. self.wndCoins = None
  731. self.wndCoinsIcon = None
  732. self.wndCoinsSlot = None
  733.  
  734. self.jd = 0
  735. self.wndJD = None
  736. self.wndJDIcon = None
  737. self.wndJDSlot = None
  738.  
  739. self.euro = 0
  740. self.wndEuro = None
  741. self.wndEuroIcon = None
  742. self.wndEuroSlot = None
  743.  
  744. if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  745. self.wndExpandedMoneyBar = None
  746.  
  747. if self.wndCostume:
  748. self.wndCostume.Destroy()
  749. self.wndCostume = 0
  750.  
  751. if self.wndBelt:
  752. self.wndBelt.Destroy()
  753. self.wndBelt = None
  754.  
  755. if self.wndSideBar:
  756. self.wndSideBar.Destroy()
  757. self.wndSideBar = None
  758.  
  759. self.inventoryTab = []
  760. self.equipmentTab = []
  761.  
  762. def Hide(self):
  763. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  764. self.OnCloseQuestionDialog()
  765. return
  766.  
  767. if self.tooltipItem is not None:
  768. self.tooltipItem.HideToolTip()
  769.  
  770. if self.wndCostume:
  771. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow()
  772. self.wndCostume.Hide()
  773.  
  774. if self.wndBelt:
  775. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory()
  776. print("Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory)
  777. self.wndBelt.Hide()
  778.  
  779. if self.dlgPickMoney:
  780. self.dlgPickMoney.Close()
  781.  
  782. if self.wndSideBar:
  783. self.wndSideBar.Close()
  784.  
  785. if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  786. if self.wndExpandedMoneyBar:
  787. self.wndExpandedMoneyBar.Close()
  788.  
  789. wndMgr.Hide(self.hWnd)
  790.  
  791. def Close(self):
  792. self.Hide()
  793.  
  794. if constInfo.ENABLE_EXPANDED_MONEY_TASKBAR:
  795. def SetExpandedMoneyBar(self, wndBar):
  796. self.wndExpandedMoneyBar = wndBar
  797.  
  798. if self.wndExpandedMoneyBar:
  799. if app.ENABLE_COINS_SYSTEM:
  800. self.wndCoinsSlot = self.wndExpandedMoneyBar.GetCoinsSlot()
  801. self.wndCoins = self.wndExpandedMoneyBar.GetCoins()
  802.  
  803. self.wndJDSlot = self.wndExpandedMoneyBar.GetJDSlot()
  804. self.wndJD = self.wndExpandedMoneyBar.GetJD()
  805.  
  806. self.wndEuroSlot = self.wndExpandedMoneyBar.GetEuroSlot()
  807. self.wndEuro = self.wndExpandedMoneyBar.GetEuro()
  808.  
  809. def SetInventoryPage(self, page):
  810. self.inventoryTab[self.inventoryPageIndex].SetUp()
  811. self.inventoryPageIndex = page
  812. self.inventoryTab[self.inventoryPageIndex].Down()
  813.  
  814. self.RefreshBagSlotWindow()
  815.  
  816. if app.EXCHANGE_CHECKIN_UPDATE:
  817. def SetExchangeWindow(self, wndExchange):
  818. self.wndExchange = wndExchange
  819.  
  820. def SetDiceWindow(self, wndDice):
  821. self.wndDice = wndDice
  822.  
  823. if app.ENABLE_HIGHLIGHT_SYSTEM:
  824. def HighlightSlot(self, slot):
  825. if not slot in self.listHighlightedSlot:
  826. self.listHighlightedSlot.append(slot)
  827.  
  828. def SetEquipmentPage(self, page):
  829. self.equipmentTab[self.equipmentPageIndex].SetUp()
  830. self.equipmentPageIndex = page
  831. self.equipmentTab[self.equipmentPageIndex].Down()
  832.  
  833. if page == 0:
  834. self.mask1.Show()
  835. self.mask2.Hide()
  836.  
  837. elif page == 1:
  838. self.mask1.Hide()
  839. self.mask2.Show()
  840.  
  841. self.RefreshEquipSlotWindow()
  842.  
  843. def OnRunMouseWheel(self, nLen):
  844. if nLen > 0:
  845. if self.equipmentPageIndex < 1:
  846. self.SetEquipmentPage(self.equipmentPageIndex + 1)
  847. else:
  848. if self.equipmentPageIndex > 0:
  849. self.SetEquipmentPage(self.equipmentPageIndex - 1)
  850.  
  851. def ClickMallButton(self):
  852. if FALSE == self.pannelWindow.IsShow():
  853. self.pannelWindow.Show()
  854. self.pannelWindow2.Show()
  855. self.pannelWindow3.Show()
  856. self.mallWindow.Show()
  857. self.safeboxWindow.Show()
  858. else:
  859. self.pannelWindow.Hide()
  860. self.pannelWindow2.Hide()
  861. self.pannelWindow3.Hide()
  862. self.mallWindow.Hide()
  863. self.safeboxWindow.Hide()
  864.  
  865. def OpenIs(self):
  866. self.mallWindow.Hide()
  867. self.pannelWindow.Hide()
  868. self.pannelWindow2.Hide()
  869. self.pannelWindow3.Hide()
  870. self.safeboxWindow.Hide()
  871.  
  872. net.SendChatPacket("/click_mall")
  873.  
  874. def _normal_mall(self):
  875. self.mallWindow.Hide()
  876. self.safeboxWindow.Hide()
  877. self.pannelWindow.Hide()
  878. self.pannelWindow2.Hide()
  879. self.pannelWindow3.Hide()
  880.  
  881. net.SendChatPacket("/click_safebox")
  882.  
  883. def ClickDSSButton(self):
  884. print "click_dss_button"
  885. self.interface.ToggleDragonSoulWindow()
  886.  
  887. def ClickCostumeButton(self):
  888. print "Click Costume Button"
  889. if self.wndCostume:
  890. if self.wndCostume.IsShow():
  891. self.wndCostume.Hide()
  892. else:
  893. self.wndCostume.Show()
  894. else:
  895. self.wndCostume = CostumeWindow(self)
  896. self.wndCostume.Show()
  897.  
  898. def OpenPickMoneyDialog(self):
  899.  
  900. if mouseModule.mouseController.isAttached():
  901.  
  902. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  903. if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  904.  
  905. if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  906. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  907. snd.PlaySound("sound/ui/money.wav")
  908.  
  909. mouseModule.mouseController.DeattachObject()
  910.  
  911. else:
  912. curMoney = player.GetElk()
  913.  
  914. if curMoney <= 0:
  915. return
  916.  
  917. self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  918. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  919. self.dlgPickMoney.Open(curMoney)
  920. self.dlgPickMoney.SetMax(7)
  921.  
  922. def OnPickMoney(self, money):
  923. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  924.  
  925. def OnPickItem(self, count):
  926. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  927. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  928. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  929.  
  930. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  931. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  932. return local
  933.  
  934. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  935.  
  936. def RefreshBagSlotWindow(self):
  937. getItemVNum = player.GetItemIndex
  938. getItemCount = player.GetItemCount
  939. setItemVNum = self.wndItem.SetItemSlot
  940.  
  941. for i in xrange(player.INVENTORY_PAGE_SIZE):
  942. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  943.  
  944. itemCount = getItemCount(slotNumber)
  945. if 0 == itemCount:
  946. self.wndItem.ClearSlot(i)
  947. continue
  948.  
  949. elif 1 == itemCount:
  950. itemCount = 0
  951.  
  952. itemVnum = getItemVNum(slotNumber)
  953. setItemVNum(i, itemVnum, itemCount)
  954.  
  955. if constInfo.IS_AUTO_POTION(itemVnum):
  956. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  957.  
  958. if slotNumber >= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex:
  959. slotNumber -= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex
  960.  
  961. isActivated = 0 != metinSocket[0]
  962.  
  963. if isActivated:
  964. self.wndItem.ActivateSlot(slotNumber)
  965. potionType = 0;
  966.  
  967. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  968. potionType = player.AUTO_POTION_TYPE_HP
  969.  
  970. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  971. potionType = player.AUTO_POTION_TYPE_SP
  972.  
  973. usedAmount = int(metinSocket[1])
  974. totalAmount = int(metinSocket[2])
  975. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  976.  
  977. else:
  978. self.wndItem.DeactivateSlot(slotNumber)
  979.  
  980. elif app.ENABLE_HIGHLIGHT_SYSTEM:
  981. if slotNumber in self.listHighlightedSlot:
  982. self.wndItem.ActivateSlot(slotNumber)
  983.  
  984. self.wndItem.RefreshSlot()
  985.  
  986. if self.wndBelt:
  987. self.wndBelt.RefreshSlot()
  988.  
  989. def RefreshEquipSlotWindow(self):
  990. getItemVNum = player.GetItemIndex
  991. getItemCount = player.GetItemCount
  992. setItemVNum = self.wndEquip.SetItemSlot
  993.  
  994. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  995. slotNumber = player.EQUIPMENT_SLOT_START + i
  996. itemCount = getItemCount(slotNumber)
  997.  
  998. if itemCount <= 1:
  999. itemCount = 0
  1000.  
  1001. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1002.  
  1003. for i in xrange(item.COSTUME_SLOT_COUNT):
  1004. slotNumber = item.COSTUME_SLOT_START + i
  1005. self.wndCostume.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  1006. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  1007.  
  1008. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1009. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1010. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1011.  
  1012. itemCount = getItemCount(slotNumber)
  1013. if itemCount <= 1:
  1014. itemCount = 0
  1015.  
  1016. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1017. print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  1018.  
  1019. self.wndEquip.RefreshSlot()
  1020.  
  1021. def RefreshItemSlot(self):
  1022. self.RefreshBagSlotWindow()
  1023. self.RefreshEquipSlotWindow()
  1024.  
  1025. def RefreshStatus(self):
  1026. money = player.GetElk()
  1027. self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  1028.  
  1029. if app.ENABLE_COINS_SYSTEM:
  1030. self.wndCoins.SetText('|cfff7bd48' + localeInfo.NumberToCoinsString(self.coins))
  1031. self.wndJD.SetText('|cfff7bd48' + localeInfo.NumberToCoinsString(self.jd, False, True))
  1032. self.wndEuro.SetText('|cff00ff00' + localeInfo.NumberToEuroString(self.euro))
  1033.  
  1034. def SetItemToolTip(self, tooltipItem):
  1035. self.tooltipItem = tooltipItem
  1036.  
  1037. def SellItem(self):
  1038. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  1039. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  1040. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  1041. snd.PlaySound("sound/ui/money.wav")
  1042.  
  1043. self.OnCloseQuestionDialog()
  1044.  
  1045. def OnDetachMetinFromItem(self):
  1046. if None == self.questionDialog:
  1047. return
  1048.  
  1049. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1050. self.OnCloseQuestionDialog()
  1051.  
  1052. def OnCloseQuestionDialog(self):
  1053. if not self.questionDialog:
  1054. return
  1055.  
  1056. self.questionDialog.Close()
  1057. self.questionDialog = None
  1058. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1059.  
  1060. def SelectEmptySlot(self, selectedSlotPos):
  1061. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1062. return
  1063.  
  1064. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  1065.  
  1066. if mouseModule.mouseController.isAttached():
  1067.  
  1068. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1069. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1070. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1071. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1072.  
  1073. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1074. itemCount = player.GetItemCount(attachedSlotPos)
  1075. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1076. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1077.  
  1078. if item.IsRefineScroll(attachedItemIndex):
  1079. self.wndItem.SetUseMode(False)
  1080.  
  1081. elif app.ENABLE_SWITCHBOT and player.SLOT_TYPE_SWITCHBOT == attachedSlotType:
  1082. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1083. net.SendItemMovePacket(player.SWITCHBOT, attachedSlotPos, player.INVENTORY, selectedSlotPos, attachedCount)
  1084.  
  1085. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  1086. mouseModule.mouseController.RunCallBack("INVENTORY")
  1087.  
  1088. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  1089. net.SendShopBuyPacket(attachedSlotPos)
  1090.  
  1091. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1092.  
  1093. if player.ITEM_MONEY == attachedItemIndex:
  1094. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1095. snd.PlaySound("sound/ui/money.wav")
  1096.  
  1097. else:
  1098. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1099.  
  1100. elif player.SLOT_TYPE_MALL == attachedSlotType:
  1101. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1102.  
  1103. mouseModule.mouseController.DeattachObject()
  1104.  
  1105. def SelectItemSlot(self, itemSlotIndex):
  1106. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1107. return
  1108.  
  1109. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1110.  
  1111. if mouseModule.mouseController.isAttached():
  1112. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1113. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1114. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1115.  
  1116. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1117. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1118.  
  1119. mouseModule.mouseController.DeattachObject()
  1120.  
  1121. else:
  1122.  
  1123. curCursorNum = app.GetCursor()
  1124. if app.SELL == curCursorNum:
  1125. self.__SellItem(itemSlotIndex)
  1126.  
  1127. elif app.BUY == curCursorNum:
  1128. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1129.  
  1130. elif app.IsPressed(app.DIK_LALT):
  1131. link = player.GetItemLink(itemSlotIndex)
  1132. ime.PasteString(link)
  1133.  
  1134. elif app.IsPressed(app.DIK_LSHIFT):
  1135. itemCount = player.GetItemCount(itemSlotIndex)
  1136.  
  1137. if itemCount > 1:
  1138. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1139. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1140. self.dlgPickMoney.Open(itemCount)
  1141. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1142. #else:
  1143. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1144. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1145.  
  1146. elif app.IsPressed(app.DIK_LCONTROL):
  1147. itemIndex = player.GetItemIndex(itemSlotIndex)
  1148.  
  1149. if True == item.CanAddToQuickSlotItem(itemIndex):
  1150. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1151. else:
  1152. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1153.  
  1154. else:
  1155. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1156. itemCount = player.GetItemCount(itemSlotIndex)
  1157. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1158.  
  1159. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1160. self.wndItem.SetUseMode(True)
  1161. else:
  1162. self.wndItem.SetUseMode(False)
  1163.  
  1164. snd.PlaySound("sound/ui/pick.wav")
  1165.  
  1166. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1167. if srcItemSlotPos == dstItemSlotPos:
  1168. return
  1169.  
  1170. elif item.IsRefineScroll(srcItemVID):
  1171. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1172. self.wndItem.SetUseMode(False)
  1173.  
  1174. elif item.IsMetin(srcItemVID):
  1175. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1176.  
  1177. elif item.IsDetachScroll(srcItemVID):
  1178. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1179.  
  1180. elif item.IsKey(srcItemVID):
  1181. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1182.  
  1183. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1184. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1185.  
  1186. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1187. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1188.  
  1189. else:
  1190. #snd.PlaySound("sound/ui/drop.wav")
  1191.  
  1192. if player.IsEquipmentSlot(dstItemSlotPos):
  1193.  
  1194. if item.IsEquipmentVID(srcItemVID):
  1195. self.__UseItem(srcItemSlotPos)
  1196.  
  1197. else:
  1198. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1199. #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1200.  
  1201. def __SellItem(self, itemSlotPos):
  1202. if not player.IsEquipmentSlot(itemSlotPos):
  1203. self.sellingSlotNumber = itemSlotPos
  1204. itemIndex = player.GetItemIndex(itemSlotPos)
  1205. itemCount = player.GetItemCount(itemSlotPos)
  1206.  
  1207. self.sellingSlotitemIndex = itemIndex
  1208. self.sellingSlotitemCount = itemCount
  1209.  
  1210. item.SelectItem(itemIndex)
  1211.  
  1212. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1213. popup = uiCommon.PopupDialog()
  1214. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1215. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1216. popup.Open()
  1217. self.popup = popup
  1218. return
  1219.  
  1220. itemPrice = item.GetISellItemPrice()
  1221.  
  1222. if item.Is1GoldItem():
  1223. itemPrice = itemCount / itemPrice / 5
  1224. else:
  1225. itemPrice = itemPrice * itemCount / 5
  1226.  
  1227. item.GetItemName(itemIndex)
  1228. itemName = item.GetItemName()
  1229.  
  1230. self.questionDialog = uiCommon.QuestionDialog()
  1231. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1232. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1233. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1234. self.questionDialog.Open()
  1235. self.questionDialog.count = itemCount
  1236.  
  1237. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1238.  
  1239. def __OnClosePopupDialog(self):
  1240. self.pop = None
  1241.  
  1242. def RefineItem(self, scrollSlotPos, targetSlotPos):
  1243.  
  1244. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1245. targetIndex = player.GetItemIndex(targetSlotPos)
  1246.  
  1247. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1248. return
  1249.  
  1250. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1251. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1252. return
  1253.  
  1254. #net.SendRequestRefineInfoPacket(targetSlotPos)
  1255. #return
  1256.  
  1257. result = player.CanRefine(scrollIndex, targetSlotPos)
  1258.  
  1259. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1260. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1261. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1262.  
  1263. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1264. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1265. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1266.  
  1267. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1268. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1269. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1270.  
  1271. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1272. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1273. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1274.  
  1275. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1276. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1277.  
  1278. if player.REFINE_OK != result:
  1279. return
  1280.  
  1281. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1282.  
  1283. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1284. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1285. targetIndex = player.GetItemIndex(targetSlotPos)
  1286.  
  1287. if not player.CanDetach(scrollIndex, targetSlotPos):
  1288. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1289. return
  1290.  
  1291. self.questionDialog = uiCommon.QuestionDialog()
  1292. self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1293. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1294. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1295. self.questionDialog.Open()
  1296. self.questionDialog.sourcePos = scrollSlotPos
  1297. self.questionDialog.targetPos = targetSlotPos
  1298.  
  1299. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1300. metinIndex = player.GetItemIndex(metinSlotPos)
  1301. targetIndex = player.GetItemIndex(targetSlotPos)
  1302.  
  1303. item.SelectItem(metinIndex)
  1304. itemName = item.GetItemName()
  1305.  
  1306. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1307.  
  1308. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1309. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1310.  
  1311. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1312. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1313.  
  1314. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1315. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1316.  
  1317. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1318. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1319.  
  1320. if player.ATTACH_METIN_OK != result:
  1321. return
  1322.  
  1323. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1324.  
  1325. def OverOutItem(self):
  1326. self.wndItem.SetUsableItem(False)
  1327.  
  1328. if None != self.tooltipItem:
  1329. self.tooltipItem.HideToolTip()
  1330.  
  1331. def OverInItem(self, overSlotPos):
  1332.  
  1333. if app.ENABLE_HIGHLIGHT_SYSTEM:
  1334. stat = 0
  1335. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1336. itemVnum = player.GetItemIndex(slotNumber)
  1337.  
  1338. if constInfo.IS_AUTO_POTION(itemVnum):
  1339. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1340.  
  1341. if slotNumber >= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex:
  1342. slotNumber -= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex
  1343.  
  1344. isActivated = 0 != metinSocket[0]
  1345.  
  1346. if isActivated:
  1347. stat = 1
  1348.  
  1349. if not stat:
  1350. self.wndItem.DeactivateSlot(overSlotPos)
  1351. try:
  1352. self.listHighlightedSlot.remove(slotNumber)
  1353.  
  1354. except:
  1355. pass
  1356.  
  1357. overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1358. self.wndItem.SetUsableItem(False)
  1359.  
  1360. if mouseModule.mouseController.isAttached():
  1361. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1362. if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1363.  
  1364. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1365. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1366.  
  1367. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1368. self.wndItem.SetUsableItem(True)
  1369. self.ShowToolTip(overSlotPos)
  1370.  
  1371. return
  1372.  
  1373. self.ShowToolTip(overSlotPos)
  1374.  
  1375. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1376. "다른 아이템에 사용할 수 있는 아이템인가?"
  1377.  
  1378. if item.IsRefineScroll(srcItemVNum):
  1379. return True
  1380.  
  1381. elif item.IsMetin(srcItemVNum):
  1382. return True
  1383.  
  1384. elif item.IsDetachScroll(srcItemVNum):
  1385. return True
  1386.  
  1387. elif item.IsKey(srcItemVNum):
  1388. return True
  1389.  
  1390. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1391. return True
  1392.  
  1393. else:
  1394. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1395. return True
  1396.  
  1397. return False
  1398.  
  1399. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1400. "대상 아이템에 사용할 수 있는가?"
  1401.  
  1402. if srcSlotPos == dstSlotPos:
  1403. return False
  1404.  
  1405. if item.IsRefineScroll(srcItemVNum):
  1406. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1407. return True
  1408.  
  1409. elif item.IsMetin(srcItemVNum):
  1410. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1411. return True
  1412.  
  1413. elif item.IsDetachScroll(srcItemVNum):
  1414. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1415. return True
  1416.  
  1417. elif item.IsKey(srcItemVNum):
  1418. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1419. return True
  1420.  
  1421. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1422. return True
  1423.  
  1424. else:
  1425. useType=item.GetUseType(srcItemVNum)
  1426.  
  1427. if "USE_CLEAN_SOCKET" == useType:
  1428. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1429. return True
  1430.  
  1431. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1432. if self.__CanChangeItemAttrList(dstSlotPos):
  1433. return True
  1434.  
  1435. elif "USE_ADD_ATTRIBUTE" == useType:
  1436. if self.__CanAddItemAttr(dstSlotPos):
  1437. return True
  1438.  
  1439. elif "USE_ADD_ATTRIBUTE2" == useType:
  1440. if self.__CanAddItemAttr(dstSlotPos):
  1441. return True
  1442.  
  1443. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1444. if self.__CanAddAccessorySocket(dstSlotPos):
  1445. return True
  1446.  
  1447. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1448. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1449. return TRUE;
  1450.  
  1451. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1452. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1453. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1454.  
  1455. item.SelectItem(dstItemVNum)
  1456.  
  1457. if item.ITEM_TYPE_BELT == item.GetItemType():
  1458. return True
  1459.  
  1460. return False
  1461.  
  1462. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1463. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1464. if dstItemVNum == 0:
  1465. return False
  1466.  
  1467. item.SelectItem(dstItemVNum)
  1468.  
  1469. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1470. return False
  1471.  
  1472. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1473. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1474. return True
  1475.  
  1476. return False
  1477.  
  1478. def __CanChangeItemAttrList(self, dstSlotPos):
  1479. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1480. if dstItemVNum == 0:
  1481. return False
  1482.  
  1483. item.SelectItem(dstItemVNum)
  1484.  
  1485. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1486. return False
  1487.  
  1488. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1489. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1490. return True
  1491.  
  1492. return False
  1493.  
  1494. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1495. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1496. if dstItemVNum == 0:
  1497. return False
  1498.  
  1499. item.SelectItem(dstItemVNum)
  1500.  
  1501. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1502. return False
  1503.  
  1504. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1505. return False
  1506.  
  1507. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1508. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1509.  
  1510. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1511. return False
  1512.  
  1513. if curCount>=maxCount:
  1514. return False
  1515.  
  1516. return True
  1517.  
  1518. def __CanAddAccessorySocket(self, dstSlotPos):
  1519. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1520. if dstItemVNum == 0:
  1521. return False
  1522.  
  1523. item.SelectItem(dstItemVNum)
  1524.  
  1525. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1526. return False
  1527.  
  1528. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1529. return False
  1530.  
  1531. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1532. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1533.  
  1534. ACCESSORY_SOCKET_MAX_SIZE = 3
  1535. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1536. return False
  1537.  
  1538. return True
  1539.  
  1540. def __CanAddItemAttr(self, dstSlotPos):
  1541. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1542. if dstItemVNum == 0:
  1543. return False
  1544.  
  1545. item.SelectItem(dstItemVNum)
  1546.  
  1547. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1548. return False
  1549.  
  1550. attrCount = 0
  1551. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1552. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1553. attrCount += 1
  1554.  
  1555. if attrCount<4:
  1556. return True
  1557.  
  1558. return False
  1559.  
  1560. def ShowToolTip(self, slotIndex):
  1561. itemVnum = player.GetItemIndex(slotIndex)
  1562.  
  1563. if None != self.tooltipItem:
  1564. self.tooltipItem.SetInventoryItem(slotIndex)
  1565.  
  1566. if not player.IsEquipmentSlot(slotIndex) and not item.IsAntiFlag(item.ANTIFLAG_GIVE):
  1567. if self.wndExchange.IsShow():
  1568. self.tooltipItem.AppendTradeableInformation()
  1569.  
  1570. if self.wndDice.IsShow():
  1571. self.tooltipItem.AppendTradeableInformation()
  1572.  
  1573. def OnTop(self):
  1574. if None != self.tooltipItem:
  1575. self.tooltipItem.SetTop()
  1576.  
  1577. def OnPressEscapeKey(self):
  1578. self.Close()
  1579. return True
  1580.  
  1581. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  1582. def RefreshVisibleCostume(self):
  1583. body = constInfo.HIDDEN_BODY_COSTUME
  1584. hair = constInfo.HIDDEN_HAIR_COSTUME
  1585. weapon = constInfo.HIDDEN_WEAPON_COSTUME
  1586.  
  1587. if body == 1:
  1588. self.visibleButtonList[0].SetToolTipText("Show")
  1589. self.visibleButtonList[0].Down()
  1590. else:
  1591. self.visibleButtonList[0].SetToolTipText("Hide")
  1592. self.visibleButtonList[0].SetUp()
  1593.  
  1594. if hair == 1:
  1595. self.visibleButtonList[1].SetToolTipText("Show")
  1596. self.visibleButtonList[1].Down()
  1597. else:
  1598. self.visibleButtonList[1].SetToolTipText("Hide")
  1599. self.visibleButtonList[1].SetUp()
  1600.  
  1601. if weapon == 1:
  1602. self.visibleButtonList[2].SetToolTipText("Show")
  1603. self.visibleButtonList[2].Down()
  1604. else:
  1605. self.visibleButtonList[2].SetToolTipText("Hide")
  1606. self.visibleButtonList[2].SetUp()
  1607.  
  1608. def VisibleCostume(self, part, hidden):
  1609. net.SendChatPacket("/hide_costume %d %d" % (part, hidden))
  1610.  
  1611. if app.ENABLE_COINS_SYSTEM:
  1612. def SetCoins(self, coins):
  1613. self.coins = coins
  1614.  
  1615. def SetJD(self, jd):
  1616. self.jd = jd
  1617.  
  1618. def SetEuro(self, euro):
  1619. self.euro = euro
  1620.  
  1621. def UseItemSlot(self, slotIndex):
  1622. curCursorNum = app.GetCursor()
  1623.  
  1624. if app.SELL == curCursorNum:
  1625. return
  1626.  
  1627. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1628. return
  1629.  
  1630. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1631.  
  1632. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1633. if self.wndDragonSoulRefine.IsShow():
  1634. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1635.  
  1636. return
  1637.  
  1638. if app.EXCHANGE_CHECKIN_UPDATE:
  1639. if self.wndExchange.IsShow() or self.wndDice.IsShow() and slotIndex < player.EQUIPMENT_SLOT_START:
  1640. for i in xrange(exchange.EXCHANGE_ITEM_MAX_NUM):
  1641. itemVnum = exchange.GetItemVnumFromSelf(i)
  1642.  
  1643. if itemVnum != 0:
  1644. continue
  1645.  
  1646. if not net.SendExchangeItemAddPacket(1, slotIndex, i):
  1647. continue
  1648. break
  1649.  
  1650. return
  1651.  
  1652. self.__UseItem(slotIndex)
  1653.  
  1654. mouseModule.mouseController.DeattachObject()
  1655.  
  1656. self.OverOutItem()
  1657.  
  1658. def __UseItem(self, slotIndex):
  1659. ItemVNum = player.GetItemIndex(slotIndex)
  1660. item.SelectItem(ItemVNum)
  1661.  
  1662. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1663. self.questionDialog = uiCommon.QuestionDialog()
  1664. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1665. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1666. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1667. self.questionDialog.Open()
  1668. self.questionDialog.slotIndex = slotIndex
  1669.  
  1670. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1671.  
  1672. else:
  1673. self.__SendUseItemPacket(slotIndex)
  1674.  
  1675. def __UseItemQuestionDialog_OnCancel(self):
  1676. self.OnCloseQuestionDialog()
  1677.  
  1678. def __UseItemQuestionDialog_OnAccept(self):
  1679. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1680. self.OnCloseQuestionDialog()
  1681.  
  1682. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1683. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1684. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1685. return
  1686.  
  1687. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1688.  
  1689. def __SendUseItemPacket(self, slotPos):
  1690. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1691. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1692. return
  1693.  
  1694. net.SendItemUsePacket(slotPos)
  1695.  
  1696. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1697. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1698. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1699. return
  1700.  
  1701. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1702.  
  1703. def __OverInButton(self, stat):
  1704. self.__ShowToolTip(self.BUTTON_TOOLTIP[stat])
  1705.  
  1706. def __OverOutButton(self):
  1707. self.__HideToolTip()
  1708.  
  1709. def __ShowToolTip(self, statDesc):
  1710. arglen = len(str(statDesc))
  1711.  
  1712. self.toolTip.SetThinBoardSize(8 * arglen)
  1713. self.toolTip.ClearToolTip()
  1714. self.toolTip.AppendTextLine(statDesc)
  1715. self.toolTip.Show()
  1716.  
  1717. def __HideToolTip(self):
  1718. self.toolTip.Hide()
  1719.  
  1720. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  1721. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1722. self.wndDragonSoulRefine = wndDragonSoulRefine
  1723.  
  1724. def OnMoveWindow(self, x, y):
  1725.  
  1726. if self.wndBelt:
  1727. self.wndBelt.AdjustPositionAndSize()
  1728.  
  1729. if self.wndSideBar:
  1730. self.wndSideBar.AdjustPosition()
  1731.  
Advertisement
Add Comment
Please, Sign In to add comment