Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.29 KB | None | 0 0
  1. import ui
  2. import player
  3. import mouseModule
  4. import net
  5. import app
  6. import snd
  7. import item
  8. import uiprofessionalbiolog
  9. import uiToolTip
  10. import player
  11. import chat
  12. import grp
  13. import uiScriptLocale
  14. import uiRefine
  15. import uiAttachMetin
  16. import uiPickMoney
  17. import uiCommon
  18. import uiPrivateShopBuilder # 개인상점 열동안 ItemMove 방지
  19. import localeInfo
  20. import constInfo
  21. import ime
  22. import wndMgr
  23.  
  24. ITEM_MALL_BUTTON_ENABLE = True
  25.  
  26.  
  27.  
  28. ITEM_FLAG_APPLICABLE = 1 << 14
  29.  
  30. class CostumeWindow(ui.ScriptWindow):
  31.  
  32. def __init__(self, wndInventory):
  33. import exception
  34.  
  35. if not app.ENABLE_COSTUME_SYSTEM:
  36. exception.Abort("What do you do?")
  37. return
  38.  
  39. if not wndInventory:
  40. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  41. return
  42.  
  43. ui.ScriptWindow.__init__(self)
  44.  
  45. self.isLoaded = 0
  46. self.wndInventory = wndInventory;
  47.  
  48. self.__LoadWindow()
  49.  
  50. def __del__(self):
  51. ui.ScriptWindow.__del__(self)
  52.  
  53. def Show(self):
  54. self.__LoadWindow()
  55. self.RefreshCostumeSlot()
  56.  
  57. ui.ScriptWindow.Show(self)
  58.  
  59. def Close(self):
  60. self.Hide()
  61.  
  62. def __LoadWindow(self):
  63. if self.isLoaded == 1:
  64. return
  65.  
  66. self.isLoaded = 1
  67.  
  68. try:
  69. pyScrLoader = ui.PythonScriptLoader()
  70. pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  71. except:
  72. import exception
  73. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  74.  
  75. try:
  76. wndEquip = self.GetChild("CostumeSlot")
  77. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  78.  
  79. except:
  80. import exception
  81. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  82.  
  83. ## Equipment
  84. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  85. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  86. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  87. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  88. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  89. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  90.  
  91. self.wndEquip = wndEquip
  92.  
  93. def RefreshCostumeSlot(self):
  94. getItemVNum=player.GetItemIndex
  95.  
  96. for i in xrange(item.COSTUME_SLOT_COUNT):
  97. slotNumber = item.COSTUME_SLOT_START + i
  98. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  99.  
  100. self.wndEquip.RefreshSlot()
  101.  
  102.  
  103. if app.ENABLE_BIOLOG_SYSTEM:
  104. ###################################################################
  105. # title_name : Professional Biolog System
  106. # date_created : 2016.08.07
  107. # filename : uiInventory.py
  108. # author : VegaS
  109. # version_actual : Version 0.2.8
  110. #
  111. class CollectInventoryWindow(ui.ScriptWindow):
  112. def __init__(self, wndInventory):
  113. import exception
  114. if not wndInventory:
  115. exception.Abort("wndInventory parameter must be set to CollectInventoryWindow")
  116. return
  117. ui.ScriptWindow.__init__(self)
  118. self.isLoaded = 0
  119. self.updated = 0
  120. self.wndInventory = wndInventory;
  121. self.tooltipItem = uiToolTip.ItemToolTip()
  122. self.tooltipItem.Hide()
  123. self.wndBeltInventoryLayer = None
  124. self.wndBeltInventorySlot = None
  125. self.expandBtn = None
  126. self.minBtn = None
  127. self.gameWindow = None
  128. self.__LoadWindow()
  129.  
  130. def __del__(self):
  131. ui.ScriptWindow.__del__(self)
  132.  
  133. def Show(self, openBeltSlot = False):
  134. self.__LoadWindow()
  135. ui.ScriptWindow.Show(self)
  136.  
  137. if openBeltSlot:
  138. self.OpenInventory()
  139. else:
  140. self.CloseInventory()
  141.  
  142. def Close(self):
  143. self.Hide()
  144.  
  145. def IsOpeningInventory(self):
  146. return self.wndBeltInventoryLayer.IsShow()
  147.  
  148. def OpenInventory(self):
  149. self.wndBeltInventoryLayer.Show()
  150. self.expandBtn.Hide()
  151.  
  152. self.AdjustPositionAndSize()
  153.  
  154. def CloseInventory(self):
  155. self.wndBeltInventoryLayer.Hide()
  156. self.expandBtn.Show()
  157.  
  158. self.AdjustPositionAndSize()
  159.  
  160. def GetBasePosition(self):
  161. x, y = self.wndInventory.GetGlobalPosition()
  162. return x - 148, y + 260
  163.  
  164. def AdjustPositionAndSize(self):
  165. bx, by = self.GetBasePosition()
  166.  
  167. if self.IsOpeningInventory():
  168. self.SetPosition(bx, by)
  169. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  170. else:
  171. self.SetPosition(bx + 135, by);
  172. self.SetSize(15, self.GetHeight())
  173.  
  174. def __LoadWindow(self):
  175. if self.isLoaded == 1:
  176. return
  177.  
  178. self.isLoaded = 1
  179.  
  180. try:
  181. pyScrLoader = ui.PythonScriptLoader()
  182. pyScrLoader.LoadScriptFile(self, "UIScript/biolog_collectinventorywindow.py")
  183. except:
  184. import exception
  185. exception.Abort("CollectInventoryWindow.LoadWindow.LoadObject")
  186.  
  187. try:
  188. self.ORIGINAL_WIDTH = self.GetWidth()
  189. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  190. self.wndItem = self.GetChild("BeltInventorySlot")
  191. self.time_value = self.GetChild("time_value")
  192. self.biolog_count = self.GetChild("count_value")
  193. self.expandBtn = self.GetChild("ExpandBtn")
  194. self.minBtn = self.GetChild("MinimizeBtn")
  195. self.sendBtn = self.GetChild("send_biolog")
  196. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  197. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  198. self.wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  199. self.wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  200. except:
  201. import exception
  202. exception.Abort("CollectInventoryWindow.LoadWindow.BindObject")
  203.  
  204. if self.sendBtn:
  205. self.sendBtn.SetEvent(ui.__mem_func__(self.AcceptBiolog))
  206.  
  207. def SetItem(self, arg1, arg2, arg3):
  208. self.wndItem.SetItemSlot(0, int(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0]), 0)
  209.  
  210. def AcceptBiolog(self):
  211. net.SendChatPacket("/biolog")
  212.  
  213. def SetTime(self, time):
  214. time_collect = time - app.GetGlobalTimeStamp()
  215.  
  216. if time_collect < 0:
  217. time_collect = 0
  218.  
  219. if time_collect == 1:
  220. self.wndLeftTime = uiprofessionalbiolog.Biolog_TimeExpired()
  221. self.wndLeftTime.OpenWindow()
  222. self.wndLeftTime.Show()
  223.  
  224. self.time_value.SetText(localeInfo.FormatTime(time_collect))
  225.  
  226. def OnUpdate(self):
  227. self.SetTime(int(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["time"][0]))
  228. self.SetItem(0, uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0], 0)
  229. self.biolog_count.SetText(uiprofessionalbiolog.BIOLOG_BINARY_LOADED['countActual'][0] + "/" + uiprofessionalbiolog.BIOLOG_BINARY_LOADED['countNeed'][0])
  230.  
  231. def OverInItem(self):
  232. if uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0]:
  233. self.tooltipItem.SetItemToolTip(uiprofessionalbiolog.BIOLOG_BINARY_LOADED["vnum"][0])
  234.  
  235. def OverOutItem(self):
  236. if self.tooltipItem:
  237. self.tooltipItem.HideToolTip()
  238.  
  239. class InventoryWindow(ui.ScriptWindow):
  240.  
  241. 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")
  242.  
  243. questionDialog = None
  244. tooltipItem = None
  245. wndCostume = None
  246. wndBelt = None
  247. if app.ENABLE_BIOLOG_SYSTEM:
  248. wndCollect = None
  249. dlgPickMoney = None
  250.  
  251. sellingSlotNumber = -1
  252. isLoaded = 0
  253. isOpenedCostumeWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 코스츔이 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  254. if app.ENABLE_BIOLOG_SYSTEM:
  255. isOpenedCollectWindowWhenClosingInventory = 0
  256. isOpenedBeltWindowWhenClosingInventory = 0 # 인벤토리 닫을 때 벨트 인벤토리가 열려있었는지 여부-_-; 네이밍 ㅈㅅ
  257.  
  258. def __init__(self):
  259. ui.ScriptWindow.__init__(self)
  260. self.OpenBoniSwitcherEvent = lambda : None
  261. self.__LoadWindow()
  262.  
  263. def __del__(self):
  264. ui.ScriptWindow.__del__(self)
  265.  
  266. if app.ENABLE_BIOLOG_SYSTEM:
  267. def GetBasePosition(self):
  268. x, y = self.wndInventory.GetGlobalPosition()
  269. return x - 148, y + 385
  270. else:
  271. def GetBasePosition(self):
  272. x, y = self.wndInventory.GetGlobalPosition()
  273. return x - 148, y + 241
  274. def Show(self):
  275. self.__LoadWindow()
  276.  
  277. ui.ScriptWindow.Show(self)
  278.  
  279. # 인벤토리를 닫을 때 코스츔이 열려있었다면 인벤토리를 열 때 코스츔도 같이 열도록 함.
  280. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  281. self.wndCostume.Show()
  282.  
  283. if app.ENABLE_BIOLOG_SYSTEM:
  284. if self.wndCollect:
  285. self.wndCollect.Show(self.isOpenedCollectWindowWhenClosingInventory)
  286.  
  287. # 인벤토리를 닫을 때 벨트 인벤토리가 열려있었다면 같이 열도록 함.
  288.  
  289. def BindInterfaceClass(self, interface):
  290. self.interface = interface
  291.  
  292. def __LoadWindow(self):
  293. if self.isLoaded == 1:
  294. return
  295.  
  296. self.isLoaded = 1
  297.  
  298. try:
  299. pyScrLoader = ui.PythonScriptLoader()
  300.  
  301. if ITEM_MALL_BUTTON_ENABLE:
  302. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
  303. else:
  304. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  305. except:
  306. import exception
  307. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  308.  
  309. try:
  310. wndItem = self.GetChild("ItemSlot")
  311. wndEquip = self.GetChild("EquipmentSlot")
  312. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  313. self.wndMoney = self.GetChild("Money")
  314. self.wndMoneySlot = self.GetChild("Money_Slot")
  315. self.mallButton = self.GetChild2("MallButton")
  316.  
  317. self.DSSButton = self.GetChild2("DSSButton")
  318. self.costumeButton = self.GetChild2("CostumeButton")
  319.  
  320. self.inventoryTab = []
  321. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  322. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  323. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  324. self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  325. #self.inventoryTab.append(self.GetChild("Inventory_Tab_05"))
  326.  
  327. self.equipmentTab = []
  328. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  329. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  330. self.equipmentTab.append(self.GetChild("Equipment_Tab_03"))
  331. self.equipmentTab.append(self.GetChild("Equipment_Tab_04"))
  332. #self.equipmentTab.append(self.GetChild("Equipment_Tab_05"))
  333.  
  334. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  335. self.costumeButton.Hide()
  336. self.costumeButton.Destroy()
  337. self.costumeButton = 0
  338.  
  339. # Belt Inventory Window
  340. self.wndBelt = None
  341.  
  342. if app.ENABLE_BIOLOG_SYSTEM:
  343. self.wndCollect = None
  344. self.wndCollect = CollectInventoryWindow(self)
  345.  
  346. except:
  347. import exception
  348. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  349.  
  350. ## Item
  351. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  352. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  353. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  354. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  355. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  356. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  357.  
  358. ## Equipment
  359. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  360. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  361. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  362. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  363. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  364. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  365.  
  366. ## PickMoneyDialog
  367. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  368. dlgPickMoney.LoadDialog()
  369. dlgPickMoney.Hide()
  370.  
  371. ## RefineDialog
  372. self.refineDialog = uiRefine.RefineDialog()
  373. self.refineDialog.Hide()
  374.  
  375. ## AttachMetinDialog
  376. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  377. self.attachMetinDialog.Hide()
  378.  
  379. ## MoneySlot
  380. self.wndMoneySlot.SetEvent(ui.__mem_func__(self.OpenPickMoneyDialog))
  381.  
  382. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  383. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  384. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  385. self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  386. self.inventoryTab[0].Down()
  387.  
  388. self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  389. self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  390. self.equipmentTab[2].SetEvent(lambda arg=2: self.SetEquipmentPage(arg))
  391. self.equipmentTab[3].SetEvent(lambda arg=3: self.SetEquipmentPage(arg))
  392. self.equipmentTab[0].Down()
  393. self.equipmentTab[0].Hide()
  394. self.equipmentTab[1].Hide()
  395. self.equipmentTab[2].Hide()
  396. self.equipmentTab[3].Hide()
  397.  
  398. self.wndItem = wndItem
  399. self.wndEquip = wndEquip
  400. self.dlgPickMoney = dlgPickMoney
  401. ## DEPOZITE
  402. self.choix = ui.BoardWithTitleBar()
  403. self.choix.SetSize(210, 80)
  404. self.choix.SetCenterPosition()
  405. self.choix.AddFlag('float')
  406. self.choix.AddFlag('movable')
  407. self.choix.SetTitleName("Depozit")
  408.  
  409. self.EntrepotIs = ui.Button()
  410. self.EntrepotIs.SetEvent(self.OpenIs)
  411. self.EntrepotIs.SetParent(self.choix)
  412. self.EntrepotIs.SetPosition(35, 40)
  413. self.EntrepotIs.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
  414. self.EntrepotIs.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
  415. self.EntrepotIs.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
  416. self.EntrepotIs.SetText("ItemShop")
  417. self.EntrepotIs.SetToolTipText("ItemShop")
  418.  
  419. # MallButton
  420. if self.mallButton:
  421. self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  422.  
  423. if self.DSSButton:
  424. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  425.  
  426. # Costume Button
  427. if self.costumeButton:
  428. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  429.  
  430. self.wndCostume = None
  431.  
  432. #####
  433.  
  434. ## Refresh
  435. self.SetInventoryPage(0)
  436. self.SetEquipmentPage(0)
  437. self.RefreshItemSlot()
  438. self.RefreshStatus()
  439.  
  440. def Destroy(self):
  441. self.ClearDictionary()
  442.  
  443. self.dlgPickMoney.Destroy()
  444. self.dlgPickMoney = 0
  445.  
  446. self.refineDialog.Destroy()
  447. self.refineDialog = 0
  448.  
  449. self.attachMetinDialog.Destroy()
  450. self.attachMetinDialog = 0
  451.  
  452. self.tooltipItem = None
  453. self.wndItem = 0
  454. self.wndEquip = 0
  455. self.dlgPickMoney = 0
  456. self.wndMoney = 0
  457. self.wndMoneySlot = 0
  458. self.wndPremium = 0
  459. self.questionDialog = None
  460. self.mallButton = None
  461. self.DSSButton = None
  462. self.interface = None
  463.  
  464. if self.wndCostume:
  465. self.wndCostume.Destroy()
  466. self.wndCostume = 0
  467.  
  468. if self.wndBelt:
  469. self.wndBelt.Destroy()
  470. self.wndBelt = None
  471.  
  472. if app.ENABLE_BIOLOG_SYSTEM:
  473. if self.wndCollect:
  474. self.wndCollect.Destroy()
  475. self.wndCollect = None
  476.  
  477. self.inventoryTab = []
  478. self.equipmentTab = []
  479.  
  480. def Hide(self):
  481. if None != self.tooltipItem:
  482. self.tooltipItem.HideToolTip()
  483.  
  484. if self.wndCostume:
  485. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow() # 인벤토리 창이 닫힐 때 코스츔이 열려 있었는가?
  486. self.wndCostume.Close()
  487.  
  488. if app.ENABLE_BIOLOG_SYSTEM:
  489. if self.wndCollect:
  490. self.isOpenedCollectWindowWhenClosingInventory = self.wndCollect.IsOpeningInventory()
  491. print "Is opening Biolog Inventory", self.isOpenedCollectWindowWhenClosingInventory
  492. self.wndCollect.Close()
  493.  
  494. if self.wndBelt:
  495. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory() # 인벤토리 창이 닫힐 때 벨트 인벤토리도 열려 있었는가?
  496. print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  497. self.wndBelt.Close()
  498.  
  499. if self.dlgPickMoney:
  500. self.dlgPickMoney.Close()
  501.  
  502. self.OnCloseQuestionDialog()
  503.  
  504. wndMgr.Hide(self.hWnd)
  505.  
  506.  
  507. def Close(self):
  508. self.Hide()
  509.  
  510.  
  511. def SetInventoryPage(self, page):
  512. self.inventoryPageIndex = page
  513. self.inventoryTab[0].SetUp()
  514. self.inventoryTab[1].SetUp()
  515. self.inventoryTab[2].SetUp()
  516. self.inventoryTab[3].SetUp()
  517. if len(self.inventoryTab) >=page:
  518. self.inventoryTab[page].Down()
  519. self.RefreshBagSlotWindow()
  520.  
  521. def SetEquipmentPage(self, page):
  522. self.equipmentPageIndex = page
  523. self.equipmentTab[0].SetUp()
  524. self.equipmentTab[1].SetUp()
  525. self.equipmentTab[2].SetUp()
  526. self.equipmentTab[3].SetUp()
  527. if len(self.equipmentTab) >=page:
  528. self.equipmentTab[page].Down()
  529. self.RefreshEquipSlotWindow()
  530.  
  531. def ClickMallButton(self):
  532. self.choix = ui.BoardWithTitleBar()
  533. self.choix.SetSize(210, 80)
  534. self.choix.SetCenterPosition()
  535. self.choix.AddFlag('float')
  536. self.choix.AddFlag('movable')
  537. self.choix.SetTitleName("Deschide ItemShop sau Depozit")
  538. self.choix.Show()
  539.  
  540. self.EntrepotIs = ui.Button()
  541. self.EntrepotIs.SetEvent(self.OpenIs)
  542. self.EntrepotIs.SetParent(self.choix)
  543. self.EntrepotIs.SetPosition(35, 40)
  544. self.EntrepotIs.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
  545. self.EntrepotIs.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
  546. self.EntrepotIs.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
  547. self.EntrepotIs.SetText("ItemShop")
  548. self.EntrepotIs.SetToolTipText("Deschide ItemShop")
  549. self.EntrepotIs.Show()
  550.  
  551. self.Magasinier = ui.Button()
  552. self.Magasinier.SetEvent(self._normal_mall)
  553. self.Magasinier.SetParent(self.choix)
  554. self.Magasinier.SetPosition(105, 40)
  555. self.Magasinier.SetUpVisual("d:/ymir work/ui/public/middle_button_01.sub")
  556. self.Magasinier.SetOverVisual("d:/ymir work/ui/public/middle_button_02.sub")
  557. self.Magasinier.SetDownVisual("d:/ymir work/ui/public/middle_button_03.sub")
  558. self.Magasinier.SetText("Depozit")
  559. self.Magasinier.SetToolTipText("Deschide Depozit Portabil")
  560. self.Magasinier.Show()
  561.  
  562. def OpenIs(self):
  563. self.EntrepotIs.Hide()
  564. self.choix.Hide()
  565. self.Magasinier.Hide()
  566. net.SendChatPacket("/click_mall")
  567.  
  568. def _normal_mall(self):
  569. self.EntrepotIs.Hide()
  570. self.Magasinier.Hide()
  571. self.choix.Hide()
  572. net.SendChatPacket("/click_safebox")
  573.  
  574. # DSSButton
  575. def ClickDSSButton(self):
  576. print "click_dss_button"
  577. self.interface.ToggleDragonSoulWindow()
  578.  
  579. def ClickCostumeButton(self):
  580. print "Click Costume Button"
  581. if self.wndCostume:
  582. if self.wndCostume.IsShow():
  583. self.wndCostume.Hide()
  584. else:
  585. self.wndCostume.Show()
  586. else:
  587. self.wndCostume = CostumeWindow(self)
  588. self.wndCostume.Show()
  589.  
  590. def OpenPickMoneyDialog(self):
  591.  
  592. if mouseModule.mouseController.isAttached():
  593.  
  594. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  595. if player.SLOT_TYPE_SAFEBOX == mouseModule.mouseController.GetAttachedType():
  596.  
  597. if player.ITEM_MONEY == mouseModule.mouseController.GetAttachedItemIndex():
  598. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  599. snd.PlaySound("sound/ui/money.wav")
  600.  
  601. mouseModule.mouseController.DeattachObject()
  602.  
  603. else:
  604. curMoney = player.GetElk()
  605.  
  606. if curMoney <= 0:
  607. return
  608.  
  609. self.dlgPickMoney.SetTitleName(localeInfo.PICK_MONEY_TITLE)
  610. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickMoney))
  611. self.dlgPickMoney.Open(curMoney)
  612. self.dlgPickMoney.SetMax(7) # 인벤토리 990000 제한 버그 수정
  613.  
  614. def OnPickMoney(self, money):
  615. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  616.  
  617. def OnPickItem(self, count):
  618. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  619. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  620. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  621.  
  622. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  623.  
  624. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or player.IsBeltInventorySlot(local):
  625. return local
  626.  
  627. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  628.  
  629.  
  630. def RefreshBagSlotWindow(self):
  631. getItemVNum=player.GetItemIndex
  632. getItemCount=player.GetItemCount
  633. setItemVNum=self.wndItem.SetItemSlot
  634. for i in xrange(player.INVENTORY_PAGE_SIZE*2):
  635. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  636. itemCount = getItemCount(slotNumber)
  637. if 0 == itemCount:
  638. self.wndItem.ClearSlot(i)
  639. continue
  640. elif 1 == itemCount:
  641. itemCount = 0
  642.  
  643. itemVnum = getItemVNum(slotNumber)
  644. setItemVNum(i, itemVnum, itemCount)
  645.  
  646. ## 자동물약 (HP: #72723 ~ #72726, SP: #72727 ~ #72730) 특수처리 - 아이템인데도 슬롯에 활성화/비활성화 표시를 위한 작업임 - [hyo]
  647. if constInfo.IS_AUTO_POTION(itemVnum):
  648. # metinSocket - [0] : 활성화 여부, [1] : 사용한 양, [2] : 최대 용량
  649. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  650.  
  651. if slotNumber >= player.INVENTORY_PAGE_SIZE:
  652. slotNumber -= player.INVENTORY_PAGE_SIZE
  653.  
  654. isActivated = 0 != metinSocket[0]
  655.  
  656. if isActivated:
  657. self.wndItem.ActivateSlot(slotNumber)
  658. potionType = 0;
  659. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  660. potionType = player.AUTO_POTION_TYPE_HP
  661. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  662. potionType = player.AUTO_POTION_TYPE_SP
  663.  
  664. usedAmount = int(metinSocket[1])
  665. totalAmount = int(metinSocket[2])
  666. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  667.  
  668. else:
  669. self.wndItem.DeactivateSlot(slotNumber)
  670.  
  671. self.wndItem.RefreshSlot()
  672.  
  673. if self.wndBelt:
  674. self.wndBelt.RefreshSlot()
  675.  
  676. def RefreshEquipSlotWindow(self):
  677. getItemVNum=player.GetItemIndex
  678. getItemCount=player.GetItemCount
  679. setItemVNum=self.wndEquip.SetItemSlot
  680. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  681. slotNumber = player.EQUIPMENT_SLOT_START + i
  682. itemCount = getItemCount(slotNumber)
  683. if itemCount <= 1:
  684. itemCount = 0
  685. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  686.  
  687. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  688. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  689. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  690. itemCount = getItemCount(slotNumber)
  691. if itemCount <= 1:
  692. itemCount = 0
  693. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  694. print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  695.  
  696.  
  697.  
  698. self.wndEquip.RefreshSlot()
  699.  
  700. if self.wndCostume:
  701. self.wndCostume.RefreshCostumeSlot()
  702.  
  703. def RefreshItemSlot(self):
  704. self.RefreshBagSlotWindow()
  705. self.RefreshEquipSlotWindow()
  706.  
  707. def RefreshStatus(self):
  708. money = player . GetElk ()
  709. if money <= 100000000 :
  710. self . wndMoney . SetFontColor ( 1.0 , 0.2 , 0.2 )
  711. elif money >= 100000001 and money <= 1000000000 :
  712. self . wndMoney . SetFontColor ( 1.0 , 0.6 , 0.2 )
  713. elif money >= 1000000001 and money <= 1500000000 :
  714. self . wndMoney . SetFontColor ( 1.0 , 1.0 , 0.2 )
  715. elif money >= 1500000001 :
  716. self . wndMoney . SetFontColor ( 0.6 , 1.0 , 0.2 )
  717. self . wndMoney . SetText ( localeInfo . NumberToMoneyString ( money ))
  718.  
  719. def SetItemToolTip(self, tooltipItem):
  720. self.tooltipItem = tooltipItem
  721.  
  722. def SellItem(self):
  723. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  724. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  725. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count)
  726. snd.PlaySound("sound/ui/money.wav")
  727. self.OnCloseQuestionDialog()
  728.  
  729. def OnDetachMetinFromItem(self):
  730. if None == self.questionDialog:
  731. return
  732.  
  733. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  734. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  735. self.OnCloseQuestionDialog()
  736.  
  737. def OnCloseQuestionDialog(self):
  738. if self.questionDialog:
  739. self.questionDialog.Close()
  740.  
  741. self.questionDialog = None
  742.  
  743. ## Slot Event
  744. def SelectEmptySlot(self, selectedSlotPos):
  745. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
  746. return
  747.  
  748. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  749.  
  750. if mouseModule.mouseController.isAttached():
  751.  
  752. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  753. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  754. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  755. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  756.  
  757. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  758. itemCount = player.GetItemCount(attachedSlotPos)
  759. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  760. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  761.  
  762. if item.IsRefineScroll(attachedItemIndex):
  763. self.wndItem.SetUseMode(False)
  764.  
  765. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  766. mouseModule.mouseController.RunCallBack("INVENTORY")
  767.  
  768. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  769. if constInfo.IsItemShop == 0:
  770. net.SendShopBuyPacket(attachedSlotPos)
  771. else:
  772. import uiShop
  773. self.wndShop = uiShop.ShopDialog()
  774. self.wndShop.BuyFromIS(attachedSlotPos)
  775.  
  776. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  777.  
  778. if player.ITEM_MONEY == attachedItemIndex:
  779. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  780. snd.PlaySound("sound/ui/money.wav")
  781.  
  782. else:
  783. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  784.  
  785. elif player.SLOT_TYPE_MALL == attachedSlotType:
  786. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  787.  
  788. mouseModule.mouseController.DeattachObject()
  789.  
  790. def SelectItemSlot(self, itemSlotIndex):
  791. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
  792. return
  793.  
  794. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  795.  
  796. if mouseModule.mouseController.isAttached():
  797. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  798. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  799. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  800.  
  801. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  802. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  803.  
  804. mouseModule.mouseController.DeattachObject()
  805.  
  806. else:
  807.  
  808. curCursorNum = app.GetCursor()
  809. if app.SELL == curCursorNum:
  810. self.__SellItem(itemSlotIndex)
  811.  
  812. elif app.BUY == curCursorNum:
  813. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  814.  
  815. elif app.IsPressed(app.DIK_LALT):
  816. link = player.GetItemLink(itemSlotIndex)
  817. ime.PasteString(link)
  818.  
  819. elif app.IsPressed(app.DIK_LSHIFT):
  820. itemCount = player.GetItemCount(itemSlotIndex)
  821.  
  822. if itemCount > 1:
  823. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  824. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  825. self.dlgPickMoney.Open(itemCount)
  826. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  827. #else:
  828. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  829. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  830.  
  831. elif app.IsPressed(app.DIK_LCONTROL):
  832. itemIndex = player.GetItemIndex(itemSlotIndex)
  833.  
  834. if True == item.CanAddToQuickSlotItem(itemIndex):
  835. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  836. else:
  837. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  838.  
  839. else:
  840. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  841. itemCount = player.GetItemCount(itemSlotIndex)
  842. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  843.  
  844. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  845. self.wndItem.SetUseMode(True)
  846. else:
  847. self.wndItem.SetUseMode(False)
  848.  
  849. snd.PlaySound("sound/ui/pick.wav")
  850.  
  851. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  852. if srcItemSlotPos == dstItemSlotPos:
  853. return
  854.  
  855. if item.IsRefineScroll(srcItemVID):
  856. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  857. self.wndItem.SetUseMode(False)
  858.  
  859. elif item.IsMetin(srcItemVID):
  860. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  861.  
  862. elif item.IsDetachScroll(srcItemVID):
  863. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  864.  
  865. elif item.IsKey(srcItemVID):
  866. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  867.  
  868. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  869. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  870.  
  871. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  872. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  873.  
  874. else:
  875. #snd.PlaySound("sound/ui/drop.wav")
  876.  
  877. ## 이동시킨 곳이 장착 슬롯일 경우 아이템을 사용해서 장착 시킨다 - [levites]
  878. if player.IsEquipmentSlot(dstItemSlotPos):
  879.  
  880. ## 들고 있는 아이템이 장비일때만
  881. if item.IsEquipmentVID(srcItemVID):
  882. self.__UseItem(srcItemSlotPos)
  883.  
  884. else:
  885. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  886. #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  887.  
  888. def __SellItem(self, itemSlotPos):
  889. if not player.IsEquipmentSlot(itemSlotPos):
  890. self.sellingSlotNumber = itemSlotPos
  891. itemIndex = player.GetItemIndex(itemSlotPos)
  892. itemCount = player.GetItemCount(itemSlotPos)
  893.  
  894.  
  895. self.sellingSlotitemIndex = itemIndex
  896. self.sellingSlotitemCount = itemCount
  897.  
  898. item.SelectItem(itemIndex)
  899. itemPrice = item.GetISellItemPrice()
  900.  
  901. if item.Is1GoldItem():
  902. itemPrice = itemCount / itemPrice / 5
  903. else:
  904. itemPrice = itemPrice * itemCount / 5
  905.  
  906. item.GetItemName(itemIndex)
  907. itemName = item.GetItemName()
  908.  
  909. self.questionDialog = uiCommon.QuestionDialog()
  910. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  911. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  912. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  913. self.questionDialog.Open()
  914. self.questionDialog.count = itemCount
  915.  
  916. def RefineItem(self, scrollSlotPos, targetSlotPos):
  917.  
  918. scrollIndex = player.GetItemIndex(scrollSlotPos)
  919. targetIndex = player.GetItemIndex(targetSlotPos)
  920.  
  921. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  922. return
  923.  
  924. ###########################################################
  925. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  926. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  927. return
  928. ###########################################################
  929.  
  930. ###########################################################
  931. #net.SendRequestRefineInfoPacket(targetSlotPos)
  932. #return
  933. ###########################################################
  934.  
  935. result = player.CanRefine(scrollIndex, targetSlotPos)
  936.  
  937. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  938. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  939. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  940.  
  941. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  942. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  943. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  944.  
  945. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  946. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  947. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  948.  
  949. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  950. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  951. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  952.  
  953. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  954. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  955.  
  956. if player.REFINE_OK != result:
  957. return
  958.  
  959. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  960.  
  961. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  962. scrollIndex = player.GetItemIndex(scrollSlotPos)
  963. targetIndex = player.GetItemIndex(targetSlotPos)
  964.  
  965. if not player.CanDetach(scrollIndex, targetSlotPos):
  966. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  967. return
  968.  
  969. self.questionDialog = uiCommon.QuestionDialog()
  970. self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  971. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  972. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  973. self.questionDialog.Open()
  974. self.questionDialog.sourcePos = scrollSlotPos
  975. self.questionDialog.targetPos = targetSlotPos
  976.  
  977. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  978. metinIndex = player.GetItemIndex(metinSlotPos)
  979. targetIndex = player.GetItemIndex(targetSlotPos)
  980.  
  981. item.SelectItem(metinIndex)
  982. itemName = item.GetItemName()
  983.  
  984. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  985.  
  986. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  987. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  988.  
  989. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  990. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  991.  
  992. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  993. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  994.  
  995. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  996. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  997.  
  998. if player.ATTACH_METIN_OK != result:
  999. return
  1000.  
  1001. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1002.  
  1003.  
  1004.  
  1005. def OverOutItem(self):
  1006. self.wndItem.SetUsableItem(False)
  1007. if None != self.tooltipItem:
  1008. self.tooltipItem.HideToolTip()
  1009.  
  1010. def OverInItem(self, overSlotPos):
  1011. overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1012. self.wndItem.SetUsableItem(False)
  1013.  
  1014. if mouseModule.mouseController.isAttached():
  1015. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1016. if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1017.  
  1018. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1019. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1020.  
  1021. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1022. self.wndItem.SetUsableItem(True)
  1023. self.ShowToolTip(overSlotPos)
  1024. return
  1025.  
  1026. self.ShowToolTip(overSlotPos)
  1027.  
  1028.  
  1029. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1030. "다른 아이템에 사용할 수 있는 아이템인가?"
  1031.  
  1032. if item.IsRefineScroll(srcItemVNum):
  1033. return True
  1034. elif item.IsMetin(srcItemVNum):
  1035. return True
  1036. elif item.IsDetachScroll(srcItemVNum):
  1037. return True
  1038. elif item.IsKey(srcItemVNum):
  1039. return True
  1040. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1041. return True
  1042. else:
  1043. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1044. return True
  1045.  
  1046. return False
  1047.  
  1048. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1049. "대상 아이템에 사용할 수 있는가?"
  1050.  
  1051. if srcSlotPos == dstSlotPos:
  1052. return False
  1053.  
  1054. if item.IsRefineScroll(srcItemVNum):
  1055. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1056. return True
  1057. elif item.IsMetin(srcItemVNum):
  1058. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1059. return True
  1060. elif item.IsDetachScroll(srcItemVNum):
  1061. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1062. return True
  1063. elif item.IsKey(srcItemVNum):
  1064. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1065. return True
  1066.  
  1067. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1068. return True
  1069.  
  1070. else:
  1071. useType=item.GetUseType(srcItemVNum)
  1072.  
  1073. if "USE_CLEAN_SOCKET" == useType:
  1074. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1075. return True
  1076. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1077. if self.__CanChangeItemAttrList(dstSlotPos):
  1078. return True
  1079. elif "USE_ADD_ATTRIBUTE" == useType:
  1080. if self.__CanAddItemAttr(dstSlotPos):
  1081. return True
  1082. elif "USE_ADD_ATTRIBUTE2" == useType:
  1083. if self.__CanAddItemAttr(dstSlotPos):
  1084. return True
  1085. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1086. if self.__CanAddAccessorySocket(dstSlotPos):
  1087. return True
  1088. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1089. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1090. return True;
  1091. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  1092. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1093. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  1094.  
  1095. item.SelectItem(dstItemVNum)
  1096.  
  1097. if item.ITEM_TYPE_BELT == item.GetItemType():
  1098. return True
  1099.  
  1100. return False
  1101.  
  1102. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1103. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1104. if dstItemVNum == 0:
  1105. return False
  1106.  
  1107. item.SelectItem(dstItemVNum)
  1108.  
  1109. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1110. return False
  1111.  
  1112. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1113. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1114. return True
  1115.  
  1116. return False
  1117.  
  1118. def __CanChangeItemAttrList(self, dstSlotPos):
  1119. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1120. if dstItemVNum == 0:
  1121. return False
  1122.  
  1123. item.SelectItem(dstItemVNum)
  1124.  
  1125. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1126. return False
  1127.  
  1128. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1129. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1130. return True
  1131.  
  1132. return False
  1133.  
  1134. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1135. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1136. if dstItemVNum == 0:
  1137. return False
  1138.  
  1139. item.SelectItem(dstItemVNum)
  1140.  
  1141. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1142. return False
  1143.  
  1144. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1145. return False
  1146.  
  1147. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1148. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1149.  
  1150. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1151. return False
  1152.  
  1153. if curCount>=maxCount:
  1154. return False
  1155.  
  1156. return True
  1157.  
  1158. def __CanAddAccessorySocket(self, dstSlotPos):
  1159. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1160. if dstItemVNum == 0:
  1161. return False
  1162.  
  1163. item.SelectItem(dstItemVNum)
  1164.  
  1165. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1166. return False
  1167.  
  1168. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1169. return False
  1170.  
  1171. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1172. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1173.  
  1174. ACCESSORY_SOCKET_MAX_SIZE = 3
  1175. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1176. return False
  1177.  
  1178. return True
  1179.  
  1180. def __CanAddItemAttr(self, dstSlotPos):
  1181. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1182. if dstItemVNum == 0:
  1183. return False
  1184.  
  1185. item.SelectItem(dstItemVNum)
  1186.  
  1187. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1188. return False
  1189.  
  1190. attrCount = 0
  1191. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1192. if player.GetItemAttribute(dstSlotPos, i) != 0:
  1193. attrCount += 1
  1194.  
  1195. if attrCount<4:
  1196. return True
  1197.  
  1198. return False
  1199.  
  1200. def ShowToolTip(self, slotIndex):
  1201. if None != self.tooltipItem:
  1202. self.tooltipItem.SetInventoryItem(slotIndex)
  1203.  
  1204. def OnTop(self):
  1205. if None != self.tooltipItem:
  1206. self.tooltipItem.SetTop()
  1207.  
  1208. def OnPressEscapeKey(self):
  1209. self.Close()
  1210. return True
  1211.  
  1212. def UseItemSlot(self, slotIndex):
  1213.  
  1214. curCursorNum = app.GetCursor()
  1215. if app.SELL == curCursorNum:
  1216. return
  1217.  
  1218. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS():
  1219. return
  1220.  
  1221. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1222.  
  1223. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1224. if self.wndDragonSoulRefine.IsShow():
  1225. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  1226. return
  1227.  
  1228. self.__UseItem(slotIndex)
  1229. mouseModule.mouseController.DeattachObject()
  1230. self.OverOutItem()
  1231.  
  1232. def SetOpenBoniSwitcherEvent(self, event):
  1233. self.OpenBoniSwitcherEvent = ui.__mem_func__(event)
  1234.  
  1235. def __UseItem(self, slotIndex):
  1236. ItemVNum = player.GetItemIndex(slotIndex)
  1237. item.SelectItem(ItemVNum)
  1238. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1239. self.questionDialog = uiCommon.QuestionDialog()
  1240. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1241. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1242. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1243. self.questionDialog.Open()
  1244. self.questionDialog.slotIndex = slotIndex
  1245.  
  1246. elif player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GIFTBOX:
  1247. if app.ENABLE_SHOW_CHEST_DROP:
  1248. if self.interface:
  1249. if self.interface.dlgChestDrop:
  1250. if not self.interface.dlgChestDrop.IsShow():
  1251. self.interface.dlgChestDrop.Open(slotIndex)
  1252. net.SendChestDropInfo(slotIndex)
  1253. else:
  1254. self.__SendUseItemPacket(slotIndex)
  1255.  
  1256. def __UseItemQuestionDialog_OnCancel(self):
  1257. self.OnCloseQuestionDialog()
  1258.  
  1259. def __UseItemQuestionDialog_OnAccept(self):
  1260. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1261.  
  1262. if self.questionDialog:
  1263. self.questionDialog.Close()
  1264. self.questionDialog = None
  1265.  
  1266. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1267. # 개인상점 열고 있는 동안 아이템 사용 방지
  1268. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1269. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1270. return
  1271.  
  1272. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1273.  
  1274. def __SendUseItemPacket(self, slotPos):
  1275. # 개인상점 열고 있는 동안 아이템 사용 방지
  1276. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1277. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1278. return
  1279.  
  1280. net.SendItemUsePacket(slotPos)
  1281.  
  1282. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1283. # 개인상점 열고 있는 동안 아이템 사용 방지
  1284. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1285. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1286. return
  1287.  
  1288. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1289.  
  1290. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  1291. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  1292. self.wndDragonSoulRefine = wndDragonSoulRefine
  1293.  
  1294. def OnMoveWindow(self, x, y):
  1295. # print "Inventory Global Pos : ", self.GetGlobalPosition()
  1296. if self.wndBelt:
  1297. # print "Belt Global Pos : ", self.wndBelt.GetGlobalPosition()
  1298. self.wndBelt.AdjustPositionAndSize()
  1299. if app.ENABLE_BIOLOG_SYSTEM:
  1300. if self.wndCollect:
  1301. self.wndCollect.AdjustPositionAndSize()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement