1. import ui
  2. import player
  3. import mouseModule
  4. import net
  5. import app
  6. import snd
  7. import item
  8. import player
  9. import chat
  10. import grp
  11. import uiScriptLocale
  12. import uiRefine
  13. import uiAttachMetin
  14. import uiPickMoney
  15. import uiCommon
  16. import uiPrivateShopBuilder
  17. import localeInfo
  18. import constInfo
  19. import ime
  20. import wndMgr
  21. import uiPickEtc
  22. import uiToolTip
  23. if app.ENABLE_ACCE_SYSTEM:
  24. import acce
  25. ITEM_MALL_BUTTON_ENABLE = True
  26. ITEM_FLAG_APPLICABLE = 1 << 14
  27. class CostumeWindow(ui.ScriptWindow):
  28. def __init__(self, wndInventory):
  29. import exception
  30. if not app.ENABLE_COSTUME_SYSTEM:
  31. exception.Abort("What do you do?")
  32. return
  33. if not wndInventory:
  34. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  35. return
  36. ui.ScriptWindow.__init__(self)
  37. self.isLoaded = 0
  38. self.wndInventory = wndInventory;
  39. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  40. self.visibleButtonList = []
  41. self.__LoadWindow()
  42. def __del__(self):
  43. ui.ScriptWindow.__del__(self)
  44. def Show(self):
  45. self.__LoadWindow()
  46. self.RefreshCostumeSlot()
  47. ui.ScriptWindow.Show(self)
  48. def Close(self):
  49. self.Hide()
  50. def __LoadWindow(self):
  51. if self.isLoaded == 1:
  52. return
  53. self.isLoaded = 1
  54. try:
  55. pyScrLoader = ui.PythonScriptLoader()
  56. pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  57. except:
  58. import exception
  59. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  60. try:
  61. wndEquip = self.GetChild("CostumeSlot")
  62. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  63. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  64. self.visibleButtonList.append(self.GetChild("BodyToolTipButton"))
  65. self.visibleButtonList.append(self.GetChild("HairToolTipButton"))
  66. self.visibleButtonList.append(self.GetChild("AcceToolTipButton"))
  67. self.visibleButtonList.append(self.GetChild("WeaponToolTipButton"))
  68. except:
  69. import exception
  70. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  71. ## Equipment
  72. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  73. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  74. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  75. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  76. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  77. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  78. self.wndEquip = wndEquip
  79. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  80. self.visibleButtonList[0].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 1, 0)
  81. self.visibleButtonList[1].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 2, 0)
  82. if app.ENABLE_ACCE_COSTUME_SYSTEM:
  83. self.visibleButtonList[2].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 3, 0)
  84. if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  85. self.visibleButtonList[3].SetToggleUpEvent(ui.__mem_func__(self.VisibleCostume), 4, 0)
  86. self.visibleButtonList[0].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 1, 1)
  87. self.visibleButtonList[1].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 2, 1)
  88. if app.ENABLE_ACCE_COSTUME_SYSTEM:
  89. self.visibleButtonList[2].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 3, 1)
  90. if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  91. self.visibleButtonList[3].SetToggleDownEvent(ui.__mem_func__(self.VisibleCostume), 4, 1)
  92. def RefreshCostumeSlot(self):
  93. getItemVNum=player.GetItemIndex
  94. for i in xrange(item.COSTUME_SLOT_COUNT):
  95. slotNumber = item.COSTUME_SLOT_START + i
  96. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  97. if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  98. self.wndEquip.SetItemSlot(item.COSTUME_SLOT_WEAPON, getItemVNum(item.COSTUME_SLOT_WEAPON), 0)
  99. self.wndEquip.RefreshSlot()
  100. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  101. def RefreshVisibleCostume(self):
  102. body = constInfo.HIDDEN_BODY_COSTUME
  103. hair = constInfo.HIDDEN_HAIR_COSTUME
  104. if app.ENABLE_ACCE_COSTUME_SYSTEM:
  105. acce = constInfo.HIDDEN_ACCE_COSTUME
  106. if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  107. weapon = constInfo.HIDDEN_WEAPON_COSTUME
  108. if body == 1:
  109. self.visibleButtonList[0].SetToolTipText(localeInfo.SHOW_COSTUME)
  110. self.visibleButtonList[0].Down()
  111. else:
  112. self.visibleButtonList[0].SetToolTipText(localeInfo.HIDE_COSTUME)
  113. self.visibleButtonList[0].SetUp()
  114. if hair == 1:
  115. self.visibleButtonList[1].SetToolTipText(localeInfo.SHOW_COSTUME)
  116. self.visibleButtonList[1].Down()
  117. else:
  118. self.visibleButtonList[1].SetToolTipText(localeInfo.HIDE_COSTUME)
  119. self.visibleButtonList[1].SetUp()
  120. if app.ENABLE_ACCE_COSTUME_SYSTEM:
  121. if acce == 1:
  122. self.visibleButtonList[2].SetToolTipText(localeInfo.SHOW_COSTUME)
  123. self.visibleButtonList[2].Down()
  124. else:
  125. self.visibleButtonList[2].SetToolTipText(localeInfo.HIDE_COSTUME)
  126. self.visibleButtonList[2].SetUp()
  127. if app.ENABLE_WEAPON_COSTUME_SYSTEM:
  128. if weapon == 1:
  129. self.visibleButtonList[3].SetToolTipText(localeInfo.SHOW_COSTUME)
  130. self.visibleButtonList[3].Down()
  131. else:
  132. self.visibleButtonList[3].SetToolTipText(localeInfo.HIDE_COSTUME)
  133. self.visibleButtonList[3].SetUp()
  134. def VisibleCostume(self, part, hidden):
  135. net.SendChatPacket("/hide_costume %d %d" % (part, hidden))
  136. if app.WJ_SPLIT_INVENTORY_SYSTEM:
  137. class ExtendedInventoryWindow(ui.ScriptWindow):
  138. tooltipItem = None
  139. interface = None
  140. dlgPickMoney = None
  141. dlgPickItem = None
  142. sellingSlotNumber = -1
  143. isLoaded = 0
  144. def __init__(self):
  145. ui.ScriptWindow.__init__(self)
  146. self.inventoryPageIndex = 0
  147. self.__LoadWindow()
  148. def __del__(self):
  149. ui.ScriptWindow.__del__(self)
  150. def Show(self):
  151. self.__LoadWindow()
  152. ui.ScriptWindow.Show(self)
  153. def BindInterfaceClass(self, interface):
  154. self.interface = interface
  155. def __LoadWindow(self):
  156. if self.isLoaded == 1:
  157. return
  158. self.isLoaded = 1
  159. try:
  160. pyScrLoader = ui.PythonScriptLoader()
  161. pyScrLoader.LoadScriptFile(self, "UIScript/ExtendedInventoryWindow.py")
  162. except:
  163. import exception
  164. exception.Abort("ExtendedInventoryWindow.LoadWindow.LoadObject")
  165. try:
  166. wndItem = self.GetChild("ItemSlot")
  167. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  168. self.titleName = self.GetChild("TitleName")
  169. self.SkillBookButton = self.GetChild("SkillBookButton")
  170. self.UpgradeItemsButton = self.GetChild("UpgradeItemsButton")
  171. self.stoneButton = self.GetChild("StoneButton")
  172. self.boxButton = self.GetChild("BoxButton")
  173. self.efsunButton = self.GetChild("EfsunButton")
  174. self.cicekButton = self.GetChild("CicekButton")
  175. self.inventoryTab = []
  176. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  177. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  178. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  179. self.MalzemeDeposuInfo = self.GetChild("MalzemeDeposuInfo")
  180. except:
  181. import exception
  182. exception.Abort("ExtendedInventoryWindow.LoadWindow.BindObject")
  183. ## Info
  184. self.tlInfo = uiToolTip.ItemToolTip()
  185. self.tlInfo.Hide()
  186. self.tooltipInfo = [self.tlInfo]*7
  187. self.InformationText = [localeInfo.MALZEME_DEPOSU,
  188. localeInfo.BK_ENVANTER_TEXT1,
  189. localeInfo.BK_ENVANTER_TEXT2,
  190. localeInfo.BK_ENVANTER_TEXT3,
  191. localeInfo.BK_ENVANTER_TEXT4,
  192. localeInfo.BK_ENVANTER_TEXT5,
  193. localeInfo.BK_ENVANTER_TEXT6
  194. ]
  195. for i in xrange(7):
  196. self.tooltipInfo[i].SetFollow(True)
  197. self.tooltipInfo[i].AlignHorizonalCenter()
  198. if i == 0:
  199. TITLE_COLOR = grp.GenerateColor(0.9490, 0.9058, 0.7568, 1.0)
  200. self.tooltipInfo[i].AutoAppendTextLine(self.InformationText[i], TITLE_COLOR)
  201. else:
  202. self.tooltipInfo[i].AutoAppendTextLine(self.InformationText[i])
  203. self.tooltipInfo[i].Hide()
  204. self.tooltipInfo[i].toolTipWidth += 10
  205. ## Item
  206. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  207. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  208. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  209. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  210. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  211. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  212. self.envanterileacilsin = ui.CheckBox()
  213. self.envanterileacilsin.SetParent(self)
  214. self.envanterileacilsin.SetPosition(17, 385)
  215. self.envanterileacilsin.SetEvent(ui.__mem_func__(self.__OnClickEnableEnvanterOn), "ON_CHECK", True)
  216. self.envanterileacilsin.SetEvent(ui.__mem_func__(self.__OnClickDisableEnvanterOf), "ON_UNCKECK", False)
  217. self.envanterileacilsin.SetTextInfo(localeInfo.ENVANTER_ILE_AC)
  218. self.envanterileacilsin.SetCheckStatus(constInfo.EnvanterAcilsinmi)
  219. self.envanterileacilsin.Show()
  220. self.SkillBookButton.SetEvent(lambda arg=0: self.SetInventoryType(arg))
  221. self.UpgradeItemsButton.SetEvent(lambda arg=1: self.SetInventoryType(arg))
  222. self.stoneButton.SetEvent(lambda arg=2: self.SetInventoryType(arg))
  223. self.boxButton.SetEvent(lambda arg=3: self.SetInventoryType(arg))
  224. self.efsunButton.SetEvent(lambda arg=4: self.SetInventoryType(arg))
  225. self.cicekButton.SetEvent(lambda arg=5: self.SetInventoryType(arg))
  226. self.SkillBookButton.Down()
  227. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  228. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  229. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  230. self.inventoryTab[0].Down()
  231. ## PickMoneyDialog
  232. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  233. dlgPickMoney.LoadDialog()
  234. dlgPickMoney.Hide()
  235. ## PickItemDialog
  236. dlgPickItem = uiPickEtc.PickEtcDialog()
  237. dlgPickItem.LoadDialog()
  238. dlgPickItem.Hide()
  239. self.dlgPickMoney = dlgPickMoney
  240. self.wndItem = wndItem
  241. self.SetInventoryType(0)
  242. self.SetInventoryPage(0)
  243. self.dlgPickItem = dlgPickItem
  244. self.wndCostume = None
  245. def Destroy(self):
  246. self.ClearDictionary()
  247. self.dlgPickMoney.Destroy()
  248. self.dlgPickItem.Destroy()
  249. self.dlgPickItem = 0
  250. self.dlgPickMoney = 0
  251. self.tooltipItem = None
  252. self.wndItem = 0
  253. self.interface = None
  254. self.inventoryTab = []
  255. self.envanterileacilsin = []
  256. def __OnClickEnableEnvanterOn(self):
  257. constInfo.EnvanterAcilsinmi = 1
  258. chat.AppendChat(chat.CHAT_TYPE_INFO, "<Sistem> Envanter ile a汚lma aktif.")
  259. def __OnClickDisableEnvanterOf(self):
  260. constInfo.EnvanterAcilsinmi = 0
  261. chat.AppendChat(chat.CHAT_TYPE_INFO, "<Sistem> Envanter ile a汚lma pasif.")
  262. def Hide(self):
  263. if None != self.tooltipItem:
  264. self.tooltipItem.HideToolTip()
  265. self.tlInfo.Hide()
  266. if self.dlgPickItem:
  267. self.dlgPickItem.Close()
  268. wndMgr.Hide(self.hWnd)
  269. def Close(self):
  270. if self.tooltipItem:
  271. self.tooltipItem.HideToolTip()
  272. self.tlInfo.Hide()
  273. self.Hide()
  274. def OnUpdate(self):
  275. for i in xrange(7):
  276. if self.MalzemeDeposuInfo.IsIn():
  277. self.tooltipInfo[i].Show()
  278. else:
  279. self.tooltipInfo[i].Hide()
  280. def SetInventoryType(self, type):
  281. self.inventoryType = type
  282. if type == 0:
  283. self.SkillBookButton.Down()
  284. self.efsunButton.SetUp()
  285. self.cicekButton.SetUp()
  286. self.UpgradeItemsButton.SetUp()
  287. self.stoneButton.SetUp()
  288. self.boxButton.SetUp()
  289. self.titleName.SetText(localeInfo.INVENTORY_SKILL_BOOK_TOOLTIP)
  290. elif type == 2:
  291. self.stoneButton.Down()
  292. self.efsunButton.SetUp()
  293. self.cicekButton.SetUp()
  294. self.UpgradeItemsButton.SetUp()
  295. self.SkillBookButton.SetUp()
  296. self.boxButton.SetUp()
  297. self.titleName.SetText(localeInfo.INVENTORY_STONE_TOOLTIP)
  298. elif type == 3:
  299. self.boxButton.Down()
  300. self.efsunButton.SetUp()
  301. self.UpgradeItemsButton.SetUp()
  302. self.cicekButton.SetUp()
  303. self.stoneButton.SetUp()
  304. self.SkillBookButton.SetUp()
  305. self.titleName.SetText(localeInfo.INVENTORY_BOX_TOOLTIP)
  306. elif type == 4:
  307. self.efsunButton.Down()
  308. self.boxButton.SetUp()
  309. self.cicekButton.SetUp()
  310. self.UpgradeItemsButton.SetUp()
  311. self.stoneButton.SetUp()
  312. self.SkillBookButton.SetUp()
  313. self.titleName.SetText(localeInfo.INVENTORY_EFSUN_TOOLTIP)
  314. elif type == 5:
  315. self.cicekButton.Down()
  316. self.efsunButton.SetUp()
  317. self.boxButton.SetUp()
  318. self.UpgradeItemsButton.SetUp()
  319. self.stoneButton.SetUp()
  320. self.SkillBookButton.SetUp()
  321. self.titleName.SetText(localeInfo.INVENTORY_CICEK_TOOLTIP)
  322. else:
  323. self.UpgradeItemsButton.Down()
  324. self.SkillBookButton.SetUp()
  325. self.efsunButton.SetUp()
  326. self.cicekButton.SetUp()
  327. self.stoneButton.SetUp()
  328. self.boxButton.SetUp()
  329. self.titleName.SetText(localeInfo.INVENTORY_UPGRADE_ITEM_TOOLTIP)
  330. self.RefreshBagSlotWindow()
  331. def SetInventoryPage(self, page):
  332. self.inventoryPageIndex = page
  333. for i in range(0,len(self.inventoryTab)):
  334. self.inventoryTab[i].SetUp()
  335. self.inventoryTab[page].Down()
  336. self.RefreshBagSlotWindow()
  337. def OnPickItem(self, count):
  338. itemSlotIndex = self.dlgPickItem.itemGlobalSlotIndex
  339. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  340. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_SKILL_BOOK_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  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. def GetInventoryPageIndex(self):
  355. return self.inventoryPageIndex
  356. def RefreshBagSlotWindow(self):
  357. getItemVNum=player.GetItemIndex
  358. getItemCount=player.GetItemCount
  359. setItemVNum=self.wndItem.SetItemSlot
  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. def RefreshItemSlot(self):
  452. self.RefreshBagSlotWindow()
  453. def RefreshStatus(self):
  454. pass
  455. def SetItemToolTip(self, tooltipItem):
  456. self.tooltipItem = tooltipItem
  457. def SelectEmptySlot(self, selectedSlotPos):
  458. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  459. return
  460. if self.inventoryType == 0:
  461. selectedSlotPos += item.SKILL_BOOK_INVENTORY_SLOT_START
  462. if self.GetInventoryPageIndex() == 1:
  463. selectedSlotPos += 45
  464. elif self.GetInventoryPageIndex() == 2:
  465. selectedSlotPos += 90
  466. elif self.inventoryType == 2:
  467. selectedSlotPos += item.STONE_INVENTORY_SLOT_START
  468. if self.GetInventoryPageIndex() == 1:
  469. selectedSlotPos += 45
  470. elif self.GetInventoryPageIndex() == 2:
  471. selectedSlotPos += 90
  472. elif self.inventoryType == 3:
  473. selectedSlotPos += item.BOX_INVENTORY_SLOT_START
  474. if self.GetInventoryPageIndex() == 1:
  475. selectedSlotPos += 45
  476. elif self.GetInventoryPageIndex() == 2:
  477. selectedSlotPos += 90
  478. elif self.inventoryType == 4:
  479. selectedSlotPos += item.EFSUN_INVENTORY_SLOT_START
  480. if self.GetInventoryPageIndex() == 1:
  481. selectedSlotPos += 45
  482. elif self.GetInventoryPageIndex() == 2:
  483. selectedSlotPos += 90
  484. elif self.inventoryType == 5:
  485. selectedSlotPos += item.CICEK_INVENTORY_SLOT_START
  486. if self.GetInventoryPageIndex() == 1:
  487. selectedSlotPos += 45
  488. elif self.GetInventoryPageIndex() == 2:
  489. selectedSlotPos += 90
  490. else:
  491. selectedSlotPos += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  492. if self.GetInventoryPageIndex() == 1:
  493. selectedSlotPos += 45
  494. elif self.GetInventoryPageIndex() == 2:
  495. selectedSlotPos += 90
  496. if mouseModule.mouseController.isAttached():
  497. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  498. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  499. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  500. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  501. if player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or\
  502. player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or\
  503. player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or\
  504. player.SLOT_TYPE_BOX_INVENTORY == attachedSlotType or\
  505. player.SLOT_TYPE_EFSUN_INVENTORY == attachedSlotType or\
  506. player.SLOT_TYPE_CICEK_INVENTORY == attachedSlotType:
  507. itemCount = player.GetItemCount(attachedSlotPos)
  508. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  509. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  510. if item.IsRefineScroll(attachedItemIndex):
  511. self.wndItem.SetUseMode(False)
  512. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  513. mouseModule.mouseController.RunCallBack("INVENTORY")
  514. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  515. net.SendShopBuyPacket(attachedSlotPos)
  516. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  517. if player.ITEM_MONEY == attachedItemIndex:
  518. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  519. snd.PlaySound("sound/ui/money.wav")
  520. else:
  521. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  522. elif player.SLOT_TYPE_MALL == attachedSlotType:
  523. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  524. mouseModule.mouseController.DeattachObject()
  525. def SelectItemSlot(self, itemSlotIndex):
  526. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  527. return
  528. if self.inventoryType == 0:
  529. itemSlotIndex += item.SKILL_BOOK_INVENTORY_SLOT_START
  530. if self.GetInventoryPageIndex() == 1:
  531. itemSlotIndex += 45
  532. elif self.GetInventoryPageIndex() == 2:
  533. itemSlotIndex += 90
  534. elif self.inventoryType == 2:
  535. itemSlotIndex += item.STONE_INVENTORY_SLOT_START
  536. if self.GetInventoryPageIndex() == 1:
  537. itemSlotIndex += 45
  538. elif self.GetInventoryPageIndex() == 2:
  539. itemSlotIndex += 90
  540. elif self.inventoryType == 3:
  541. itemSlotIndex += item.BOX_INVENTORY_SLOT_START
  542. if self.GetInventoryPageIndex() == 1:
  543. itemSlotIndex += 45
  544. elif self.GetInventoryPageIndex() == 2:
  545. itemSlotIndex += 90
  546. elif self.inventoryType == 4:
  547. itemSlotIndex += item.EFSUN_INVENTORY_SLOT_START
  548. if self.GetInventoryPageIndex() == 1:
  549. itemSlotIndex += 45
  550. elif self.GetInventoryPageIndex() == 2:
  551. itemSlotIndex += 90
  552. elif self.inventoryType == 5:
  553. itemSlotIndex += item.CICEK_INVENTORY_SLOT_START
  554. if self.GetInventoryPageIndex() == 1:
  555. itemSlotIndex += 45
  556. elif self.GetInventoryPageIndex() == 2:
  557. itemSlotIndex += 90
  558. else:
  559. itemSlotIndex += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  560. if self.GetInventoryPageIndex() == 1:
  561. itemSlotIndex += 45
  562. elif self.GetInventoryPageIndex() == 2:
  563. itemSlotIndex += 90
  564. if mouseModule.mouseController.isAttached():
  565. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  566. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  567. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  568. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  569. if player.GetItemCount(itemSlotIndex) > attachedItemCount:
  570. return
  571. if player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or\
  572. player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or\
  573. player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or\
  574. player.SLOT_TYPE_BOX_INVENTORY == attachedSlotType or\
  575. player.SLOT_TYPE_EFSUN_INVENTORY == attachedSlotType or\
  576. player.SLOT_TYPE_CICEK_INVENTORY == attachedSlotType:
  577. self.__SendMoveItemPacket(attachedSlotPos, itemSlotIndex, attachedItemCount)
  578. mouseModule.mouseController.DeattachObject()
  579. else:
  580. curCursorNum = app.GetCursor()
  581. #if app.SELL == curCursorNum:
  582. #self.__SellItem(itemSlotIndex)
  583. if app.BUY == curCursorNum:
  584. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  585. elif app.IsPressed(app.DIK_LALT):
  586. link = player.GetItemLink(itemSlotIndex)
  587. ime.PasteString(link)
  588. elif app.IsPressed(app.DIK_LALT):
  589. link = player.GetItemLink(itemSlotIndex)
  590. ime.PasteString(link)
  591. elif app.IsPressed(app.DIK_LSHIFT):
  592. itemCount = player.GetItemCount(itemSlotIndex)
  593. if itemCount > 1:
  594. self.dlgPickItem.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  595. self.dlgPickItem.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  596. self.dlgPickItem.Open(itemCount)
  597. self.dlgPickItem.itemGlobalSlotIndex = itemSlotIndex
  598. elif app.IsPressed(app.DIK_LCONTROL):
  599. itemIndex = player.GetItemIndex(itemSlotIndex)
  600. if TRUE == item.CanAddToQuickSlotItem(itemIndex):
  601. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  602. else:
  603. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  604. else:
  605. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  606. itemCount = player.GetItemCount(itemSlotIndex)
  607. if self.inventoryType == 0:
  608. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_SKILL_BOOK_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  609. elif self.inventoryType == 2:
  610. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_STONE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  611. elif self.inventoryType == 3:
  612. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_BOX_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  613. elif self.inventoryType == 4:
  614. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_EFSUN_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  615. elif self.inventoryType == 5:
  616. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_CICEK_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  617. else:
  618. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  619. self.wndItem.SetUseMode(True)
  620. snd.PlaySound("sound/ui/pick.wav")
  621. def OnCloseQuestionDialog(self):
  622. if not self.questionDialog:
  623. return
  624. self.questionDialog.Close()
  625. self.questionDialog = None
  626. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  627. def Sat(self):
  628. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  629. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  630. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  631. snd.PlaySound("sound/ui/money.wav")
  632. self.OnCloseQuestionDialog()
  633. def __OnClosePopupDialog(self):
  634. self.pop = None
  635. def OverOutItem(self):
  636. self.wndItem.SetUsableItem(False)
  637. if None != self.tooltipItem:
  638. self.tooltipItem.HideToolTip()
  639. def OverInItem(self, overSlotPos):
  640. if self.inventoryType == 0:
  641. overSlotPos += item.SKILL_BOOK_INVENTORY_SLOT_START
  642. if self.GetInventoryPageIndex() == 1:
  643. overSlotPos += 45
  644. elif self.GetInventoryPageIndex() == 2:
  645. overSlotPos += 90
  646. elif self.inventoryType == 2:
  647. overSlotPos += item.STONE_INVENTORY_SLOT_START
  648. if self.GetInventoryPageIndex() == 1:
  649. overSlotPos += 45
  650. elif self.GetInventoryPageIndex() == 2:
  651. overSlotPos += 90
  652. elif self.inventoryType == 3:
  653. overSlotPos += item.BOX_INVENTORY_SLOT_START
  654. if self.GetInventoryPageIndex() == 1:
  655. overSlotPos += 45
  656. elif self.GetInventoryPageIndex() == 2:
  657. overSlotPos += 90
  658. elif self.inventoryType == 4:
  659. overSlotPos += item.EFSUN_INVENTORY_SLOT_START
  660. if self.GetInventoryPageIndex() == 1:
  661. overSlotPos += 45
  662. elif self.GetInventoryPageIndex() == 2:
  663. overSlotPos += 90
  664. elif self.inventoryType == 5:
  665. overSlotPos += item.CICEK_INVENTORY_SLOT_START
  666. if self.GetInventoryPageIndex() == 1:
  667. overSlotPos += 45
  668. elif self.GetInventoryPageIndex() == 2:
  669. overSlotPos += 90
  670. else:
  671. overSlotPos += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  672. if self.GetInventoryPageIndex() == 1:
  673. overSlotPos += 45
  674. elif self.GetInventoryPageIndex() == 2:
  675. overSlotPos += 90
  676. self.wndItem.SetUsableItem(False)
  677. self.ShowToolTip(overSlotPos)
  678. def ShowToolTip(self, slotIndex):
  679. if None != self.tooltipItem:
  680. self.tooltipItem.SetInventoryItem(slotIndex)
  681. def OnPressEscapeKey(self):
  682. self.Close()
  683. return True
  684. def UseItemSlot(self, slotIndex):
  685. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  686. return
  687. if self.inventoryType == 0:
  688. slotIndex += item.SKILL_BOOK_INVENTORY_SLOT_START
  689. if self.GetInventoryPageIndex() == 1:
  690. slotIndex += 45
  691. elif self.GetInventoryPageIndex() == 2:
  692. slotIndex += 90
  693. elif self.inventoryType == 2:
  694. slotIndex += item.STONE_INVENTORY_SLOT_START
  695. if self.GetInventoryPageIndex() == 1:
  696. slotIndex += 45
  697. elif self.GetInventoryPageIndex() == 2:
  698. slotIndex += 90
  699. elif self.inventoryType == 3:
  700. slotIndex += item.BOX_INVENTORY_SLOT_START
  701. if self.GetInventoryPageIndex() == 1:
  702. slotIndex += 45
  703. elif self.GetInventoryPageIndex() == 2:
  704. slotIndex += 90
  705. elif self.inventoryType == 4:
  706. slotIndex += item.EFSUN_INVENTORY_SLOT_START
  707. if self.GetInventoryPageIndex() == 1:
  708. slotIndex += 45
  709. elif self.GetInventoryPageIndex() == 2:
  710. slotIndex += 90
  711. elif self.inventoryType == 5:
  712. slotIndex += item.CICEK_INVENTORY_SLOT_START
  713. if self.GetInventoryPageIndex() == 1:
  714. slotIndex += 45
  715. elif self.GetInventoryPageIndex() == 2:
  716. slotIndex += 90
  717. else:
  718. slotIndex += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  719. if self.GetInventoryPageIndex() == 1:
  720. slotIndex += 45
  721. elif self.GetInventoryPageIndex() == 2:
  722. slotIndex += 90
  723. self.__UseItem(slotIndex)
  724. mouseModule.mouseController.DeattachObject()
  725. self.OverOutItem()
  726. def __UseItem(self, slotIndex):
  727. ItemVNum = player.GetItemIndex(slotIndex)
  728. item.SelectItem(ItemVNum)
  729. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  730. self.questionDialog = uiCommon.QuestionDialog()
  731. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  732. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  733. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  734. self.questionDialog.Open()
  735. self.questionDialog.slotIndex = slotIndex
  736. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  737. elif app.IsPressed(app.DIK_LSHIFT):
  738. if player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GIFTBOX and\
  739. ItemVNum != 31374 and ItemVNum != 50255 and\
  740. ItemVNum != 50187 and ItemVNum != 50197 and\
  741. ItemVNum != 50188 and ItemVNum != 50189 and\
  742. ItemVNum != 50190 and ItemVNum != 50191 and\
  743. ItemVNum != 50192 and ItemVNum != 50193 and\
  744. ItemVNum != 50194 and ItemVNum != 50195:
  745. if app.ENABLE_SHOW_CHEST_DROP:
  746. if self.interface:
  747. if self.interface.dlgChestDrop:
  748. if not self.interface.dlgChestDrop.IsShow():
  749. self.interface.dlgChestDrop.Open(slotIndex)
  750. net.SendChestDropInfo(slotIndex)
  751. else:
  752. self.__SendUseItemPacket(slotIndex)
  753. def __UseItemQuestionDialog_OnCancel(self):
  754. self.OnCloseQuestionDialog()
  755. def __UseItemQuestionDialog_OnAccept(self):
  756. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  757. self.OnCloseQuestionDialog()
  758. def __SendUseItemPacket(self, slotPos):
  759. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  760. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  761. return
  762. net.SendItemUsePacket(slotPos)
  763. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  764. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  765. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  766. return
  767. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  768. class BeltInventoryWindow(ui.ScriptWindow):
  769. def __init__(self, wndInventory):
  770. import exception
  771. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  772. exception.Abort("What do you do?")
  773. return
  774. if not wndInventory:
  775. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  776. return
  777. ui.ScriptWindow.__init__(self)
  778. self.isLoaded = 0
  779. self.wndInventory = wndInventory;
  780. self.wndBeltInventoryLayer = None
  781. self.wndBeltInventorySlot = None
  782. self.expandBtn = None
  783. self.minBtn = None
  784. self.__LoadWindow()
  785. def __del__(self):
  786. ui.ScriptWindow.__del__(self)
  787. def Show(self, openBeltSlot = False):
  788. self.__LoadWindow()
  789. self.RefreshSlot()
  790. ui.ScriptWindow.Show(self)
  791. if openBeltSlot:
  792. self.OpenInventory()
  793. else:
  794. self.CloseInventory()
  795. def Close(self):
  796. self.Hide()
  797. def IsOpeningInventory(self):
  798. return self.wndBeltInventoryLayer.IsShow()
  799. def OpenInventory(self):
  800. self.wndBeltInventoryLayer.Show()
  801. self.expandBtn.Hide()
  802. if localeInfo.IsARABIC() == 0:
  803. self.AdjustPositionAndSize()
  804. def CloseInventory(self):
  805. self.wndBeltInventoryLayer.Hide()
  806. self.expandBtn.Show()
  807. if localeInfo.IsARABIC() == 0:
  808. self.AdjustPositionAndSize()
  809. ## 현재 인벤토리 위치를 기준으로 BASE 위치를 계산, 리턴.. 숫자 하드코딩하기 정말 싫지만 방법이 없다..
  810. def GetBasePosition(self):
  811. x, y = self.wndInventory.GetGlobalPosition()
  812. return x - 148, y + 241
  813. def AdjustPositionAndSize(self):
  814. bx, by = self.GetBasePosition()
  815. if self.IsOpeningInventory():
  816. self.SetPosition(bx, by)
  817. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  818. else:
  819. self.SetPosition(bx + 138, by);
  820. self.SetSize(10, self.GetHeight())
  821. def __LoadWindow(self):
  822. if self.isLoaded == 1:
  823. return
  824. self.isLoaded = 1
  825. try:
  826. pyScrLoader = ui.PythonScriptLoader()
  827. pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  828. except:
  829. import exception
  830. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  831. try:
  832. self.ORIGINAL_WIDTH = self.GetWidth()
  833. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  834. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  835. self.expandBtn = self.GetChild("ExpandBtn")
  836. self.minBtn = self.GetChild("MinimizeBtn")
  837. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  838. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  839. if localeInfo.IsARABIC() :
  840. self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  841. self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
  842. self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
  843. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  844. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  845. wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  846. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  847. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  848. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", False, False)
  849. except:
  850. import exception
  851. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  852. ## Equipment
  853. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  854. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  855. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  856. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  857. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  858. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  859. self.wndBeltInventorySlot = wndBeltInventorySlot
  860. def RefreshSlot(self):
  861. getItemVNum=player.GetItemIndex
  862. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  863. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  864. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  865. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, True)
  866. avail = "0"
  867. if player.IsAvailableBeltInventoryCell(slotNumber):
  868. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  869. else:
  870. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  871. self.wndBeltInventorySlot.RefreshSlot()
  872. class InventoryWindow(ui.ScriptWindow):
  873. 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")
  874. if app.ENABLE_USE_COSTUME_ATTR:
  875. USE_TYPE_TUPLE = tuple(list(USE_TYPE_TUPLE) + ["USE_CHANGE_COSTUME_ATTR", "USE_RESET_COSTUME_ATTR"])
  876. questionDialog = None
  877. tooltipItem = None
  878. wndCostume = None
  879. wndBelt = None
  880. dlgPickMoney = None
  881. sellingSlotNumber = -1
  882. isLoaded = 0
  883. isOpenedCostumeWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 코스츔이 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  884. isOpenedBeltWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  885. if app.ENABLE_HIGHLIGHT_NEW_ITEM:
  886. liHighlightedItems = []
  887. def __init__(self):
  888. ui.ScriptWindow.__init__(self)
  889. self.isOpenedBeltWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  890. self.inventoryPageIndex = 0
  891. self.__LoadWindow()
  892. def __del__(self):
  893. ui.ScriptWindow.__del__(self)
  894. def Show(self):
  895. self.__LoadWindow()
  896. ui.ScriptWindow.Show(self)
  897. # 인벤토리를 닫을 때 코스츔이 열려있었다면 인벤토리를 열 때 코스츔도 같이 열도록 함.
  898. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  899. self.wndCostume.Show()
  900. # 인벤토리를 닫을 때 벨트 인벤토리가 열려있었다면 같이 열도록 함.
  901. if self.wndBelt:
  902. self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  903. def BindInterfaceClass(self, interface):
  904. self.interface = interface
  905. def __LoadWindow(self):
  906. if self.isLoaded == 1:
  907. return
  908. self.isLoaded = 1
  909. try:
  910. pyScrLoader = ui.PythonScriptLoader()
  911. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  912. except:
  913. import exception
  914. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  915. try:
  916. wndItem = self.GetChild("ItemSlot")
  917. wndEquip = self.GetChild("EquipmentSlot")
  918. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  919. self.wndMoney = self.GetChild("Money")
  920. self.wndMoneySlot = self.GetChild("Money_Slot")
  921. self.mallButton = self.GetChild2("MallButton")
  922. self.DSSButton = self.GetChild2("DSSButton")
  923. self.costumeButton = self.GetChild2("CostumeButton")
  924. self.inventoryTab = []
  925. for i in xrange(player.INVENTORY_PAGE_COUNT):
  926. self.inventoryTab.append(self.GetChild("Inventory_Tab_%02d" % (i+1)))
  927. self.equipmentTab = []
  928. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  929. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  930. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  931. self.costumeButton.Hide()
  932. self.costumeButton.Destroy()
  933. self.costumeButton = 0
  934. # Belt Inventory Window
  935. self.wndBelt = None
  936. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  937. self.wndBelt = BeltInventoryWindow(self)
  938. except:
  939. import exception
  940. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  941. ## Item
  942. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  943. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  944. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  945. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  946. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  947. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  948. ## Equipment
  949. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  950. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  951. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  952. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  953. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  954. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  955. ## PickMoneyDialog
  956. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  957. dlgPickMoney.LoadDialog()
  958. dlgPickMoney.Hide()
  959. ## RefineDialog
  960. self.refineDialog = uiRefine.RefineDialog()
  961. self.refineDialog.Hide()
  962. ## AttachMetinDialog
  963. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  964. self.attachMetinDialog.Hide()
  965. ## MoneySlot
  966. self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  967. for i in xrange(player.INVENTORY_PAGE_COUNT):
  968. self.inventoryTab[i].SetEvent(lambda arg=i: self.SetInventoryPage(arg))
  969. self.inventoryTab[0].Down()
  970. self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  971. self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  972. self.equipmentTab[0].Down()
  973. self.equipmentTab[0].Hide()
  974. self.equipmentTab[1].Hide()
  975. self.wndItem = wndItem
  976. self.wndEquip = wndEquip
  977. self.dlgPickMoney = dlgPickMoney
  978. # MallButton
  979. if self.mallButton:
  980. self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  981. if self.DSSButton:
  982. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  983. # Costume Button
  984. if self.costumeButton:
  985. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  986. self.wndCostume = None
  987. #####
  988. if app.ENABLE_ACCE_SYSTEM:
  989. self.listAttachedAcces = []
  990. ## Refresh
  991. self.SetInventoryPage(0)
  992. self.SetEquipmentPage(0)
  993. self.RefreshItemSlot()
  994. self.RefreshStatus()
  995. def Destroy(self):
  996. self.ClearDictionary()
  997. self.dlgPickMoney.Destroy()
  998. self.dlgPickMoney = 0
  999. self.refineDialog.Destroy()
  1000. self.refineDialog = 0
  1001. self.attachMetinDialog.Destroy()
  1002. self.attachMetinDialog = 0
  1003. self.tooltipItem = None
  1004. self.wndItem = 0
  1005. self.wndEquip = 0
  1006. self.dlgPickMoney = 0
  1007. self.wndMoney = 0
  1008. self.wndMoneySlot = 0
  1009. self.questionDialog = None
  1010. self.mallButton = None
  1011. self.DSSButton = None
  1012. self.interface = None
  1013. if self.wndCostume:
  1014. self.wndCostume.Destroy()
  1015. self.wndCostume = 0
  1016. if self.wndBelt:
  1017. self.wndBelt.Destroy()
  1018. self.wndBelt = None
  1019. self.inventoryTab = []
  1020. self.equipmentTab = []
  1021. def Hide(self):
  1022. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1023. self.OnCloseQuestionDialog()
  1024. return
  1025. if None != self.tooltipItem:
  1026. self.tooltipItem.HideToolTip()
  1027. if self.wndCostume:
  1028. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow() # 인벤토리 창이 닫힐 때 코스츔이 열려 있었는가?
  1029. self.wndCostume.Close()
  1030. if self.wndBelt:
  1031. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # 인벤토리 창이 닫힐 때 벨트 인벤토리도 열려 있었는가?
  1032. print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  1033. self.wndBelt.Close()
  1034. if self.dlgPickMoney:
  1035. self.dlgPickMoney.Close()
  1036. wndMgr.Hide(self.hWnd)
  1037. def Close(self):
  1038. self.Hide()
  1039. def SetInventoryPage(self, page):
  1040. self.inventoryPageIndex = page
  1041. for i in xrange(player.INVENTORY_PAGE_COUNT):
  1042. if i!=page:
  1043. self.inventoryTab[i].SetUp()
  1044. self.RefreshBagSlotWindow()
  1045. def SetEquipmentPage(self, page):
  1046. self.equipmentPageIndex = page
  1047. self.equipmentTab[1-page].SetUp()
  1048. self.RefreshEquipSlotWindow()
  1049. def ClickMallButton(self):
  1050. print "click_mall_button"
  1051. net.SendChatPacket("/click_mall")
  1052. # DSSButton
  1053. def ClickDSSButton(self):
  1054. print "click_dss_button"
  1055. self.interface.ToggleDragonSoulWindow()
  1056. def ClickCostumeButton(self):
  1057. print "Click Costume Button"
  1058. if self.wndCostume:
  1059. if self.wndCostume.IsShow():
  1060. self.wndCostume.Hide()
  1061. else:
  1062. self.wndCostume.Show()
  1063. else:
  1064. self.wndCostume = CostumeWindow(self)
  1065. self.wndCostume.Show()
  1066. def OpenPickMoneyDialog(self):
  1067. if mouseModule.mouseController.isAttached():
  1068. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1069. if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  1070. if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  1071. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1072. snd.PlaySound("sound/ui/money.wav")
  1073. mouseModule.mouseController.DeattachObject()
  1074. else:
  1075. curMoney = player.GetElk()
  1076. if curMoney <= 0:
  1077. return
  1078. self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  1079. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  1080. self.dlgPickMoney.Open(curMoney)
  1081. self.dlgPickMoney.SetMax(9) # 인벤토리 990000 제한 버그 수정
  1082. def OnPickMoney(self, money):
  1083. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  1084. def OnPickItem(self, count):
  1085. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  1086. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1087. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  1088. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  1089. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  1090. return local
  1091. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  1092. def RefreshBagSlotWindow(self):
  1093. getItemVNum=player.GetItemIndex
  1094. getItemCount=player.GetItemCount
  1095. setItemVNum=self.wndItem.SetItemSlot
  1096. for i in xrange(player.INVENTORY_PAGE_SIZE):
  1097. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1098. itemCount = getItemCount(slotNumber)
  1099. # itemCount == 0이면 소켓을 비운다.
  1100. if 0 == itemCount:
  1101. self.wndItem.ClearSlot(i)
  1102. continue
  1103. elif 1 == itemCount:
  1104. itemCount = 0
  1105. itemVnum = getItemVNum(slotNumber)
  1106. setItemVNum(i, itemVnum, itemCount)
  1107. ## 자동물약 (HP: #72723 ~ #72726, SP: #72727 ~ #72730) 특수처리 - 아이템인데도 슬롯에 활성화/비활성화 표시를 위한 작업임 - [hyo]
  1108. if constInfo.IS_AUTO_POTION(itemVnum):
  1109. # metinSocket - [0] : 활성화 여부, [1] : 사용한 양, [2] : 최대 용량
  1110. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1111. isActivated = 0 != metinSocket[0]
  1112. if isActivated:
  1113. self.wndItem.ActivateSlot(i)
  1114. potionType = 0;
  1115. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  1116. potionType = player.AUTO_POTION_TYPE_HP
  1117. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  1118. potionType = player.AUTO_POTION_TYPE_SP
  1119. usedAmount = int(metinSocket[1])
  1120. totalAmount = int(metinSocket[2])
  1121. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  1122. else:
  1123. self.wndItem.DeactivateSlot(i)
  1124. if app.ENABLE_ACCE_SYSTEM:
  1125. slotNumberChecked = 0
  1126. if not constInfo.IS_AUTO_POTION(itemVnum):
  1127. if app.ENABLE_HIGHLIGHT_NEW_ITEM:
  1128. if not slotNumber in self.liHighlightedItems:
  1129. self.wndItem.DeactivateSlot(i)
  1130. else:
  1131. self.wndItem.DeactivateSlot(i)
  1132. for j in xrange(acce.WINDOW_MAX_MATERIALS):
  1133. (isHere, iCell) = acce.GetAttachedItem(j)
  1134. if isHere:
  1135. if iCell == slotNumber:
  1136. self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
  1137. if not slotNumber in self.listAttachedAcces:
  1138. self.listAttachedAcces.append(slotNumber)
  1139. slotNumberChecked = 1
  1140. else:
  1141. if slotNumber in self.listAttachedAcces and not slotNumberChecked:
  1142. self.wndItem.DeactivateSlot(i)
  1143. self.listAttachedAcces.remove(slotNumber)
  1144. elif app.ENABLE_HIGHLIGHT_NEW_ITEM and not constInfo.IS_AUTO_POTION(itemVnum):
  1145. if not slotNumber in self.liHighlightedItems:
  1146. self.wndItem.DeactivateSlot(i)
  1147. self.wndItem.RefreshSlot()
  1148. if app.ENABLE_HIGHLIGHT_NEW_ITEM:
  1149. self.__RefreshHighlights()
  1150. if self.wndBelt:
  1151. self.wndBelt.RefreshSlot()
  1152. if app.ENABLE_HIGHLIGHT_NEW_ITEM:
  1153. def HighlightSlot(self, slot):
  1154. if not slot in self.liHighlightedItems:
  1155. self.liHighlightedItems.append(slot)
  1156. def __RefreshHighlights(self):
  1157. for i in xrange(player.INVENTORY_PAGE_SIZE):
  1158. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1159. if slotNumber in self.liHighlightedItems:
  1160. self.wndItem.ActivateSlot(i)
  1161. def RefreshEquipSlotWindow(self):
  1162. getItemVNum=player.GetItemIndex
  1163. getItemCount=player.GetItemCount
  1164. setItemVNum=self.wndEquip.SetItemSlot
  1165. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  1166. slotNumber = player.EQUIPMENT_SLOT_START + i
  1167. itemCount = getItemCount(slotNumber)
  1168. if itemCount <= 1:
  1169. itemCount = 0
  1170. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1171. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1172. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1173. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1174. itemCount = getItemCount(slotNumber)
  1175. if itemCount <= 1:
  1176. itemCount = 0
  1177. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1178. print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  1179. self.wndEquip.RefreshSlot()
  1180. if self.wndCostume:
  1181. self.wndCostume.RefreshCostumeSlot()
  1182. def RefreshItemSlot(self):
  1183. self.RefreshBagSlotWindow()
  1184. self.RefreshEquipSlotWindow()
  1185. def RefreshStatus(self):
  1186. money = player.GetElk()
  1187. self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  1188. def SetItemToolTip(self, tooltipItem):
  1189. self.tooltipItem = tooltipItem
  1190. def SellItem(self):
  1191. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  1192. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  1193. ## 용혼석도 팔리게 하는 기능 추가하면서 인자 type 추가
  1194. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  1195. snd.PlaySound("sound/ui/money.wav")
  1196. self.OnCloseQuestionDialog()
  1197. def OnDetachMetinFromItem(self):
  1198. if None == self.questionDialog:
  1199. return
  1200. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1201. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1202. self.OnCloseQuestionDialog()
  1203. def OnCloseQuestionDialog(self):
  1204. if not self.questionDialog:
  1205. return
  1206. self.questionDialog.Close()
  1207. self.questionDialog = None
  1208. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1209. ## Slot Event
  1210. def SelectEmptySlot(self, selectedSlotPos):
  1211. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1212. return
  1213. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  1214. if mouseModule.mouseController.isAttached():
  1215. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1216. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1217. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1218. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1219. if player.SLOT_TYPE_INVENTORY == attachedSlotType or\
  1220. player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType or\
  1221. player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or\
  1222. player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or\
  1223. player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or\
  1224. player.SLOT_TYPE_BOX_INVENTORY == attachedSlotType or\
  1225. player.SLOT_TYPE_EFSUN_INVENTORY == attachedSlotType or\
  1226. player.SLOT_TYPE_CICEK_INVENTORY == attachedSlotType:
  1227. itemCount = player.GetItemCount(attachedSlotPos)
  1228. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1229. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1230. #@fixme011 BEGIN (block ds equip)
  1231. attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
  1232. if player.IsDSEquipmentSlot(attachedInvenType, attachedSlotPos):
  1233. mouseModule.mouseController.DeattachObject()
  1234. return
  1235. #@fixme011 END
  1236. itemCount = player.GetItemCount(attachedSlotPos)
  1237. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1238. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1239. if item.IsRefineScroll(attachedItemIndex):
  1240. self.wndItem.SetUseMode(False)
  1241. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  1242. mouseModule.mouseController.RunCallBack("INVENTORY")
  1243. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  1244. net.SendShopBuyPacket(attachedSlotPos)
  1245. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1246. if player.ITEM_MONEY == attachedItemIndex:
  1247. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1248. snd.PlaySound("sound/ui/money.wav")
  1249. else:
  1250. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1251. elif player.SLOT_TYPE_MALL == attachedSlotType:
  1252. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1253. mouseModule.mouseController.DeattachObject()
  1254. def SelectItemSlot(self, itemSlotIndex):
  1255. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1256. return
  1257. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1258. if mouseModule.mouseController.isAttached():
  1259. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1260. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1261. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1262. if player.SLOT_TYPE_INVENTORY == attachedSlotType or\
  1263. player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or\
  1264. player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or\
  1265. player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or\
  1266. player.SLOT_TYPE_BOX_INVENTORY == attachedSlotType or\
  1267. player.SLOT_TYPE_EFSUN_INVENTORY == attachedSlotType or\
  1268. player.SLOT_TYPE_CICEK_INVENTORY == attachedSlotType:
  1269. #@fixme011 BEGIN (block ds equip)
  1270. attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
  1271. if player.IsDSEquipmentSlot(attachedInvenType, attachedSlotPos):
  1272. mouseModule.mouseController.DeattachObject()
  1273. return
  1274. #@fixme011 END
  1275. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1276. mouseModule.mouseController.DeattachObject()
  1277. else:
  1278. curCursorNum = app.GetCursor()
  1279. if app.SELL == curCursorNum:
  1280. self.__SellItem(itemSlotIndex)
  1281. elif app.BUY == curCursorNum:
  1282. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1283. elif app.IsPressed(app.DIK_LALT):
  1284. link = player.GetItemLink(itemSlotIndex)
  1285. ime.PasteString(link)
  1286. elif app.IsPressed(app.DIK_LSHIFT):
  1287. itemCount = player.GetItemCount(itemSlotIndex)
  1288. if itemCount > 1:
  1289. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1290. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1291. self.dlgPickMoney.Open(itemCount)
  1292. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1293. #else:
  1294. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1295. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1296. elif app.IsPressed(app.DIK_LCONTROL):
  1297. itemIndex = player.GetItemIndex(itemSlotIndex)
  1298. if True == item.CanAddToQuickSlotItem(itemIndex):
  1299. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1300. else:
  1301. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1302. else:
  1303. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1304. itemCount = player.GetItemCount(itemSlotIndex)
  1305. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1306. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1307. self.wndItem.SetUseMode(True)
  1308. else:
  1309. self.wndItem.SetUseMode(False)
  1310. snd.PlaySound("sound/ui/pick.wav")
  1311. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1312. if srcItemSlotPos == dstItemSlotPos:
  1313. return
  1314. # cyh itemseal 2013 11 08
  1315. if app.ENABLE_SOULBIND_SYSTEM and item.IsSealScroll(srcItemVID):
  1316. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1317. elif item.IsRefineScroll(srcItemVID):
  1318. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1319. self.wndItem.SetUseMode(False)
  1320. elif item.IsMetin(srcItemVID):
  1321. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1322. elif item.IsDetachScroll(srcItemVID):
  1323. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1324. elif item.IsKey(srcItemVID):
  1325. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1326. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1327. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1328. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1329. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1330. else:
  1331. #snd.PlaySound("sound/ui/drop.wav")
  1332. if app.THANOS_GLOVE:
  1333. if SrcItemVNum == 500007:
  1334. if DstItemVNum >= 500001 and DstItemVNum <= 500006:
  1335. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1336. ## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites]
  1337. if player.IsEquipmentSlot(dstItemSlotPos):
  1338. ## 들고 있는 아이템이 장비일때만
  1339. if item.IsEquipmentVID(srcItemVID):
  1340. self.__UseItem(srcItemSlotPos)
  1341. else:
  1342. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1343. #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1344. def __SellItem(self, itemSlotPos):
  1345. if not player.IsEquipmentSlot(itemSlotPos):
  1346. self.sellingSlotNumber = itemSlotPos
  1347. itemIndex = player.GetItemIndex(itemSlotPos)
  1348. itemCount = player.GetItemCount(itemSlotPos)
  1349. self.sellingSlotitemIndex = itemIndex
  1350. self.sellingSlotitemCount = itemCount
  1351. item.SelectItem(itemIndex)
  1352. ## 안티 플레그 검사 빠져서 추가
  1353. ## 20140220
  1354. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1355. popup = uiCommon.PopupDialog()
  1356. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1357. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1358. popup.Open()
  1359. self.popup = popup
  1360. return
  1361. itemPrice = item.GetISellItemPrice()
  1362. if item.Is1GoldItem():
  1363. itemPrice = itemCount / itemPrice / 5
  1364. else:
  1365. itemPrice = itemPrice * itemCount / 5
  1366. item.GetItemName(itemIndex)
  1367. itemName = item.GetItemName()
  1368. self.questionDialog = uiCommon.QuestionDialog()
  1369. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1370. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1371. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1372. self.questionDialog.Open()
  1373. self.questionDialog.count = itemCount
  1374. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1375. def __OnClosePopupDialog(self):
  1376. self.pop = None
  1377. def RefineItem(self, scrollSlotPos, targetSlotPos):
  1378. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1379. targetIndex = player.GetItemIndex(targetSlotPos)
  1380. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1381. return
  1382. if app.ENABLE_REFINE_RENEWAL:
  1383. constInfo.AUTO_REFINE_TYPE = 1
  1384. constInfo.AUTO_REFINE_DATA["ITEM"][0] = scrollSlotPos
  1385. constInfo.AUTO_REFINE_DATA["ITEM"][1] = targetSlotPos
  1386. ###########################################################
  1387. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1388. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1389. return
  1390. ###########################################################
  1391. ###########################################################
  1392. #net.SendRequestRefineInfoPacket(targetSlotPos)
  1393. #return
  1394. ###########################################################
  1395. result = player.CanRefine(scrollIndex, targetSlotPos)
  1396. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1397. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1398. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1399. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1400. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1401. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1402. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1403. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1404. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1405. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1406. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1407. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1408. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1409. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1410. if player.REFINE_OK != result:
  1411. return
  1412. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1413. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1414. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1415. targetIndex = player.GetItemIndex(targetSlotPos)
  1416. if not player.CanDetach(scrollIndex, targetSlotPos):
  1417. if app.ENABLE_ACCE_SYSTEM:
  1418. item.SelectItem(scrollIndex)
  1419. if item.GetValue(0) == acce.CLEAN_ATTR_VALUE0:
  1420. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.ACCE_FAILURE_CLEAN)
  1421. else:
  1422. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1423. else:
  1424. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1425. return
  1426. self.questionDialog = uiCommon.QuestionDialog()
  1427. self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1428. if app.ENABLE_ACCE_SYSTEM:
  1429. item.SelectItem(targetIndex)
  1430. if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_ACCE:
  1431. item.SelectItem(scrollIndex)
  1432. if item.GetValue(0) == acce.CLEAN_ATTR_VALUE0:
  1433. self.questionDialog.SetText(localeInfo.ACCE_DO_YOU_CLEAN)
  1434. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1435. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1436. self.questionDialog.Open()
  1437. self.questionDialog.sourcePos = scrollSlotPos
  1438. self.questionDialog.targetPos = targetSlotPos
  1439. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1440. metinIndex = player.GetItemIndex(metinSlotPos)
  1441. targetIndex = player.GetItemIndex(targetSlotPos)
  1442. item.SelectItem(metinIndex)
  1443. itemName = item.GetItemName()
  1444. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1445. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1446. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1447. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1448. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1449. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1450. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1451. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1452. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1453. if player.ATTACH_METIN_OK != result:
  1454. return
  1455. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1456. def OverOutItem(self):
  1457. self.wndItem.SetUsableItem(False)
  1458. if None != self.tooltipItem:
  1459. self.tooltipItem.HideToolTip()
  1460. def OverInItem(self,overSlotPos ):
  1461. overSlotPosGlobal = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1462. self.wndItem.SetUsableItem(False)
  1463. if app.ENABLE_HIGHLIGHT_NEW_ITEM and overSlotPosGlobal in self.liHighlightedItems:
  1464. self.liHighlightedItems.remove(overSlotPosGlobal)
  1465. self.wndItem.DeactivateSlot(overSlotPos)
  1466. if mouseModule.mouseController.isAttached():
  1467. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1468. if player.SLOT_TYPE_INVENTORY == attachedItemType or player.SLOT_TYPE_STONE_INVENTORY == attachedItemType or player.SLOT_TYPE_EFSUN_INVENTORY == attachedItemType:
  1469. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1470. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1471. if attachedItemVNum==player.ITEM_MONEY: # @fixme005
  1472. pass
  1473. elif self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPosGlobal):
  1474. self.wndItem.SetUsableItem(True)
  1475. self.wndItem.SetUseMode(True)
  1476. self.ShowToolTip(overSlotPosGlobal)
  1477. return
  1478. self.ShowToolTip(overSlotPosGlobal)
  1479. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1480. if app.THANOS_GLOVE:
  1481. if srcItemVNum == 500007:
  1482. return TRUE
  1483. if item.IsRefineScroll(srcItemVNum):
  1484. return True
  1485. elif item.IsMetin(srcItemVNum):
  1486. return True
  1487. elif item.IsDetachScroll(srcItemVNum):
  1488. return True
  1489. elif item.IsKey(srcItemVNum):
  1490. return True
  1491. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1492. return True
  1493. else:
  1494. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1495. return True
  1496. return False
  1497. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1498. "대상 아이템에 사용할 수 있는가?"
  1499. if srcSlotPos == dstSlotPos and not item.IsMetin(srcItemVNum):
  1500. return False
  1501. if item.IsRefineScroll(srcItemVNum):
  1502. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1503. return True
  1504. elif item.IsMetin(srcItemVNum):
  1505. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1506. return True
  1507. elif item.IsDetachScroll(srcItemVNum):
  1508. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1509. return True
  1510. elif item.IsKey(srcItemVNum):
  1511. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1512. return True
  1513. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1514. return True
  1515. else:
  1516. useType=item.GetUseType(srcItemVNum)
  1517. if "USE_CLEAN_SOCKET" == useType:
  1518. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1519. return True
  1520. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1521. if self.__CanChangeItemAttrList(dstSlotPos):
  1522. return True
  1523. elif "USE_ADD_ATTRIBUTE" == useType:
  1524. if self.__CanAddItemAttr(dstSlotPos):
  1525. return True
  1526. elif "USE_ADD_ATTRIBUTE2" == useType:
  1527. if self.__CanAddItemAttr(dstSlotPos):
  1528. return True
  1529. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1530. if self.__CanAddAccessorySocket(dstSlotPos):
  1531. return True
  1532. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1533. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1534. return True;
  1535. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1536. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1537. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1538. item.SelectItem(dstItemVNum)
  1539. if item.ITEM_TYPE_BELT == item.GetItemType():
  1540. return True
  1541. elif app.ENABLE_USE_COSTUME_ATTR and "USE_CHANGE_COSTUME_ATTR" == useType:
  1542. if self.__CanChangeCostumeAttrList(dstSlotPos):
  1543. return True
  1544. elif app.ENABLE_USE_COSTUME_ATTR and "USE_RESET_COSTUME_ATTR" == useType:
  1545. if self.__CanResetCostumeAttr(dstSlotPos):
  1546. return True
  1547. return False
  1548. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1549. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1550. if dstItemVNum == 0:
  1551. return False
  1552. item.SelectItem(dstItemVNum)
  1553. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1554. return False
  1555. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1556. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1557. return True
  1558. return False
  1559. def __CanChangeItemAttrList(self, dstSlotPos):
  1560. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1561. if dstItemVNum == 0:
  1562. return False
  1563. item.SelectItem(dstItemVNum)
  1564. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1565. return False
  1566. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1567. if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
  1568. return True
  1569. return False
  1570. if app.ENABLE_USE_COSTUME_ATTR:
  1571. def __CanChangeCostumeAttrList(self, dstSlotPos):
  1572. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1573. if dstItemVNum == 0:
  1574. return False
  1575. item.SelectItem(dstItemVNum)
  1576. if item.GetItemType() != item.ITEM_TYPE_COSTUME:
  1577. return False
  1578. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1579. if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
  1580. return True
  1581. return False
  1582. def __CanResetCostumeAttr(self, dstSlotPos):
  1583. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1584. if dstItemVNum == 0:
  1585. return False
  1586. item.SelectItem(dstItemVNum)
  1587. if item.GetItemType() != item.ITEM_TYPE_COSTUME:
  1588. return False
  1589. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1590. if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
  1591. return True
  1592. return False
  1593. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1594. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1595. if dstItemVNum == 0:
  1596. return False
  1597. item.SelectItem(dstItemVNum)
  1598. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1599. return False
  1600. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1601. return False
  1602. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1603. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1604. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1605. return False
  1606. if curCount>=maxCount:
  1607. return False
  1608. return True
  1609. def __CanAddAccessorySocket(self, dstSlotPos):
  1610. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1611. if dstItemVNum == 0:
  1612. return False
  1613. item.SelectItem(dstItemVNum)
  1614. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1615. return False
  1616. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1617. return False
  1618. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1619. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1620. ACCESSORY_SOCKET_MAX_SIZE = 3
  1621. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1622. return False
  1623. return True
  1624. def __CanAddItemAttr(self, dstSlotPos):
  1625. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1626. if dstItemVNum == 0:
  1627. return False
  1628. item.SelectItem(dstItemVNum)
  1629. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1630. return False
  1631. attrCount = 0
  1632. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1633. if player.GetItemAttribute(dstSlotPos, i)[0] != 0:
  1634. attrCount += 1
  1635. if attrCount<4:
  1636. return True
  1637. return False
  1638. def ShowToolTip(self, slotIndex):
  1639. if None != self.tooltipItem:
  1640. self.tooltipItem.SetInventoryItem(slotIndex)
  1641. def OnTop(self):
  1642. if None != self.tooltipItem:
  1643. self.tooltipItem.SetTop()
  1644. def OnPressEscapeKey(self):
  1645. self.Close()
  1646. return True
  1647. def UseItemSlot(self, slotIndex):
  1648. curCursorNum = app.GetCursor()
  1649. if app.SELL == curCursorNum:
  1650. return
  1651. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1652. return
  1653. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1654. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1655. if self.wndDragonSoulRefine.IsShow():
  1656. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1657. return
  1658. if app.ENABLE_ACCE_SYSTEM:
  1659. if self.isShowAcceWindow():
  1660. acce.Add(player.INVENTORY, slotIndex, 255)
  1661. return
  1662. self.__UseItem(slotIndex)
  1663. mouseModule.mouseController.DeattachObject()
  1664. self.OverOutItem()
  1665. def __UseItem(self, slotIndex):
  1666. ItemVNum = player.GetItemIndex(slotIndex)
  1667. item.SelectItem(ItemVNum)
  1668. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1669. self.questionDialog = uiCommon.QuestionDialog()
  1670. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1671. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1672. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1673. self.questionDialog.Open()
  1674. self.questionDialog.slotIndex = slotIndex
  1675. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1676. else:
  1677. self.__SendUseItemPacket(slotIndex)
  1678. def __UseItemQuestionDialog_OnCancel(self):
  1679. self.OnCloseQuestionDialog()
  1680. def __UseItemQuestionDialog_OnAccept(self):
  1681. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1682. self.OnCloseQuestionDialog()
  1683. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1684. # 개인상점 열고 있는 동안 아이템 사용 방지
  1685. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1686. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1687. return
  1688. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1689. def __SendUseItemPacket(self, slotPos):
  1690. # 개인상점 열고 있는 동안 아이템 사용 방지
  1691. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1692. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1693. return
  1694. net.SendItemUsePacket(slotPos)
  1695. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1696. # 개인상점 열고 있는 동안 아이템 사용 방지
  1697. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1698. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1699. return
  1700. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1701. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  1702. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1703. self.wndDragonSoulRefine = wndDragonSoulRefine
  1704. if app.ENABLE_ACCE_SYSTEM:
  1705. def SetAcceWindow(self, wndAcceCombine, wndAcceAbsorption):
  1706. self.wndAcceCombine = wndAcceCombine
  1707. self.wndAcceAbsorption = wndAcceAbsorption
  1708. def isShowAcceWindow(self):
  1709. if self.wndAcceCombine:
  1710. if self.wndAcceCombine.IsShow():
  1711. return 1
  1712. if self.wndAcceAbsorption:
  1713. if self.wndAcceAbsorption.IsShow():
  1714. return 1
  1715. return 0
  1716. if app.ENABLE_HIDE_COSTUME_SYSTEM:
  1717. def RefreshVisibleCostume(self):
  1718. if self.wndCostume:
  1719. self.wndCostume.RefreshVisibleCostume()
  1720. else:
  1721. self.wndCostume = CostumeWindow(self)
  1722. self.wndCostume.RefreshVisibleCostume()
  1723. def OnMoveWindow(self, x, y):
  1724. # print "Inventory Global Pos : ", self.GetGlobalPosition()
  1725. if self.wndBelt:
  1726. # print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  1727. self.wndBelt.AdjustPositionAndSize()