Advertisement
Guest User

Untitled

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