Advertisement
Guest User

Untitled

a guest
Jan 4th, 2020
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 97.17 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. if app.ENABLE_BIOLOG_SYSTEM:
  9. import uiprofessionalbiolog, uiToolTip
  10. import player
  11. import chat
  12. import grp
  13. import uiScriptLocale
  14. import uiRefine
  15. import uiAttachMetin
  16. import uiPickMoney
  17. import uiCommon
  18. import uiPrivateShopBuilder
  19. import localeInfo
  20. import constInfo
  21. import ime
  22. import wndMgr
  23. import interfaceModule
  24. import background
  25. import event
  26. import exchange
  27. import uichestopen
  28. import uichangelook
  29.  
  30. ITEM_MALL_BUTTON_ENABLE = True
  31. if app.ENABLE_SASH_SYSTEM:
  32. import sash
  33.  
  34. ITEM_FLAG_APPLICABLE = 1 << 14
  35.  
  36. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  37. EX_INVEN_COVER_IMG_OPEN = "d:/ymir work/ui/ex_inven_cover_button_open.sub"
  38. EX_INVEN_COVER_IMG_CLOSE = "d:/ymir work/ui/ex_inven_cover_button_close.sub"
  39.  
  40. class CostumeWindow(ui.ScriptWindow):
  41.  
  42. def __init__(self, wndInventory):
  43. import exception
  44.  
  45. if not app.ENABLE_COSTUME_SYSTEM:
  46. exception.Abort("What do you do?")
  47. return
  48.  
  49. if not wndInventory:
  50. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  51. return
  52.  
  53. ui.ScriptWindow.__init__(self)
  54.  
  55. self.isLoaded = 0
  56. self.wndInventory = wndInventory;
  57. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  58. self.elemets_world = {}
  59.  
  60. self.__LoadWindow()
  61.  
  62. def __del__(self):
  63. ui.ScriptWindow.__del__(self)
  64.  
  65. def Show(self):
  66. self.__LoadWindow()
  67. self.RefreshCostumeSlot()
  68.  
  69. ui.ScriptWindow.Show(self)
  70.  
  71. def Close(self):
  72. self.Hide()
  73.  
  74. def __LoadWindow(self):
  75. if self.isLoaded == 1:
  76. return
  77.  
  78. self.isLoaded = 1
  79.  
  80. try:
  81. pyScrLoader = ui.PythonScriptLoader()
  82. pyScrLoader.LoadScriptFile(self, "uiscript/costumewindow.py")
  83. except:
  84. import exception
  85. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  86.  
  87. try:
  88. wndEquip = self.GetChild("CostumeSlot")
  89. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  90.  
  91. except:
  92. import exception
  93. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  94.  
  95. ## Equipment
  96. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  97. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  98. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  99. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  100. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  101. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  102.  
  103. self.wndEquip = wndEquip
  104.  
  105. def RefreshCostumeSlot(self):
  106. getItemVNum=player.GetItemIndex
  107.  
  108. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  109. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  110. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  111.  
  112. for i in xrange(item.COSTUME_SLOT_COUNT):
  113. slotNumber = item.COSTUME_SLOT_START + i
  114. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  115.  
  116. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  117. if player.GetItemLook(slotNumber):
  118. self.wndEquip.ShowChangeLookIcon(slotNumber)
  119. else:
  120. self.wndEquip.HideChangeLookIcon(slotNumber)
  121.  
  122. if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  123. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  124. costume_slot_weapon = item.COSTUME_SLOT_WEAPON
  125. itemTransmutedVnum = player.GetItemLook(costume_slot_weapon)
  126.  
  127. if itemTransmutedVnum:
  128. self.wndEquip.ShowChangeLookIcon(costume_slot_weapon)
  129. else:
  130. self.wndEquip.HideChangeLookIcon(costume_slot_weapon)
  131.  
  132. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  133. self.elemets_hide = self.wndInventory.get_costume_hide_list()
  134. self.ButtonsHideCostume()
  135. self.costume_hide_load()
  136.  
  137. # if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  138. # self.wndEquip.SetItemSlot(COSTUME_START_INDEX+4, getItemVNum(COSTUME_START_INDEX+4), 0)
  139.  
  140. self.wndEquip.RefreshSlot()
  141.  
  142. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  143. def ButtonsHideCostume(self):
  144. self.elemets_world["position"] = [
  145. [61,45],
  146. [61,8],
  147. [61,125],
  148. [13,13],
  149. ]
  150.  
  151. for i in xrange(self.GetSlotCount()):
  152. self.elemets_world["hide_button_%d"%i] = ui.Button()
  153. self.elemets_world["hide_button_%d"%i].SetParent(self)
  154. self.elemets_world["hide_button_%d"%i].SetPosition(self.elemets_world["position"][i][0]+12,self.elemets_world["position"][i][1]+37)
  155. self.elemets_world["hide_button_%d"%i].SetUpVisual("modulo/hidecostume/button_show_0.tga")
  156. self.elemets_world["hide_button_%d"%i].SetOverVisual("modulo/hidecostume/button_show_1.tga")
  157. self.elemets_world["hide_button_%d"%i].SetDownVisual("modulo/hidecostume/button_show_0.tga")
  158. self.elemets_world["hide_button_%d"%i].SetEvent(self.FuncHide,i)
  159. self.elemets_world["hide_button_%d"%i].Hide()
  160.  
  161. def FuncHide(self,index):
  162. net.SendChatPacket("/costume_hide %d" %index)
  163.  
  164. def costume_hide_load(self):
  165. for i in xrange(self.GetSlotCount()):
  166. if len(self.elemets_hide) > 0:
  167. self.elemets_world["hide_button_%d"%self.elemets_hide[i][0]].SetUpVisual("modulo/hidecostume/button_%s_0.tga"%self.ButtonInfoHide(self.elemets_hide[i][1]))
  168. self.elemets_world["hide_button_%d"%self.elemets_hide[i][0]].SetOverVisual("modulo/hidecostume/button_%s_1.tga"%self.ButtonInfoHide(self.elemets_hide[i][1]))
  169. self.elemets_world["hide_button_%d"%self.elemets_hide[i][0]].SetDownVisual("modulo/hidecostume/button_%s_0.tga"%self.ButtonInfoHide(self.elemets_hide[i][1]))
  170. self.elemets_world["hide_button_%d"%i].Show()
  171.  
  172. def ButtonInfoHide(self,index):
  173. if index == 0:
  174. return "show"
  175. return "hide"
  176.  
  177. def GetSlotCount(self):
  178. slot_total = 2
  179.  
  180. if app.ENABLE_HIDE_COSTUME_SYSTEM_ACCE:
  181. slot_total += 1
  182. if app.ENABLE_HIDE_COSTUME_SYSTEM_WEAPON_COSTUME:
  183. slot_total += 1
  184.  
  185. return slot_total
  186.  
  187. class BeltInventoryWindow(ui.ScriptWindow):
  188.  
  189. def __init__(self, wndInventory):
  190. import exception
  191.  
  192. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  193. exception.Abort("What do you do?")
  194. return
  195.  
  196. if not wndInventory:
  197. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  198. return
  199.  
  200. ui.ScriptWindow.__init__(self)
  201.  
  202. self.isLoaded = 0
  203. self.wndInventory = wndInventory;
  204.  
  205. self.wndBeltInventoryLayer = None
  206. self.wndBeltInventorySlot = None
  207. self.expandBtn = None
  208. self.minBtn = None
  209.  
  210. self.__LoadWindow()
  211.  
  212. def __del__(self):
  213. ui.ScriptWindow.__del__(self)
  214.  
  215. def Show(self, openBeltSlot = False):
  216. self.__LoadWindow()
  217. self.RefreshSlot()
  218.  
  219. ui.ScriptWindow.Show(self)
  220.  
  221. if openBeltSlot:
  222. self.OpenInventory()
  223. else:
  224. self.CloseInventory()
  225.  
  226. def Close(self):
  227. self.Hide()
  228.  
  229. def IsOpeningInventory(self):
  230. return self.wndBeltInventoryLayer.IsShow()
  231.  
  232. def OpenInventory(self):
  233. self.wndBeltInventoryLayer.Show()
  234. self.expandBtn.Hide()
  235.  
  236. self.AdjustPositionAndSize()
  237.  
  238. def CloseInventory(self):
  239. self.wndBeltInventoryLayer.Hide()
  240. self.expandBtn.Show()
  241.  
  242. self.AdjustPositionAndSize()
  243.  
  244. ## ÇöŔç ŔÎşĄĹ丮 Ŕ§Äˇ¸¦ ±âÁŘŔ¸·Î BASE Ŕ§Äˇ¸¦ °č»ę, ¸®ĹĎ.. ĽýŔÚ ÇϵĺÄÚµůÇϱâ Á¤¸» ˝ČÁö¸¸ ąćąýŔĚ ľř´Ů..
  245. if app.ENABLE_BIOLOG_SYSTEM:
  246. def GetBasePosition(self):
  247. x, y = self.wndInventory.GetGlobalPosition()
  248. return x - 148, y + 385
  249. else:
  250. def GetBasePosition(self):
  251. x, y = self.wndInventory.GetGlobalPosition()
  252. return x - 148, y + 241
  253.  
  254. def AdjustPositionAndSize(self):
  255. bx, by = self.GetBasePosition()
  256.  
  257. if self.IsOpeningInventory():
  258. self.SetPosition(bx, by)
  259. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  260.  
  261. else:
  262. self.SetPosition(bx + 138, by);
  263. self.SetSize(10, self.GetHeight())
  264.  
  265. def __LoadWindow(self):
  266. if self.isLoaded == 1:
  267. return
  268.  
  269. self.isLoaded = 1
  270.  
  271. try:
  272. pyScrLoader = ui.PythonScriptLoader()
  273. pyScrLoader.LoadScriptFile(self, "uiscript/beltinventorywindow.py")
  274. except:
  275. import exception
  276. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  277.  
  278. try:
  279. self.ORIGINAL_WIDTH = self.GetWidth()
  280. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  281. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  282. self.expandBtn = self.GetChild("ExpandBtn")
  283. self.minBtn = self.GetChild("MinimizeBtn")
  284.  
  285. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  286. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  287.  
  288. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  289. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  290.  
  291. except:
  292. import exception
  293. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  294.  
  295. ## Equipment
  296. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  297. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  298. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  299. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  300. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  301. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  302.  
  303. self.wndBeltInventorySlot = wndBeltInventorySlot
  304.  
  305. def RefreshSlot(self):
  306. getItemVNum=player.GetItemIndex
  307.  
  308. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  309. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  310. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  311. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, True)
  312.  
  313. avail = "0"
  314.  
  315. if player.IsAvailableBeltInventoryCell(slotNumber):
  316. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  317. else:
  318. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  319.  
  320. self.wndBeltInventorySlot.RefreshSlot()
  321.  
  322. if app.ENABLE_BIOLOG_SYSTEM:
  323. ###################################################################
  324. # title_name : Professional Biolog System
  325. # date_created : 2016.08.07
  326. # filename : uiInventory.py
  327. # author : VegaS
  328. # version_actual : Version 0.2.8
  329. #
  330. class CollectInventoryWindow(ui.ScriptWindow):
  331. def __init__(self, wndInventory):
  332. import exception
  333. if not wndInventory:
  334. exception.Abort("wndInventory parameter must be set to CollectInventoryWindow")
  335. return
  336. ui.ScriptWindow.__init__(self)
  337. self.isLoaded = 0
  338. self.updated = 0
  339. self.wndInventory = wndInventory;
  340. self.tooltipItem = uiToolTip.ItemToolTip()
  341. self.tooltipItem.Hide()
  342. self.wndBeltInventoryLayer = None
  343. self.wndBeltInventorySlot = None
  344. self.expandBtn = None
  345. self.minBtn = None
  346. self.gameWindow = None
  347. self.__LoadWindow()
  348.  
  349. def __del__(self):
  350. ui.ScriptWindow.__del__(self)
  351.  
  352. def Show(self, openBeltSlot = False):
  353. self.__LoadWindow()
  354. ui.ScriptWindow.Show(self)
  355.  
  356. if openBeltSlot:
  357. self.OpenInventory()
  358. else:
  359. self.CloseInventory()
  360.  
  361. def Close(self):
  362. self.Hide()
  363.  
  364. def IsOpeningInventory(self):
  365. return self.wndBeltInventoryLayer.IsShow()
  366.  
  367. def OpenInventory(self):
  368. self.wndBeltInventoryLayer.Show()
  369. self.expandBtn.Hide()
  370.  
  371. self.AdjustPositionAndSize()
  372.  
  373. def CloseInventory(self):
  374. self.wndBeltInventoryLayer.Hide()
  375. self.expandBtn.Show()
  376.  
  377. self.AdjustPositionAndSize()
  378.  
  379. def GetBasePosition(self):
  380. x, y = self.wndInventory.GetGlobalPosition()
  381. return x - 148, y + 260
  382.  
  383. def AdjustPositionAndSize(self):
  384. bx, by = self.GetBasePosition()
  385.  
  386. if self.IsOpeningInventory():
  387. self.SetPosition(bx, by)
  388. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  389. else:
  390. self.SetPosition(bx + 138, by);
  391. self.SetSize(10, self.GetHeight())
  392.  
  393. def __LoadWindow(self):
  394. if self.isLoaded == 1:
  395. return
  396.  
  397. self.isLoaded = 1
  398.  
  399. try:
  400. pyScrLoader = ui.PythonScriptLoader()
  401. pyScrLoader.LoadScriptFile(self, "uiscript/biolog_collectinventorywindow.py")
  402. except:
  403. import exception
  404. exception.Abort("CollectInventoryWindow.LoadWindow.LoadObject")
  405.  
  406. try:
  407. self.ORIGINAL_WIDTH = self.GetWidth()
  408. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  409. self.wndItem = self.GetChild("BeltInventorySlot")
  410. self.time_value = self.GetChild("time_value")
  411. self.biolog_count = self.GetChild("count_value")
  412. self.expandBtn = self.GetChild("ExpandBtn")
  413. self.minBtn = self.GetChild("MinimizeBtn")
  414. self.sendBtn = self.GetChild("send_biolog")
  415. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  416. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  417. self.wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  418. self.wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  419. except:
  420. import exception
  421. exception.Abort("CollectInventoryWindow.LoadWindow.BindObject")
  422.  
  423. if self.sendBtn:
  424. self.sendBtn.SetEvent(ui.__mem_func__(self.AcceptBiolog))
  425.  
  426. def SetItem(self, arg1, arg2, arg3):
  427. self.wndItem.SetItemSlot(0, int(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0]), 0)
  428.  
  429. def AcceptBiolog(self):
  430. net.SendChatPacket("/biolog")
  431.  
  432. def SetTime(self, time):
  433. time_collect = time - app.GetGlobalTimeStamp()
  434.  
  435. if time_collect < 0:
  436. time_collect = 0
  437.  
  438. if time_collect == 1:
  439. self.wndLeftTime = uiprofessionalbiolog.Biolog_TimeExpired()
  440. self.wndLeftTime.OpenWindow()
  441. self.wndLeftTime.Show()
  442.  
  443. self.time_value.SetText(localeInfo.FormatTime(time_collect))
  444.  
  445. def OnUpdate(self):
  446. self.SetTime(int(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["time"][0]))
  447. self.SetItem(0, uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0], 0)
  448. self.biolog_count.SetText(uiprofessionalbiolog.BIOLOG_BINARY_LOADED['countActual'][0] + "/" + uiprofessionalbiolog.BIOLOG_BINARY_LOADED['countNeed'][0])
  449.  
  450. def OverInItem(self):
  451. if uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0]:
  452. self.tooltipItem.SetItemToolTip(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0])
  453.  
  454. def OverOutItem(self):
  455. if self.tooltipItem:
  456. self.tooltipItem.HideToolTip()
  457.  
  458.  
  459. class InventoryWindow(ui.ScriptWindow):
  460.  
  461. 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")
  462.  
  463. questionDialog = None
  464. tooltipItem = None
  465. wndCostume = None
  466. wndBelt = None
  467. if app.ENABLE_BIOLOG_SYSTEM:
  468. wndCollect = None
  469. dlgPickMoney = None
  470. interface = None
  471. if app.WJ_ENABLE_TRADABLE_ICON:
  472. bindWnds = []
  473.  
  474. sellingSlotNumber = -1
  475. isLoaded = 0
  476. isOpenedCostumeWindowWhenClosingInventory = 0
  477. if app.ENABLE_BIOLOG_SYSTEM:
  478. isOpenedCollectWindowWhenClosingInventory = 0
  479. isOpenedBeltWindowWhenClosingInventory = 0
  480. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  481. changeLookSlots = []
  482.  
  483. def __init__(self):
  484. ui.ScriptWindow.__init__(self)
  485. self.OpenBoniSwitcherEvent = lambda : None
  486. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  487. self.elemets_hide = []
  488. self.__LoadWindow()
  489.  
  490. def __del__(self):
  491. ui.ScriptWindow.__del__(self)
  492.  
  493. def Show(self):
  494. self.__LoadWindow()
  495.  
  496. ui.ScriptWindow.Show(self)
  497.  
  498. # Costume System
  499. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  500. self.wndCostume.Show()
  501.  
  502. if app.ENABLE_BIOLOG_SYSTEM:
  503. if self.wndCollect:
  504. self.wndCollect.Show(self.isOpenedCollectWindowWhenClosingInventory)
  505.  
  506. # Belt System
  507. if self.wndBelt:
  508. self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  509.  
  510. def BindInterfaceClass(self, interface):
  511. self.interface = interface
  512.  
  513. if app.WJ_ENABLE_TRADABLE_ICON:
  514. def BindWindow(self, wnd):
  515. self.bindWnds.append(wnd)
  516.  
  517. def __LoadWindow(self):
  518. if self.isLoaded == 1:
  519. return
  520.  
  521. self.isLoaded = 1
  522.  
  523. try:
  524. pyScrLoader = ui.PythonScriptLoader()
  525. pyScrLoader.LoadScriptFile(self, "uiscript/inventorywindow.py")
  526. except:
  527. import exception
  528. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  529.  
  530. try:
  531. wndItem = self.GetChild("ItemSlot")
  532. wndEquip = self.GetChild("EquipmentSlot")
  533. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  534. self.wndMoney = self.GetChild("Money")
  535. self.wndMoneySlot = self.GetChild("Money_Slot")
  536. # self.mallButton = self.GetChild2("MallButton")
  537. self.DSSButton = self.GetChild2("DSSButton")
  538. self.costumeButton = self.GetChild2("CostumeButton")
  539. self.SeparateButton = self.GetChild2("SeparateButton")
  540. self.EfsunButton = self.GetChild2("EfsunButton")
  541. self.LagerButton = self.GetChild2("LagerButton")
  542. self.offlineShopButton = self.GetChild2("OfflineShopButton")
  543. self.boxopensystem = self.GetChild2("OpenBoxSystemButton")
  544. if app.ENABLE_DRAGON_SOUL_SYSTEM==0:
  545. self.DSSButton.Hide()
  546.  
  547. self.Sil_Slot = self.GetChild2("Sil_Slot")
  548.  
  549. #self.Alaska_py = self.GetChild2("Alaska_py")
  550. #self.Telep = self.GetChild2("Telep")
  551. #self.Switchbot = self.GetChild2("Switchbot")
  552. #self.depozit_index = self.GetChild2("depozit_index")
  553. #self.StatusUp = self.GetChild2("StatusUp")
  554.  
  555.  
  556. self.inventoryTab = []
  557. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  558. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  559. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  560. self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  561.  
  562. self.equipmentTab = []
  563. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  564. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  565.  
  566. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  567. self.__CreateExtendInvenButton()
  568. self.ExInvenQuestionDlg = uiCommon.QuestionDialog()
  569. self.ExInvenQuestionDlg.Close()
  570. self.pop = None
  571.  
  572. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  573. self.costumeButton.Hide()
  574. self.costumeButton.Destroy()
  575. self.costumeButton = 0
  576.  
  577. # Belt Inventory Window
  578. #self.separateButton = None
  579.  
  580. #if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  581. #self.wndBelt = BeltInventoryWindow(self)
  582.  
  583. if app.ENABLE_BIOLOG_SYSTEM:
  584. self.wndCollect = None
  585. self.wndCollect = CollectInventoryWindow(self)
  586.  
  587. self.chestsystem = uichestopen.ChestDropWindow()
  588.  
  589. except:
  590. import exception
  591. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  592.  
  593. ## Item
  594. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  595. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  596. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  597. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  598. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  599. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  600.  
  601. ## Equipment
  602. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  603. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  604. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  605. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  606. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  607. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  608.  
  609. ## PickMoneyDialog
  610. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  611. dlgPickMoney.LoadDialog()
  612. dlgPickMoney.Hide()
  613.  
  614. ## RefineDialog
  615. self.refineDialog = uiRefine.RefineDialog()
  616. self.refineDialog.Hide()
  617.  
  618. ## AttachMetinDialog
  619. if app.WJ_ENABLE_TRADABLE_ICON:
  620. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog(self)
  621. self.BindWindow(self.attachMetinDialog)
  622. else:
  623. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  624. self.attachMetinDialog.Hide()
  625.  
  626. ## MoneySlot
  627. self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  628.  
  629. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  630. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  631. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  632. self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  633. self.inventoryTab[0].Down()
  634.  
  635. self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  636. self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  637. self.equipmentTab[0].Down()
  638. self.equipmentTab[0].Hide()
  639. self.equipmentTab[1].Hide()
  640.  
  641. self.wndItem = wndItem
  642. self.wndEquip = wndEquip
  643. self.dlgPickMoney = dlgPickMoney
  644.  
  645. # MallButton
  646. # if self.mallButton:
  647. # self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  648.  
  649. if self.DSSButton:
  650. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  651.  
  652. # Costume Button
  653. if self.costumeButton:
  654. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  655.  
  656. # Offline Shop Button
  657. if (self.Sil_Slot):
  658. self.Sil_Slot.SetEvent(ui.__mem_func__(self.ClickSil_Slot))
  659.  
  660.  
  661. if self.EfsunButton:
  662. self.EfsunButton.SetEvent(ui.__mem_func__(self.__EfsunButton))
  663.  
  664. if self.LagerButton:
  665. self.LagerButton.SetEvent(ui.__mem_func__(self.__LagerButton))
  666.  
  667. if self.SeparateButton:
  668. self.SeparateButton.SetEvent(ui.__mem_func__(self.__CustomeEvent))
  669.  
  670. if self.boxopensystem:
  671. self.boxopensystem.SetEvent(ui.__mem_func__(self.__BoxOpenSystem))
  672.  
  673.  
  674. self.wndCostume = None
  675. self.listUnusableSlot = []
  676.  
  677. ## Refresh
  678. if app.ENABLE_SASH_SYSTEM:
  679. self.listAttachedSashs = []
  680. self.SetInventoryPage(0)
  681. self.SetEquipmentPage(0)
  682. self.RefreshItemSlot()
  683. self.RefreshStatus()
  684.  
  685. def Destroy(self):
  686. self.ClearDictionary()
  687.  
  688. self.dlgPickMoney.Destroy()
  689. self.dlgPickMoney = 0
  690.  
  691. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  692. self.ExInvenButton = []
  693. if self.ExInvenQuestionDlg:
  694. self.ExInvenQuestionDlg.Close()
  695.  
  696. self.refineDialog.Destroy()
  697. self.refineDialog = 0
  698.  
  699. self.attachMetinDialog.Destroy()
  700. self.attachMetinDialog = 0
  701.  
  702. self.tooltipItem = None
  703. self.wndItem = 0
  704. self.wndEquip = 0
  705. self.dlgPickMoney = 0
  706. self.wndMoney = 0
  707. self.wndMoneySlot = 0
  708. self.questionDialog = None
  709. # self.mallButton = None
  710. self.boxopensystem = None
  711. self.SeparateButton = None
  712. self.DSSButton = None
  713. self.interface = None
  714. if app.WJ_ENABLE_TRADABLE_ICON:
  715. self.bindWnds = []
  716.  
  717. if self.wndCostume:
  718. self.wndCostume.Destroy()
  719. self.wndCostume = 0
  720.  
  721. if self.wndBelt:
  722. self.wndBelt.Destroy()
  723. self.wndBelt = None
  724.  
  725. if app.ENABLE_BIOLOG_SYSTEM:
  726. if self.wndCollect:
  727. self.wndCollect.Destroy()
  728. self.wndCollect = None
  729.  
  730. self.inventoryTab = []
  731. self.equipmentTab = []
  732. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  733. self.changeLookSlots = []
  734.  
  735. def Hide(self):
  736. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  737. self.OnCloseQuestionDialog()
  738. return
  739. if None != self.tooltipItem:
  740. self.tooltipItem.HideToolTip()
  741.  
  742. if self.wndCostume:
  743. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow() # ŔÎşĄĹ丮 âŔĚ ´ÝČú ¶§ ÄÚ˝şĂőŔĚ ż­·Á ŔÖľú´Â°ˇ?
  744. self.wndCostume.Close()
  745.  
  746. if app.ENABLE_BIOLOG_SYSTEM:
  747. if self.wndCollect:
  748. self.isOpenedCollectWindowWhenClosingInventory = self.wndCollect.IsOpeningInventory()
  749. print "Is opening Biolog Inventory", self.isOpenedCollectWindowWhenClosingInventory
  750. self.wndCollect.Close()
  751.  
  752. if self.wndBelt:
  753. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # ŔÎşĄĹ丮 âŔĚ ´ÝČú ¶§ ş§Ć® ŔÎşĄĹ丮µµ ż­·Á ŔÖľú´Â°ˇ?
  754. print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  755. self.wndBelt.Close()
  756.  
  757. if self.dlgPickMoney:
  758. self.dlgPickMoney.Close()
  759.  
  760. self.OnCloseQuestionDialog()
  761.  
  762. wndMgr.Hide(self.hWnd)
  763.  
  764.  
  765. def Close(self):
  766. self.Hide()
  767.  
  768. def SetInventoryPage(self, page):
  769. self.inventoryPageIndex = page
  770. self.inventoryTab[(page+1)%4].SetUp()
  771. self.inventoryTab[(page+2)%4].SetUp()
  772. self.inventoryTab[(page+3)%4].SetUp()
  773. self.RefreshBagSlotWindow()
  774.  
  775. def SetEquipmentPage(self, page):
  776. self.equipmentPageIndex = page
  777. self.equipmentTab[1-page].SetUp()
  778. self.RefreshEquipSlotWindow()
  779.  
  780. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  781. def __CreateExtendInvenButton(self):
  782. parent = self.GetChild("board")
  783. self.ExInvenButton = []
  784. start_x = 8
  785. start_y = 278
  786. img_height = 32
  787. for button_index in range(player.INVENTORY_LOCKED_PAGE_COUNT*9):
  788. ex_inven_button = ui.Button()
  789. increase_y = img_height * (button_index % 9)
  790. ex_inven_button.SetParent(parent)
  791. ex_inven_button.SetPosition(start_x, start_y + increase_y )
  792. ex_inven_button.SetUpVisual(EX_INVEN_COVER_IMG_CLOSE)
  793. ex_inven_button.SetOverVisual(EX_INVEN_COVER_IMG_CLOSE)
  794. ex_inven_button.SetDownVisual(EX_INVEN_COVER_IMG_CLOSE)
  795. ex_inven_button.SetDisableVisual(EX_INVEN_COVER_IMG_CLOSE)
  796. ex_inven_button.SetEvent(ui.__mem_func__(self.__ClickExtendInvenButton), button_index)
  797. ex_inven_button.Hide()
  798. self.ExInvenButton.append(ex_inven_button)
  799.  
  800. def __ClickExtendInvenButton(self, index):
  801. if index >= len(self.ExInvenButton):
  802. self.__OpenExInvenMsgDlg(localeInfo.EXINVEN_USE_ITEM_FAIL_FOURTH_PAGE_STAGE_MAX)
  803. return
  804. if self.ExInvenQuestionDlg and index == player.GetExtendInvenStage():
  805. needkeys = []
  806. for n in range(player.INVENTORY_NEED_KEY_START, (player.INVENTORY_LOCKED_PAGE_COUNT*player.INVENTORY_NEED_KEY_INCREASE)+2):
  807. for i in range(3):
  808. needkeys.append(n)
  809. self.ExInvenQuestionDlg.SetText(localeInfo.EXINVEN_USE_ITEM_QUESTION % needkeys[index])
  810. self.ExInvenQuestionDlg.SetAcceptEvent(ui.__mem_func__(self.__AcceptExInvenItemUse))
  811. self.ExInvenQuestionDlg.SetCancelEvent(ui.__mem_func__(self.__CancelExInvenItemUse))
  812. w,h = self.ExInvenQuestionDlg.GetTextSize()
  813. self.ExInvenQuestionDlg.SetWidth( w + 40 )
  814. self.ExInvenQuestionDlg.Open()
  815. def __HideAllExtendInvenButton(self):
  816. for index in range( len(self.ExInvenButton) ):
  817. self.ExInvenButton[index].Hide()
  818. def __ShowExtendInvenButton(self, cur_stage):
  819. if self.inventoryPageIndex < player.INVENTORY_OPEN_PAGE_COUNT:
  820. return
  821. count = 9
  822. min_range = (self.inventoryPageIndex - player.INVENTORY_OPEN_PAGE_COUNT) * count
  823. max_range = min_range + count
  824. for button_index in range(min_range, max_range):
  825. if button_index == cur_stage:
  826. self.ExInvenButton[button_index].SetUpVisual(EX_INVEN_COVER_IMG_OPEN)
  827. self.ExInvenButton[button_index].SetOverVisual(EX_INVEN_COVER_IMG_OPEN)
  828. self.ExInvenButton[button_index].SetDownVisual(EX_INVEN_COVER_IMG_OPEN)
  829. self.ExInvenButton[button_index].SetDisableVisual(EX_INVEN_COVER_IMG_OPEN)
  830. if button_index < cur_stage:
  831. self.ExInvenButton[button_index].Hide()
  832. else:
  833. self.ExInvenButton[button_index].Show()
  834. def __RefreshExinvenCoverSlot(self):
  835. self.__HideAllExtendInvenButton()
  836. self.__ShowExtendInvenButton(player.GetExtendInvenStage())
  837. def __AcceptExInvenItemUse(self):
  838. net.Envanter_genislet()
  839. self.ExInvenQuestionDlg.Close()
  840. def __CancelExInvenItemUse(self):
  841. self.ExInvenQuestionDlg.Close()
  842. def __OpenExInvenMsgDlg(self, msg):
  843. popup = uiCommon.PopupDialog()
  844. popup.SetText(msg)
  845. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  846. w,h = popup.GetTextSize()
  847. popup.SetWidth( w + 40 )
  848. popup.Open()
  849. if self.pop:
  850. self.pop.Destroy()
  851. self.pop = popup
  852. def OpenExInvenFallShortCountMsgDlg(self, enough_count):
  853. popup = uiCommon.PopupDialog()
  854. popup.SetText(localeInfo.EXINVEN_USE_ITEM_FAIL_FALL_SHORT % int(enough_count) )
  855. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  856. popup.Open()
  857. if self.pop:
  858. self.pop.Destroy()
  859. self.pop = popup
  860.  
  861. def __LagerButton(self):
  862. self.choix = ui.BoardWithTitleBar()
  863. self.choix.SetSize(265, 80)
  864. self.choix.SetCenterPosition()
  865. self.choix.AddFlag('float')
  866. self.choix.AddFlag('movable')
  867. self.choix.SetTitleName("Select Storage")
  868. self.choix.Show()
  869.  
  870. self.SpezialLager = ui.Button()
  871. self.SpezialLager.SetEvent(self._spezial_alger)
  872. self.SpezialLager.SetParent(self.choix)
  873. self.SpezialLager.SetPosition(35, 40)
  874. self.SpezialLager.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
  875. self.SpezialLager.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
  876. self.SpezialLager.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
  877. self.SpezialLager.SetText("Special")
  878. self.SpezialLager.SetToolTipText("Open Special Storage")
  879. self.SpezialLager.Show()
  880.  
  881. self.EntrepotIs = ui.Button()
  882. self.EntrepotIs.SetEvent(self.OpenIs)
  883. self.EntrepotIs.SetParent(self.choix)
  884. self.EntrepotIs.SetPosition(105, 40)
  885. self.EntrepotIs.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
  886. self.EntrepotIs.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
  887. self.EntrepotIs.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
  888. self.EntrepotIs.SetText("ItemShop")
  889. self.EntrepotIs.SetToolTipText("Open ItemShop Storage")
  890. self.EntrepotIs.Show()
  891.  
  892. self.Magasinier = ui.Button()
  893. self.Magasinier.SetEvent(self._normal_mall)
  894. self.Magasinier.SetParent(self.choix)
  895. self.Magasinier.SetPosition(175, 40)
  896. self.Magasinier.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
  897. self.Magasinier.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
  898. self.Magasinier.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
  899. self.Magasinier.SetText("Normal")
  900. self.Magasinier.SetToolTipText("Open Normales Storage")
  901. self.Magasinier.Show()
  902.  
  903. def OpenIs(self):
  904. self.EntrepotIs.Hide()
  905. self.choix.Hide()
  906. self.Magasinier.Hide()
  907. net.SendChatPacket("/click_mall")
  908.  
  909. def _normal_mall(self):
  910. self.EntrepotIs.Hide()
  911. self.Magasinier.Hide()
  912. self.choix.Hide()
  913. net.SendChatPacket("/click_safebox")
  914.  
  915. def _spezial_alger(self):
  916. self.EntrepotIs.Hide()
  917. self.Magasinier.Hide()
  918. self.choix.Hide()
  919. self.SpezialLager.Hide()
  920. if self.interface:
  921. self.interface.ToggleExtendedInventoryWindow()
  922.  
  923. def ClickLagerButton(self):
  924. import event
  925. qid = constInfo.mallqin
  926. event.QuestButtonClick(qid)
  927.  
  928. # def ClickMallButton(self):
  929. # self.interface.ToggleDragonSoulWindow()
  930.  
  931. def ClickDSSButton(self):
  932. if self.interface:
  933. self.interface.ToggleExtendedInventoryWindow()
  934.  
  935. def __EfsunButton(self):
  936. import switchbot
  937. switchbot.Bot().Show()
  938.  
  939. def __BoxOpenSystem(self):
  940. if constInfo.CHEST_SYSTEM == 0:
  941. self.chestsystem.Show()
  942. constInfo.CHEST_SYSTEM = 1
  943. else:
  944. self.chestsystem.Close()
  945. constInfo.CHEST_SYSTEM = 0
  946.  
  947.  
  948. def ClickSil_Slot(self):
  949. import uiAchievements
  950. self.achievement = uiAchievements.AchievementWindow()
  951. self.achievement.Open()
  952.  
  953. def ClickCostumeButton(self):
  954. print "Click Costume Button"
  955. if self.wndCostume:
  956. if self.wndCostume.IsShow():
  957. self.wndCostume.Hide()
  958. else:
  959. self.wndCostume.Show()
  960. else:
  961. self.wndCostume = CostumeWindow(self)
  962. self.wndCostume.Show()
  963.  
  964. #def ClickAlaska_py(self):
  965. # import uibonuspage
  966. # uibonuspage.BonusBoardDialog().Show()
  967.  
  968. #Telep
  969. #def ClickTelep(self):
  970. # import event
  971. # qid = constInfo.Telepqin
  972. # event.QuestButtonClick(qid)
  973.  
  974. #Telep
  975. #def Clickdepozit_index(self):
  976. # import event
  977. # qid = constInfo.Depoport
  978. # event.QuestButtonClick(qid)
  979.  
  980. #def ClickSwitchbot(self):
  981. # import switchbot
  982. # switchbot.Bot().Show()
  983.  
  984. #def ClickStatusUp(self):
  985. # import uistatusup
  986. # uistatusup.StatusUp().Show()
  987.  
  988.  
  989. def OpenPickMoneyDialog(self):
  990.  
  991. if mouseModule.mouseController.isAttached():
  992.  
  993. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  994. if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  995.  
  996. if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  997. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  998. snd.PlaySound("sound/ui/money.wav")
  999.  
  1000. mouseModule.mouseController.DeattachObject()
  1001.  
  1002. else:
  1003. curMoney = player.GetElk()
  1004.  
  1005. if curMoney <= 0:
  1006. return
  1007.  
  1008. self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  1009. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  1010. self.dlgPickMoney.Open(curMoney)
  1011. self.dlgPickMoney.SetMax(7) # ŔÎşĄĹ丮 990000 Á¦ÇŃ ąö±× ĽöÁ¤
  1012.  
  1013. def OnPickMoney(self, money):
  1014. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  1015.  
  1016. def OnPickItem(self, count):
  1017. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  1018. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1019. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  1020.  
  1021. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  1022. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  1023. return local
  1024.  
  1025. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  1026.  
  1027. def GetInventoryPageIndex(self):
  1028. return self.inventoryPageIndex
  1029.  
  1030. if app.WJ_ENABLE_TRADABLE_ICON:
  1031. def RefreshMarkSlots(self, localIndex=None):
  1032. if not self.interface:
  1033. return
  1034.  
  1035. onTopWnd = self.interface.GetOnTopWindow()
  1036. if localIndex:
  1037. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(localIndex)
  1038. if onTopWnd == player.ON_TOP_WND_NONE:
  1039. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1040.  
  1041. elif onTopWnd == player.ON_TOP_WND_SHOP:
  1042. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  1043. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1044. else:
  1045. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1046.  
  1047. elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  1048. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  1049. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1050. else:
  1051. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1052.  
  1053. elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  1054. if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  1055. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1056. else:
  1057. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1058.  
  1059. elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  1060. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  1061. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1062. else:
  1063. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1064.  
  1065. return
  1066.  
  1067. for i in xrange(player.INVENTORY_PAGE_SIZE):
  1068. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1069.  
  1070. if onTopWnd == player.ON_TOP_WND_NONE:
  1071. self.wndItem.SetUsableSlotOnTopWnd(i)
  1072.  
  1073. elif onTopWnd == player.ON_TOP_WND_SHOP:
  1074. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  1075. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1076. else:
  1077. self.wndItem.SetUsableSlotOnTopWnd(i)
  1078.  
  1079. elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  1080. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  1081. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1082. else:
  1083. self.wndItem.SetUsableSlotOnTopWnd(i)
  1084.  
  1085. elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  1086. if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  1087. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1088. else:
  1089. self.wndItem.SetUsableSlotOnTopWnd(i)
  1090.  
  1091. elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  1092. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  1093. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1094. else:
  1095. self.wndItem.SetUsableSlotOnTopWnd(i)
  1096.  
  1097. def RefreshBagSlotWindow(self):
  1098. getItemVNum=player.GetItemIndex
  1099. getItemCount=player.GetItemCount
  1100. setItemVNum=self.wndItem.SetItemSlot
  1101. for i in xrange(player.INVENTORY_PAGE_SIZE):
  1102. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1103. itemCount = getItemCount(slotNumber)
  1104. # itemCount == 0ŔĚ¸é ĽŇÄĎŔ» şńżî´Ů.
  1105. if 0 == itemCount:
  1106. self.wndItem.ClearSlot(i)
  1107. continue
  1108. elif 1 == itemCount:
  1109. itemCount = 0
  1110.  
  1111. itemVnum = getItemVNum(slotNumber)
  1112. setItemVNum(i, itemVnum, itemCount)
  1113.  
  1114. ## ŔÚµżą°ľŕ (HP: #72723 ~ #72726, SP: #72727 ~ #72730) ĆŻĽöĂł¸® - ľĆŔĚĹŰŔεĄµµ ˝˝·Ôżˇ Č°ĽşČ­/şńČ°ĽşČ­ ÇĄ˝Ă¸¦ Ŕ§ÇŃ ŔŰľ÷ŔÓ - [hyo]
  1115. if constInfo.IS_AUTO_POTION(itemVnum):
  1116. # metinSocket - [0] : Č°ĽşČ­ ż©şÎ, [1] : »çżëÇŃ ľç, [2] : ĂÖ´ë żë·®
  1117. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1118.  
  1119. if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  1120. slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  1121.  
  1122. isActivated = 0 != metinSocket[0]
  1123.  
  1124. if isActivated:
  1125. #self.wndItem.ActivateSlot(slotNumber)
  1126. self.wndItem.ActivateSlot(slotNumber, (32.00 / 255.0), (178.00 / 255.0), (170.00 / 255.0), 1.0)
  1127. potionType = 0;
  1128. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  1129. potionType = player.AUTO_POTION_TYPE_HP
  1130. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  1131. potionType = player.AUTO_POTION_TYPE_SP
  1132.  
  1133. usedAmount = int(metinSocket[1])
  1134. totalAmount = int(metinSocket[2])
  1135. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  1136.  
  1137. else:
  1138. self.wndItem.DeactivateSlot(slotNumber)
  1139.  
  1140. if app.ENABLE_SASH_SYSTEM:
  1141. slotNumberChecked = 0
  1142. if not constInfo.IS_AUTO_POTION(itemVnum):
  1143. self.wndItem.DeactivateSlot(i)
  1144.  
  1145. for j in xrange(sash.WINDOW_MAX_MATERIALS):
  1146. (isHere, iCell) = sash.GetAttachedItem(j)
  1147. if isHere:
  1148. if iCell == slotNumber:
  1149. self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
  1150. if not slotNumber in self.listAttachedSashs:
  1151. self.listAttachedSashs.append(slotNumber)
  1152.  
  1153. slotNumberChecked = 1
  1154. else:
  1155. if slotNumber in self.listAttachedSashs and not slotNumberChecked:
  1156. self.wndItem.DeactivateSlot(i)
  1157. self.listAttachedSashs.remove(slotNumber)
  1158.  
  1159. if app.WJ_ENABLE_TRADABLE_ICON:
  1160. self.RefreshMarkSlots(i)
  1161.  
  1162. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  1163. slotNumberChecked = 0
  1164.  
  1165. if slotNumber in self.changeLookSlots:
  1166. #self.wndItem.ActivateSlot(i)
  1167. self.wndItem.ActivateSlot(slotNumber, (32.00 / 255.0), (178.00 / 255.0), (170.00 / 255.0), 1.0)
  1168. slotNumberChecked = 1
  1169. else:
  1170. if slotNumber in self.changeLookSlots and not slotNumberChecked:
  1171. self.wndItem.DeactivateSlot(i)
  1172.  
  1173. if player.GetItemLook(slotNumber):
  1174. self.wndItem.ShowChangeLookIcon(i)
  1175. else:
  1176. self.wndItem.HideChangeLookIcon(i)
  1177.  
  1178. if app.NEW_TAU_DRAGON_POTION_EFFECT:
  1179. if constInfo.IS_NEW_SPEED_POTION(itemVnum):
  1180. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1181.  
  1182. if slotNumber >= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex:
  1183. slotNumber -= player.INVENTORY_PAGE_SIZE * self.inventoryPageIndex
  1184.  
  1185. isActivated = 0 != metinSocket[0]
  1186.  
  1187. if isActivated:
  1188. #self.wndItem.ActivateSlot(i)
  1189. self.wndItem.ActivateSlot(slotNumber, (32.00 / 255.0), (178.00 / 255.0), (170.00 / 255.0), 1.0)
  1190. else:
  1191. self.wndItem.DeactivateSlot(i)
  1192.  
  1193. self.wndItem.RefreshSlot()
  1194.  
  1195. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  1196. self.__RefreshExinvenCoverSlot()
  1197.  
  1198. if self.wndBelt:
  1199. self.wndBelt.RefreshSlot()
  1200.  
  1201. if app.WJ_ENABLE_TRADABLE_ICON:
  1202. map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  1203.  
  1204. def RefreshEquipSlotWindow(self):
  1205. getItemVNum=player.GetItemIndex
  1206. getItemCount=player.GetItemCount
  1207. setItemVNum=self.wndEquip.SetItemSlot
  1208. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  1209. slotNumber = player.EQUIPMENT_SLOT_START + i
  1210. itemCount = getItemCount(slotNumber)
  1211. if itemCount <= 1:
  1212. itemCount = 0
  1213. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1214. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  1215. if player.GetItemLook(player.EQUIPMENT, slotNumber):
  1216. self.wndEquip.ShowChangeLookIcon(slotNumber)
  1217. else:
  1218. self.wndEquip.HideChangeLookIcon(slotNumber)
  1219.  
  1220. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1221. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1222. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1223. itemCount = getItemCount(slotNumber)
  1224. if itemCount <= 1:
  1225. itemCount = 0
  1226. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1227. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  1228. if player.GetItemLook(player.EQUIPMENT, slotNumber):
  1229. self.wndEquip.ShowChangeLookIcon(slotNumber)
  1230. else:
  1231. self.wndEquip.HideChangeLookIcon(slotNumber)
  1232.  
  1233. self.wndEquip.RefreshSlot()
  1234.  
  1235. if self.wndCostume:
  1236. self.wndCostume.RefreshCostumeSlot()
  1237.  
  1238. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  1239. def costume_hide_clear(self):
  1240. self.elemets_hide = []
  1241.  
  1242. def costume_hide_list(self,slot,index):
  1243. self.elemets_hide.append([int(slot),int(index)])
  1244.  
  1245. def costume_hide_load(self):
  1246. if self.wndCostume:
  1247. self.wndCostume.costume_hide_load()
  1248.  
  1249. def get_costume_hide_list(self):
  1250. return self.elemets_hide
  1251.  
  1252. def RefreshItemSlot(self):
  1253. self.RefreshBagSlotWindow()
  1254. self.RefreshEquipSlotWindow()
  1255.  
  1256. def RefreshStatus(self):
  1257. money = player.GetElk()
  1258. self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  1259.  
  1260. def SetItemToolTip(self, tooltipItem):
  1261. self.tooltipItem = tooltipItem
  1262.  
  1263. def SellItem(self):
  1264. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  1265. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  1266. ## żëČĄĽ®µµ Ćȸ®°Ô ÇĎ´Â ±â´É Ăß°ˇÇϸ鼭 ŔÎŔÚ type Ăß°ˇ
  1267. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  1268. snd.PlaySound("sound/ui/money.wav")
  1269. self.OnCloseQuestionDialog()
  1270.  
  1271. def OnDetachMetinFromItem(self):
  1272. if None == self.questionDialog:
  1273. return
  1274.  
  1275. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1276. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1277. self.OnCloseQuestionDialog()
  1278.  
  1279. def OnCloseQuestionDialog(self):
  1280. if not self.questionDialog:
  1281. return
  1282.  
  1283. self.questionDialog.Close()
  1284. self.questionDialog = None
  1285. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1286.  
  1287. ## Slot Event
  1288. def SelectEmptySlot(self, selectedSlotPos):
  1289. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1290. return
  1291.  
  1292. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  1293.  
  1294. if mouseModule.mouseController.isAttached():
  1295.  
  1296. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1297. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1298. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1299. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1300.  
  1301. if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType or player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or player.SLOT_TYPE_BONI_INVENTORY == attachedSlotType or player.SLOT_TYPE_ETC_INVENTORY == attachedSlotType:
  1302. itemCount = player.GetItemCount(attachedSlotPos)
  1303. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1304. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1305.  
  1306. if item.IsRefineScroll(attachedItemIndex):
  1307. self.wndItem.SetUseMode(False)
  1308.  
  1309. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  1310. mouseModule.mouseController.RunCallBack("INVENTORY")
  1311. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  1312. net.SendShopBuyPacket(attachedSlotPos)
  1313.  
  1314. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1315.  
  1316. if player.ITEM_MONEY == attachedItemIndex:
  1317. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1318. snd.PlaySound("sound/ui/money.wav")
  1319.  
  1320. else:
  1321. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1322.  
  1323. elif player.SLOT_TYPE_MALL == attachedSlotType:
  1324. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1325.  
  1326. mouseModule.mouseController.DeattachObject()
  1327.  
  1328. def SelectItemSlot(self, itemSlotIndex):
  1329. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1330. return
  1331.  
  1332. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1333.  
  1334. if mouseModule.mouseController.isAttached():
  1335. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1336. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1337. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1338.  
  1339. if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or player.SLOT_TYPE_BONI_INVENTORY == attachedSlotType or player.SLOT_TYPE_ETC_INVENTORY == attachedSlotType:
  1340. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1341.  
  1342. mouseModule.mouseController.DeattachObject()
  1343.  
  1344. else:
  1345.  
  1346. curCursorNum = app.GetCursor()
  1347. if app.SELL == curCursorNum:
  1348. self.__SellItem(itemSlotIndex)
  1349.  
  1350. elif app.BUY == curCursorNum:
  1351. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1352.  
  1353. elif app.IsPressed(app.DIK_LALT):
  1354. link = player.GetItemLink(itemSlotIndex)
  1355. ime.PasteString(link)
  1356.  
  1357. elif app.IsPressed(app.DIK_LSHIFT):
  1358. itemCount = player.GetItemCount(itemSlotIndex)
  1359.  
  1360. if itemCount > 1:
  1361. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1362. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1363. self.dlgPickMoney.Open(itemCount)
  1364. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1365. else:
  1366. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1367. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1368.  
  1369. elif app.IsPressed(app.DIK_LCONTROL):
  1370. itemIndex = player.GetItemIndex(itemSlotIndex)
  1371.  
  1372. if True == item.CanAddToQuickSlotItem(itemIndex):
  1373. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1374. else:
  1375. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1376.  
  1377. else:
  1378. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1379. itemCount = player.GetItemCount(itemSlotIndex)
  1380. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1381.  
  1382. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1383. self.wndItem.SetUseMode(True)
  1384. else:
  1385. self.wndItem.SetUseMode(False)
  1386.  
  1387. snd.PlaySound("sound/ui/pick.wav")
  1388.  
  1389. def UseTransportBox(self):
  1390. self.__SendUseItemToItemPacket(self.questionDialog.src, self.questionDialog.dst)
  1391. self.OnCloseQuestionDialog()
  1392.  
  1393. def UseProtein(self):
  1394. self.__SendUseItemToItemPacket(self.questionDialog.src, self.questionDialog.dst)
  1395. self.OnCloseQuestionDialog()
  1396.  
  1397. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1398. if srcItemSlotPos == dstItemSlotPos:
  1399. return
  1400. elif srcItemVID == player.GetItemIndex(dstItemSlotPos):
  1401. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1402. return
  1403.  
  1404. if app.ENABLE_CHANGE_LOOK_SYSTEM and srcItemVID == 72325:
  1405. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1406.  
  1407. # if srcItemVID == 25040:
  1408. # self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1409. # self.wndItem.SetUseMode(False)
  1410.  
  1411.  
  1412. if srcItemVID >= 55701 and srcItemVID <= 55705 and player.GetItemIndex(dstItemSlotPos) == 55002:
  1413. self.questionDialog = uiCommon.QuestionDialog()
  1414. self.questionDialog.SetText("You want Transport the Pet?")
  1415. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseTransportBox))
  1416. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1417. self.questionDialog.Open()
  1418. self.questionDialog.src = srcItemSlotPos
  1419. self.questionDialog.dst = dstItemSlotPos
  1420.  
  1421. if srcItemVID == 55001 and player.GetItemIndex(dstItemSlotPos) >= 55701 and player.GetItemIndex(dstItemSlotPos) <= 55706:
  1422. self.questionDialog = uiCommon.QuestionDialog()
  1423. self.questionDialog.SetText("Do you want to feed the Pet?")
  1424. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseProtein))
  1425. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1426. self.questionDialog.Open()
  1427. self.questionDialog.src = srcItemSlotPos
  1428. self.questionDialog.dst = dstItemSlotPos
  1429.  
  1430. elif item.IsRefineScroll(srcItemVID):
  1431. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1432. self.wndItem.SetUseMode(False)
  1433.  
  1434. elif item.IsMetin(srcItemVID):
  1435. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1436.  
  1437. elif item.IsCostumeScroll(srcItemVID):
  1438. self.CostumeMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1439.  
  1440. elif item.IsDetachScroll(srcItemVID):
  1441. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1442. elif item.IsKey(srcItemVID):
  1443. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1444. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1445. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1446. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1447. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1448. else:
  1449. if player.IsEquipmentSlot(dstItemSlotPos):
  1450. if item.IsEquipmentVID(srcItemVID):
  1451. self.__UseItem(srcItemSlotPos)
  1452. else:
  1453. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1454.  
  1455. def __SellItem(self, itemSlotPos):
  1456. if not player.IsEquipmentSlot(itemSlotPos):
  1457. self.sellingSlotNumber = itemSlotPos
  1458. itemIndex = player.GetItemIndex(itemSlotPos)
  1459. itemCount = player.GetItemCount(itemSlotPos)
  1460.  
  1461. self.sellingSlotitemIndex = itemIndex
  1462. self.sellingSlotitemCount = itemCount
  1463.  
  1464. item.SelectItem(itemIndex)
  1465. ## ľČĆĽ ÇĂ·ą±× °Ë»ç şüÁ®Ľ­ Ăß°ˇ
  1466. ## 20140220
  1467. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1468. popup = uiCommon.PopupDialog()
  1469. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1470. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1471. popup.Open()
  1472. self.popup = popup
  1473. return
  1474.  
  1475. itemPrice = item.GetISellItemPrice()
  1476.  
  1477. if item.Is1GoldItem():
  1478. itemPrice = itemCount / itemPrice
  1479. else:
  1480. itemPrice = itemPrice * itemCount
  1481.  
  1482. item.GetItemName(itemIndex)
  1483. itemName = item.GetItemName()
  1484.  
  1485. self.questionDialog = uiCommon.QuestionDialog()
  1486. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1487. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1488. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1489. self.questionDialog.Open()
  1490. self.questionDialog.count = itemCount
  1491.  
  1492. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1493.  
  1494. def __OnClosePopupDialog(self):
  1495. self.pop = None
  1496.  
  1497. def RefineItem(self, scrollSlotPos, targetSlotPos):
  1498.  
  1499. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1500. targetIndex = player.GetItemIndex(targetSlotPos)
  1501.  
  1502. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1503. return
  1504.  
  1505. if app.ENABLE_REFINE_RENEWAL:
  1506. constInfo.AUTO_REFINE_TYPE = 1
  1507. constInfo.AUTO_REFINE_DATA["ITEM"][0] = scrollSlotPos
  1508. constInfo.AUTO_REFINE_DATA["ITEM"][1] = targetSlotPos
  1509.  
  1510. ###########################################################
  1511. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1512. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1513. return
  1514. ###########################################################
  1515.  
  1516. ###########################################################
  1517. #net.SendRequestRefineInfoPacket(targetSlotPos)
  1518. #return
  1519. ###########################################################
  1520.  
  1521. result = player.CanRefine(scrollIndex, targetSlotPos)
  1522.  
  1523. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1524. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1525. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1526.  
  1527. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1528. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1529. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1530.  
  1531. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1532. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1533. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1534.  
  1535. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1536. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1537. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1538.  
  1539. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1540. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1541.  
  1542. if player.REFINE_OK != result:
  1543. return
  1544.  
  1545. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1546.  
  1547. def CostumeMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1548. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1549. targetIndex = player.GetItemIndex(targetSlotPos)
  1550.  
  1551. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1552.  
  1553. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1554. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1555. targetIndex = player.GetItemIndex(targetSlotPos)
  1556. if app.ENABLE_SASH_SYSTEM:
  1557. if not player.CanDetach(scrollIndex, targetSlotPos):
  1558. item.SelectItem(scrollIndex)
  1559. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1560. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SASH_FAILURE_CLEAN)
  1561. else:
  1562. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1563.  
  1564. return
  1565. else:
  1566. if not player.CanDetach(scrollIndex, targetSlotPos):
  1567. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1568. return
  1569.  
  1570. self.questionDialog = uiCommon.QuestionDialog()
  1571. self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1572. if app.ENABLE_SASH_SYSTEM:
  1573. item.SelectItem(targetIndex)
  1574. if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_SASH:
  1575. item.SelectItem(scrollIndex)
  1576. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1577. self.questionDialog.SetText(localeInfo.SASH_DO_YOU_CLEAN)
  1578.  
  1579. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1580. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1581. self.questionDialog.Open()
  1582. self.questionDialog.sourcePos = scrollSlotPos
  1583. self.questionDialog.targetPos = targetSlotPos
  1584.  
  1585. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1586. metinIndex = player.GetItemIndex(metinSlotPos)
  1587. targetIndex = player.GetItemIndex(targetSlotPos)
  1588.  
  1589. item.SelectItem(metinIndex)
  1590. itemName = item.GetItemName()
  1591.  
  1592. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1593.  
  1594. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1595. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1596.  
  1597. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1598. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1599.  
  1600. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1601. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1602.  
  1603. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1604. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1605.  
  1606. if player.ATTACH_METIN_OK != result:
  1607. return
  1608.  
  1609. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1610.  
  1611. def OverOutItem(self):
  1612. self.wndItem.SetUsableItem(False)
  1613. if None != self.tooltipItem:
  1614. self.tooltipItem.HideToolTip()
  1615.  
  1616. def OverInItem(self, overSlotPos):
  1617. overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1618. self.wndItem.SetUsableItem(False)
  1619.  
  1620. if mouseModule.mouseController.isAttached():
  1621. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1622. if attachedItemType in (player.SLOT_TYPE_INVENTORY, player.SLOT_TYPE_STONE_INVENTORY, player.SLOT_TYPE_BONI_INVENTORY, player.SLOT_TYPE_ETC_INVENTORY, ):
  1623. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1624. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1625.  
  1626. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1627. if attachedItemType in (player.SLOT_TYPE_INVENTORY, player.SLOT_TYPE_STONE_INVENTORY, player.SLOT_TYPE_BONI_INVENTORY, player.SLOT_TYPE_ETC_INVENTORY, ):
  1628. self.wndItem.SetUseMode(True)
  1629.  
  1630. self.wndItem.SetUsableItem(True)
  1631. self.ShowToolTip(overSlotPos)
  1632. return
  1633.  
  1634. self.ShowToolTip(overSlotPos)
  1635.  
  1636. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1637.  
  1638. if srcItemVNum >= 55701 and srcItemVNum <= 55706:
  1639. return True
  1640.  
  1641. if srcItemVNum == 55001:
  1642. return True
  1643. if app.ENABLE_CHANGE_LOOK_SYSTEM and (srcItemVNum == 72325):
  1644. return True
  1645. if item.IsRefineScroll(srcItemVNum):
  1646. return True
  1647. elif item.IsMetin(srcItemVNum):
  1648. return True
  1649. elif item.IsCostumeScroll(srcItemVNum):
  1650. return True
  1651. elif item.IsDetachScroll(srcItemVNum):
  1652. return True
  1653. elif item.IsKey(srcItemVNum):
  1654. return True
  1655. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1656. return True
  1657. else:
  1658. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1659. return True
  1660.  
  1661. return False
  1662.  
  1663. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1664. "´ë»ó ľĆŔĚĹŰżˇ »çżëÇŇ Ľö Ŕִ°ˇ?"
  1665.  
  1666. if srcItemVNum >= 55701 and srcItemVNum <= 55706 and player.GetItemIndex(dstSlotPos) == 55002:
  1667. return True
  1668.  
  1669. if srcItemVNum == 55001 and player.GetItemIndex(dstSlotPos) >= 55701 and player.GetItemIndex(dstSlotPos) <= 55706:
  1670. return True
  1671.  
  1672. if srcSlotPos == dstSlotPos:
  1673. return False
  1674.  
  1675.  
  1676. elif item.IsRefineScroll(srcItemVNum):
  1677. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1678. return True
  1679. elif srcItemVNum == player.GetItemIndex(dstSlotPos):
  1680. if player.GetItemCount(dstSlotPos) < 200:
  1681. return True
  1682. elif app.ENABLE_CHANGE_LOOK_SYSTEM and (srcItemVNum == 72325) and player.GetItemLook(dstSlotPos):
  1683. return True
  1684. elif item.IsMetin(srcItemVNum):
  1685. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1686. return True
  1687. elif item.IsCostumeScroll(srcItemVNum):
  1688. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1689. return True
  1690. elif item.IsDetachScroll(srcItemVNum):
  1691. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1692. return True
  1693. elif item.IsKey(srcItemVNum):
  1694. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1695. return True
  1696.  
  1697. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1698. return True
  1699.  
  1700. else:
  1701. useType=item.GetUseType(srcItemVNum)
  1702.  
  1703. if "USE_CLEAN_SOCKET" == useType:
  1704. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1705. return True
  1706. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1707. if srcItemVNum == 70063 or srcItemVNum == 70064 or srcItemVNum == 70065 or srcItemVNum == 70066:
  1708. if self.__CanChangeCostumeAttrList(dstSlotPos):
  1709. return True
  1710. else:
  1711. if self.__CanChangeItemAttrList(dstSlotPos):
  1712. return True
  1713. elif "USE_ADD_ATTRIBUTE" == useType:
  1714. if self.__CanAddItemAttr(dstSlotPos):
  1715. return True
  1716. elif "USE_ADD_ATTRIBUTE2" == useType:
  1717. if self.__CanAddItemAttr(dstSlotPos):
  1718. return True
  1719. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1720. if self.__CanAddAccessorySocket(dstSlotPos):
  1721. return True
  1722. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1723. # if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1724. return True;
  1725. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1726. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1727. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1728.  
  1729. item.SelectItem(dstItemVNum)
  1730.  
  1731. if item.ITEM_TYPE_BELT == item.GetItemType():
  1732. return True
  1733.  
  1734. return False
  1735.  
  1736. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1737. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1738. if dstItemVNum == 0:
  1739. return False
  1740.  
  1741. item.SelectItem(dstItemVNum)
  1742.  
  1743. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1744. return False
  1745.  
  1746. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1747. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1748. return True
  1749.  
  1750. return False
  1751.  
  1752. def __CanChangeItemAttrList(self, dstSlotPos):
  1753. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1754. if dstItemVNum == 0:
  1755. return False
  1756.  
  1757. item.SelectItem(dstItemVNum)
  1758.  
  1759. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1760. return False
  1761.  
  1762. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1763. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1764. return True
  1765.  
  1766. return False
  1767.  
  1768. def __CanChangeCostumeAttrList(self, dstSlotPos):
  1769. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1770. if dstItemVNum == 0:
  1771. return False
  1772.  
  1773. item.SelectItem(dstItemVNum)
  1774.  
  1775. if item.GetItemType() == item.ITEM_TYPE_COSTUME:
  1776. return True
  1777.  
  1778. return False
  1779.  
  1780. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1781. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1782. if dstItemVNum == 0:
  1783. return False
  1784.  
  1785. item.SelectItem(dstItemVNum)
  1786.  
  1787. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1788. return False
  1789.  
  1790. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1791. return False
  1792.  
  1793. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1794. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1795.  
  1796. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1797. return False
  1798.  
  1799. if curCount>=maxCount:
  1800. return False
  1801.  
  1802. return True
  1803.  
  1804. def __CanAddAccessorySocket(self, dstSlotPos):
  1805. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1806. if dstItemVNum == 0:
  1807. return False
  1808.  
  1809. item.SelectItem(dstItemVNum)
  1810.  
  1811. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1812. return False
  1813.  
  1814. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1815. return False
  1816.  
  1817. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1818. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1819.  
  1820. ACCESSORY_SOCKET_MAX_SIZE = 3
  1821. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1822. return False
  1823.  
  1824. return True
  1825.  
  1826. def __CanAddItemAttr(self, dstSlotPos):
  1827. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1828. if dstItemVNum == 0:
  1829. return False
  1830.  
  1831. item.SelectItem(dstItemVNum)
  1832.  
  1833. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1834. return False
  1835.  
  1836. attrCount = 0
  1837. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1838. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1839. attrCount += 1
  1840.  
  1841. if attrCount<5:
  1842. return True
  1843.  
  1844. return False
  1845.  
  1846. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  1847. def SetChangeLookSlot(self, slot):
  1848. if not slot in self.changeLookSlots:
  1849. self.changeLookSlots.append(slot)
  1850.  
  1851. def UnsetChangeLookSlot(self, slot):
  1852. self.changeLookSlots.remove(slot)
  1853.  
  1854. def ShowToolTip(self, slotIndex):
  1855. if None != self.tooltipItem:
  1856. self.tooltipItem.SetInventoryItem(slotIndex)
  1857.  
  1858. def OnTop(self):
  1859. if app.WJ_ENABLE_TRADABLE_ICON:
  1860. map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  1861. self.RefreshMarkSlots()
  1862. if None != self.tooltipItem:
  1863. self.tooltipItem.SetTop()
  1864.  
  1865. def OnPressEscapeKey(self):
  1866. self.Close()
  1867. return True
  1868.  
  1869. def UseItemSlot(self, slotIndex):
  1870. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS():
  1871. return
  1872.  
  1873. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1874. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1875. if self.wndDragonSoulRefine.IsShow():
  1876. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1877. return
  1878.  
  1879. if app.ENABLE_SASH_SYSTEM:
  1880. if self.isShowSashWindow():
  1881. sash.Add(player.INVENTORY, slotIndex, 255)
  1882. return
  1883.  
  1884. if app.ENABLE_CHANGE_LOOK_SYSTEM:
  1885. if self.interface.wndChangeLook.IsShow():
  1886. self.interface.wndChangeLook.SelectEmptySlot(slotIndex)
  1887. return
  1888.  
  1889. self.__UseItem(slotIndex)
  1890. mouseModule.mouseController.DeattachObject()
  1891. self.OverOutItem()
  1892.  
  1893. def SetOpenBoniSwitcherEvent(self, event):
  1894. self.OpenBoniSwitcherEvent = ui.__mem_func__(event)
  1895.  
  1896. def __GetCurrentItemGrid(self):
  1897. itemGrid = [[False for slot in xrange(player.INVENTORY_PAGE_SIZE)] for page in xrange(player.INVENTORY_PAGE_COUNT)]
  1898.  
  1899. for page in xrange(player.INVENTORY_PAGE_COUNT):
  1900. for slot in xrange(player.INVENTORY_PAGE_SIZE):
  1901. itemVnum = player.GetItemIndex(slot + page * player.INVENTORY_PAGE_SIZE)
  1902. if itemVnum <> 0:
  1903. (w, h) = item.GetItemSize(item.SelectItem(itemVnum))
  1904. for i in xrange(h):
  1905. itemGrid[page][slot + i * 5] = True
  1906.  
  1907. return itemGrid
  1908.  
  1909. def __FindEmptyCellForSize(self, itemGrid, size):
  1910. for page in xrange(player.INVENTORY_PAGE_COUNT):
  1911. for slot in xrange(player.INVENTORY_PAGE_SIZE):
  1912. if itemGrid[page][slot] == False:
  1913. possible = True
  1914. for i in xrange(size):
  1915. p = slot + (i * 5)
  1916.  
  1917. try:
  1918. if itemGrid[page][p] == True:
  1919. possible = False
  1920. break
  1921. except IndexError:
  1922. possible = False
  1923. break
  1924.  
  1925. if possible:
  1926. return slot + page * player.INVENTORY_PAGE_SIZE
  1927.  
  1928. return -1
  1929.  
  1930. def AttachItemFromSafebox(self, slotIndex, itemIndex):
  1931. itemGrid = self.__GetCurrentItemGrid()
  1932.  
  1933. if item.GetItemType(item.SelectItem(itemIndex)) == item.ITEM_TYPE_DS:
  1934. return
  1935.  
  1936. emptySlotIndex = self.__FindEmptyCellForSize(itemGrid, item.GetItemSize()[1])
  1937. if emptySlotIndex <> -1:
  1938. net.SendSafeboxCheckoutPacket(slotIndex, player.INVENTORY, emptySlotIndex)
  1939.  
  1940. return True
  1941.  
  1942. def __UseItem(self, slotIndex):
  1943. if self.interface and self.interface.AttachInvenItemToOtherWindowSlot(player.INVENTORY, slotIndex):#slotIndex is the argument of __UseItem
  1944. return
  1945. ItemVNum = player.GetItemIndex(slotIndex)
  1946. item.SelectItem(ItemVNum)
  1947.  
  1948. if player.IsExtendInvenKey(ItemVNum) and app.ENABLE_EXTEND_INVEN_SYSTEM:
  1949. self.__ClickExtendInvenButton(player.GetExtendInvenStage())
  1950.  
  1951. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1952. self.questionDialog = uiCommon.QuestionDialog()
  1953. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1954. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1955. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1956. self.questionDialog.Open()
  1957. self.questionDialog.slotIndex = slotIndex
  1958.  
  1959. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1960.  
  1961. elif item.GetItemType() == 23:
  1962. if app.ENABLE_SHOW_CHEST_DROP:
  1963. if self.interface:
  1964. if self.interface.dlgChestDrop:
  1965. if not self.interface.dlgChestDrop.IsShow():
  1966. self.interface.dlgChestDrop.Open(slotIndex)
  1967. net.SendChestDropInfo(slotIndex)
  1968.  
  1969. else:
  1970. self.__SendUseItemPacket(slotIndex)
  1971.  
  1972. def __UseItemQuestionDialog_OnCancel(self):
  1973. self.OnCloseQuestionDialog()
  1974.  
  1975. def __UseItemQuestionDialog_OnAccept(self):
  1976. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1977. self.OnCloseQuestionDialog()
  1978.  
  1979. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1980. # °łŔλóÁˇ ż­°í ŔÖ´Â µżľČ ľĆŔĚĹŰ »çżë ąćÁö
  1981. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1982. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1983. return
  1984.  
  1985. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1986.  
  1987. def __SendUseItemPacket(self, slotPos):
  1988. # °łŔλóÁˇ ż­°í ŔÖ´Â µżľČ ľĆŔĚĹŰ »çżë ąćÁö
  1989. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1990. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1991. return
  1992. net.SendItemUsePacket(slotPos)
  1993.  
  1994. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1995. # °łŔλóÁˇ ż­°í ŔÖ´Â µżľČ ľĆŔĚĹŰ »çżë ąćÁö
  1996. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1997. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1998. return
  1999.  
  2000. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  2001.  
  2002. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  2003. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  2004. self.wndDragonSoulRefine = wndDragonSoulRefine
  2005.  
  2006. if app.ENABLE_SASH_SYSTEM:
  2007. def SetSashWindow(self, wndSashCombine, wndSashAbsorption):
  2008. self.wndSashCombine = wndSashCombine
  2009. self.wndSashAbsorption = wndSashAbsorption
  2010.  
  2011. def isShowSashWindow(self):
  2012. if self.wndSashCombine:
  2013. if self.wndSashCombine.IsShow():
  2014. return 1
  2015.  
  2016. if self.wndSashAbsorption:
  2017. if self.wndSashAbsorption.IsShow():
  2018. return 1
  2019.  
  2020. return 0
  2021.  
  2022. def OnMoveWindow(self, x, y):
  2023. if self.wndBelt:
  2024. self.wndBelt.AdjustPositionAndSize()
  2025.  
  2026. if app.ENABLE_BIOLOG_SYSTEM:
  2027. if self.wndCollect:
  2028. self.wndCollect.AdjustPositionAndSize()
  2029.  
  2030. def __CustomeEvent(self):
  2031. net.SendChatPacket("/item_check")
  2032.  
  2033. if app.WJ_SPLIT_INVENTORY_SYSTEM:
  2034. class ExtendedInventoryWindow(ui.ScriptWindow):
  2035. tooltipItem = None
  2036. interface = None
  2037. dlgPickMoney = None
  2038. dlgPickItem = None
  2039. sellingSlotNumber = -1
  2040. isLoaded = 0
  2041.  
  2042. def __init__(self):
  2043. ui.ScriptWindow.__init__(self)
  2044. self.inventoryPageIndex = 0
  2045. self.__LoadWindow()
  2046.  
  2047. def __del__(self):
  2048. ui.ScriptWindow.__del__(self)
  2049.  
  2050. def Show(self):
  2051. self.__LoadWindow()
  2052. ui.ScriptWindow.Show(self)
  2053.  
  2054. def BindInterfaceClass(self, interface):
  2055. self.interface = interface
  2056.  
  2057. def __LoadWindow(self):
  2058. if self.isLoaded == 1:
  2059. return
  2060.  
  2061. self.isLoaded = 1
  2062.  
  2063. try:
  2064. pyScrLoader = ui.PythonScriptLoader()
  2065. pyScrLoader.LoadScriptFile(self, "UIScript/extendedinventorywindow.py")
  2066. except:
  2067. import exception
  2068. exception.Abort("ExtendedInventoryWindow.LoadWindow.LoadObject")
  2069.  
  2070. try:
  2071. wndItem = self.GetChild("ItemSlot")
  2072. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  2073. self.titleName = self.GetChild("TitleName")
  2074. self.SkillBookButton = self.GetChild("SkillBookButton")
  2075. self.UpgradeItemsButton = self.GetChild("UpgradeItemsButton")
  2076. self.stoneButton = self.GetChild("StoneButton")
  2077. self.boniButton = self.GetChild("BoniButton")
  2078. self.EtcButton = self.GetChild("EtcButton")
  2079. self.inventoryTab = []
  2080. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  2081. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  2082. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  2083. self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  2084. self.inventoryTab.append(self.GetChild("Inventory_Tab_05"))
  2085. self.inventoryTab.append(self.GetChild("Inventory_Tab_06"))
  2086. except:
  2087. import exception
  2088. exception.Abort("ExtendedInventoryWindow.LoadWindow.BindObject")
  2089.  
  2090. ## Item
  2091. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  2092. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  2093. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  2094. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  2095. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  2096. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  2097.  
  2098. self.SkillBookButton.SetEvent(lambda arg=0: self.SetInventoryType(arg))
  2099. self.UpgradeItemsButton.SetEvent(lambda arg=1: self.SetInventoryType(arg))
  2100. self.stoneButton.SetEvent(lambda arg=2: self.SetInventoryType(arg))
  2101. self.boniButton.SetEvent(lambda arg=3: self.SetInventoryType(arg))
  2102. self.EtcButton.SetEvent(lambda arg=4: self.SetInventoryType(arg))
  2103. self.SkillBookButton.Down()
  2104.  
  2105. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  2106. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  2107. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  2108. self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  2109. self.inventoryTab[4].SetEvent(lambda arg=4: self.SetInventoryPage(arg))
  2110. self.inventoryTab[5].SetEvent(lambda arg=5: self.SetInventoryPage(arg))
  2111. self.inventoryTab[0].Down()
  2112.  
  2113. ## PickMoneyDialog
  2114. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  2115. dlgPickMoney.LoadDialog()
  2116. dlgPickMoney.Hide()
  2117.  
  2118. self.dlgPickMoney = dlgPickMoney
  2119.  
  2120. self.wndItem = wndItem
  2121. self.SetInventoryType(0)
  2122. self.SetInventoryPage(0)
  2123.  
  2124. def Destroy(self):
  2125. self.ClearDictionary()
  2126. self.dlgPickMoney.Destroy()
  2127. self.dlgPickMoney = 0
  2128. self.tooltipItem = None
  2129. self.wndItem = 0
  2130. self.interface = None
  2131. self.inventoryTab = []
  2132.  
  2133. def Hide(self):
  2134. if None != self.tooltipItem:
  2135. self.tooltipItem.HideToolTip()
  2136. wndMgr.Hide(self.hWnd)
  2137.  
  2138. def Close(self):
  2139. self.Hide()
  2140.  
  2141.  
  2142. def SetInventoryType(self, type):
  2143. self.inventoryType = type
  2144. if type == 0:
  2145. self.SkillBookButton.Down()
  2146. self.UpgradeItemsButton.SetUp()
  2147. self.EtcButton.SetUp()
  2148. self.stoneButton.SetUp()
  2149. self.boniButton.SetUp()
  2150. self.titleName.SetText(localeInfo.INVENTORY_SKILL_BOOK_TOOLTIP)
  2151. elif type == 2:
  2152. self.stoneButton.Down()
  2153. self.boniButton.SetUp()
  2154. self.EtcButton.SetUp()
  2155. self.UpgradeItemsButton.SetUp()
  2156. self.SkillBookButton.SetUp()
  2157. self.titleName.SetText(localeInfo.INVENTORY_STONE_TOOLTIP)
  2158. elif type == 3:
  2159. self.boniButton.Down()
  2160. self.EtcButton.SetUp()
  2161. self.stoneButton.SetUp()
  2162. self.UpgradeItemsButton.SetUp()
  2163. self.SkillBookButton.SetUp()
  2164. self.titleName.SetText(localeInfo.INVENTORY_SANDIK_TOOLTIP)
  2165. elif type == 4:
  2166. self.EtcButton.Down()
  2167. self.boniButton.SetUp()
  2168. self.stoneButton.SetUp()
  2169. self.UpgradeItemsButton.SetUp()
  2170. self.SkillBookButton.SetUp()
  2171. self.titleName.SetText("General")
  2172. else:
  2173. self.UpgradeItemsButton.Down()
  2174. self.SkillBookButton.SetUp()
  2175. self.EtcButton.SetUp()
  2176. self.stoneButton.SetUp()
  2177. self.boniButton.SetUp()
  2178. self.titleName.SetText(localeInfo.INVENTORY_UPGRADE_ITEM_TOOLTIP)
  2179. self.RefreshBagSlotWindow()
  2180.  
  2181. def SetInventoryPage(self, page):
  2182. self.inventoryPageIndex = page
  2183. for i in range(0,len(self.inventoryTab)):
  2184. self.inventoryTab[i].SetUp()
  2185. self.inventoryTab[page].Down()
  2186. self.RefreshBagSlotWindow()
  2187.  
  2188. def OnPickItem(self, count):
  2189. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  2190. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  2191. if self.inventoryType == 0:
  2192. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_SKILL_BOOK_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  2193. elif self.inventoryType == 2:
  2194. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_STONE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  2195. elif self.inventoryType == 3:
  2196. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_BONI_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  2197. elif self.inventoryType == 4:
  2198. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_ETC_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  2199. else:
  2200. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  2201.  
  2202. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  2203. if self.inventoryType == 0:
  2204. return self.inventoryPageIndex*player.SKILL_BOOK_INVENTORY_SLOT_COUNT + local + item.SKILL_BOOK_INVENTORY_SLOT_START
  2205. elif self.inventoryType == 2:
  2206. return self.inventoryPageIndex*player.STONE_INVENTORY_SLOT_COUNT + local + item.STONE_INVENTORY_SLOT_START
  2207. elif self.inventoryType == 3:
  2208. return self.inventoryPageIndex*player.BONI_INVENTORY_SLOT_COUNT + local + item.BONI_INVENTORY_SLOT_START
  2209. elif self.inventoryType == 4:
  2210. return self.inventoryPageIndex*player.ETC_INVENTORY_SLOT_COUNT + local + item.ETC_INVENTORY_SLOT_START
  2211. else:
  2212. return self.inventoryPageIndex*player.UPGRADE_ITEMS_INVENTORY_SLOT_COUNT + local + item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  2213.  
  2214. def GetInventoryPageIndex(self):
  2215. return self.inventoryPageIndex
  2216.  
  2217. def RefreshBagSlotWindow(self):
  2218. getItemVNum=player.GetItemIndex
  2219. getItemCount=player.GetItemCount
  2220. setItemVNum=self.wndItem.SetItemSlot
  2221.  
  2222. if self.inventoryType == 0:
  2223. for i in xrange(player.SKILL_BOOK_INVENTORY_SLOT_COUNT):
  2224. slotNumber = item.SKILL_BOOK_INVENTORY_SLOT_START + i
  2225. if self.GetInventoryPageIndex() == 1:
  2226. slotNumber += 45
  2227. elif self.GetInventoryPageIndex() == 2:
  2228. slotNumber += 90
  2229. elif self.GetInventoryPageIndex() == 3:
  2230. slotNumber += 135
  2231. elif self.GetInventoryPageIndex() == 4:
  2232. slotNumber += 180
  2233. elif self.GetInventoryPageIndex() == 5:
  2234. slotNumber += 225
  2235. itemCount = getItemCount(slotNumber)
  2236. if 0 == itemCount:
  2237. self.wndItem.ClearSlot(i)
  2238. continue
  2239. elif 1 == itemCount:
  2240. itemCount = 0
  2241. itemVnum = getItemVNum(slotNumber)
  2242. setItemVNum(i, itemVnum, itemCount)
  2243. elif self.inventoryType == 2:
  2244. for i in xrange(player.STONE_INVENTORY_SLOT_COUNT):
  2245. slotNumber = item.STONE_INVENTORY_SLOT_START + i
  2246. if self.GetInventoryPageIndex() == 1:
  2247. slotNumber += 45
  2248. elif self.GetInventoryPageIndex() == 2:
  2249. slotNumber += 90
  2250. elif self.GetInventoryPageIndex() == 3:
  2251. slotNumber += 135
  2252. elif self.GetInventoryPageIndex() == 4:
  2253. slotNumber += 180
  2254. elif self.GetInventoryPageIndex() == 5:
  2255. slotNumber += 225
  2256. itemCount = getItemCount(slotNumber)
  2257. if 0 == itemCount:
  2258. self.wndItem.ClearSlot(i)
  2259. continue
  2260. elif 1 == itemCount:
  2261. itemCount = 0
  2262. itemVnum = getItemVNum(slotNumber)
  2263. setItemVNum(i, itemVnum, itemCount)
  2264. elif self.inventoryType == 3:
  2265. for i in xrange(player.BONI_INVENTORY_SLOT_COUNT):
  2266. slotNumber = item.BONI_INVENTORY_SLOT_START + i
  2267. if self.GetInventoryPageIndex() == 1:
  2268. slotNumber += 45
  2269. elif self.GetInventoryPageIndex() == 2:
  2270. slotNumber += 90
  2271. elif self.GetInventoryPageIndex() == 3:
  2272. slotNumber += 135
  2273. elif self.GetInventoryPageIndex() == 4:
  2274. slotNumber += 180
  2275. elif self.GetInventoryPageIndex() == 5:
  2276. slotNumber += 225
  2277. itemCount = getItemCount(slotNumber)
  2278. if 0 == itemCount:
  2279. self.wndItem.ClearSlot(i)
  2280. continue
  2281. elif 1 == itemCount:
  2282. itemCount = 0
  2283. itemVnum = getItemVNum(slotNumber)
  2284. setItemVNum(i, itemVnum, itemCount)
  2285. elif self.inventoryType == 4:
  2286. for i in xrange(player.ETC_INVENTORY_SLOT_COUNT):
  2287. slotNumber = item.ETC_INVENTORY_SLOT_START + i
  2288. if self.GetInventoryPageIndex() == 1:
  2289. slotNumber += 45
  2290. elif self.GetInventoryPageIndex() == 2:
  2291. slotNumber += 90
  2292. elif self.GetInventoryPageIndex() == 3:
  2293. slotNumber += 135
  2294. elif self.GetInventoryPageIndex() == 4:
  2295. slotNumber += 180
  2296. elif self.GetInventoryPageIndex() == 5:
  2297. slotNumber += 225
  2298. itemCount = getItemCount(slotNumber)
  2299. if 0 == itemCount:
  2300. self.wndItem.ClearSlot(i)
  2301. continue
  2302. elif 1 == itemCount:
  2303. itemCount = 0
  2304. itemVnum = getItemVNum(slotNumber)
  2305. setItemVNum(i, itemVnum, itemCount)
  2306. else:
  2307. for i in xrange(player.UPGRADE_ITEMS_INVENTORY_SLOT_COUNT):
  2308. slotNumber = item.UPGRADE_ITEMS_INVENTORY_SLOT_START + i
  2309. if self.GetInventoryPageIndex() == 1:
  2310. slotNumber += 45
  2311. elif self.GetInventoryPageIndex() == 2:
  2312. slotNumber += 90
  2313. elif self.GetInventoryPageIndex() == 3:
  2314. slotNumber += 135
  2315. elif self.GetInventoryPageIndex() == 4:
  2316. slotNumber += 180
  2317. elif self.GetInventoryPageIndex() == 5:
  2318. slotNumber += 225
  2319. itemCount = getItemCount(slotNumber)
  2320. if 0 == itemCount:
  2321. self.wndItem.ClearSlot(i)
  2322. continue
  2323. elif 1 == itemCount:
  2324. itemCount = 0
  2325. itemVnum = getItemVNum(slotNumber)
  2326. setItemVNum(i, itemVnum, itemCount)
  2327. self.wndItem.RefreshSlot()
  2328.  
  2329. def RefreshItemSlot(self):
  2330. self.RefreshBagSlotWindow()
  2331.  
  2332. def RefreshStatus(self):
  2333. pass
  2334.  
  2335. def SetItemToolTip(self, tooltipItem):
  2336. self.tooltipItem = tooltipItem
  2337.  
  2338. def SelectEmptySlot(self, selectedSlotPos):
  2339. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  2340. return
  2341.  
  2342. if self.inventoryType == 0:
  2343. selectedSlotPos += item.SKILL_BOOK_INVENTORY_SLOT_START
  2344. if self.GetInventoryPageIndex() == 1:
  2345. selectedSlotPos += 45
  2346. elif self.GetInventoryPageIndex() == 2:
  2347. selectedSlotPos += 90
  2348. elif self.GetInventoryPageIndex() == 3:
  2349. selectedSlotPos += 135
  2350. elif self.GetInventoryPageIndex() == 4:
  2351. selectedSlotPos += 180
  2352. elif self.GetInventoryPageIndex() == 5:
  2353. selectedSlotPos += 225
  2354. elif self.inventoryType == 2:
  2355. selectedSlotPos += item.STONE_INVENTORY_SLOT_START
  2356. if self.GetInventoryPageIndex() == 1:
  2357. selectedSlotPos += 45
  2358. elif self.GetInventoryPageIndex() == 2:
  2359. selectedSlotPos += 90
  2360. elif self.GetInventoryPageIndex() == 3:
  2361. selectedSlotPos += 135
  2362. elif self.GetInventoryPageIndex() == 4:
  2363. selectedSlotPos += 180
  2364. elif self.GetInventoryPageIndex() == 5:
  2365. selectedSlotPos += 225
  2366. elif self.inventoryType == 3:
  2367. selectedSlotPos += item.BONI_INVENTORY_SLOT_START
  2368. if self.GetInventoryPageIndex() == 1:
  2369. selectedSlotPos += 45
  2370. elif self.GetInventoryPageIndex() == 2:
  2371. selectedSlotPos += 90
  2372. elif self.GetInventoryPageIndex() == 3:
  2373. selectedSlotPos += 135
  2374. elif self.GetInventoryPageIndex() == 4:
  2375. selectedSlotPos += 180
  2376. elif self.GetInventoryPageIndex() == 5:
  2377. selectedSlotPos += 225
  2378. elif self.inventoryType == 4:
  2379. selectedSlotPos += item.ETC_INVENTORY_SLOT_START
  2380. if self.GetInventoryPageIndex() == 1:
  2381. selectedSlotPos += 45
  2382. elif self.GetInventoryPageIndex() == 2:
  2383. selectedSlotPos += 90
  2384. elif self.GetInventoryPageIndex() == 3:
  2385. selectedSlotPos += 135
  2386. elif self.GetInventoryPageIndex() == 4:
  2387. selectedSlotPos += 180
  2388. elif self.GetInventoryPageIndex() == 5:
  2389. selectedSlotPos += 225
  2390. else:
  2391. selectedSlotPos += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  2392. if self.GetInventoryPageIndex() == 1:
  2393. selectedSlotPos += 45
  2394. elif self.GetInventoryPageIndex() == 2:
  2395. selectedSlotPos += 90
  2396. elif self.GetInventoryPageIndex() == 3:
  2397. selectedSlotPos += 135
  2398. elif self.GetInventoryPageIndex() == 4:
  2399. selectedSlotPos += 180
  2400. elif self.GetInventoryPageIndex() == 5:
  2401. selectedSlotPos += 225
  2402.  
  2403. if mouseModule.mouseController.isAttached():
  2404.  
  2405. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  2406. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  2407. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  2408. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  2409.  
  2410. if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or player.SLOT_TYPE_BONI_INVENTORY == attachedSlotType or player.SLOT_TYPE_ETC_INVENTORY == attachedSlotType:
  2411. itemCount = player.GetItemCount(attachedSlotPos)
  2412. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  2413. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  2414.  
  2415. if item.IsRefineScroll(attachedItemIndex):
  2416. self.wndItem.SetUseMode(False)
  2417.  
  2418. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  2419. mouseModule.mouseController.RunCallBack("INVENTORY")
  2420.  
  2421. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  2422. net.SendShopBuyPacket(attachedSlotPos)
  2423.  
  2424. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  2425.  
  2426. if player.ITEM_MONEY == attachedItemIndex:
  2427. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  2428. snd.PlaySound("sound/ui/money.wav")
  2429.  
  2430. else:
  2431. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  2432.  
  2433. elif player.SLOT_TYPE_MALL == attachedSlotType:
  2434. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  2435.  
  2436. mouseModule.mouseController.DeattachObject()
  2437.  
  2438. def SelectItemSlot(self, itemSlotIndex):
  2439. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  2440. return
  2441. if self.inventoryType == 0:
  2442. itemSlotIndex += item.SKILL_BOOK_INVENTORY_SLOT_START
  2443. if self.GetInventoryPageIndex() == 1:
  2444. itemSlotIndex += 45
  2445. elif self.GetInventoryPageIndex() == 2:
  2446. itemSlotIndex += 90
  2447. elif self.GetInventoryPageIndex() == 3:
  2448. itemSlotIndex += 135
  2449. elif self.GetInventoryPageIndex() == 4:
  2450. itemSlotIndex += 180
  2451. elif self.GetInventoryPageIndex() == 5:
  2452. itemSlotIndex += 225
  2453. elif self.inventoryType == 2:
  2454. itemSlotIndex += item.STONE_INVENTORY_SLOT_START
  2455. if self.GetInventoryPageIndex() == 1:
  2456. itemSlotIndex += 45
  2457. elif self.GetInventoryPageIndex() == 2:
  2458. itemSlotIndex += 90
  2459. elif self.GetInventoryPageIndex() == 3:
  2460. itemSlotIndex += 135
  2461. elif self.GetInventoryPageIndex() == 4:
  2462. itemSlotIndex += 180
  2463. elif self.GetInventoryPageIndex() == 5:
  2464. itemSlotIndex += 225
  2465. elif self.inventoryType == 3:
  2466. itemSlotIndex += item.BONI_INVENTORY_SLOT_START
  2467. if self.GetInventoryPageIndex() == 1:
  2468. itemSlotIndex += 45
  2469. elif self.GetInventoryPageIndex() == 2:
  2470. itemSlotIndex += 90
  2471. elif self.GetInventoryPageIndex() == 3:
  2472. itemSlotIndex += 135
  2473. elif self.GetInventoryPageIndex() == 4:
  2474. itemSlotIndex += 180
  2475. elif self.GetInventoryPageIndex() == 5:
  2476. itemSlotIndex += 225
  2477. elif self.inventoryType == 4:
  2478. itemSlotIndex += item.ETC_INVENTORY_SLOT_START
  2479. if self.GetInventoryPageIndex() == 1:
  2480. itemSlotIndex += 45
  2481. elif self.GetInventoryPageIndex() == 2:
  2482. itemSlotIndex += 90
  2483. elif self.GetInventoryPageIndex() == 3:
  2484. itemSlotIndex += 135
  2485. elif self.GetInventoryPageIndex() == 4:
  2486. itemSlotIndex += 180
  2487. elif self.GetInventoryPageIndex() == 5:
  2488. itemSlotIndex += 225
  2489. else:
  2490. itemSlotIndex += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  2491. if self.GetInventoryPageIndex() == 1:
  2492. itemSlotIndex += 45
  2493. elif self.GetInventoryPageIndex() == 2:
  2494. itemSlotIndex += 90
  2495. elif self.GetInventoryPageIndex() == 3:
  2496. itemSlotIndex += 135
  2497. elif self.GetInventoryPageIndex() == 4:
  2498. itemSlotIndex += 180
  2499. elif self.GetInventoryPageIndex() == 5:
  2500. itemSlotIndex += 225
  2501.  
  2502. if mouseModule.mouseController.isAttached():
  2503. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  2504. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  2505. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  2506. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  2507.  
  2508. if player.GetItemCount(itemSlotIndex) > attachedItemCount:
  2509. return
  2510.  
  2511. curCursorNum = app.GetCursor()
  2512. if app.SELL == curCursorNum:
  2513. self.__SellItem(itemSlotIndex)
  2514.  
  2515. if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or player.SLOT_TYPE_BONI_INVENTORY == attachedSlotType or player.SLOT_TYPE_ETC_INVENTORY == attachedSlotType:
  2516. self.__SendMoveItemPacket(attachedSlotPos, itemSlotIndex, attachedItemCount)
  2517.  
  2518. mouseModule.mouseController.DeattachObject()
  2519. else:
  2520.  
  2521. curCursorNum = app.GetCursor()
  2522. if app.SELL == curCursorNum:
  2523. self.__SellItem(itemSlotIndex)
  2524.  
  2525. elif app.BUY == curCursorNum:
  2526. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  2527.  
  2528. elif app.IsPressed(app.DIK_LALT):
  2529. link = player.GetItemLink(itemSlotIndex)
  2530. ime.PasteString(link)
  2531.  
  2532. elif app.IsPressed(app.DIK_LSHIFT):
  2533. itemCount = player.GetItemCount(itemSlotIndex)
  2534.  
  2535. if itemCount > 1:
  2536. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  2537. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  2538. self.dlgPickMoney.Open(itemCount)
  2539. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  2540. #else:
  2541. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  2542. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  2543.  
  2544. elif app.IsPressed(app.DIK_LCONTROL):
  2545. itemIndex = player.GetItemIndex(itemSlotIndex)
  2546.  
  2547. if True == item.CanAddToQuickSlotItem(itemIndex):
  2548. if self.inventoryType == 0:
  2549. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_SKILL_BOOK_INVENTORY, itemSlotIndex)
  2550. elif self.inventoryType == 2:
  2551. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_STONE_INVENTORY, itemSlotIndex)
  2552. elif self.inventoryType == 3:
  2553. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_BONI_INVENTORY, itemSlotIndex)
  2554. elif self.inventoryType == 4:
  2555. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_ETC_INVENTORY, itemSlotIndex)
  2556. else:
  2557. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY, itemSlotIndex)
  2558. else:
  2559. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  2560.  
  2561. else:
  2562. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  2563. itemCount = player.GetItemCount(itemSlotIndex)
  2564. if self.inventoryType == 0:
  2565. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_SKILL_BOOK_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  2566. elif self.inventoryType == 2:
  2567. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_STONE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  2568. elif self.inventoryType == 3:
  2569. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_BONI_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  2570. elif self.inventoryType == 4:
  2571. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_ETC_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  2572. else:
  2573. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  2574.  
  2575. self.wndItem.SetUseMode(True)
  2576.  
  2577. snd.PlaySound("sound/ui/pick.wav")
  2578.  
  2579. def __SellItem(self, itemSlotPos):
  2580. if not player.IsEquipmentSlot(itemSlotPos):
  2581. self.sellingSlotNumber = itemSlotPos
  2582. itemIndex = player.GetItemIndex(itemSlotPos)
  2583. itemCount = player.GetItemCount(itemSlotPos)
  2584.  
  2585.  
  2586. self.sellingSlotitemIndex = itemIndex
  2587. self.sellingSlotitemCount = itemCount
  2588.  
  2589. item.SelectItem(itemIndex)
  2590. ## ?? ??? ?? ??? ??
  2591. ## 20140220
  2592. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  2593. popup = uiCommon.PopupDialog()
  2594. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  2595. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  2596. popup.Open()
  2597. self.popup = popup
  2598. return
  2599. itemPrice = player.GetISellItemPrice(itemSlotPos)
  2600.  
  2601. item.GetItemName(itemIndex)
  2602. itemName = item.GetItemName()
  2603.  
  2604. self.questionDialog = uiCommon.QuestionDialog()
  2605. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  2606. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  2607. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  2608. self.questionDialog.Open()
  2609. self.questionDialog.count = itemCount
  2610.  
  2611. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  2612.  
  2613. def SellItem(self):
  2614. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  2615. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  2616. ## ???? ??? ?? ?? ????? ?? type ??
  2617. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  2618. snd.PlaySound("sound/ui/money.wav")
  2619. self.OnCloseQuestionDialog()
  2620.  
  2621. def OnCloseQuestionDialog(self):
  2622. if not self.questionDialog:
  2623. return
  2624.  
  2625. self.questionDialog.Close()
  2626. self.questionDialog = None
  2627. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  2628.  
  2629. def __OnClosePopupDialog(self):
  2630. self.pop = None
  2631.  
  2632. def OverOutItem(self):
  2633. self.wndItem.SetUsableItem(False)
  2634. if None != self.tooltipItem:
  2635. self.tooltipItem.HideToolTip()
  2636.  
  2637. def OverInItem(self, overSlotPos):
  2638. overSlotPosGlobal = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  2639. if self.inventoryType == 0:
  2640. overSlotPos += item.SKILL_BOOK_INVENTORY_SLOT_START
  2641. if self.GetInventoryPageIndex() == 1:
  2642. overSlotPos += 45
  2643. elif self.GetInventoryPageIndex() == 2:
  2644. overSlotPos += 90
  2645. elif self.GetInventoryPageIndex() == 3:
  2646. overSlotPos += 135
  2647. elif self.GetInventoryPageIndex() == 4:
  2648. overSlotPos += 180
  2649. elif self.GetInventoryPageIndex() == 5:
  2650. overSlotPos += 225
  2651. elif self.inventoryType == 2:
  2652. overSlotPos += item.STONE_INVENTORY_SLOT_START
  2653. if self.GetInventoryPageIndex() == 1:
  2654. overSlotPos += 45
  2655. elif self.GetInventoryPageIndex() == 2:
  2656. overSlotPos += 90
  2657. elif self.GetInventoryPageIndex() == 3:
  2658. overSlotPos += 135
  2659. elif self.GetInventoryPageIndex() == 4:
  2660. overSlotPos += 180
  2661. elif self.GetInventoryPageIndex() == 5:
  2662. overSlotPos += 225
  2663. elif self.inventoryType == 3:
  2664. overSlotPos += item.BONI_INVENTORY_SLOT_START
  2665. if self.GetInventoryPageIndex() == 1:
  2666. overSlotPos += 45
  2667. elif self.GetInventoryPageIndex() == 2:
  2668. overSlotPos += 90
  2669. elif self.GetInventoryPageIndex() == 3:
  2670. overSlotPos += 135
  2671. elif self.GetInventoryPageIndex() == 4:
  2672. overSlotPos += 180
  2673. elif self.GetInventoryPageIndex() == 5:
  2674. overSlotPos += 225
  2675. elif self.inventoryType == 4:
  2676. overSlotPos += item.ETC_INVENTORY_SLOT_START
  2677. if self.GetInventoryPageIndex() == 1:
  2678. overSlotPos += 45
  2679. elif self.GetInventoryPageIndex() == 2:
  2680. overSlotPos += 90
  2681. elif self.GetInventoryPageIndex() == 3:
  2682. overSlotPos += 135
  2683. elif self.GetInventoryPageIndex() == 4:
  2684. overSlotPos += 180
  2685. elif self.GetInventoryPageIndex() == 5:
  2686. overSlotPos += 225
  2687. else:
  2688. overSlotPos += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  2689. if self.GetInventoryPageIndex() == 1:
  2690. overSlotPos += 45
  2691. elif self.GetInventoryPageIndex() == 2:
  2692. overSlotPos += 90
  2693. elif self.GetInventoryPageIndex() == 3:
  2694. overSlotPos += 135
  2695. elif self.GetInventoryPageIndex() == 4:
  2696. overSlotPos += 180
  2697. elif self.GetInventoryPageIndex() == 5:
  2698. overSlotPos += 225
  2699. self.wndItem.SetUsableItem(False)
  2700. self.ShowToolTip(overSlotPos)
  2701. #self.ShowToolTip(overSlotPosGlobal)
  2702.  
  2703. def ShowToolTip(self, slotIndex):
  2704. if None != self.tooltipItem:
  2705. self.tooltipItem.SetInventoryItem(slotIndex)
  2706.  
  2707. def OnPressEscapeKey(self):
  2708. self.Close()
  2709. return True
  2710.  
  2711. def UseItemSlot(self, slotIndex):
  2712. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  2713. return
  2714.  
  2715. if self.inventoryType == 0:
  2716. slotIndex += item.SKILL_BOOK_INVENTORY_SLOT_START
  2717. if self.GetInventoryPageIndex() == 1:
  2718. slotIndex += 45
  2719. elif self.GetInventoryPageIndex() == 2:
  2720. slotIndex += 90
  2721. elif self.GetInventoryPageIndex() == 3:
  2722. slotIndex += 135
  2723. elif self.GetInventoryPageIndex() == 4:
  2724. slotIndex += 180
  2725. elif self.GetInventoryPageIndex() == 5:
  2726. slotIndex += 225
  2727. elif self.inventoryType == 2:
  2728. slotIndex += item.STONE_INVENTORY_SLOT_START
  2729. if self.GetInventoryPageIndex() == 1:
  2730. slotIndex += 45
  2731. elif self.GetInventoryPageIndex() == 2:
  2732. slotIndex += 90
  2733. elif self.GetInventoryPageIndex() == 3:
  2734. slotIndex += 135
  2735. elif self.GetInventoryPageIndex() == 4:
  2736. slotIndex += 180
  2737. elif self.GetInventoryPageIndex() == 5:
  2738. slotIndex += 225
  2739. elif self.inventoryType == 3:
  2740. slotIndex += item.BONI_INVENTORY_SLOT_START
  2741. if self.GetInventoryPageIndex() == 1:
  2742. slotIndex += 45
  2743. elif self.GetInventoryPageIndex() == 2:
  2744. slotIndex += 90
  2745. elif self.GetInventoryPageIndex() == 3:
  2746. slotIndex += 135
  2747. elif self.GetInventoryPageIndex() == 4:
  2748. slotIndex += 180
  2749. elif self.GetInventoryPageIndex() == 5:
  2750. slotIndex += 225
  2751. elif self.inventoryType == 4:
  2752. slotIndex += item.ETC_INVENTORY_SLOT_START
  2753. if self.GetInventoryPageIndex() == 1:
  2754. slotIndex += 45
  2755. elif self.GetInventoryPageIndex() == 2:
  2756. slotIndex += 90
  2757. elif self.GetInventoryPageIndex() == 3:
  2758. slotIndex += 135
  2759. elif self.GetInventoryPageIndex() == 4:
  2760. slotIndex += 180
  2761. elif self.GetInventoryPageIndex() == 5:
  2762. slotIndex += 225
  2763. else:
  2764. slotIndex += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  2765. if self.GetInventoryPageIndex() == 1:
  2766. slotIndex += 45
  2767. elif self.GetInventoryPageIndex() == 2:
  2768. slotIndex += 90
  2769. elif self.GetInventoryPageIndex() == 3:
  2770. slotIndex += 135
  2771. elif self.GetInventoryPageIndex() == 4:
  2772. slotIndex += 180
  2773. elif self.GetInventoryPageIndex() == 5:
  2774. slotIndex += 225
  2775. self.__UseItem(slotIndex)
  2776. mouseModule.mouseController.DeattachObject()
  2777. self.OverOutItem()
  2778.  
  2779. def __UseItem(self, slotIndex):
  2780. ItemVNum = player.GetItemIndex(slotIndex)
  2781. item.SelectItem(ItemVNum)
  2782. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  2783. self.questionDialog = uiCommon.QuestionDialog()
  2784. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  2785. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  2786. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  2787. self.questionDialog.Open()
  2788. self.questionDialog.slotIndex = slotIndex
  2789.  
  2790. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  2791.  
  2792. else:
  2793. self.__SendUseItemPacket(slotIndex)
  2794. #net.SendItemUsePacket(slotIndex)
  2795.  
  2796. def __UseItemQuestionDialog_OnCancel(self):
  2797. self.OnCloseQuestionDialog()
  2798.  
  2799. def __UseItemQuestionDialog_OnAccept(self):
  2800. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  2801. self.OnCloseQuestionDialog()
  2802.  
  2803. def __SendUseItemPacket(self, slotPos):
  2804. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2805. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  2806. return
  2807.  
  2808. net.SendItemUsePacket(slotPos)
  2809.  
  2810. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  2811. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2812. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  2813. return
  2814.  
  2815. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement