Guest User

Untitled

a guest
Jul 31st, 2021
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 71.76 KB | None | 0 0
  1. import ui
  2. import player
  3. import mouseModule
  4. import net
  5. import app
  6. import snd
  7. import item
  8. import player
  9. import chat
  10. import grp
  11. import uiScriptLocale
  12. import uiRefine
  13. import uiAttachMetin
  14. import uiPickMoney
  15. import uiCommon
  16. import uiPrivateShopBuilder # 개인상점 열동안 ItemMove 방지
  17. import localeInfo
  18. import constInfo
  19. import ime
  20. import ui
  21. import wndMgr
  22. import exchange
  23. import uiSearchShop
  24. import uiNewShop
  25. if app.ENABLE_SASH_SYSTEM:
  26. import sash
  27. if app.ENABLE_BIOLOG_SYSTEM:
  28. import uiprofessionalbiolog, uiToolTip
  29. if app.ENABLE_CHANGELOOK_SYSTEM:
  30. import changelook
  31. from _weakref import proxy
  32. import switchbot
  33. import interfaceModule
  34.  
  35. ITEM_MALL_BUTTON_ENABLE = True
  36.  
  37.  
  38.  
  39. ITEM_FLAG_APPLICABLE = 1 << 14
  40.  
  41. class CostumeWindow(ui.ScriptWindow):
  42.  
  43. def __init__(self, wndInventory):
  44. import exception
  45.  
  46. if not app.ENABLE_COSTUME_SYSTEM:
  47. exception.Abort("What do you do?")
  48. return
  49.  
  50. if not wndInventory:
  51. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  52. return
  53.  
  54. ui.ScriptWindow.__init__(self)
  55.  
  56. self.isLoaded = 0
  57. self.wndInventory = wndInventory;
  58.  
  59. self.__LoadWindow()
  60.  
  61. def __del__(self):
  62. ui.ScriptWindow.__del__(self)
  63.  
  64. def Show(self):
  65. self.__LoadWindow()
  66. self.RefreshCostumeSlot()
  67.  
  68. ui.ScriptWindow.Show(self)
  69.  
  70. def Close(self):
  71. self.Hide()
  72.  
  73. if app.WJ_ENABLE_PICKUP_ITEM_EFFECT:
  74. def HighlightSlot(self, slot):
  75. if not slot in self.listHighlightedSlot:
  76. self.listHighlightedSlot.append(slot)
  77.  
  78. def __LoadWindow(self):
  79. if self.isLoaded == 1:
  80. return
  81.  
  82. self.isLoaded = 1
  83.  
  84. try:
  85. pyScrLoader = ui.PythonScriptLoader()
  86. pyScrLoader.LoadScriptFile(self, "UIScript/costumewindow.py")
  87. except:
  88. import exception
  89. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  90.  
  91. try:
  92. wndEquip = self.GetChild("CostumeSlot")
  93. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  94.  
  95. except:
  96. import exception
  97. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  98.  
  99. ## Equipment
  100. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  101. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  102. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  103. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  104. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  105. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  106.  
  107. self.wndEquip = wndEquip
  108.  
  109. def RefreshCostumeSlot(self):
  110. getItemVNum=player.GetItemIndex
  111. for i in xrange(item.COSTUME_SLOT_COUNT):
  112. slotNumber = item.COSTUME_SLOT_START + i
  113. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  114. if app.ENABLE_CHANGELOOK_SYSTEM:
  115. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  116. if itemTransmutedVnum:
  117. self.wndEquip.DisableCoverButton(slotNumber)
  118. else:
  119. self.wndEquip.EnableCoverButton(slotNumber)
  120.  
  121. slotNumber = item.EQUIPMENT_BELT + 1
  122. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  123. if app.ENABLE_CHANGELOOK_SYSTEM:
  124. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  125. if itemTransmutedVnum:
  126. self.wndEquip.DisableCoverButton(slotNumber)
  127. else:
  128. self.wndEquip.EnableCoverButton(slotNumber)
  129.  
  130. self.wndEquip.RefreshSlot()
  131. class BeltInventoryWindow(ui.ScriptWindow):
  132.  
  133. def __init__(self, wndInventory):
  134. import exception
  135.  
  136. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  137. exception.Abort("What do you do?")
  138. return
  139.  
  140. if not wndInventory:
  141. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  142. return
  143.  
  144. ui.ScriptWindow.__init__(self)
  145.  
  146. self.isLoaded = 0
  147. self.wndInventory = wndInventory;
  148.  
  149. self.wndBeltInventoryLayer = None
  150. self.wndBeltInventorySlot = None
  151. self.expandBtn = None
  152. self.minBtn = None
  153.  
  154. self.__LoadWindow()
  155.  
  156. def __del__(self):
  157. ui.ScriptWindow.__del__(self)
  158.  
  159. def Show(self, openBeltSlot = False):
  160. self.__LoadWindow()
  161. self.RefreshSlot()
  162.  
  163. ui.ScriptWindow.Show(self)
  164.  
  165. if openBeltSlot:
  166. self.OpenInventory()
  167. else:
  168. self.CloseInventory()
  169.  
  170. def Close(self):
  171. self.Hide()
  172.  
  173. if app.WJ_ENABLE_PICKUP_ITEM_EFFECT:
  174. def HighlightSlot(self, slot):
  175. if not slot in self.listHighlightedSlot:
  176. self.listHighlightedSlot.append(slot)
  177.  
  178. def IsOpeningInventory(self):
  179. return self.wndBeltInventoryLayer.IsShow()
  180.  
  181. def OpenInventory(self):
  182. self.wndBeltInventoryLayer.Show()
  183. self.expandBtn.Hide()
  184.  
  185. if localeInfo.IsARABIC() == 0:
  186. self.AdjustPositionAndSize()
  187.  
  188. def CloseInventory(self):
  189. self.wndBeltInventoryLayer.Hide()
  190. self.expandBtn.Show()
  191.  
  192. if localeInfo.IsARABIC() == 0:
  193. self.AdjustPositionAndSize()
  194.  
  195. ## 현재 인벤토리 위치를 기준으로 BASE 위치를 계산, 리턴.. 숫자 하드코딩하기 정말 싫지만 방법이 없다..
  196. if app.ENABLE_BIOLOG_SYSTEM:
  197. def GetBasePosition(self):
  198. x, y = self.wndInventory.GetGlobalPosition()
  199. return x - 148, y + 385
  200. else:
  201. def GetBasePosition(self):
  202. x, y = self.wndInventory.GetGlobalPosition()
  203. return x - 148, y + 241
  204.  
  205. def AdjustPositionAndSize(self):
  206. bx, by = self.GetBasePosition()
  207.  
  208. if self.IsOpeningInventory():
  209. self.SetPosition(bx, by)
  210. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  211.  
  212. else:
  213. self.SetPosition(bx + 138, by);
  214. self.SetSize(10, self.GetHeight())
  215.  
  216. def __LoadWindow(self):
  217. if self.isLoaded == 1:
  218. return
  219.  
  220. self.isLoaded = 1
  221.  
  222. try:
  223. pyScrLoader = ui.PythonScriptLoader()
  224. pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  225. except:
  226. import exception
  227. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  228.  
  229. try:
  230. self.ORIGINAL_WIDTH = self.GetWidth()
  231. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  232. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  233. self.expandBtn = self.GetChild("ExpandBtn")
  234. self.minBtn = self.GetChild("MinimizeBtn")
  235.  
  236. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  237. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  238.  
  239. if localeInfo.IsARABIC() :
  240. self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  241. self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
  242. self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
  243.  
  244. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  245. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  246. wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  247. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  248. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  249. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", False, False)
  250.  
  251. except:
  252. import exception
  253. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  254.  
  255. ## Equipment
  256. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  257. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  258. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  259. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  260. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  261. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  262.  
  263. self.wndBeltInventorySlot = wndBeltInventorySlot
  264.  
  265. def RefreshSlot(self):
  266. getItemVNum=player.GetItemIndex
  267.  
  268. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  269. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  270. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  271. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, True)
  272.  
  273. avail = "0"
  274.  
  275. if player.IsAvailableBeltInventoryCell(slotNumber):
  276. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  277. else:
  278. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  279.  
  280. self.wndBeltInventorySlot.RefreshSlot()
  281.  
  282. if app.ENABLE_BIOLOG_SYSTEM:
  283. ###################################################################
  284. # title_name : Professional Biolog System
  285. # date_created : 2016.08.07
  286. # filename : uiInventory.py
  287. # author : VegaS
  288. # version_actual : Version 0.2.8
  289. #
  290. class CollectInventoryWindow(ui.ScriptWindow):
  291. def __init__(self, wndInventory):
  292. import exception
  293. if not wndInventory:
  294. exception.Abort("wndInventory parameter must be set to CollectInventoryWindow")
  295. return
  296. ui.ScriptWindow.__init__(self)
  297. self.isLoaded = 0
  298. self.updated = 0
  299. self.wndInventory = wndInventory;
  300. self.tooltipItem = uiToolTip.ItemToolTip()
  301. self.tooltipItem.Hide()
  302. self.wndBeltInventoryLayer = None
  303. self.wndBeltInventorySlot = None
  304. self.expandBtn = None
  305. self.minBtn = None
  306. self.gameWindow = None
  307. self.__LoadWindow()
  308.  
  309. def __del__(self):
  310. ui.ScriptWindow.__del__(self)
  311.  
  312. def Show(self, openBeltSlot = False):
  313. self.__LoadWindow()
  314. ui.ScriptWindow.Show(self)
  315.  
  316. if openBeltSlot:
  317. self.OpenInventory()
  318. else:
  319. self.CloseInventory()
  320.  
  321. def Close(self):
  322. self.Hide()
  323.  
  324. def IsOpeningInventory(self):
  325. return self.wndBeltInventoryLayer.IsShow()
  326.  
  327. def OpenInventory(self):
  328. self.wndBeltInventoryLayer.Show()
  329. self.expandBtn.Hide()
  330.  
  331. self.AdjustPositionAndSize()
  332.  
  333. def CloseInventory(self):
  334. self.wndBeltInventoryLayer.Hide()
  335. self.expandBtn.Show()
  336.  
  337. self.AdjustPositionAndSize()
  338.  
  339. def GetBasePosition(self):
  340. x, y = self.wndInventory.GetGlobalPosition()
  341. return x - 148, y + 260
  342.  
  343. def AdjustPositionAndSize(self):
  344. bx, by = self.GetBasePosition()
  345.  
  346. if self.IsOpeningInventory():
  347. self.SetPosition(bx, by)
  348. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  349. else:
  350. self.SetPosition(bx + 138, by);
  351. self.SetSize(10, self.GetHeight())
  352.  
  353. def __LoadWindow(self):
  354. if self.isLoaded == 1:
  355. return
  356.  
  357. self.isLoaded = 1
  358.  
  359. try:
  360. pyScrLoader = ui.PythonScriptLoader()
  361. pyScrLoader.LoadScriptFile(self, "UIScript/biolog_collectinventorywindow.py")
  362. except:
  363. import exception
  364. exception.Abort("CollectInventoryWindow.LoadWindow.LoadObject")
  365.  
  366. try:
  367. self.ORIGINAL_WIDTH = self.GetWidth()
  368. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  369. self.wndItem = self.GetChild("BeltInventorySlot")
  370. self.time_value = self.GetChild("time_value")
  371. self.biolog_count = self.GetChild("count_value")
  372. self.expandBtn = self.GetChild("ExpandBtn")
  373. self.minBtn = self.GetChild("MinimizeBtn")
  374. self.sendBtn = self.GetChild("send_biolog")
  375. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  376. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  377. self.wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  378. self.wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  379. except:
  380. import exception
  381. exception.Abort("CollectInventoryWindow.LoadWindow.BindObject")
  382.  
  383. if self.sendBtn:
  384. self.sendBtn.SetEvent(ui.__mem_func__(self.AcceptBiolog))
  385.  
  386. def SetItem(self, arg1, arg2, arg3):
  387. self.wndItem.SetItemSlot(0, int(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0]), 0)
  388.  
  389. def AcceptBiolog(self):
  390. net.SendChatPacket("/biolog")
  391.  
  392. def SetTime(self, time):
  393. time_collect = time - app.GetGlobalTimeStamp()
  394.  
  395. if time_collect < 0:
  396. time_collect = 0
  397.  
  398. if time_collect == 1:
  399. self.wndLeftTime = uiprofessionalbiolog.Biolog_TimeExpired()
  400. self.wndLeftTime.OpenWindow()
  401. self.wndLeftTime.Show()
  402.  
  403. self.time_value.SetText(localeInfo.FormatTime(time_collect))
  404.  
  405. def OnUpdate(self):
  406. self.SetTime(int(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["time"][0]))
  407. self.SetItem(0, uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0], 0)
  408. self.biolog_count.SetText(uiprofessionalbiolog.BIOLOG_BINARY_LOADED['countActual'][0] + "/" + uiprofessionalbiolog.BIOLOG_BINARY_LOADED['countNeed'][0])
  409.  
  410. def OverInItem(self):
  411. if uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0]:
  412. self.tooltipItem.SetItemToolTip(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0])
  413.  
  414. def OverOutItem(self):
  415. if self.tooltipItem:
  416. self.tooltipItem.HideToolTip()
  417.  
  418. class InventoryWindow(ui.ScriptWindow):
  419.  
  420. if app.ENABLE_COSTUME_ATTR_SYSTEM:
  421. USE_TYPE_TUPLE = ("USE_CLEAN_SOCKET", "USE_CHANGE_ATTRIBUTE", "USE_ADD_ATTRIBUTE", "USE_ADD_ATTRIBUTE2", "USE_ADD_ACCESSORY_SOCKET", "USE_PUT_INTO_ACCESSORY_SOCKET", "USE_PUT_INTO_BELT_SOCKET", "USE_PUT_INTO_RING_SOCKET", "USE_COSTUME_ENCHANT", "USE_COSTUME_TRANSFORM", "USE_SPECIAL")
  422. else:
  423. USE_TYPE_TUPLE = ("USE_CLEAN_SOCKET", "USE_CHANGE_ATTRIBUTE", "USE_ADD_ATTRIBUTE", "USE_ADD_ATTRIBUTE2", "USE_ADD_ACCESSORY_SOCKET", "USE_PUT_INTO_ACCESSORY_SOCKET", "USE_PUT_INTO_BELT_SOCKET", "USE_PUT_INTO_RING_SOCKET", "USE_SPECIAL")
  424.  
  425. questionDialog = None
  426. tooltipItem = None
  427. wndCostume = None
  428. wndBelt = None
  429. if app.ENABLE_BIOLOG_SYSTEM:
  430. wndCollect = None
  431. dlgPickMoney = None
  432. interface = None
  433. if app.WJ_ENABLE_TRADABLE_ICON:
  434. bindWnds = []
  435.  
  436. sellingSlotNumber = -1
  437. isLoaded = 0
  438. isOpenedCostumeWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 코스츔이 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  439. if app.ENABLE_BIOLOG_SYSTEM:
  440. isOpenedCollectWindowWhenClosingInventory = 0
  441. isOpenedBeltWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  442.  
  443. def __init__(self):
  444. ui.ScriptWindow.__init__(self)
  445.  
  446. self.isOpenedBeltWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  447. self.uiSearchShop=uiSearchShop.ShopSearch()
  448. self.__LoadWindow()
  449.  
  450. def __del__(self):
  451. ui.ScriptWindow.__del__(self)
  452.  
  453. def Show(self):
  454. self.__LoadWindow()
  455.  
  456. ui.ScriptWindow.Show(self)
  457.  
  458. # 인벤토리를 닫을 때 코스츔이 열려있었다면 인벤토리를 열 때 코스츔도 같이 열도록 함.
  459. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  460. self.wndCostume.Show()
  461.  
  462. if app.ENABLE_BIOLOG_SYSTEM:
  463. if self.wndCollect:
  464. self.wndCollect.Show(self.isOpenedCollectWindowWhenClosingInventory)
  465.  
  466. # Belt System
  467. if self.wndBelt:
  468. self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  469.  
  470. job = player.GetJob()
  471.  
  472. if job == 1:
  473. if self.wndEquip:
  474. self.wndEquip.Hide()
  475.  
  476. if self.wndEquipBase:
  477. self.wndEquipBase.LoadImage("inventory/equipment_bg_without_ring_ninja.tga")
  478. else:
  479. if self.wndEquip:
  480. self.wndEquip.Show()
  481.  
  482. if self.wndEquipBase:
  483. self.wndEquipBase.LoadImage("inventory/equipment_bg_without_ring.tga")
  484.  
  485. def BindInterfaceClass(self, interface):
  486. self.interface = interface
  487.  
  488. if app.WJ_ENABLE_TRADABLE_ICON:
  489. def BindWindow(self, wnd):
  490. self.bindWnds.append(wnd)
  491.  
  492. def __LoadWindow(self):
  493. if self.isLoaded == 1:
  494. return
  495.  
  496. self.isLoaded = 1
  497.  
  498. try:
  499. pyScrLoader = ui.PythonScriptLoader()
  500. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  501. except:
  502. import exception
  503. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  504.  
  505. try:
  506. wndItem = self.GetChild("ItemSlot")
  507. wndEquip = self.GetChild("EquipmentSlot")
  508. wndCostume = self.GetChild("CostumeSlot") #slot0
  509. wndSecondary = self.GetChild("SecondarySlot") #slot 1
  510. wndTalisman = self.GetChild("TalismanSlot") #slot 2
  511. wndEffect = self.GetChild("EffectSlot") #slot 3
  512.  
  513. self.wndEquipBase = self.GetChild("Equipment_Base")
  514. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  515. self.DSSButton = self.GetChild2("DSSButton")
  516. mask1 = self.GetChild("Equipment_Base")
  517. mask2 = self.GetChild("Costume_Base") #slot 0
  518. mask3 = self.GetChild("Secondary_Base") #slot 1
  519. mask4 = self.GetChild("Talisman_Base") #slot 2
  520. mask5 = self.GetChild("Effect_Base") #slot 3
  521. self.SpecialStorageButton = self.GetChild2("SpecialStorageButton")
  522. # self.INFOCHESTButton = self.GetChild2("INFOCHESTButton")
  523. self.costumeButton = self.GetChild2("CostumeButton")
  524. self.arrange_button = self.GetChild2("arrange_button")
  525.  
  526. self.inventoryTab = []
  527. for i in xrange(player.INVENTORY_PAGE_COUNT):
  528. self.inventoryTab.append(self.GetChild("Inventory_Tab_%02d" % (i+1)))
  529.  
  530. self.equipmentTab = []
  531. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  532. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  533. self.equipmentTab.append(self.GetChild("Equipment_Tab_03"))
  534. self.equipmentTab.append(self.GetChild("Equipment_Tab_04"))
  535. self.equipmentTab.append(self.GetChild("Equipment_Tab_05"))
  536.  
  537. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  538. self.costumeButton.Hide()
  539. self.costumeButton.Destroy()
  540. self.costumeButton = 0
  541.  
  542. # Belt Inventory Window
  543. self.wndBelt = None
  544.  
  545. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  546. self.wndBelt = BeltInventoryWindow(self)
  547. if app.ENABLE_BIOLOG_SYSTEM:
  548. self.wndCollect = None
  549. self.wndCollect = CollectInventoryWindow(self)
  550.  
  551. except:
  552. import exception
  553. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  554.  
  555. ## Item
  556. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  557. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  558. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  559. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  560. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  561. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  562.  
  563. ## Equipment
  564. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  565. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  566. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  567. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  568. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  569. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  570.  
  571. ## ECHIPAMENT
  572. ## Costume
  573. wndCostume.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  574. wndCostume.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  575. wndCostume.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  576. wndCostume.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  577. wndCostume.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  578. wndCostume.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  579. ## Secondary
  580. wndSecondary.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  581. wndSecondary.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  582. wndSecondary.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  583. wndSecondary.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  584. wndSecondary.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  585. wndSecondary.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  586. ## Talisman
  587. wndTalisman.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  588. wndTalisman.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  589. wndTalisman.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  590. wndTalisman.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  591. wndTalisman.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  592. wndTalisman.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  593. ## Effect
  594. wndEffect.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  595. wndEffect.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  596. wndEffect.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  597. wndEffect.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  598. wndEffect.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  599. wndEffect.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  600. ## ECHIPAMENT
  601.  
  602. ## PickMoneyDialog
  603. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  604. dlgPickMoney.LoadDialog()
  605. dlgPickMoney.Hide()
  606.  
  607. ## RefineDialog
  608. self.refineDialog = uiRefine.RefineDialog()
  609. self.refineDialog.Hide()
  610.  
  611. ## AttachMetinDialog
  612. if app.WJ_ENABLE_TRADABLE_ICON:
  613. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog(self)
  614. self.BindWindow(self.attachMetinDialog)
  615. else:
  616. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  617. self.attachMetinDialog.Hide()
  618.  
  619. ## MoneySlot
  620. #self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  621.  
  622. for i in xrange(player.INVENTORY_PAGE_COUNT):
  623. self.inventoryTab[i].SetEvent(lambda arg=i: self.SetInventoryPage(arg))
  624. self.inventoryTab[0].Down()
  625.  
  626. self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  627. self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  628. self.equipmentTab[2].SetEvent(lambda arg=2: self.SetEquipmentPage(arg))
  629. self.equipmentTab[3].SetEvent(lambda arg=3: self.SetEquipmentPage(arg))
  630. self.equipmentTab[4].SetEvent(lambda arg=4: self.SetEquipmentPage(arg))
  631. self.equipmentTab[0].Down()
  632. self.equipmentPageIndex = 0
  633.  
  634. self.wndItem = wndItem
  635. self.wndEquip = wndEquip
  636. self.dlgPickMoney = dlgPickMoney
  637. self.wndCostume = wndCostume
  638. self.wndSecondary = wndSecondary
  639. self.wndTalisman = wndTalisman
  640. self.wndEffect = wndEffect
  641. self.mask1 = mask1
  642. self.mask2 = mask2
  643. self.mask3 = mask3
  644. self.mask4 = mask4
  645. self.mask5 = mask5
  646.  
  647. # MallButton
  648. # if self.mallButton:
  649. # self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  650.  
  651. if self.DSSButton:
  652. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  653.  
  654. if self.SpecialStorageButton:
  655. self.SpecialStorageButton.SetEvent(ui.__mem_func__(self.ClickSpecialStorageButton))
  656.  
  657. # if self.OFFButton:
  658. # self.OFFButton.SetEvent(ui.__mem_func__(self.ClickOFFButton))
  659.  
  660. # if self.SWITCHButton:
  661. # self.SWITCHButton.SetEvent(ui.__mem_func__(self.SwitchBot))
  662.  
  663. # if self.INFOCHESTButton:
  664. # self.INFOCHESTButton.SetEvent(ui.__mem_func__(self.InfoChest))
  665.  
  666. # Costume Button
  667. if self.costumeButton:
  668. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  669.  
  670. if self.arrange_button:
  671. self.arrange_button.SetEvent(ui.__mem_func__(self.click_arrange))
  672.  
  673. self.wndCostume = None
  674.  
  675. if app.WJ_ENABLE_PICKUP_ITEM_EFFECT:
  676. self.listHighlightedSlot = []
  677.  
  678. #####
  679.  
  680. ## Refresh
  681. if app.ENABLE_SASH_SYSTEM:
  682. self.listAttachedSashs = []
  683. if app.ENABLE_CHANGELOOK_SYSTEM:
  684. self.listAttachedCl = []
  685. self.SetInventoryPage(0)
  686. self.SetEquipmentPage(0)
  687. self.RefreshItemSlot()
  688. self.RefreshStatus()
  689.  
  690. def Destroy(self):
  691. self.ClearDictionary()
  692.  
  693. self.dlgPickMoney.Destroy()
  694. self.dlgPickMoney = 0
  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.wndCostume = 0
  706. self.wndSecondary = 0
  707. self.wndTalisman = 0
  708. self.wndEffect = 0
  709. self.dlgPickMoney = 0
  710. #self.wndMoney = 0
  711. #self.wndMoneySlot = 0
  712. self.questionDialog = None
  713. self.arrange_button = None
  714. # self.mallButton = None
  715. self.DSSButton = None
  716. # self.OFFButton = None
  717. # self.SWITCHButton = None
  718. # self.INFOCHESTButton = None
  719. self.interface = None
  720. if app.WJ_ENABLE_TRADABLE_ICON:
  721. self.bindWnds = []
  722.  
  723. if self.wndCostume:
  724. self.wndCostume.Destroy()
  725. self.wndCostume = 0
  726.  
  727. if self.wndBelt:
  728. self.wndBelt.Destroy()
  729. self.wndBelt = None
  730.  
  731. if app.ENABLE_BIOLOG_SYSTEM:
  732. if self.wndCollect:
  733. self.wndCollect.Destroy()
  734. self.wndCollect = None
  735.  
  736. if self.uiSearchShop:
  737. self.uiSearchShop.Destroy()
  738. self.uiSearchShop = None
  739.  
  740. self.inventoryTab = []
  741. self.equipmentTab = []
  742.  
  743. def Hide(self):
  744. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  745. self.OnCloseQuestionDialog()
  746. return
  747. if None != self.tooltipItem:
  748. self.tooltipItem.HideToolTip()
  749.  
  750. if self.wndCostume:
  751. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow() # 인벤토리 창이 닫힐 때 코스츔이 열려 있었는가?
  752. self.wndCostume.Close()
  753.  
  754. if app.ENABLE_BIOLOG_SYSTEM:
  755. if self.wndCollect:
  756. self.isOpenedCollectWindowWhenClosingInventory = self.wndCollect.IsOpeningInventory()
  757. print "Is opening Biolog Inventory", self.isOpenedCollectWindowWhenClosingInventory
  758. self.wndCollect.Close()
  759.  
  760. if self.wndBelt:
  761. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # 인벤토리 창이 닫힐 때 벨트 인벤토리도 열려 있었는가?
  762. print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  763. self.wndBelt.Close()
  764.  
  765. if self.dlgPickMoney:
  766. self.dlgPickMoney.Close()
  767.  
  768. self.OnCloseQuestionDialog()
  769.  
  770. wndMgr.Hide(self.hWnd)
  771.  
  772.  
  773. def Close(self):
  774. self.Hide()
  775.  
  776. if app.WJ_ENABLE_PICKUP_ITEM_EFFECT:
  777. def HighlightSlot(self, slot):
  778. if not slot in self.listHighlightedSlot:
  779. self.listHighlightedSlot.append(slot)
  780.  
  781. def SetInventoryPage(self, page):
  782. self.inventoryPageIndex = page
  783. for i in xrange(player.INVENTORY_PAGE_COUNT):
  784. if i!=page:
  785. self.inventoryTab[i].SetUp()
  786. self.RefreshBagSlotWindow()
  787.  
  788. def SetEquipmentPage(self, page):
  789. self.equipmentTab[self.equipmentPageIndex].SetUp()
  790. self.equipmentPageIndex = page
  791. self.equipmentTab[self.equipmentPageIndex].Down()
  792. self.mask1.Hide()
  793. self.mask2.Hide()
  794. self.mask3.Hide()
  795. self.mask4.Hide()
  796. self.mask5.Hide()
  797. if page == 0:
  798. self.mask1.Show()
  799. elif page == 1:
  800. self.mask3.Show()
  801. elif page == 2:
  802. self.mask2.Show()
  803. elif page == 3:
  804. self.mask4.Show()
  805. elif page == 4:
  806. self.mask5.Show()
  807. else:
  808. self.mask1.Hide()
  809. self.mask2.Hide()
  810. self.mask3.Hide()
  811. self.mask4.Hide()
  812. self.mask5.Hide()
  813. self.RefreshEquipSlotWindow()
  814.  
  815. def OnRunMouseWheel(self, nLen):
  816. if nLen > 0:
  817. if self.equipmentPageIndex < 4:
  818. self.SetEquipmentPage(self.equipmentPageIndex + 1)
  819. else:
  820. if self.equipmentPageIndex > 0:
  821. self.SetEquipmentPage(self.equipmentPageIndex - 1)
  822.  
  823. # def ClickMallButton(self):
  824. # print "click_mall_button"
  825. # net.SendChatPacket("/click_mall")
  826.  
  827. # DSSButton
  828. # def ClickOFFButton(self):
  829. # print "click_off_button"
  830. # import uiNewShop
  831. # net.SendChatPacket("/open_shop")
  832.  
  833. def ClickDSSButton(self):
  834. self.interface.ToggleDragonSoulWindow()
  835.  
  836. def ClickSpecialStorageButton(self):
  837. self.interface.ToggleSpecialStorageWindow()
  838.  
  839. # def SwitchBot(self):
  840. # self.interface.ToggleSpecialStorageWindow()
  841.  
  842. # def InfoChest(self):
  843. # self.meniuinventar = uiInventoryMenue.InventoryMenueDialog()
  844. # self.meniuinventar.Show()
  845. def click_arrange(self):
  846. self.__ClickStartButton()
  847.  
  848. def __ClickStartButton(self):
  849. startQuestionDialog = uiCommon.QuestionDialog2()
  850. startQuestionDialog.SetText1("Acesta optiune ajuta la stacarea obiectelor din inventar.")
  851. startQuestionDialog.SetText2("Doresti sa continui aceasta actiune ?")
  852. startQuestionDialog.SetAcceptEvent(ui.__mem_func__(self.__StartAccept))
  853. startQuestionDialog.SetCancelEvent(ui.__mem_func__(self.__StartCancel))
  854. startQuestionDialog.Open()
  855. self.startQuestionDialog = startQuestionDialog
  856.  
  857. def __StartAccept(self):
  858. net.SendChatPacket("/click_sort_items")
  859. self.__StartCancel()
  860.  
  861. def __StartCancel(self):
  862. self.startQuestionDialog.Close()
  863.  
  864. def ClickCostumeButton(self):
  865. print "Click Costume Button"
  866. if self.wndCostume:
  867. if self.wndCostume.IsShow():
  868. self.wndCostume.Hide()
  869. else:
  870. self.wndCostume.Show()
  871. else:
  872. self.wndCostume = CostumeWindow(self)
  873. self.wndCostume.Show()
  874.  
  875. def OpenPickMoneyDialog(self):
  876.  
  877. if mouseModule.mouseController.isAttached():
  878.  
  879. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  880. if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  881.  
  882. if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  883. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  884. snd.PlaySound("sound/ui/money.wav")
  885.  
  886. mouseModule.mouseController.DeattachObject()
  887.  
  888. else:
  889. curMoney = player.GetElk()
  890.  
  891. if curMoney <= 0:
  892. return
  893.  
  894. self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  895. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  896. self.dlgPickMoney.Open(curMoney)
  897. self.dlgPickMoney.SetMax(7) # 인벤토리 990000 제한 버그 수정
  898.  
  899. def OnPickMoney(self, money):
  900. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  901.  
  902. def OnPickItem(self, count):
  903. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  904. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  905. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  906.  
  907. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  908. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  909. return local
  910.  
  911. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  912.  
  913. def GetInventoryPageIndex(self):
  914. return self.inventoryPageIndex
  915.  
  916. if app.WJ_ENABLE_TRADABLE_ICON:
  917. def RefreshMarkSlots(self, localIndex=None):
  918. if not self.interface:
  919. return
  920.  
  921. onTopWnd = self.interface.GetOnTopWindow()
  922. if localIndex:
  923. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(localIndex)
  924. if onTopWnd == player.ON_TOP_WND_NONE:
  925. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  926.  
  927. elif onTopWnd == player.ON_TOP_WND_SHOP:
  928. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  929. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  930. else:
  931. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  932.  
  933. elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  934. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  935. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  936. else:
  937. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  938.  
  939. elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  940. if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  941. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  942. else:
  943. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  944.  
  945. elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  946. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  947. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  948. else:
  949. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  950.  
  951. return
  952.  
  953. for i in xrange(player.INVENTORY_PAGE_SIZE):
  954. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  955.  
  956. if onTopWnd == player.ON_TOP_WND_NONE:
  957. self.wndItem.SetUsableSlotOnTopWnd(i)
  958.  
  959. elif onTopWnd == player.ON_TOP_WND_SHOP:
  960. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  961. self.wndItem.SetUnusableSlotOnTopWnd(i)
  962. else:
  963. self.wndItem.SetUsableSlotOnTopWnd(i)
  964.  
  965. elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  966. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  967. self.wndItem.SetUnusableSlotOnTopWnd(i)
  968. else:
  969. self.wndItem.SetUsableSlotOnTopWnd(i)
  970.  
  971. elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  972. if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  973. self.wndItem.SetUnusableSlotOnTopWnd(i)
  974. else:
  975. self.wndItem.SetUsableSlotOnTopWnd(i)
  976.  
  977. elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  978. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  979. self.wndItem.SetUnusableSlotOnTopWnd(i)
  980. else:
  981. self.wndItem.SetUsableSlotOnTopWnd(i)
  982.  
  983. def RefreshBagSlotWindow(self):
  984. is_activated = 0
  985. getItemVNum=player.GetItemIndex
  986. getItemCount=player.GetItemCount
  987. setItemVNum=self.wndItem.SetItemSlot
  988.  
  989. for i in xrange(player.INVENTORY_PAGE_SIZE*2):
  990. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  991.  
  992. itemCount = getItemCount(slotNumber)
  993.  
  994. if 0 == itemCount:
  995. self.wndItem.ClearSlot(i)
  996. continue
  997. elif 1 == itemCount:
  998. itemCount = 0
  999.  
  1000. itemVnum = getItemVNum(slotNumber)
  1001. setItemVNum(i, itemVnum, itemCount)
  1002.  
  1003. if app.ENABLE_CHANGELOOK_SYSTEM:
  1004. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  1005. if itemTransmutedVnum:
  1006. self.wndItem.DisableCoverButton(i)
  1007. else:
  1008. self.wndItem.EnableCoverButton(i)
  1009.  
  1010. if constInfo.IS_NEW_DEW_BOTTLE_P(itemVnum):
  1011. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1012.  
  1013. isActivated = 0 != metinSocket[2]
  1014. if isActivated:
  1015. self.wndItem.ActivateSlot(i)
  1016. else:
  1017. self.wndItem.DeactivateSlot(i)
  1018.  
  1019. if constInfo.IS_NEW_SPEED_POT(itemVnum):
  1020. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1021.  
  1022. isActivated = 0 != metinSocket[2]
  1023. if isActivated:
  1024. self.wndItem.ActivateSlot(i)
  1025. else:
  1026. self.wndItem.DeactivateSlot(i)
  1027.  
  1028.  
  1029. if constInfo.IS_AFFECT_ITEM_P(itemVnum):
  1030. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1031.  
  1032. isActivated = 0 != metinSocket[2]
  1033. if isActivated:
  1034. self.wndItem.ActivateSlot(i)
  1035. else:
  1036. self.wndItem.DeactivateSlot(i)
  1037.  
  1038. if constInfo.IS_ENERGY_CRISTAL_P(itemVnum):
  1039. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1040.  
  1041. isActivated = 0 != metinSocket[2]
  1042. if isActivated:
  1043. self.wndItem.ActivateSlot(i)
  1044. else:
  1045. self.wndItem.DeactivateSlot(i)
  1046.  
  1047. if constInfo.IS_AUTO_POTION(itemVnum):
  1048. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1049. if slotNumber >= player.INVENTORY_PAGE_SIZE:
  1050. slotNumber -= player.INVENTORY_PAGE_SIZE
  1051.  
  1052. if constInfo.IS_NEW_DEW_BOTTLE_P(itemVnum):
  1053. isActivated = 0 != metinSocket[2]
  1054. elif constInfo.IS_NEW_SPEED_POT(itemVnum):
  1055. isActivated = 0 != metinSocket[2]
  1056. elif constInfo.IS_AFFECT_ITEM_P(itemVnum):
  1057. isActivated = 0 != metinSocket[2]
  1058. elif constInfo.IS_ENERGY_CRISTAL_P(itemVnum):
  1059. isActivated = 0 != metinSocket[2]
  1060. else:
  1061. isActivated = 0 != metinSocket[0]
  1062. if isActivated:
  1063. self.wndItem.ActivateSlot(i)
  1064. potionType = 0;
  1065. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  1066. potionType = player.AUTO_POTION_TYPE_HP
  1067. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  1068. potionType = player.AUTO_POTION_TYPE_SP
  1069.  
  1070. usedAmount = int(metinSocket[1])
  1071. totalAmount = int(metinSocket[2])
  1072. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  1073. else:
  1074. self.wndItem.DeactivateSlot(i)
  1075.  
  1076. elif app.WJ_ENABLE_PICKUP_ITEM_EFFECT:
  1077. if slotNumber in self.listHighlightedSlot:
  1078. self.wndItem.ActivateSlot(i)
  1079.  
  1080. if app.WJ_ENABLE_TRADABLE_ICON:
  1081. self.RefreshMarkSlots(i)
  1082.  
  1083. if app.ENABLE_SASH_SYSTEM or app.ENABLE_CHANGELOOK_SYSTEM:
  1084. if not constInfo.IS_AUTO_POTION(itemVnum):
  1085. self.wndItem.DeactivateSlotOld(i)
  1086.  
  1087. if app.ENABLE_SASH_SYSTEM:
  1088. slotNumberChecked = 0
  1089. if not constInfo.IS_AUTO_POTION(itemVnum):
  1090. if app.WJ_ENABLE_PICKUP_ITEM_EFFECT:
  1091. if not slotNumber in self.listHighlightedSlot:
  1092. self.wndItem.DeactivateSlot(i)
  1093. else:
  1094. self.wndItem.DeactivateSlot(i)
  1095.  
  1096. for j in xrange(sash.WINDOW_MAX_MATERIALS):
  1097. (isHere, iCell) = sash.GetAttachedItem(j)
  1098. if isHere:
  1099. if iCell == slotNumber:
  1100. self.wndItem.ActivateSlot(i, (238.00 / 255.0), (11.00 / 255.0), (11.00 / 255.0), 1.0)
  1101. if not slotNumber in self.listAttachedSashs:
  1102. self.listAttachedSashs.append(slotNumber)
  1103.  
  1104. slotNumberChecked = 1
  1105. else:
  1106. if slotNumber in self.listAttachedSashs and not slotNumberChecked:
  1107. self.wndItem.DeactivateSlot(i)
  1108. self.listAttachedSashs.remove(slotNumber)
  1109.  
  1110. if app.ENABLE_CHANGELOOK_SYSTEM:
  1111. slotClNumberChecked = 0
  1112. for q in xrange(changelook.WINDOW_MAX_MATERIALS):
  1113. (isHere, iCell) = changelook.GetAttachedItem(q)
  1114. if isHere:
  1115. if iCell == slotNumber:
  1116. self.wndItem.ActivateSlot(i, (238.00 / 255.0), (11.00 / 255.0), (11.00 / 255.0), 1.0)
  1117. if not slotNumber in self.listAttachedCl:
  1118. self.listAttachedCl.append(slotNumber)
  1119.  
  1120. slotClNumberChecked = 1
  1121. else:
  1122. if slotNumber in self.listAttachedCl and not slotClNumberChecked:
  1123. self.wndItem.DeactivateSlot(i)
  1124. self.listAttachedCl.remove(slotNumber)
  1125.  
  1126. self.wndItem.RefreshSlot()
  1127.  
  1128. if self.wndBelt:
  1129. self.wndBelt.RefreshSlot()
  1130.  
  1131. if app.WJ_ENABLE_TRADABLE_ICON:
  1132. map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  1133.  
  1134. def RefreshEquipSlotWindow(self):
  1135. getItemVNum=player.GetItemIndex
  1136. getItemCount=player.GetItemCount
  1137. setItemVNum=self.wndEquip.SetItemSlot
  1138. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  1139. slotNumber = player.EQUIPMENT_SLOT_START + i
  1140. itemCount = getItemCount(slotNumber)
  1141. if itemCount <= 1:
  1142. itemCount = 0
  1143. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1144. for i in xrange(item.COSTUME_SLOT_COUNT):
  1145. slotNumber = item.COSTUME_SLOT_START + i
  1146. self.wndCostume.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  1147. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  1148. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1149. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1150. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1151. itemCount = getItemCount(slotNumber)
  1152. if itemCount <= 1:
  1153. itemCount = 0
  1154. self.wndSecondary.SetItemSlot(slotNumber, getItemVNum(slotNumber), itemCount)
  1155. print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  1156.  
  1157. self.wndEquip.RefreshSlot()
  1158.  
  1159. if app.ENABLE_CHANGELOOK_SYSTEM:
  1160. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  1161. if job == 1:
  1162. if itemTransmutedVnum:
  1163. self.wndEquip.DisableCoverButton(slotNumber)
  1164. else:
  1165. self.wndEquip.EnableCoverButton(slotNumber)
  1166.  
  1167. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1168. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1169. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1170. itemCount = getItemCount(slotNumber)
  1171. if itemCount <= 1:
  1172. itemCount = 0
  1173.  
  1174. # setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1175. if job == 1:
  1176. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), itemCount)
  1177. # if app.ENABLE_CHANGELOOK_SYSTEM:
  1178. # itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  1179. # if itemTransmutedVnum:
  1180. # self.wndEquip.DisableCoverButton(slotNumber)
  1181. # else:
  1182. # self.wndEquip.EnableCoverButton(slotNumber)
  1183. if app.ENABLE_CHANGELOOK_SYSTEM:
  1184. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  1185. if job == 1:
  1186. if itemTransmutedVnum:
  1187. self.wndEquip.DisableCoverButton(slotNumber)
  1188. else:
  1189. self.wndEquip.EnableCoverButton(slotNumber)
  1190.  
  1191. # self.wndEquip.RefreshSlot()
  1192. if job == 1:
  1193. self.wndEquip.RefreshSlot()
  1194.  
  1195. if self.wndCostume:
  1196. self.wndCostume.RefreshCostumeSlot()
  1197.  
  1198. def RefreshItemSlot(self):
  1199. self.RefreshBagSlotWindow()
  1200. self.RefreshEquipSlotWindow()
  1201.  
  1202. def RefreshStatus(self):
  1203. money = player.GetElk()
  1204. #self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  1205. def ActivateDragonSoul(self, deck):
  1206. if deck == 0:
  1207. if self.DSSButton:
  1208. self.DSSButton.SetUpVisual("d:/ymir work/ui/dragonsoul/deck1_1.tga")
  1209. self.DSSButton.SetOverVisual("d:/ymir work/ui/dragonsoul/deck1_2.tga")
  1210. self.DSSButton.SetDownVisual("d:/ymir work/ui/dragonsoul/deck1_3.tga")
  1211. else:
  1212. if self.DSSButton:
  1213. self.DSSButton.SetUpVisual("d:/ymir work/ui/dragonsoul/deck2_1.tga")
  1214. self.DSSButton.SetOverVisual("d:/ymir work/ui/dragonsoul/deck2_2.tga")
  1215. self.DSSButton.SetDownVisual("d:/ymir work/ui/dragonsoul/deck2_3.tga")
  1216.  
  1217. def DeactivateDragonSoul(self):
  1218. if self.DSSButton:
  1219. self.DSSButton.SetUpVisual("d:/ymir work/ui/dragonsoul/ds_01.tga")
  1220. self.DSSButton.SetOverVisual("d:/ymir work/ui/dragonsoul/ds_02.tga")
  1221. self.DSSButton.SetDownVisual("d:/ymir work/ui/dragonsoul/ds_03.tga")
  1222.  
  1223. def SetItemToolTip(self, tooltipItem):
  1224. self.tooltipItem = tooltipItem
  1225.  
  1226. def SellItem(self):
  1227. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  1228. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  1229. ## 용혼석도 팔리게 하는 기능 추가하면서 인자 type 추가
  1230. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  1231. snd.PlaySound("sound/ui/money.wav")
  1232. self.OnCloseQuestionDialog()
  1233.  
  1234. def OnDetachMetinFromItem(self):
  1235. if None == self.questionDialog:
  1236. return
  1237.  
  1238. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1239. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1240. self.OnCloseQuestionDialog()
  1241.  
  1242. def OnCloseQuestionDialog(self):
  1243. if not self.questionDialog:
  1244. return
  1245.  
  1246. self.questionDialog.Close()
  1247. self.questionDialog = None
  1248. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1249.  
  1250. ## Slot Event
  1251. def SelectEmptySlot(self, selectedSlotPos):
  1252. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1253. return
  1254.  
  1255. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  1256.  
  1257. if mouseModule.mouseController.isAttached():
  1258.  
  1259. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1260. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1261. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1262. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1263.  
  1264. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1265. itemCount = player.GetItemCount(attachedSlotPos)
  1266. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1267. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1268.  
  1269. if item.IsRefineScroll(attachedItemIndex):
  1270. self.wndItem.SetUseMode(False)
  1271.  
  1272. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  1273. mouseModule.mouseController.RunCallBack("INVENTORY")
  1274.  
  1275. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  1276. net.SendShopBuyPacket(attachedSlotPos)
  1277.  
  1278. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1279.  
  1280. if player.ITEM_MONEY == attachedItemIndex:
  1281. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1282. snd.PlaySound("sound/ui/money.wav")
  1283.  
  1284. else:
  1285. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1286.  
  1287. elif player.SLOT_TYPE_MALL == attachedSlotType:
  1288. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1289.  
  1290. mouseModule.mouseController.DeattachObject()
  1291.  
  1292. def SelectItemSlot(self, itemSlotIndex):
  1293. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1294. return
  1295.  
  1296. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1297.  
  1298. if mouseModule.mouseController.isAttached():
  1299. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1300. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1301. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1302.  
  1303. if app.ENABLE_SPECIAL_STORAGE:
  1304. if player.SLOT_TYPE_INVENTORY == attachedSlotType or player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType:
  1305. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1306. else:
  1307. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1308. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1309.  
  1310. mouseModule.mouseController.DeattachObject()
  1311.  
  1312. else:
  1313.  
  1314. curCursorNum = app.GetCursor()
  1315. if app.SELL == curCursorNum:
  1316. self.__SellItem(itemSlotIndex)
  1317.  
  1318. elif app.BUY == curCursorNum:
  1319. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1320.  
  1321. elif app.IsPressed(app.DIK_LALT):
  1322. link = player.GetItemLink(itemSlotIndex)
  1323. ime.PasteString(link)
  1324.  
  1325. elif app.IsPressed(app.DIK_LSHIFT):
  1326. itemCount = player.GetItemCount(itemSlotIndex)
  1327.  
  1328. if itemCount > 1:
  1329. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1330. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1331. self.dlgPickMoney.Open(itemCount)
  1332. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1333. #else:
  1334. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1335. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1336.  
  1337. elif app.IsPressed(app.DIK_LCONTROL):
  1338. itemIndex = player.GetItemIndex(itemSlotIndex)
  1339.  
  1340. if True == item.CanAddToQuickSlotItem(itemIndex):
  1341. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1342. else:
  1343. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1344.  
  1345. else:
  1346. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1347. itemCount = player.GetItemCount(itemSlotIndex)
  1348. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1349.  
  1350. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1351. self.wndItem.SetUseMode(True)
  1352. else:
  1353. self.wndItem.SetUseMode(False)
  1354.  
  1355. snd.PlaySound("sound/ui/pick.wav")
  1356.  
  1357. def UseTransportBox(self):
  1358. self.__SendUseItemToItemPacket(self.questionDialog.src, self.questionDialog.dst)
  1359. self.OnCloseQuestionDialog()
  1360.  
  1361. def UseProtein(self):
  1362. self.__SendUseItemToItemPacket(self.questionDialog.src, self.questionDialog.dst)
  1363. self.OnCloseQuestionDialog()
  1364.  
  1365. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1366. if app.ENABLE_SPECIAL_STORAGE:
  1367. if srcItemSlotPos == dstItemSlotPos and not item.IsMetin(srcItemVID):
  1368. return
  1369. else:
  1370. if srcItemSlotPos == dstItemSlotPos:
  1371. return
  1372.  
  1373. if srcItemVID >= 55701 and srcItemVID <= 55708 and player.GetItemIndex(dstItemSlotPos) == 55002:
  1374. self.questionDialog = uiCommon.QuestionDialog()
  1375. self.questionDialog.SetText("Vrei sa adaugi insotitorul in cutia de transport?")
  1376. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseTransportBox))
  1377. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1378. self.questionDialog.Open()
  1379. self.questionDialog.src = srcItemSlotPos
  1380. self.questionDialog.dst = dstItemSlotPos
  1381.  
  1382. if srcItemVID == 55001 and player.GetItemIndex(dstItemSlotPos) >= 55701 and player.GetItemIndex(dstItemSlotPos) <= 55708:
  1383. self.questionDialog = uiCommon.QuestionDialog()
  1384. self.questionDialog.SetText("Vrei sa hranesti insotitorul?")
  1385. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseProtein))
  1386. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1387. self.questionDialog.Open()
  1388. self.questionDialog.src = srcItemSlotPos
  1389. self.questionDialog.dst = dstItemSlotPos
  1390.  
  1391. if srcItemVID == 71051 and player.GetItemIndex(dstItemSlotPos) >= 70500 and player.GetItemIndex(dstItemSlotPos) <= 70509:
  1392. self.questionDialog = uiCommon.QuestionDialog()
  1393. self.questionDialog.SetText("Vrei sa adaugi sufletele pe acest item?")
  1394. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseProtein))
  1395. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1396. self.questionDialog.Open()
  1397. self.questionDialog.src = srcItemSlotPos
  1398. self.questionDialog.dst = dstItemSlotPos
  1399.  
  1400. if srcItemVID == 71051 and player.GetItemIndex(dstItemSlotPos) >= 9600 and player.GetItemIndex(dstItemSlotPos) <= 10770:
  1401. self.questionDialog = uiCommon.QuestionDialog()
  1402. self.questionDialog.SetText("Vrei sa adaugi sufletele pe acest item?")
  1403. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseProtein))
  1404. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1405. self.questionDialog.Open()
  1406. self.questionDialog.src = srcItemSlotPos
  1407. self.questionDialog.dst = dstItemSlotPos
  1408.  
  1409. if srcItemVID == 71052 and player.GetItemIndex(dstItemSlotPos) >= 70500 and player.GetItemIndex(dstItemSlotPos) <= 70509:
  1410. self.questionDialog = uiCommon.QuestionDialog()
  1411. self.questionDialog.SetText("Vrei sa adaugi sufletele pe acest item?")
  1412. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseProtein))
  1413. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1414. self.questionDialog.Open()
  1415. self.questionDialog.src = srcItemSlotPos
  1416. self.questionDialog.dst = dstItemSlotPos
  1417.  
  1418. if srcItemVID == 71052 and player.GetItemIndex(dstItemSlotPos) >= 9600 and player.GetItemIndex(dstItemSlotPos) <= 10770:
  1419. self.questionDialog = uiCommon.QuestionDialog()
  1420. self.questionDialog.SetText("Vrei sa adaugi sufletele pe acest item?")
  1421. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseProtein))
  1422. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1423. self.questionDialog.Open()
  1424. self.questionDialog.src = srcItemSlotPos
  1425. self.questionDialog.dst = dstItemSlotPos
  1426.  
  1427. if srcItemVID >= 91021 and srcItemVID <= 91029 and player.GetItemIndex(dstItemSlotPos) >= 91010 and player.GetItemIndex(dstItemSlotPos) <= 91020:
  1428. self.questionDialog = uiCommon.QuestionDialog()
  1429. self.questionDialog.SetText("Sigur vrei sa folosesti acest item?")
  1430. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseProtein))
  1431. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1432. self.questionDialog.Open()
  1433. self.questionDialog.src = srcItemSlotPos
  1434. self.questionDialog.dst = dstItemSlotPos
  1435.  
  1436. # cyh itemseal 2013 11 08
  1437. if app.ENABLE_SEALBIND_SYSTEM and item.IsSealScroll(srcItemVID):
  1438. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1439.  
  1440. elif item.IsRefineScroll(srcItemVID):
  1441. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1442. self.wndItem.SetUseMode(False)
  1443.  
  1444. elif item.IsMetin(srcItemVID):
  1445. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1446.  
  1447. elif item.IsDetachScroll(srcItemVID):
  1448. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1449.  
  1450. elif item.IsKey(srcItemVID):
  1451. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1452.  
  1453. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1454. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1455.  
  1456. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1457. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1458.  
  1459. else:
  1460. #snd.PlaySound("sound/ui/drop.wav")
  1461.  
  1462. ## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites]
  1463. if player.IsEquipmentSlot(dstItemSlotPos):
  1464.  
  1465. ## 들고 있는 아이템이 장비일때만
  1466. if item.IsEquipmentVID(srcItemVID):
  1467. self.__UseItem(srcItemSlotPos)
  1468.  
  1469. else:
  1470. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1471. #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1472.  
  1473. def __SellItem(self, itemSlotPos):
  1474. if not player.IsEquipmentSlot(itemSlotPos):
  1475. self.sellingSlotNumber = itemSlotPos
  1476. itemIndex = player.GetItemIndex(itemSlotPos)
  1477. itemCount = player.GetItemCount(itemSlotPos)
  1478.  
  1479.  
  1480. self.sellingSlotitemIndex = itemIndex
  1481. self.sellingSlotitemCount = itemCount
  1482.  
  1483. item.SelectItem(itemIndex)
  1484. ## 안티 플레그 검사 빠져서 추가
  1485. ## 20140220
  1486. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1487. popup = uiCommon.PopupDialog()
  1488. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1489. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1490. popup.Open()
  1491. self.popup = popup
  1492. return
  1493.  
  1494. itemPrice = item.GetISellItemPrice()
  1495.  
  1496. if item.Is1GoldItem():
  1497. itemPrice = itemCount / itemPrice / 5
  1498. else:
  1499. itemPrice = itemPrice * itemCount / 5
  1500.  
  1501. item.GetItemName(itemIndex)
  1502. itemName = item.GetItemName()
  1503.  
  1504. self.questionDialog = uiCommon.QuestionDialog()
  1505. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1506. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1507. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1508. self.questionDialog.Open()
  1509. self.questionDialog.count = itemCount
  1510.  
  1511. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1512.  
  1513. def __OnClosePopupDialog(self):
  1514. self.pop = None
  1515.  
  1516. def RefineItem(self, scrollSlotPos, targetSlotPos):
  1517.  
  1518. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1519. targetIndex = player.GetItemIndex(targetSlotPos)
  1520.  
  1521. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1522. return
  1523.  
  1524. if app.ENABLE_REFINE_RENEWAL:
  1525. constInfo.AUTO_REFINE_TYPE = 1
  1526. constInfo.AUTO_REFINE_DATA["ITEM"][0] = scrollSlotPos
  1527. constInfo.AUTO_REFINE_DATA["ITEM"][1] = targetSlotPos
  1528.  
  1529. ###########################################################
  1530. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1531. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1532. return
  1533. ###########################################################
  1534.  
  1535. ###########################################################
  1536. #net.SendRequestRefineInfoPacket(targetSlotPos)
  1537. #return
  1538. ###########################################################
  1539.  
  1540. result = player.CanRefine(scrollIndex, targetSlotPos)
  1541.  
  1542. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1543. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1544. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1545.  
  1546. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1547. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1548. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1549.  
  1550. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1551. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1552. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1553.  
  1554. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1555. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1556. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1557.  
  1558. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1559. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1560.  
  1561. if player.REFINE_OK != result:
  1562. return
  1563.  
  1564. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1565.  
  1566. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1567. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1568. targetIndex = player.GetItemIndex(targetSlotPos)
  1569. if app.ENABLE_SASH_SYSTEM and app.ENABLE_CHANGELOOK_SYSTEM:
  1570. if not player.CanDetach(scrollIndex, targetSlotPos):
  1571. item.SelectItem(scrollIndex)
  1572. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1573. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SASH_FAILURE_CLEAN)
  1574. elif item.GetValue(0) == changelook.CLEAN_ATTR_VALUE0:
  1575. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHANGE_LOOK_FAILURE_CLEAN)
  1576. else:
  1577. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1578.  
  1579. return
  1580. elif app.ENABLE_SASH_SYSTEM:
  1581. if not player.CanDetach(scrollIndex, targetSlotPos):
  1582. item.SelectItem(scrollIndex)
  1583. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1584. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SASH_FAILURE_CLEAN)
  1585. else:
  1586. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1587.  
  1588. return
  1589. elif app.ENABLE_CHANGELOOK_SYSTEM:
  1590. if not player.CanDetach(scrollIndex, targetSlotPos):
  1591. item.SelectItem(scrollIndex)
  1592. if item.GetValue(0) == changelook.CLEAN_ATTR_VALUE0:
  1593. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.CHANGE_LOOK_FAILURE_CLEAN)
  1594. else:
  1595. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1596.  
  1597. return
  1598. else:
  1599. if not player.CanDetach(scrollIndex, targetSlotPos):
  1600. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1601. return
  1602.  
  1603. self.questionDialog = uiCommon.QuestionDialog()
  1604. self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1605. if app.ENABLE_SASH_SYSTEM:
  1606. item.SelectItem(targetIndex)
  1607. if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_SASH:
  1608. item.SelectItem(scrollIndex)
  1609. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1610. self.questionDialog.SetText(localeInfo.SASH_DO_YOU_CLEAN)
  1611.  
  1612. if app.ENABLE_CHANGELOOK_SYSTEM:
  1613. item.SelectItem(targetIndex)
  1614. if item.GetItemType() == item.ITEM_TYPE_WEAPON or item.GetItemType() == item.ITEM_TYPE_ARMOR or item.GetItemType() == item.ITEM_TYPE_COSTUME:
  1615. item.SelectItem(scrollIndex)
  1616. if item.GetValue(0) == changelook.CLEAN_ATTR_VALUE0:
  1617. self.questionDialog.SetText(localeInfo.CHANGE_LOOK_DO_YOU_CLEAN)
  1618.  
  1619. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1620. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1621. self.questionDialog.Open()
  1622. self.questionDialog.sourcePos = scrollSlotPos
  1623. self.questionDialog.targetPos = targetSlotPos
  1624.  
  1625. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1626. if app.ENABLE_SPECIAL_STORAGE:
  1627. metinIndex = player.GetItemIndex(player.STONE_INVENTORY, metinSlotPos)
  1628. else:
  1629. metinIndex = player.GetItemIndex(metinSlotPos)
  1630. targetIndex = player.GetItemIndex(targetSlotPos)
  1631.  
  1632. item.SelectItem(metinIndex)
  1633. itemName = item.GetItemName()
  1634.  
  1635. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1636.  
  1637. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1638. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1639.  
  1640. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1641. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1642.  
  1643. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1644. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1645.  
  1646. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1647. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1648.  
  1649. if player.ATTACH_METIN_OK != result:
  1650. return
  1651.  
  1652. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1653.  
  1654.  
  1655.  
  1656. def OverOutItem(self):
  1657. self.wndItem.SetUsableItem(False)
  1658. if None != self.tooltipItem:
  1659. self.tooltipItem.HideToolTip()
  1660.  
  1661. def OverInItem(self, overSlotPos):
  1662. if app.WJ_ENABLE_PICKUP_ITEM_EFFECT:
  1663. stat = 0
  1664. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1665. itemVnum = player.GetItemIndex(slotNumber)
  1666. if constInfo.IS_AUTO_POTION(itemVnum):
  1667. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1668. if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  1669. slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  1670.  
  1671. isActivated = 0 != metinSocket[0]
  1672. if isActivated:
  1673. stat = 1
  1674.  
  1675. if not stat:
  1676. if slotNumber in self.listHighlightedSlot:
  1677. self.wndItem.DeactivateSlot(overSlotPos)
  1678. try:
  1679. if app.ENABLE_SASH_SYSTEM:
  1680. if not slotNumber in self.listAttachedSashs:
  1681. self.listHighlightedSlot.remove(slotNumber)
  1682. else:
  1683. self.listHighlightedSlot.remove(slotNumber)
  1684. except:
  1685. pass
  1686.  
  1687. overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1688. self.wndItem.SetUsableItem(False)
  1689.  
  1690. if mouseModule.mouseController.isAttached():
  1691. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1692. if app.ENABLE_SPECIAL_STORAGE:
  1693. if player.SLOT_TYPE_INVENTORY == attachedItemType or player.SLOT_TYPE_STONE_INVENTORY == attachedItemType:
  1694. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1695. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1696.  
  1697. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1698. self.wndItem.SetUsableItem(True)
  1699. self.wndItem.SetUseMode(True)
  1700. self.ShowToolTip(overSlotPos)
  1701. return
  1702. else:
  1703. if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1704. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1705. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1706.  
  1707. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1708. self.wndItem.SetUsableItem(True)
  1709. self.ShowToolTip(overSlotPos)
  1710. return
  1711.  
  1712. self.ShowToolTip(overSlotPos)
  1713.  
  1714. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1715. "다른 아이템에 사용할 수 있는 아이템인가?"
  1716.  
  1717. if srcItemVNum >= 55701 and srcItemVNum <= 55708:
  1718. return True
  1719.  
  1720. if srcItemVNum >= 91010 and srcItemVNum <= 91015:
  1721. return True
  1722.  
  1723. if srcItemVNum == 55001:
  1724. return True
  1725.  
  1726. if srcItemVNum == 71051:
  1727. return True
  1728.  
  1729. if srcItemVNum == 71052:
  1730. return True
  1731.  
  1732. if srcItemVNum >= 91021 and srcItemVNum <= 91029:
  1733. return True
  1734.  
  1735. if item.IsRefineScroll(srcItemVNum):
  1736. return True
  1737. elif item.IsMetin(srcItemVNum):
  1738. return True
  1739. elif item.IsDetachScroll(srcItemVNum):
  1740. return True
  1741. elif item.IsKey(srcItemVNum):
  1742. return True
  1743. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1744. return True
  1745. else:
  1746. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1747. return True
  1748.  
  1749. return False
  1750.  
  1751. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1752. "대상 아이템에 사용할 수 있는가?"
  1753.  
  1754. if srcItemVNum >= 55701 and srcItemVNum <= 55708 and player.GetItemIndex(dstSlotPos) == 55002:
  1755. return True
  1756.  
  1757. if srcItemVNum == 55001 and player.GetItemIndex(dstSlotPos) >= 55701 and player.GetItemIndex(dstSlotPos) <= 55708:
  1758. return True
  1759.  
  1760. if srcItemVNum == 71051 and player.GetItemIndex(dstSlotPos) >= 70500 and player.GetItemIndex(dstSlotPos) <= 70509:
  1761. return True
  1762.  
  1763. if srcItemVNum == 71051 and player.GetItemIndex(dstSlotPos) >= 9600 and player.GetItemIndex(dstSlotPos) <= 10770:
  1764. return True
  1765.  
  1766. if srcItemVNum == 71052 and player.GetItemIndex(dstSlotPos) >= 70500 and player.GetItemIndex(dstSlotPos) <= 70509:
  1767. return True
  1768.  
  1769. if srcItemVNum == 71052 and player.GetItemIndex(dstSlotPos) >= 9600 and player.GetItemIndex(dstSlotPos) <= 10770:
  1770. return True
  1771.  
  1772. if srcItemVNum >= 91021 and srcItemVNum <= 91029 and player.GetItemIndex(dstSlotPos) >= 91010 and player.GetItemIndex(dstSlotPos) <= 91020:
  1773. return True
  1774.  
  1775. if app.ENABLE_SPECIAL_STORAGE:
  1776. if srcSlotPos == dstSlotPos and not item.IsMetin(srcItemVNum):
  1777. return False
  1778. else:
  1779. if srcSlotPos == dstSlotPos:
  1780. return False
  1781.  
  1782. if item.IsRefineScroll(srcItemVNum):
  1783. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1784. return True
  1785. elif item.IsMetin(srcItemVNum):
  1786. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1787. return True
  1788. elif item.IsDetachScroll(srcItemVNum):
  1789. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1790. return True
  1791. elif item.IsKey(srcItemVNum):
  1792. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1793. return True
  1794.  
  1795. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1796. return True
  1797.  
  1798. else:
  1799. useType=item.GetUseType(srcItemVNum)
  1800.  
  1801. if "USE_CLEAN_SOCKET" == useType:
  1802. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1803. return True
  1804. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1805. if self.__CanChangeItemAttrList(dstSlotPos):
  1806. return True
  1807. elif "USE_ADD_ATTRIBUTE" == useType:
  1808. if self.__CanAddItemAttr(dstSlotPos):
  1809. return True
  1810. elif "USE_ADD_ATTRIBUTE2" == useType:
  1811. if self.__CanAddItemAttr(dstSlotPos):
  1812. return True
  1813. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1814. if self.__CanAddAccessorySocket(dstSlotPos):
  1815. return True
  1816. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1817. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1818. return True
  1819. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1820. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1821. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1822. elif useType == "USE_COSTUME_ENCHANT" or useType == "USE_COSTUME_TRANSFORM":
  1823. if not app.ENABLE_COSTUME_ATTR_SYSTEM:
  1824. return FALSE
  1825.  
  1826. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1827. item.SelectItem(dstItemVNum)
  1828. if item.GetItemType() == item.ITEM_TYPE_COSTUME:
  1829. return TRUE
  1830.  
  1831. item.SelectItem(dstItemVNum)
  1832.  
  1833. if item.ITEM_TYPE_BELT == item.GetItemType():
  1834. return True
  1835.  
  1836. return False
  1837.  
  1838. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1839. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1840. if dstItemVNum == 0:
  1841. return False
  1842.  
  1843. item.SelectItem(dstItemVNum)
  1844.  
  1845. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1846. return False
  1847.  
  1848. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1849. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1850. return True
  1851.  
  1852. return False
  1853.  
  1854. def __CanChangeItemAttrList(self, dstSlotPos):
  1855. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1856. if dstItemVNum == 0:
  1857. return False
  1858.  
  1859. item.SelectItem(dstItemVNum)
  1860.  
  1861. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR, item.ITEM_TYPE_RING):
  1862. return False
  1863.  
  1864. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1865. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1866. return True
  1867.  
  1868. return False
  1869.  
  1870. def __CanAddSoulToItem(self, dstSlotPos):
  1871. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1872. if dstItemVNum == 0:
  1873. return False
  1874.  
  1875. item.SelectItem(dstItemVNum)
  1876.  
  1877. if item.GetItemType() == item.ITEM_TYPE_ARMOR:
  1878. return True
  1879.  
  1880. return False
  1881.  
  1882. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1883. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1884. if dstItemVNum == 0:
  1885. return False
  1886.  
  1887. item.SelectItem(dstItemVNum)
  1888.  
  1889. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1890. return False
  1891.  
  1892. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1893. return False
  1894.  
  1895. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1896. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1897.  
  1898. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1899. return False
  1900.  
  1901. if curCount>=maxCount:
  1902. return False
  1903.  
  1904. return True
  1905.  
  1906. def __CanAddAccessorySocket(self, dstSlotPos):
  1907. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1908. if dstItemVNum == 0:
  1909. return False
  1910.  
  1911. item.SelectItem(dstItemVNum)
  1912.  
  1913. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1914. return False
  1915.  
  1916. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1917. return False
  1918.  
  1919. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1920. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1921.  
  1922. ACCESSORY_SOCKET_MAX_SIZE = 3
  1923. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1924. return False
  1925.  
  1926. return True
  1927.  
  1928. def __CanAddItemAttr(self, dstSlotPos):
  1929. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1930. if dstItemVNum == 0:
  1931. return False
  1932.  
  1933. item.SelectItem(dstItemVNum)
  1934.  
  1935. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR, item.ITEM_TYPE_RING):
  1936. return False
  1937.  
  1938. attrCount = 0
  1939. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1940. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1941. attrCount += 1
  1942.  
  1943. if attrCount<4:
  1944. return True
  1945.  
  1946. return False
  1947.  
  1948. def ShowToolTip(self, slotIndex):
  1949. if None != self.tooltipItem:
  1950. self.tooltipItem.SetInventoryItem(slotIndex)
  1951.  
  1952. def OnTop(self):
  1953. if None != self.tooltipItem:
  1954. self.tooltipItem.SetTop()
  1955. if app.WJ_ENABLE_TRADABLE_ICON:
  1956. map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  1957. self.RefreshMarkSlots()
  1958.  
  1959. def OnPressEscapeKey(self):
  1960. self.Close()
  1961. return True
  1962.  
  1963. def UseItemSlot(self, slotIndex):
  1964. curCursorNum = app.GetCursor()
  1965. if app.SELL == curCursorNum:
  1966. return
  1967.  
  1968.  
  1969. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1970. return
  1971.  
  1972. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1973.  
  1974. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1975. if self.wndDragonSoulRefine.IsShow():
  1976. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1977. return
  1978.  
  1979. if app.ENABLE_SASH_SYSTEM:
  1980. if self.isShowSashWindow():
  1981. sash.Add(player.INVENTORY, slotIndex, 255)
  1982. return
  1983.  
  1984. if app.ENABLE_CHANGELOOK_SYSTEM:
  1985. if self.isShowChangeLookWindow():
  1986. changelook.Add(player.INVENTORY, slotIndex, 255)
  1987. return
  1988.  
  1989. self.__UseItem(slotIndex)
  1990. mouseModule.mouseController.DeattachObject()
  1991. self.OverOutItem()
  1992.  
  1993. def IsTreasureBox(self, slotIndex):
  1994. itemVnum = player.GetItemIndex(slotIndex)
  1995. item.SelectItem(itemVnum)
  1996.  
  1997. if item.GetItemType() == item.ITEM_TYPE_GIFTBOX:
  1998. return True
  1999.  
  2000. treasures = {
  2001. 0: 50011,
  2002. 1: 50024,
  2003. 2: 50025,
  2004. 3: 50031,
  2005. 4: 50032,
  2006. }
  2007.  
  2008. if itemVnum in treasures.values():
  2009. return True
  2010.  
  2011. return False
  2012.  
  2013. def SendMultipleUseItemPacket(self, slotIndex):
  2014. for i in xrange(player.GetItemCount(slotIndex)):
  2015. self.__SendUseItemPacket(slotIndex)
  2016.  
  2017. def __UseItem(self, slotIndex):
  2018. ItemVNum = player.GetItemIndex(slotIndex)
  2019. item.SelectItem(ItemVNum)
  2020.  
  2021. if ItemVNum == 39116:
  2022. self.searchbtn2()
  2023.  
  2024. if ItemVNum == 39117:
  2025. self.searchbtn2()
  2026.  
  2027. #Open all stack of treasure box with CTRL + RIGHT CLICK - hunterukh 9.march.2017
  2028. if app.IsPressed(app.DIK_LCONTROL) and self.IsTreasureBox(slotIndex):
  2029. self.SendMultipleUseItemPacket(slotIndex)
  2030. return
  2031.  
  2032. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  2033. net.SendItemUsePacket(slotIndex)
  2034. elif player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GIFTBOX:
  2035. if app.ENABLE_SHOW_CHEST_DROP:
  2036. if self.interface:
  2037. if self.interface.dlgChestDrop:
  2038. if not self.interface.dlgChestDrop.IsShow():
  2039. self.interface.dlgChestDrop.Open(slotIndex)
  2040. net.SendChestDropInfo(slotIndex)
  2041. elif player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GACHA:
  2042. if app.ENABLE_SHOW_CHEST_DROP:
  2043. if self.interface:
  2044. if self.interface.dlgChestDrop:
  2045. if not self.interface.dlgChestDrop.IsShow():
  2046. self.interface.dlgChestDrop.Open(slotIndex)
  2047. net.SendChestDropInfo(slotIndex)
  2048. else:
  2049. # self.__SendUseItemPacket(slotIndex)
  2050. net.SendItemUsePacket(slotIndex)
  2051.  
  2052. def searchbtn2(self):
  2053. self.testasd = uiSearchShop.ShopSearch()
  2054. self.testasd.Show()
  2055.  
  2056. def __UseItemQuestionDialog_OnCancel(self):
  2057. self.OnCloseQuestionDialog()
  2058.  
  2059. def __UseItemQuestionDialog_OnAccept(self):
  2060. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  2061. self.OnCloseQuestionDialog()
  2062.  
  2063. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  2064. # 개인상점 열고 있는 동안 아이템 사용 방지
  2065. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2066. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  2067. return
  2068.  
  2069. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  2070.  
  2071. def __SendUseItemPacket(self, slotPos):
  2072. # 개인상점 열고 있는 동안 아이템 사용 방지
  2073. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2074. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  2075. return
  2076.  
  2077. net.SendItemUsePacket(slotPos)
  2078.  
  2079. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  2080. # 개인상점 열고 있는 동안 아이템 사용 방지
  2081. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2082. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  2083. return
  2084.  
  2085. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  2086.  
  2087. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  2088. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  2089. self.wndDragonSoulRefine = wndDragonSoulRefine
  2090.  
  2091. if app.ENABLE_SASH_SYSTEM:
  2092. def SetSashWindow(self, wndSashCombine, wndSashAbsorption):
  2093. self.wndSashCombine = wndSashCombine
  2094. self.wndSashAbsorption = wndSashAbsorption
  2095.  
  2096. def isShowSashWindow(self):
  2097. if self.wndSashCombine:
  2098. if self.wndSashCombine.IsShow():
  2099. return 1
  2100.  
  2101. if self.wndSashAbsorption:
  2102. if self.wndSashAbsorption.IsShow():
  2103. return 1
  2104.  
  2105. return 0
  2106.  
  2107. if app.ENABLE_CHANGELOOK_SYSTEM:
  2108. def SetChangeLookWindow(self, wndChangeLook):
  2109. self.wndChangeLook = wndChangeLook
  2110.  
  2111. def isShowChangeLookWindow(self):
  2112. if self.wndChangeLook:
  2113. if self.wndChangeLook.IsShow():
  2114. return 1
  2115.  
  2116. return 0
  2117.  
  2118. def OnMoveWindow(self, x, y):
  2119. # print "Inventory Global Pos : ", self.GetGlobalPosition()
  2120. if self.wndBelt:
  2121. # print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  2122. self.wndBelt.AdjustPositionAndSize()
  2123. if app.ENABLE_BIOLOG_SYSTEM:
  2124. if self.wndCollect:
  2125. self.wndCollect.AdjustPositionAndSize()
  2126.  
  2127.  
Advertisement
Add Comment
Please, Sign In to add comment