Guest User

Untitled

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