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