Guest User

uiinventory

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