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 shop
  12. import safebox
  13. import uiScriptLocale
  14. import uiRefine
  15. import uirarityrefine
  16. import uiAttachMetin
  17. import uiPickMoney
  18. import uiPickEtc
  19. import uiCommon
  20. import uiPrivateShopBuilder
  21. import uiOfflineShopBuilder
  22. import uiOfflineShop
  23. import localeInfo
  24. import constInfo
  25. import event
  26. import ime
  27. import wndMgr
  28. import uiToolTip
  29. import exchange
  30. import translate
  31. import interfaceModule
  32. if app.ENABLE_SASH_SYSTEM:
  33. import sash
  34. if app.ENABLE_CHANGELOOK_SYSTEM:
  35. import changelook
  36. ITEM_MALL_BUTTON_ENABLE = TRUE
  37. ITEM_FLAG_APPLICABLE = 1 << 14
  38. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  39. EX_INVEN_COVER_IMG_CLOSE = "d:/ymir work/ui/game/windows/ex_inven_cover_button_close.sub"
  40. EX_INVEN_COVER_IMG_OPEN = "d:/ymir work/ui/game/windows/ex_inven_cover_button_open.sub"
  41. class CostumeWindow(ui.ScriptWindow):
  42. def __init__(self, wndInventory):
  43. import exception
  44. if not app.ENABLE_COSTUME_SYSTEM:
  45. exception.Abort("What do you do?")
  46. return
  47. if not wndInventory:
  48. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  49. return
  50. ui.ScriptWindow.__init__(self)
  51. self.isLoaded = 0
  52. self.wndInventory = wndInventory;
  53. self.__LoadWindow()
  54. def __del__(self):
  55. ui.ScriptWindow.__del__(self)
  56. def Show(self):
  57. self.__LoadWindow()
  58. self.RefreshCostumeSlot()
  59. ui.ScriptWindow.Show(self)
  60. def Close(self):
  61. self.Hide()
  62. def __LoadWindow(self):
  63. if self.isLoaded == 1:
  64. return
  65. self.isLoaded = 1
  66. try:
  67. pyScrLoader = ui.PythonScriptLoader()
  68. pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  69. except:
  70. import exception
  71. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  72. try:
  73. wndEquip = self.GetChild("CostumeSlot")
  74. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  75. except:
  76. import exception
  77. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  78. ## Equipment
  79. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  80. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  81. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  82. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  83. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  84. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  85. self.wndEquip = wndEquip
  86. def RefreshCostumeSlot(self):
  87. getItemVNum=player.GetItemIndex
  88. for i in xrange(item.COSTUME_SLOT_COUNT):
  89. slotNumber = item.COSTUME_SLOT_START + i
  90. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  91. if app.ENABLE_CHANGELOOK_SYSTEM:
  92. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  93. if itemTransmutedVnum:
  94. self.wndEquip.DisableCoverButton(slotNumber)
  95. else:
  96. self.wndEquip.EnableCoverButton(slotNumber)
  97. for i in xrange(2):
  98. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  99. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  100. self.wndEquip.RefreshSlot()
  101. if app.WJ_SPLIT_INVENTORY_SYSTEM:
  102. class ExtendedInventoryWindow(ui.ScriptWindow):
  103. tooltipItem = None
  104. interface = None
  105. dlgPickMoney = None
  106. dlgPickItem = None
  107. sellingSlotNumber = -1
  108. isLoaded = 0
  109. def __init__(self):
  110. ui.ScriptWindow.__init__(self)
  111. self.inventoryPageIndex = 0
  112. self.__LoadWindow()
  113. def __del__(self):
  114. ui.ScriptWindow.__del__(self)
  115. def Show(self):
  116. self.__LoadWindow()
  117. ui.ScriptWindow.Show(self)
  118. def BindInterfaceClass(self, interface):
  119. self.interface = interface
  120. def __LoadWindow(self):
  121. if self.isLoaded == 1:
  122. return
  123. self.isLoaded = 1
  124. try:
  125. pyScrLoader = ui.PythonScriptLoader()
  126. pyScrLoader.LoadScriptFile(self, "UIScript/ExtendedInventoryWindow.py")
  127. except:
  128. import exception
  129. exception.Abort("ExtendedInventoryWindow.LoadWindow.LoadObject")
  130. try:
  131. wndItem = self.GetChild("ItemSlot")
  132. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  133. self.titleName = self.GetChild("TitleName")
  134. self.SkillBookButton = self.GetChild("SkillBookButton")
  135. self.UpgradeItemsButton = self.GetChild("UpgradeItemsButton")
  136. self.stoneButton = self.GetChild("StoneButton")
  137. self.boxButton = self.GetChild("BoxButton")
  138. self.efsunButton = self.GetChild("EfsunButton")
  139. self.cicekButton = self.GetChild("CicekButton")
  140. self.inventoryTab = []
  141. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  142. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  143. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  144. self.MalzemeDeposuInfo = self.GetChild("MalzemeDeposuInfo")
  145. except:
  146. import exception
  147. exception.Abort("ExtendedInventoryWindow.LoadWindow.BindObject")
  148. ## Info
  149. self.tlInfo = uiToolTip.ItemToolTip()
  150. self.tlInfo.Hide()
  151. self.tooltipInfo = [self.tlInfo]*7
  152. self.InformationText = [localeInfo.MALZEME_DEPOSU,
  153. localeInfo.BK_ENVANTER_TEXT1,
  154. localeInfo.BK_ENVANTER_TEXT2,
  155. localeInfo.BK_ENVANTER_TEXT3,
  156. localeInfo.BK_ENVANTER_TEXT4,
  157. localeInfo.BK_ENVANTER_TEXT5,
  158. localeInfo.BK_ENVANTER_TEXT6
  159. ]
  160. for i in xrange(7):
  161. self.tooltipInfo[i].SetFollow(True)
  162. self.tooltipInfo[i].AlignHorizonalCenter()
  163. if i == 0:
  164. TITLE_COLOR = grp.GenerateColor(0.9490, 0.9058, 0.7568, 1.0)
  165. self.tooltipInfo[i].AutoAppendTextLine(self.InformationText[i], TITLE_COLOR)
  166. else:
  167. self.tooltipInfo[i].AutoAppendTextLine(self.InformationText[i])
  168. self.tooltipInfo[i].Hide()
  169. self.tooltipInfo[i].toolTipWidth += 10
  170. ## Item
  171. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  172. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  173. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  174. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  175. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  176. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  177. self.envanterileacilsin = ui.CheckBox()
  178. self.envanterileacilsin.SetParent(self)
  179. self.envanterileacilsin.SetPosition(17, 385)
  180. self.envanterileacilsin.SetEvent(ui.__mem_func__(self.__OnClickEnableEnvanterOn), "ON_CHECK", True)
  181. self.envanterileacilsin.SetEvent(ui.__mem_func__(self.__OnClickDisableEnvanterOf), "ON_UNCKECK", False)
  182. self.envanterileacilsin.SetTextInfo(localeInfo.ENVANTER_ILE_AC)
  183. self.envanterileacilsin.SetCheckStatus(constInfo.EnvanterAcilsinmi)
  184. self.envanterileacilsin.Show()
  185. self.SkillBookButton.SetEvent(lambda arg=0: self.SetInventoryType(arg))
  186. self.UpgradeItemsButton.SetEvent(lambda arg=1: self.SetInventoryType(arg))
  187. self.stoneButton.SetEvent(lambda arg=2: self.SetInventoryType(arg))
  188. self.boxButton.SetEvent(lambda arg=3: self.SetInventoryType(arg))
  189. self.efsunButton.SetEvent(lambda arg=4: self.SetInventoryType(arg))
  190. self.cicekButton.SetEvent(lambda arg=5: self.SetInventoryType(arg))
  191. self.SkillBookButton.Down()
  192. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  193. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  194. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  195. self.inventoryTab[0].Down()
  196. ## PickMoneyDialog
  197. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  198. dlgPickMoney.LoadDialog()
  199. dlgPickMoney.Hide()
  200. ## PickItemDialog
  201. dlgPickItem = uiPickEtc.PickEtcDialog()
  202. dlgPickItem.LoadDialog()
  203. dlgPickItem.Hide()
  204. self.dlgPickMoney = dlgPickMoney
  205. self.wndItem = wndItem
  206. self.SetInventoryType(0)
  207. self.SetInventoryPage(0)
  208. self.dlgPickItem = dlgPickItem
  209. self.wndCostume = None
  210. def Destroy(self):
  211. self.ClearDictionary()
  212. self.dlgPickMoney.Destroy()
  213. self.dlgPickItem.Destroy()
  214. self.dlgPickItem = 0
  215. self.dlgPickMoney = 0
  216. self.tooltipItem = None
  217. self.wndItem = 0
  218. self.interface = None
  219. self.inventoryTab = []
  220. self.envanterileacilsin = []
  221. if app.EKENVANTER_AC:
  222. def __OnClickEnableEnvanterOn(self):
  223. constInfo.EnvanterAcilsinmi = 1
  224. chat.AppendChat(chat.CHAT_TYPE_INFO, "<Sistem> Envanter ile açılma aktif.")
  225. def __OnClickDisableEnvanterOf(self):
  226. constInfo.EnvanterAcilsinmi = 0
  227. chat.AppendChat(chat.CHAT_TYPE_INFO, "<Sistem> Envanter ile açılma pasif.")
  228. def Hide(self):
  229. if None != self.tooltipItem:
  230. self.tooltipItem.HideToolTip()
  231. self.tlInfo.Hide()
  232. if self.dlgPickItem:
  233. self.dlgPickItem.Close()
  234. wndMgr.Hide(self.hWnd)
  235. def Close(self):
  236. if self.tooltipItem:
  237. self.tooltipItem.HideToolTip()
  238. self.tlInfo.Hide()
  239. self.Hide()
  240. def OnUpdate(self):
  241. for i in xrange(7):
  242. if self.MalzemeDeposuInfo.IsIn():
  243. self.tooltipInfo[i].Show()
  244. else:
  245. self.tooltipInfo[i].Hide()
  246. def SetInventoryType(self, type):
  247. self.inventoryType = type
  248. if type == 0:
  249. self.SkillBookButton.Down()
  250. self.efsunButton.SetUp()
  251. self.cicekButton.SetUp()
  252. self.UpgradeItemsButton.SetUp()
  253. self.stoneButton.SetUp()
  254. self.boxButton.SetUp()
  255. self.titleName.SetText(localeInfo.INVENTORY_SKILL_BOOK_TOOLTIP)
  256. elif type == 2:
  257. self.stoneButton.Down()
  258. self.efsunButton.SetUp()
  259. self.cicekButton.SetUp()
  260. self.UpgradeItemsButton.SetUp()
  261. self.SkillBookButton.SetUp()
  262. self.boxButton.SetUp()
  263. self.titleName.SetText(localeInfo.INVENTORY_STONE_TOOLTIP)
  264. elif type == 3:
  265. self.boxButton.Down()
  266. self.efsunButton.SetUp()
  267. self.UpgradeItemsButton.SetUp()
  268. self.cicekButton.SetUp()
  269. self.stoneButton.SetUp()
  270. self.SkillBookButton.SetUp()
  271. self.titleName.SetText(localeInfo.INVENTORY_BOX_TOOLTIP)
  272. elif type == 4:
  273. self.efsunButton.Down()
  274. self.boxButton.SetUp()
  275. self.cicekButton.SetUp()
  276. self.UpgradeItemsButton.SetUp()
  277. self.stoneButton.SetUp()
  278. self.SkillBookButton.SetUp()
  279. self.titleName.SetText(localeInfo.INVENTORY_EFSUN_TOOLTIP)
  280. elif type == 5:
  281. self.cicekButton.Down()
  282. self.efsunButton.SetUp()
  283. self.boxButton.SetUp()
  284. self.UpgradeItemsButton.SetUp()
  285. self.stoneButton.SetUp()
  286. self.SkillBookButton.SetUp()
  287. self.titleName.SetText(localeInfo.INVENTORY_CICEK_TOOLTIP)
  288. else:
  289. self.UpgradeItemsButton.Down()
  290. self.SkillBookButton.SetUp()
  291. self.efsunButton.SetUp()
  292. self.cicekButton.SetUp()
  293. self.stoneButton.SetUp()
  294. self.boxButton.SetUp()
  295. self.titleName.SetText(localeInfo.INVENTORY_UPGRADE_ITEM_TOOLTIP)
  296. self.RefreshBagSlotWindow()
  297. def SetInventoryPage(self, page):
  298. self.inventoryPageIndex = page
  299. for i in range(0,len(self.inventoryTab)):
  300. self.inventoryTab[i].SetUp()
  301. self.inventoryTab[page].Down()
  302. self.RefreshBagSlotWindow()
  303. def OnPickItem(self, count):
  304. itemSlotIndex = self.dlgPickItem.itemGlobalSlotIndex
  305. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  306. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_SKILL_BOOK_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  307. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  308. if self.inventoryType == 0:
  309. return self.inventoryPageIndex*player.SKILL_BOOK_INVENTORY_SLOT_COUNT + local + item.SKILL_BOOK_INVENTORY_SLOT_START
  310. elif self.inventoryType == 2:
  311. return self.inventoryPageIndex*player.STONE_INVENTORY_SLOT_COUNT + local + item.STONE_INVENTORY_SLOT_START
  312. elif self.inventoryType == 3:
  313. return self.inventoryPageIndex*player.BOX_INVENTORY_SLOT_COUNT + local + item.BOX_INVENTORY_SLOT_START
  314. elif self.inventoryType == 4:
  315. return self.inventoryPageIndex*player.EFSUN_INVENTORY_SLOT_COUNT + local + item.EFSUN_INVENTORY_SLOT_START
  316. elif self.inventoryType == 5:
  317. return self.inventoryPageIndex*player.CICEK_INVENTORY_SLOT_COUNT + local + item.CICEK_INVENTORY_SLOT_START
  318. else:
  319. return self.inventoryPageIndex*player.UPGRADE_ITEMS_INVENTORY_SLOT_COUNT + local + item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  320. def GetInventoryPageIndex(self):
  321. return self.inventoryPageIndex
  322. def RefreshBagSlotWindow(self):
  323. getItemVNum=player.GetItemIndex
  324. getItemCount=player.GetItemCount
  325. setItemVNum=self.wndItem.SetItemSlot
  326. if self.inventoryType == 0:
  327. for i in xrange(player.SKILL_BOOK_INVENTORY_SLOT_COUNT):
  328. slotNumber = item.SKILL_BOOK_INVENTORY_SLOT_START + i
  329. if self.GetInventoryPageIndex() == 1:
  330. slotNumber += 45
  331. elif self.GetInventoryPageIndex() == 2:
  332. slotNumber += 90
  333. itemCount = getItemCount(slotNumber)
  334. if 0 == itemCount:
  335. self.wndItem.ClearSlot(i)
  336. continue
  337. elif 1 == itemCount:
  338. itemCount = 0
  339. itemVnum = getItemVNum(slotNumber)
  340. setItemVNum(i, itemVnum, itemCount)
  341. elif self.inventoryType == 2:
  342. for i in xrange(player.STONE_INVENTORY_SLOT_COUNT):
  343. slotNumber = item.STONE_INVENTORY_SLOT_START + i
  344. if self.GetInventoryPageIndex() == 1:
  345. slotNumber += 45
  346. elif self.GetInventoryPageIndex() == 2:
  347. slotNumber += 90
  348. itemCount = getItemCount(slotNumber)
  349. if 0 == itemCount:
  350. self.wndItem.ClearSlot(i)
  351. continue
  352. elif 1 == itemCount:
  353. itemCount = 0
  354. itemVnum = getItemVNum(slotNumber)
  355. setItemVNum(i, itemVnum, itemCount)
  356. elif self.inventoryType == 3:
  357. for i in xrange(player.BOX_INVENTORY_SLOT_COUNT):
  358. slotNumber = item.BOX_INVENTORY_SLOT_START + i
  359. if self.GetInventoryPageIndex() == 1:
  360. slotNumber += 45
  361. elif self.GetInventoryPageIndex() == 2:
  362. slotNumber += 90
  363. itemCount = getItemCount(slotNumber)
  364. if 0 == itemCount:
  365. self.wndItem.ClearSlot(i)
  366. continue
  367. elif 1 == itemCount:
  368. itemCount = 0
  369. itemVnum = getItemVNum(slotNumber)
  370. setItemVNum(i, itemVnum, itemCount)
  371. elif self.inventoryType == 4:
  372. for i in xrange(player.EFSUN_INVENTORY_SLOT_COUNT):
  373. slotNumber = item.EFSUN_INVENTORY_SLOT_START + i
  374. if self.GetInventoryPageIndex() == 1:
  375. slotNumber += 45
  376. elif self.GetInventoryPageIndex() == 2:
  377. slotNumber += 90
  378. itemCount = getItemCount(slotNumber)
  379. if 0 == itemCount:
  380. self.wndItem.ClearSlot(i)
  381. continue
  382. elif 1 == itemCount:
  383. itemCount = 0
  384. itemVnum = getItemVNum(slotNumber)
  385. setItemVNum(i, itemVnum, itemCount)
  386. elif self.inventoryType == 5:
  387. for i in xrange(player.CICEK_INVENTORY_SLOT_COUNT):
  388. slotNumber = item.CICEK_INVENTORY_SLOT_START + i
  389. if self.GetInventoryPageIndex() == 1:
  390. slotNumber += 45
  391. elif self.GetInventoryPageIndex() == 2:
  392. slotNumber += 90
  393. itemCount = getItemCount(slotNumber)
  394. if 0 == itemCount:
  395. self.wndItem.ClearSlot(i)
  396. continue
  397. elif 1 == itemCount:
  398. itemCount = 0
  399. itemVnum = getItemVNum(slotNumber)
  400. setItemVNum(i, itemVnum, itemCount)
  401. else:
  402. for i in xrange(player.UPGRADE_ITEMS_INVENTORY_SLOT_COUNT):
  403. slotNumber = item.UPGRADE_ITEMS_INVENTORY_SLOT_START + i
  404. if self.GetInventoryPageIndex() == 1:
  405. slotNumber += 45
  406. elif self.GetInventoryPageIndex() == 2:
  407. slotNumber += 90
  408. itemCount = getItemCount(slotNumber)
  409. if 0 == itemCount:
  410. self.wndItem.ClearSlot(i)
  411. continue
  412. elif 1 == itemCount:
  413. itemCount = 0
  414. itemVnum = getItemVNum(slotNumber)
  415. setItemVNum(i, itemVnum, itemCount)
  416. self.wndItem.RefreshSlot()
  417. def RefreshItemSlot(self):
  418. self.RefreshBagSlotWindow()
  419. def RefreshStatus(self):
  420. pass
  421. def SetItemToolTip(self, tooltipItem):
  422. self.tooltipItem = tooltipItem
  423. def SelectEmptySlot(self, selectedSlotPos):
  424. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  425. return
  426. if self.inventoryType == 0:
  427. selectedSlotPos += item.SKILL_BOOK_INVENTORY_SLOT_START
  428. if self.GetInventoryPageIndex() == 1:
  429. selectedSlotPos += 45
  430. elif self.GetInventoryPageIndex() == 2:
  431. selectedSlotPos += 90
  432. elif self.inventoryType == 2:
  433. selectedSlotPos += item.STONE_INVENTORY_SLOT_START
  434. if self.GetInventoryPageIndex() == 1:
  435. selectedSlotPos += 45
  436. elif self.GetInventoryPageIndex() == 2:
  437. selectedSlotPos += 90
  438. elif self.inventoryType == 3:
  439. selectedSlotPos += item.BOX_INVENTORY_SLOT_START
  440. if self.GetInventoryPageIndex() == 1:
  441. selectedSlotPos += 45
  442. elif self.GetInventoryPageIndex() == 2:
  443. selectedSlotPos += 90
  444. elif self.inventoryType == 4:
  445. selectedSlotPos += item.EFSUN_INVENTORY_SLOT_START
  446. if self.GetInventoryPageIndex() == 1:
  447. selectedSlotPos += 45
  448. elif self.GetInventoryPageIndex() == 2:
  449. selectedSlotPos += 90
  450. elif self.inventoryType == 5:
  451. selectedSlotPos += item.CICEK_INVENTORY_SLOT_START
  452. if self.GetInventoryPageIndex() == 1:
  453. selectedSlotPos += 45
  454. elif self.GetInventoryPageIndex() == 2:
  455. selectedSlotPos += 90
  456. else:
  457. selectedSlotPos += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  458. if self.GetInventoryPageIndex() == 1:
  459. selectedSlotPos += 45
  460. elif self.GetInventoryPageIndex() == 2:
  461. selectedSlotPos += 90
  462. if mouseModule.mouseController.isAttached():
  463. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  464. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  465. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  466. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  467. if player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or\
  468. player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or\
  469. player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or\
  470. player.SLOT_TYPE_BOX_INVENTORY == attachedSlotType or\
  471. player.SLOT_TYPE_EFSUN_INVENTORY == attachedSlotType or\
  472. player.SLOT_TYPE_CICEK_INVENTORY == attachedSlotType:
  473. itemCount = player.GetItemCount(attachedSlotPos)
  474. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  475. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  476. if item.IsRefineScroll(attachedItemIndex):
  477. self.wndItem.SetUseMode(False)
  478. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  479. mouseModule.mouseController.RunCallBack("INVENTORY")
  480. elif player.SLOT_TYPE_OFFLINE_SHOP == attachedSlotType:
  481. mouseModule.mouseController.RunCallBack("INVENTORY")
  482. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  483. net.SendShopBuyPacket(attachedSlotPos)
  484. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  485. if player.ITEM_MONEY == attachedItemIndex:
  486. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  487. snd.PlaySound("sound/ui/money.wav")
  488. else:
  489. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  490. elif player.SLOT_TYPE_MALL == attachedSlotType:
  491. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  492. mouseModule.mouseController.DeattachObject()
  493. def SelectItemSlot(self, itemSlotIndex):
  494. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  495. return
  496. if self.inventoryType == 0:
  497. itemSlotIndex += item.SKILL_BOOK_INVENTORY_SLOT_START
  498. if self.GetInventoryPageIndex() == 1:
  499. itemSlotIndex += 45
  500. elif self.GetInventoryPageIndex() == 2:
  501. itemSlotIndex += 90
  502. elif self.inventoryType == 2:
  503. itemSlotIndex += item.STONE_INVENTORY_SLOT_START
  504. if self.GetInventoryPageIndex() == 1:
  505. itemSlotIndex += 45
  506. elif self.GetInventoryPageIndex() == 2:
  507. itemSlotIndex += 90
  508. elif self.inventoryType == 3:
  509. itemSlotIndex += item.BOX_INVENTORY_SLOT_START
  510. if self.GetInventoryPageIndex() == 1:
  511. itemSlotIndex += 45
  512. elif self.GetInventoryPageIndex() == 2:
  513. itemSlotIndex += 90
  514. elif self.inventoryType == 4:
  515. itemSlotIndex += item.EFSUN_INVENTORY_SLOT_START
  516. if self.GetInventoryPageIndex() == 1:
  517. itemSlotIndex += 45
  518. elif self.GetInventoryPageIndex() == 2:
  519. itemSlotIndex += 90
  520. elif self.inventoryType == 5:
  521. itemSlotIndex += item.CICEK_INVENTORY_SLOT_START
  522. if self.GetInventoryPageIndex() == 1:
  523. itemSlotIndex += 45
  524. elif self.GetInventoryPageIndex() == 2:
  525. itemSlotIndex += 90
  526. else:
  527. itemSlotIndex += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  528. if self.GetInventoryPageIndex() == 1:
  529. itemSlotIndex += 45
  530. elif self.GetInventoryPageIndex() == 2:
  531. itemSlotIndex += 90
  532. if mouseModule.mouseController.isAttached():
  533. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  534. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  535. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  536. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  537. if player.GetItemCount(itemSlotIndex) > attachedItemCount:
  538. return
  539. if player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or\
  540. player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or\
  541. player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or\
  542. player.SLOT_TYPE_BOX_INVENTORY == attachedSlotType or\
  543. player.SLOT_TYPE_EFSUN_INVENTORY == attachedSlotType or\
  544. player.SLOT_TYPE_CICEK_INVENTORY == attachedSlotType:
  545. self.__SendMoveItemPacket(attachedSlotPos, itemSlotIndex, attachedItemCount)
  546. mouseModule.mouseController.DeattachObject()
  547. else:
  548. curCursorNum = app.GetCursor()
  549. #if app.SELL == curCursorNum:
  550. #self.__SellItem(itemSlotIndex)
  551. if app.BUY == curCursorNum:
  552. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  553. elif app.IsPressed(app.DIK_LALT):
  554. link = player.GetItemLink(itemSlotIndex)
  555. ime.PasteString(link)
  556. elif app.IsPressed(app.DIK_LALT):
  557. link = player.GetItemLink(itemSlotIndex)
  558. ime.PasteString(link)
  559. elif app.IsPressed(app.DIK_LSHIFT):
  560. itemCount = player.GetItemCount(itemSlotIndex)
  561. if itemCount > 1:
  562. self.dlgPickItem.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  563. self.dlgPickItem.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  564. self.dlgPickItem.Open(itemCount)
  565. self.dlgPickItem.itemGlobalSlotIndex = itemSlotIndex
  566. elif app.IsPressed(app.DIK_LCONTROL):
  567. itemIndex = player.GetItemIndex(itemSlotIndex)
  568. if TRUE == item.CanAddToQuickSlotItem(itemIndex):
  569. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  570. else:
  571. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  572. else:
  573. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  574. itemCount = player.GetItemCount(itemSlotIndex)
  575. if self.inventoryType == 0:
  576. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_SKILL_BOOK_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  577. elif self.inventoryType == 2:
  578. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_STONE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  579. elif self.inventoryType == 3:
  580. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_BOX_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  581. elif self.inventoryType == 4:
  582. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_EFSUN_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  583. elif self.inventoryType == 5:
  584. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_CICEK_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  585. else:
  586. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  587. self.wndItem.SetUseMode(True)
  588. snd.PlaySound("sound/ui/pick.wav")
  589. def OnCloseQuestionDialog(self):
  590. if not self.questionDialog:
  591. return
  592. self.questionDialog.Close()
  593. self.questionDialog = None
  594. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  595. def Sat(self):
  596. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  597. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  598. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  599. snd.PlaySound("sound/ui/money.wav")
  600. self.OnCloseQuestionDialog()
  601. def __OnClosePopupDialog(self):
  602. self.pop = None
  603. def OverOutItem(self):
  604. self.wndItem.SetUsableItem(False)
  605. if None != self.tooltipItem:
  606. self.tooltipItem.HideToolTip()
  607. def OverInItem(self, overSlotPos):
  608. if self.inventoryType == 0:
  609. overSlotPos += item.SKILL_BOOK_INVENTORY_SLOT_START
  610. if self.GetInventoryPageIndex() == 1:
  611. overSlotPos += 45
  612. elif self.GetInventoryPageIndex() == 2:
  613. overSlotPos += 90
  614. elif self.inventoryType == 2:
  615. overSlotPos += item.STONE_INVENTORY_SLOT_START
  616. if self.GetInventoryPageIndex() == 1:
  617. overSlotPos += 45
  618. elif self.GetInventoryPageIndex() == 2:
  619. overSlotPos += 90
  620. elif self.inventoryType == 3:
  621. overSlotPos += item.BOX_INVENTORY_SLOT_START
  622. if self.GetInventoryPageIndex() == 1:
  623. overSlotPos += 45
  624. elif self.GetInventoryPageIndex() == 2:
  625. overSlotPos += 90
  626. elif self.inventoryType == 4:
  627. overSlotPos += item.EFSUN_INVENTORY_SLOT_START
  628. if self.GetInventoryPageIndex() == 1:
  629. overSlotPos += 45
  630. elif self.GetInventoryPageIndex() == 2:
  631. overSlotPos += 90
  632. elif self.inventoryType == 5:
  633. overSlotPos += item.CICEK_INVENTORY_SLOT_START
  634. if self.GetInventoryPageIndex() == 1:
  635. overSlotPos += 45
  636. elif self.GetInventoryPageIndex() == 2:
  637. overSlotPos += 90
  638. else:
  639. overSlotPos += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  640. if self.GetInventoryPageIndex() == 1:
  641. overSlotPos += 45
  642. elif self.GetInventoryPageIndex() == 2:
  643. overSlotPos += 90
  644. self.wndItem.SetUsableItem(False)
  645. self.ShowToolTip(overSlotPos)
  646. def ShowToolTip(self, slotIndex):
  647. if None != self.tooltipItem:
  648. self.tooltipItem.SetInventoryItem(slotIndex)
  649. def OnPressEscapeKey(self):
  650. self.Close()
  651. return True
  652. def UseItemSlot(self, slotIndex):
  653. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  654. return
  655. if self.inventoryType == 0:
  656. slotIndex += item.SKILL_BOOK_INVENTORY_SLOT_START
  657. if self.GetInventoryPageIndex() == 1:
  658. slotIndex += 45
  659. elif self.GetInventoryPageIndex() == 2:
  660. slotIndex += 90
  661. elif self.inventoryType == 2:
  662. slotIndex += item.STONE_INVENTORY_SLOT_START
  663. if self.GetInventoryPageIndex() == 1:
  664. slotIndex += 45
  665. elif self.GetInventoryPageIndex() == 2:
  666. slotIndex += 90
  667. elif self.inventoryType == 3:
  668. slotIndex += item.BOX_INVENTORY_SLOT_START
  669. if self.GetInventoryPageIndex() == 1:
  670. slotIndex += 45
  671. elif self.GetInventoryPageIndex() == 2:
  672. slotIndex += 90
  673. elif self.inventoryType == 4:
  674. slotIndex += item.EFSUN_INVENTORY_SLOT_START
  675. if self.GetInventoryPageIndex() == 1:
  676. slotIndex += 45
  677. elif self.GetInventoryPageIndex() == 2:
  678. slotIndex += 90
  679. elif self.inventoryType == 5:
  680. slotIndex += item.CICEK_INVENTORY_SLOT_START
  681. if self.GetInventoryPageIndex() == 1:
  682. slotIndex += 45
  683. elif self.GetInventoryPageIndex() == 2:
  684. slotIndex += 90
  685. else:
  686. slotIndex += item.UPGRADE_ITEMS_INVENTORY_SLOT_START
  687. if self.GetInventoryPageIndex() == 1:
  688. slotIndex += 45
  689. elif self.GetInventoryPageIndex() == 2:
  690. slotIndex += 90
  691. self.__UseItem(slotIndex)
  692. mouseModule.mouseController.DeattachObject()
  693. self.OverOutItem()
  694. if app.ENABLE_10X_CHEST_OPEN:
  695. def IsTreasureBox(self, slotIndex):
  696. itemVnum = player.GetItemIndex(slotIndex)
  697. item.SelectItem(itemVnum)
  698. #if item.GetItemType() == item.ITEM_TYPE_GIFTBOX or item.GetItemType() == item.ITEM_TYPE_GACHA:
  699. if itemVnum >= 50255 and itemVnum <= 50260:
  700. return True
  701. return False
  702. def SendMultipleUseItemPacket(self, slotIndex):
  703. for i in xrange(player.GetItemCount(slotIndex)):
  704. self.__SendUseItemPacket(slotIndex)
  705. def __UseItem(self, slotIndex):
  706. ItemVNum = player.GetItemIndex(slotIndex)
  707. item.SelectItem(ItemVNum)
  708. if app.ENABLE_10X_CHEST_OPEN:
  709. if app.IsPressed(app.DIK_LCONTROL) and self.IsTreasureBox(slotIndex):
  710. self.SendMultipleUseItemPacket(slotIndex)
  711. return
  712. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  713. self.questionDialog = uiCommon.QuestionDialog()
  714. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  715. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  716. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  717. self.questionDialog.Open()
  718. self.questionDialog.slotIndex = slotIndex
  719. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  720. elif app.IsPressed(app.DIK_LSHIFT):
  721. if player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GACHA or\
  722. player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GIFTBOX and\
  723. ItemVNum != 31374 and ItemVNum != 50255 and\
  724. ItemVNum != 50187 and ItemVNum != 50197 and\
  725. ItemVNum != 50188 and ItemVNum != 50189 and\
  726. ItemVNum != 50190 and ItemVNum != 50191 and\
  727. ItemVNum != 50192 and ItemVNum != 50193 and\
  728. ItemVNum != 50194 and ItemVNum != 50195:
  729. if app.ENABLE_SHOW_CHEST_DROP:
  730. if self.interface:
  731. if self.interface.dlgChestDrop:
  732. if not self.interface.dlgChestDrop.IsShow():
  733. self.interface.dlgChestDrop.Open(slotIndex)
  734. net.SendChestDropInfo(slotIndex)
  735. else:
  736. self.__SendUseItemPacket(slotIndex)
  737. def __UseItemQuestionDialog_OnCancel(self):
  738. self.OnCloseQuestionDialog()
  739. def __UseItemQuestionDialog_OnAccept(self):
  740. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  741. self.OnCloseQuestionDialog()
  742. def __SendUseItemPacket(self, slotPos):
  743. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  744. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  745. return
  746. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  747. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_OFFLINE_SHOP)
  748. return
  749. if (uiOfflineShop.IsEditingOfflineShop()):
  750. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_OFFLINE_SHOP)
  751. return
  752. net.SendItemUsePacket(slotPos)
  753. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  754. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  755. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  756. return
  757. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  758. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_OFFLINE_SHOP)
  759. return
  760. if (uiOfflineShop.IsEditingOfflineShop()):
  761. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_OFFLINE_SHOP)
  762. return
  763. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  764. class BeltInventoryWindow(ui.ScriptWindow):
  765. def __init__(self, wndInventory):
  766. import exception
  767. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  768. exception.Abort("What do you do?")
  769. return
  770. if not wndInventory:
  771. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  772. return
  773. ui.ScriptWindow.__init__(self)
  774. self.isLoaded = 0
  775. self.wndInventory = wndInventory;
  776. self.wndBeltInventoryLayer = None
  777. self.wndBeltInventorySlot = None
  778. self.expandBtn = None
  779. self.minBtn = None
  780. self.__LoadWindow()
  781. def __del__(self):
  782. ui.ScriptWindow.__del__(self)
  783. def Show(self, openBeltSlot = FALSE):
  784. self.__LoadWindow()
  785. self.RefreshSlot()
  786. ui.ScriptWindow.Show(self)
  787. if openBeltSlot:
  788. self.OpenInventory()
  789. else:
  790. self.CloseInventory()
  791. def Close(self):
  792. self.Hide()
  793. def IsOpeningInventory(self):
  794. return self.wndBeltInventoryLayer.IsShow()
  795. def OpenInventory(self):
  796. self.wndBeltInventoryLayer.Show()
  797. self.expandBtn.Hide()
  798. if localeInfo.IsARABIC() == 0:
  799. self.AdjustPositionAndSize()
  800. def CloseInventory(self):
  801. self.wndBeltInventoryLayer.Hide()
  802. self.expandBtn.Show()
  803. if localeInfo.IsARABIC() == 0:
  804. self.AdjustPositionAndSize()
  805. def GetBasePosition(self):
  806. x, y = self.wndInventory.GetGlobalPosition()
  807. return x - 148, y + 241
  808. def AdjustPositionAndSize(self):
  809. bx, by = self.GetBasePosition()
  810. if self.IsOpeningInventory():
  811. self.SetPosition(bx, by)
  812. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  813. else:
  814. self.SetPosition(bx + 138, by);
  815. self.SetSize(10, self.GetHeight())
  816. def __LoadWindow(self):
  817. if self.isLoaded == 1:
  818. return
  819. self.isLoaded = 1
  820. try:
  821. pyScrLoader = ui.PythonScriptLoader()
  822. pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  823. except:
  824. import exception
  825. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  826. try:
  827. self.ORIGINAL_WIDTH = self.GetWidth()
  828. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  829. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  830. self.expandBtn = self.GetChild("ExpandBtn")
  831. self.minBtn = self.GetChild("MinimizeBtn")
  832. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  833. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  834. if localeInfo.IsARABIC() :
  835. self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  836. self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
  837. self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
  838. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  839. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  840. wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  841. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  842. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  843. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE)
  844. except:
  845. import exception
  846. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  847. ## Equipment
  848. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  849. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  850. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  851. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  852. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  853. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  854. self.wndBeltInventorySlot = wndBeltInventorySlot
  855. def RefreshSlot(self):
  856. getItemVNum=player.GetItemIndex
  857. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  858. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  859. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  860. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, TRUE)
  861. avail = "0"
  862. if player.IsAvailableBeltInventoryCell(slotNumber):
  863. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  864. else:
  865. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  866. self.wndBeltInventorySlot.RefreshSlot()
  867. class BioWindow(ui.ScriptWindow):
  868. def __init__(self, wndInventory):
  869. import exception
  870. if not wndInventory:
  871. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  872. return
  873. ui.ScriptWindow.__init__(self)
  874. self.isLoaded = 0
  875. self.kalan = 0
  876. self.gerekli = 0
  877. self.wndInventory = wndInventory;
  878. self.wndBioLayer = None
  879. self.wndBioSlot = None
  880. self.expandBtn = None
  881. self.minBtn = None
  882. self.tooltipItem = uiToolTip.ItemToolTip()
  883. self.tooltipItem.Hide()
  884. self.__LoadWindow()
  885. def __del__(self):
  886. ui.ScriptWindow.__del__(self)
  887. def Show(self, openBeltSlot = FALSE):
  888. self.__LoadWindow()
  889. self.RefreshSlot()
  890. ui.ScriptWindow.Show(self)
  891. if openBeltSlot:
  892. self.OpenInventory()
  893. else:
  894. self.CloseInventory()
  895. def Close(self):
  896. self.Hide()
  897. def IsOpeningInventory(self):
  898. return self.wndBioLayer.IsShow()
  899. def OpenInventory(self):
  900. self.wndBioLayer.Show()
  901. self.expandBtn.Hide()
  902. if localeInfo.IsARABIC() == 0:
  903. self.AdjustPositionAndSize()
  904. def CloseInventory(self):
  905. self.wndBioLayer.Hide()
  906. self.expandBtn.Show()
  907. if localeInfo.IsARABIC() == 0:
  908. self.AdjustPositionAndSize()
  909. def GetBasePosition(self):
  910. x, y = self.wndInventory.GetGlobalPosition()
  911. return x - 148, y + 20
  912. def AdjustPositionAndSize(self):
  913. bx, by = self.GetBasePosition()
  914. if self.IsOpeningInventory():
  915. self.SetPosition(bx, by)
  916. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  917. else:
  918. self.SetPosition(bx + 138, by);
  919. self.SetSize(10, self.GetHeight())
  920. def __LoadWindow(self):
  921. if self.isLoaded == 1:
  922. return
  923. self.isLoaded = 1
  924. try:
  925. pyScrLoader = ui.PythonScriptLoader()
  926. pyScrLoader.LoadScriptFile(self, "UIScript/BioWindow.py")
  927. except:
  928. import exception
  929. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  930. try:
  931. self.ORIGINAL_WIDTH = self.GetWidth()
  932. wndBioSlot = self.GetChild("BeltInventorySlot")
  933. self.wndBioLayer = self.GetChild("BeltInventoryLayer")
  934. self.expandBtn = self.GetChild("ExpandBtn")
  935. self.minBtn = self.GetChild("MinimizeBtn")
  936. self.counttext = self.GetChild("count")
  937. self.sure = self.GetChild("time")
  938. self.verbutton = self.GetChild("biobutton")
  939. self.remoteshop = self.GetChild("biyolog_open")
  940. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  941. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  942. self.verbutton.SetEvent(ui.__mem_func__(self.vergitsin))
  943. self.remoteshop.SetEvent(ui.__mem_func__(self.biyolog_start))
  944. if localeInfo.IsARABIC() :
  945. self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  946. self.wndBioLayer.SetPosition(self.wndBioLayer.GetWidth() - 5, 0)
  947. self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
  948. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  949. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  950. wndBioSlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  951. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  952. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  953. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE)
  954. except:
  955. import exception
  956. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  957. wndBioSlot.SetOverInItemEvent(ui.__mem_func__(self.OverInItem2))
  958. wndBioSlot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem2))
  959. self.wndBioSlot = wndBioSlot
  960. def biyolog_start(self):
  961. net.SendChatPacket("/npcac 20990")
  962. def vergitsin(self):
  963. net.SendChatPacket("/biyologver")
  964. def SetBiyolog(self, bioitem, verilen, toplam, kalansure):
  965. self.gerekli = int(bioitem)
  966. self.kalan = int(kalansure)
  967. self.counttext.SetText(str(verilen)+"/"+str(toplam))
  968. self.RefreshSlot()
  969. def OverInItem2(self):
  970. itemIndex = int(self.gerekli)
  971. item.SelectItem(itemIndex)
  972. taslarr = [player.GetItemMetinSocket(999, i) for i in xrange(player.METIN_SOCKET_MAX_NUM)]
  973. efsunlarr = [player.GetItemAttribute(999, i) for i in xrange(player.ATTRIBUTE_SLOT_MAX_NUM)]
  974. self.tooltipItem.ClearToolTip()
  975. self.tooltipItem.AddRefineItemData(itemIndex, taslarr, efsunlarr)
  976. self.tooltipItem.Show()
  977. def OverOutItem2(self):
  978. self.tooltipItem.ClearToolTip()
  979. self.tooltipItem.Hide()
  980. def OnUpdate(self):
  981. import time
  982. current_milli_time = int(app.GetGlobalTimeStamp())
  983. if int(self.kalan) == 0:
  984. self.sure.SetText("Verilebilir!")
  985. elif (int(self.kalan)-current_milli_time <= 0):
  986. self.sure.SetText("Verilebilir!")
  987. else:
  988. self.sure.SetText(str(localeInfo.surever(int(self.kalan)-current_milli_time)))
  989. def RefreshSlot(self):
  990. getItemVNum= int (self.gerekli)
  991. if getItemVNum > 0:
  992. self.wndBioSlot.SetItemSlot(999, getItemVNum)
  993. else:
  994. self.wndBioSlot.ClearSlot(999)
  995. return
  996. self.wndBioSlot.RefreshSlot()
  997. class InventoryWindow(ui.ScriptWindow):
  998. 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", "USE_BIND", "USE_UNBIND", "USE_COSTUME_ENCHANT", "USE_COSTUME_TRANSFORM")
  999. questionDialog = None
  1000. tooltipItem = None
  1001. wndCostume = None
  1002. wndBelt = None
  1003. wndBio = None
  1004. dlgPickMoney = None
  1005. dlgPickItem = None
  1006. interface = None
  1007. if app.WJ_ENABLE_TRADABLE_ICON:
  1008. bindWnds = []
  1009. sellingSlotNumber = -1
  1010. isLoaded = 0
  1011. sonbasma = 0
  1012. isOpenedCostumeWindowWhenClosingInventory = 0
  1013. isOpenedBeltWindowWhenClosingInventory = 0
  1014. isOpenedBioInventory = 0
  1015. def __init__(self):
  1016. ui.ScriptWindow.__init__(self)
  1017. self.isOpenedBeltWindowWhenClosingInventory = 0
  1018. self.isOpenedBioInventory = 0
  1019. self.__LoadWindow()
  1020. def __del__(self):
  1021. ui.ScriptWindow.__del__(self)
  1022. def Show(self):
  1023. self.__LoadWindow()
  1024. ui.ScriptWindow.Show(self)
  1025. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  1026. self.wndCostume.Show()
  1027. if self.wndBelt:
  1028. self.wndBelt.Show(self.isOpenedBeltWindowWhenClosingInventory)
  1029. if self.wndBio:
  1030. self.wndBio.Show(self.isOpenedBioInventory)
  1031. def SetBiyolog(self, bioitem, verilen, toplam, kalansure):
  1032. self.wndBio.SetBiyolog(bioitem, verilen, toplam, kalansure)
  1033. def BindInterfaceClass(self, interface):
  1034. self.interface = interface
  1035. if app.WJ_ENABLE_TRADABLE_ICON:
  1036. def BindWindow(self, wnd):
  1037. self.bindWnds.append(wnd)
  1038. def __LoadWindow(self):
  1039. if self.isLoaded == 1:
  1040. return
  1041. self.isLoaded = 1
  1042. try:
  1043. pyScrLoader = ui.PythonScriptLoader()
  1044. if ITEM_MALL_BUTTON_ENABLE:
  1045. pyScrLoader.LoadScriptFile(self, uiScriptLocale.LOCALE_UISCRIPT_PATH + "InventoryWindow.py")
  1046. else:
  1047. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  1048. except:
  1049. import exception
  1050. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  1051. try:
  1052. wndItem = self.GetChild("ItemSlot")
  1053. wndEquip = self.GetChild("EquipmentSlot")
  1054. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  1055. self.mallButton = self.GetChild2("MallButton")
  1056. self.DSSButton = self.GetChild2("DSSButton")
  1057. self.costumeButton = self.GetChild2("CostumeButton")
  1058. if app.ENABLE_DRAGON_SOUL_SYSTEM==0:
  1059. self.DSSButton.Hide()
  1060. self.inventoryTab = []
  1061. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  1062. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  1063. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  1064. self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  1065. self.equipmentTab = []
  1066. self.equipmentTab.append(self.GetChild("Equipment_Tab_01"))
  1067. self.equipmentTab.append(self.GetChild("Equipment_Tab_02"))
  1068. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  1069. self.costumeButton.Hide()
  1070. self.costumeButton.Destroy()
  1071. self.costumeButton = 0
  1072. # Belt Inventory Window
  1073. self.wndBelt = None
  1074. self.wndBio = None
  1075. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1076. self.wndBelt = BeltInventoryWindow(self)
  1077. self.wndBio = BioWindow(self)
  1078. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  1079. self.ExInvenButton = []
  1080. except:
  1081. import exception
  1082. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  1083. ## Item
  1084. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  1085. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  1086. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  1087. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  1088. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  1089. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  1090. ## Equipment
  1091. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  1092. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  1093. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  1094. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  1095. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  1096. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  1097. ## PickMoneyDialog
  1098. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  1099. dlgPickMoney.LoadDialog()
  1100. dlgPickMoney.Hide()
  1101. ## PickItemDialog
  1102. dlgPickItem = uiPickEtc.PickEtcDialog()
  1103. dlgPickItem.LoadDialog()
  1104. dlgPickItem.Hide()
  1105. ## RefineDialog
  1106. self.refineDialog = uiRefine.RefineDialog()
  1107. self.refineDialog.Hide()
  1108. self.rarityRefineDialog = uirarityrefine.RefineRarityWindow()
  1109. self.rarityRefineDialog.Hide()
  1110. ## AttachMetinDialog
  1111. if app.WJ_ENABLE_TRADABLE_ICON:
  1112. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog(self)
  1113. self.BindWindow(self.attachMetinDialog)
  1114. else:
  1115. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  1116. self.attachMetinDialog.Hide()
  1117. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  1118. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  1119. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  1120. self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  1121. self.inventoryTab[0].Down()
  1122. self.equipmentTab[0].SetEvent(lambda arg=0: self.SetEquipmentPage(arg))
  1123. self.equipmentTab[1].SetEvent(lambda arg=1: self.SetEquipmentPage(arg))
  1124. self.equipmentTab[0].Down()
  1125. self.equipmentTab[0].Hide()
  1126. self.equipmentTab[1].Hide()
  1127. self.wndItem = wndItem
  1128. self.wndEquip = wndEquip
  1129. self.dlgPickMoney = dlgPickMoney
  1130. self.dlgPickItem = dlgPickItem
  1131. # MallButton
  1132. if self.mallButton:
  1133. self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  1134. if self.DSSButton:
  1135. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  1136. # Costume Button
  1137. if self.costumeButton:
  1138. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  1139. self.wndCostume = None
  1140. #####
  1141. ## Refresh
  1142. self.listUnusableSlot = []
  1143. if app.ENABLE_HIGHLIGHT_SYSTEM:
  1144. self.listHighlightedSlot = []
  1145. if app.ENABLE_SASH_SYSTEM:
  1146. self.listAttachedSashs = []
  1147. if app.ENABLE_CHANGELOOK_SYSTEM:
  1148. self.listAttachedCl = []
  1149. self.SetInventoryPage(0)
  1150. self.SetEquipmentPage(0)
  1151. self.RefreshItemSlot()
  1152. def Destroy(self):
  1153. self.ClearDictionary()
  1154. self.dlgPickMoney.Destroy()
  1155. self.dlgPickItem.Destroy()
  1156. self.dlgPickItem = 0
  1157. self.dlgPickMoney = 0
  1158. self.refineDialog.Destroy()
  1159. self.refineDialog = 0
  1160. self.rarityRefineDialog.Destroy()
  1161. self.rarityRefineDialog = 0
  1162. self.attachMetinDialog.Destroy()
  1163. self.attachMetinDialog = 0
  1164. self.tooltipItem = None
  1165. self.wndItem = 0
  1166. self.wndEquip = 0
  1167. self.dlgPickMoney = 0
  1168. self.questionDialog = None
  1169. self.mallButton = None
  1170. self.DSSButton = None
  1171. self.interface = None
  1172. if app.WJ_ENABLE_TRADABLE_ICON:
  1173. self.bindWnds = []
  1174. if self.wndCostume:
  1175. self.wndCostume.Destroy()
  1176. self.wndCostume = 0
  1177. if self.wndBelt:
  1178. self.wndBelt.Destroy()
  1179. self.wndBelt = None
  1180. if self.wndBio:
  1181. self.wndBio.Destroy()
  1182. self.wndBio = None
  1183. self.inventoryTab = []
  1184. self.equipmentTab = []
  1185. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  1186. self.ExInvenButton = []
  1187. def Hide(self):
  1188. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  1189. self.OnCloseQuestionDialog()
  1190. return
  1191. if None != self.tooltipItem:
  1192. self.tooltipItem.HideToolTip()
  1193. if self.wndCostume:
  1194. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow()
  1195. self.wndCostume.Close()
  1196. if self.wndBelt:
  1197. self.isOpenedBeltWindowWhenClosingInventory = self.wndBelt.IsOpeningInventory()
  1198. print "Is Opening Belt Inven?? ", self.isOpenedBeltWindowWhenClosingInventory
  1199. self.wndBelt.Close()
  1200. if self.wndBio:
  1201. self.isOpenedBioInventory = self.wndBio.IsOpeningInventory()
  1202. print "Is Opening bio Inven ", self.isOpenedBioInventory
  1203. self.wndBio.Close()
  1204. if self.dlgPickMoney:
  1205. self.dlgPickMoney.Close()
  1206. if self.dlgPickItem:
  1207. self.dlgPickItem.Close()
  1208. wndMgr.Hide(self.hWnd)
  1209. def Close(self):
  1210. self.Hide()
  1211. if app.ENABLE_HIGHLIGHT_SYSTEM:
  1212. def HighlightSlot(self, slot):
  1213. if not slot in self.listHighlightedSlot:
  1214. self.listHighlightedSlot.append(slot)
  1215. def SetInventoryPage(self, page):
  1216. self.inventoryPageIndex = page
  1217. self.inventoryTab[(page+1)%4].SetUp()
  1218. self.inventoryTab[(page+2)%4].SetUp()
  1219. self.inventoryTab[(page+3)%4].SetUp()
  1220. self.RefreshBagSlotWindow()
  1221. def SetEquipmentPage(self, page):
  1222. self.equipmentPageIndex = page
  1223. self.equipmentTab[1-page].SetUp()
  1224. self.RefreshEquipSlotWindow()
  1225. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  1226. def __CreateExtendInvenButton(self):
  1227. cur_stage = player.GetExtendInvenStage()
  1228. ButtonPosition = 9
  1229. if cur_stage < 9 and self.inventoryPageIndex == 3:
  1230. ButtonPosition = cur_stage
  1231. for i in range(ButtonPosition, player.EX_INVENTORY_STAGE_MAX):
  1232. increase_y = 32 * (i % (player.EX_INVENTORY_STAGE_MAX / player.EX_INVENTORY_PAGE_COUNT))
  1233. button = ui.Button()
  1234. button.SetParent(self.GetChild("board"))
  1235. #button.SetPosition(8, 246 + i * (player.EX_INVENTORY_STAGE_MAX * player.EX_INVENTORY_PAGE_COUNT + 5)) # TODO -> player.EX_INVENTORY_STAGE_MAX * player.EX_INVENTORY_PAGE_COUNT
  1236. button.SetPosition(8, 246 + (increase_y))
  1237. button.SetUpVisual(EX_INVEN_COVER_IMG_CLOSE)
  1238. button.SetOverVisual(EX_INVEN_COVER_IMG_CLOSE)
  1239. button.SetDownVisual(EX_INVEN_COVER_IMG_CLOSE)
  1240. button.SetDisableVisual(EX_INVEN_COVER_IMG_CLOSE)
  1241. button.SetDownVisual(EX_INVEN_COVER_IMG_CLOSE)
  1242. button.Show()
  1243. button.SetEvent(ui.__mem_func__(self.__ClickExtendInvenButton))
  1244. self.ExInvenButton.append(button)
  1245. def __ClickExtendInvenButton(self):
  1246. net.SendExtendInvenButtonClick(player.GetExtendInvenStage())
  1247. def __HideAllExtendInvenButton(self):
  1248. for button in self.ExInvenButton:
  1249. button.Hide()
  1250. button.Destroy()
  1251. def __ShowExtendInvenButton(self, cur_stage):
  1252. for button in self.ExInvenButton:
  1253. button.Destroy()
  1254. self.__CreateExtendInvenButton()
  1255. ButtonPosition = 0
  1256. if cur_stage < 9 and self.inventoryPageIndex == 3:
  1257. ButtonPosition = cur_stage
  1258. button = ui.Button()
  1259. button.SetParent(self.GetChild("board"))
  1260. #button.SetPosition(8, 246 + ButtonPosition * (player.EX_INVENTORY_STAGE_MAX * player.EX_INVENTORY_PAGE_COUNT + 5)) # TODO -> player.EX_INVENTORY_STAGE_MAX * player.EX_INVENTORY_PAGE_COUNT
  1261. increase_y = 32 * (ButtonPosition % (player.EX_INVENTORY_STAGE_MAX / player.EX_INVENTORY_PAGE_COUNT))
  1262. button.SetPosition(8, 246 + (increase_y))
  1263. button.SetUpVisual(EX_INVEN_COVER_IMG_OPEN)
  1264. button.SetOverVisual(EX_INVEN_COVER_IMG_OPEN)
  1265. button.SetDownVisual(EX_INVEN_COVER_IMG_OPEN)
  1266. button.SetDisableVisual(EX_INVEN_COVER_IMG_OPEN)
  1267. button.SetDownVisual(EX_INVEN_COVER_IMG_OPEN)
  1268. button.Hide()
  1269. button.SetEvent(ui.__mem_func__(self.__ClickExtendInvenButton))
  1270. self.ExInvenButton.append(button)
  1271. if cur_stage < 9 and self.inventoryPageIndex == 3:
  1272. button.Show()
  1273. def ExInvenItemUseMsg(self, current_stage, need_left, need_count):
  1274. if current_stage >= player.EX_INVENTORY_STAGE_MAX * player.EX_INVENTORY_PAGE_COUNT:
  1275. self.__OpenExInvenMsgDlg(current_stage)
  1276. return
  1277. if need_left > 0:
  1278. self.__OpenExInvenFallShortCountMsgDlg(need_left)
  1279. return
  1280. self.__OpenExInvenQuestionDlg(need_count)
  1281. def __OpenExInvenMsgDlg(self, current_stage):
  1282. self.wndPopupDialog = uiCommon.PopupDialog()
  1283. self.wndPopupDialog.SetText(localeInfo.EXINVEN_USE_ITEM_FAIL_FOURTH_PAGE_STAGE_MAX)
  1284. self.wndPopupDialog.Open()
  1285. def __OpenExInvenFallShortCountMsgDlg(self, need_left):
  1286. self.wndPopupDialog = uiCommon.PopupDialog()
  1287. self.wndPopupDialog.SetText(localeInfo.EXINVEN_USE_ITEM_FAIL_FALL_SHORT % (need_left))
  1288. self.wndPopupDialog.Open()
  1289. def __OpenExInvenQuestionDlg(self, need_count):
  1290. ExInvquestionDialog = uiCommon.QuestionDialog2()
  1291. ExInvquestionDialog.SetText1(localeInfo.EXINVEN_USE_ITEM_QUESTION_2 % (need_count))
  1292. ExInvquestionDialog.SetText2(localeInfo.EXINVEN_USE_ITEM_QUESTION)
  1293. ExInvquestionDialog.SetAcceptEvent(ui.__mem_func__(self.__AcceptExInvenItemUse))
  1294. ExInvquestionDialog.SetCancelEvent(ui.__mem_func__(self.__CancelExInvenItemUse))
  1295. ExInvquestionDialog.Open()
  1296. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1297. self.ExInvquestionDialog = ExInvquestionDialog
  1298. def __AcceptExInvenItemUse(self):
  1299. self.ExInvquestionDialog.Close()
  1300. self.ExInvquestionDialog = None
  1301. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1302. if player.GetExtendInvenStage() >= player.EX_INVENTORY_STAGE_MAX * player.EX_INVENTORY_PAGE_COUNT:
  1303. return
  1304. net.SendExtendInvenUpgrade()
  1305. def __CancelExInvenItemUse(self):
  1306. if self.ExInvquestionDialog:
  1307. self.ExInvquestionDialog.Close()
  1308. self.ExInvquestionDialog = None
  1309. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1310. def ClickMallButton(self):
  1311. net.SendChatPacket("/depo_ac")
  1312. def OpenIs(self):
  1313. self.Itemshop.Hide()
  1314. self.Depo.Hide()
  1315. self.sehir.Hide()
  1316. self.choix.Hide()
  1317. net.SendChatPacket("/click_mall")
  1318. def _normal_mall(self):
  1319. self.Itemshop.Hide()
  1320. self.Depo.Hide()
  1321. self.sehir.Hide()
  1322. self.choix.Hide()
  1323. net.SendChatPacket("/depo_ac")
  1324. # DSSButton
  1325. def ClickDSSButton(self):
  1326. print "click_dss_button"
  1327. self.interface.ToggleDragonSoulWindow()
  1328. def ClickCostumeButton(self):
  1329. print "Click Costume Button"
  1330. if self.wndCostume:
  1331. if self.wndCostume.IsShow():
  1332. self.wndCostume.Hide()
  1333. else:
  1334. self.wndCostume.Show()
  1335. else:
  1336. self.wndCostume = CostumeWindow(self)
  1337. self.wndCostume.Show()
  1338. def OnPickItem(self, count):
  1339. itemSlotIndex = self.dlgPickItem.itemGlobalSlotIndex
  1340. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1341. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  1342. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  1343. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local) or (app.ENABLE_NEW_EQUIPMENT_SYSTEM and player.IsBeltInventorySlot(local)):
  1344. return local
  1345. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  1346. def GetInventoryPageIndex(self):
  1347. return self.inventoryPageIndex
  1348. if app.WJ_ENABLE_TRADABLE_ICON:
  1349. def RefreshMarkSlots(self, localIndex=None):
  1350. if not self.interface:
  1351. return
  1352. onTopWnd = self.interface.GetOnTopWindow()
  1353. if localIndex:
  1354. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(localIndex)
  1355. if onTopWnd == player.ON_TOP_WND_NONE:
  1356. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1357. elif onTopWnd == player.ON_TOP_WND_SHOP:
  1358. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  1359. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1360. else:
  1361. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1362. elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  1363. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  1364. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1365. else:
  1366. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1367. elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  1368. if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  1369. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1370. else:
  1371. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1372. elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  1373. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  1374. self.wndItem.SetUnusableSlotOnTopWnd(localIndex)
  1375. else:
  1376. self.wndItem.SetUsableSlotOnTopWnd(localIndex)
  1377. return
  1378. for i in xrange(player.INVENTORY_PAGE_SIZE):
  1379. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1380. if onTopWnd == player.ON_TOP_WND_NONE:
  1381. self.wndItem.SetUsableSlotOnTopWnd(i)
  1382. elif onTopWnd == player.ON_TOP_WND_SHOP:
  1383. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SELL):
  1384. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1385. else:
  1386. self.wndItem.SetUsableSlotOnTopWnd(i)
  1387. elif onTopWnd == player.ON_TOP_WND_EXCHANGE:
  1388. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_GIVE):
  1389. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1390. else:
  1391. self.wndItem.SetUsableSlotOnTopWnd(i)
  1392. elif onTopWnd == player.ON_TOP_WND_PRIVATE_SHOP:
  1393. if player.IsAntiFlagBySlot(slotNumber, item.ITEM_ANTIFLAG_MYSHOP):
  1394. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1395. else:
  1396. self.wndItem.SetUsableSlotOnTopWnd(i)
  1397. elif onTopWnd == player.ON_TOP_WND_SAFEBOX:
  1398. if player.IsAntiFlagBySlot(slotNumber, item.ANTIFLAG_SAFEBOX):
  1399. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1400. else:
  1401. self.wndItem.SetUsableSlotOnTopWnd(i)
  1402. def RefreshBagSlotWindow(self):
  1403. getItemVNum=player.GetItemIndex
  1404. getItemCount=player.GetItemCount
  1405. setItemVNum=self.wndItem.SetItemSlot
  1406. for i in xrange(player.INVENTORY_PAGE_SIZE):
  1407. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1408. itemCount = getItemCount(slotNumber)
  1409. if 0 == itemCount:
  1410. self.wndItem.ClearSlot(i)
  1411. continue
  1412. elif 1 == itemCount:
  1413. itemCount = 0
  1414. itemVnum = getItemVNum(slotNumber)
  1415. setItemVNum(i, itemVnum, itemCount)
  1416. if app.ENABLE_CHANGELOOK_SYSTEM:
  1417. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  1418. if itemTransmutedVnum:
  1419. self.wndItem.DisableCoverButton(i)
  1420. else:
  1421. self.wndItem.EnableCoverButton(i)
  1422. if ((exchange.isTrading() and item.IsAntiFlag(item.ANTIFLAG_GIVE)) or (shop.IsOpen() and not shop.IsPrivateShop() and not shop.IsOfflineShop() and item.IsAntiFlag(item.ITEM_ANTIFLAG_SELL))):
  1423. self.wndItem.SetUnusableSlotOnTopWnd(i)
  1424. self.listUnusableSlot.append(i)
  1425. elif ((not exchange.isTrading() and item.IsAntiFlag(item.ANTIFLAG_GIVE) and slotNumber in self.listUnusableSlot) or (not shop.IsOpen() and shop.IsPrivateShop() and shop.IsOfflineShop() and item.IsAntiFlag(item.ITEM_ANTIFLAG_SELL) and slotNumber in self.listUnusableSlot)):
  1426. self.wndItem.SetUsableSlotOnTopWnd(i)
  1427. self.listUnusableSlot.remove(i)
  1428. if constInfo.IS_AUTO_POTION(itemVnum):
  1429. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1430. if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  1431. slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  1432. isActivated = 0 != metinSocket[0]
  1433. if isActivated:
  1434. #self.wndItem.ActivateSlot(slotNumber)
  1435. #self.wndItem.ActivateSlot(slotNumber, (32.00 / 255.0), (178.00 / 255.0), (170.00 / 255.0), 1.0)
  1436. self.wndItem.ActivateSlot(i, (36.00 / 255.0), (178.00 / 255.0), (170.00 / 255.0), 1.0)
  1437. potionType = 0;
  1438. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  1439. potionType = player.AUTO_POTION_TYPE_HP
  1440. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  1441. potionType = player.AUTO_POTION_TYPE_SP
  1442. usedAmount = int(metinSocket[1])
  1443. totalAmount = int(metinSocket[2])
  1444. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  1445. else:
  1446. self.wndItem.DeactivateSlot(slotNumber)
  1447. if app.ENABLE_HIGHLIGHT_SYSTEM:
  1448. if slotNumber in self.listHighlightedSlot:
  1449. self.wndItem.ActivateSlot(i)
  1450. if app.ENABLE_SASH_SYSTEM:
  1451. slotNumberChecked = 0
  1452. if not constInfo.IS_AUTO_POTION(itemVnum):
  1453. if app.ENABLE_HIGHLIGHT_SYSTEM:
  1454. if not slotNumber in self.listHighlightedSlot:
  1455. self.wndItem.DeactivateSlot(i)
  1456. else:
  1457. self.wndItem.DeactivateSlot(i)
  1458. for j in xrange(sash.WINDOW_MAX_MATERIALS):
  1459. (isHere, iCell) = sash.GetAttachedItem(j)
  1460. if isHere:
  1461. if iCell == slotNumber:
  1462. self.wndItem.ActivateSlot(i, (36.00 / 255.0), (222.00 / 255.0), (3.00 / 255.0), 1.0)
  1463. if not slotNumber in self.listAttachedSashs:
  1464. self.listAttachedSashs.append(slotNumber)
  1465. slotNumberChecked = 1
  1466. else:
  1467. if slotNumber in self.listAttachedSashs and not slotNumberChecked:
  1468. self.wndItem.DeactivateSlot(i)
  1469. self.listAttachedSashs.remove(slotNumber)
  1470. if app.ENABLE_CHANGELOOK_SYSTEM:
  1471. slotClNumberChecked = 0
  1472. for q in xrange(changelook.WINDOW_MAX_MATERIALS):
  1473. (isHere, iCell) = changelook.GetAttachedItem(q)
  1474. if isHere:
  1475. if iCell == slotNumber:
  1476. self.wndItem.ActivateSlot(i, (238.00 / 255.0), (11.00 / 255.0), (11.00 / 255.0), 1.0)
  1477. if not slotNumber in self.listAttachedCl:
  1478. self.listAttachedCl.append(slotNumber)
  1479. slotClNumberChecked = 1
  1480. else:
  1481. if slotNumber in self.listAttachedCl and not slotClNumberChecked and not slotNumber in self.listAttachedSashs:
  1482. self.wndItem.DeactivateSlot(i)
  1483. self.listAttachedCl.remove(slotNumber)
  1484. if app.WJ_ENABLE_TRADABLE_ICON:
  1485. self.RefreshMarkSlots(i)
  1486. if itemVnum == 70038:
  1487. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1488. isActivated = 0 != metinSocket[0]
  1489. if isActivated:
  1490. self.wndItem.ActivateSlot(i)
  1491. else:
  1492. self.wndItem.DeactivateSlot(i)
  1493. elif itemVnum >= 53001 and itemVnum <= 53267:
  1494. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1495. isActivated = 0 != metinSocket[1]
  1496. if isActivated:
  1497. self.wndItem.ActivateSlot(i)
  1498. else:
  1499. self.wndItem.DeactivateSlot(i)
  1500. elif itemVnum >= 8383 and itemVnum <= 8384:
  1501. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1502. isActivated = 0 != metinSocket[1]
  1503. if isActivated:
  1504. self.wndItem.ActivateSlot(i)
  1505. else:
  1506. self.wndItem.DeactivateSlot(i)
  1507. self.wndItem.RefreshSlot()
  1508. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  1509. self.__RefreshExinvenCoverSlot()
  1510. if self.wndBelt:
  1511. self.wndBelt.RefreshSlot()
  1512. if self.wndBio:
  1513. self.wndBio.RefreshSlot()
  1514. if app.WJ_ENABLE_TRADABLE_ICON:
  1515. map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  1516. def RefreshEquipSlotWindow(self):
  1517. getItemVNum=player.GetItemIndex
  1518. getItemCount=player.GetItemCount
  1519. setItemVNum=self.wndEquip.SetItemSlot
  1520. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  1521. slotNumber = player.EQUIPMENT_SLOT_START + i
  1522. itemCount = getItemCount(slotNumber)
  1523. if itemCount <= 1:
  1524. itemCount = 0
  1525. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1526. if app.ENABLE_CHANGELOOK_SYSTEM:
  1527. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  1528. if itemTransmutedVnum:
  1529. self.wndEquip.DisableCoverButton(slotNumber)
  1530. else:
  1531. self.wndEquip.EnableCoverButton(slotNumber)
  1532. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1533. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1534. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1535. itemCount = getItemCount(slotNumber)
  1536. if itemCount <= 1:
  1537. itemCount = 0
  1538. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1539. if app.ENABLE_CHANGELOOK_SYSTEM:
  1540. itemTransmutedVnum = player.GetItemTransmutation(slotNumber)
  1541. if itemTransmutedVnum:
  1542. self.wndEquip.DisableCoverButton(slotNumber)
  1543. else:
  1544. self.wndEquip.EnableCoverButton(slotNumber)
  1545. self.wndEquip.RefreshSlot()
  1546. if self.wndCostume:
  1547. self.wndCostume.RefreshCostumeSlot()
  1548. def RefreshItemSlot(self):
  1549. self.RefreshBagSlotWindow()
  1550. self.RefreshEquipSlotWindow()
  1551. if app.ENABLE_EXTEND_INVEN_SYSTEM:
  1552. def __RefreshExinvenCoverSlot(self):
  1553. cur_stage = player.GetExtendInvenStage()
  1554. self.__HideAllExtendInvenButton()
  1555. if self.inventoryPageIndex >= 3:
  1556. self.__ShowExtendInvenButton(cur_stage)
  1557. else:
  1558. self.__HideAllExtendInvenButton()
  1559. def __RefreshExinvenSlotState(self):
  1560. pass
  1561. def SetItemToolTip(self, tooltipItem):
  1562. self.tooltipItem = tooltipItem
  1563. def SellItem(self):
  1564. if self.sellingSlotitemIndex == player.GetItemIndex(self.sellingSlotNumber):
  1565. if self.sellingSlotitemCount == player.GetItemCount(self.sellingSlotNumber):
  1566. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count, player.INVENTORY)
  1567. snd.PlaySound("sound/ui/money.wav")
  1568. self.OnCloseQuestionDialog()
  1569. def OnDetachMetinFromItem(self):
  1570. if None == self.questionDialog:
  1571. return
  1572. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1573. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1574. self.OnCloseQuestionDialog()
  1575. def OnCloseQuestionDialog(self):
  1576. if not self.questionDialog:
  1577. return
  1578. self.questionDialog.Close()
  1579. self.questionDialog = None
  1580. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(0)
  1581. ## Slot Event
  1582. def SelectEmptySlot(self, selectedSlotPos):
  1583. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1584. return
  1585. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  1586. if mouseModule.mouseController.isAttached():
  1587. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1588. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1589. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1590. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1591. if player.SLOT_TYPE_INVENTORY == attachedSlotType or\
  1592. player.SLOT_TYPE_DRAGON_SOUL_INVENTORY == attachedSlotType or\
  1593. player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or\
  1594. player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or\
  1595. player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or\
  1596. player.SLOT_TYPE_BOX_INVENTORY == attachedSlotType or\
  1597. player.SLOT_TYPE_EFSUN_INVENTORY == attachedSlotType or\
  1598. player.SLOT_TYPE_CICEK_INVENTORY == attachedSlotType:
  1599. itemCount = player.GetItemCount(attachedSlotPos)
  1600. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1601. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1602. if item.IsRefineScroll(attachedItemIndex):
  1603. self.wndItem.SetUseMode(FALSE)
  1604. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  1605. mouseModule.mouseController.RunCallBack("INVENTORY")
  1606. elif player.SLOT_TYPE_OFFLINE_SHOP == attachedSlotType:
  1607. mouseModule.mouseController.RunCallBack("INVENTORY")
  1608. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  1609. net.SendShopBuyPacket(attachedSlotPos)
  1610. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1611. if player.ITEM_MONEY == attachedItemIndex:
  1612. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1613. snd.PlaySound("sound/ui/money.wav")
  1614. elif player.ITEM_CHEQUE == attachedItemIndex:
  1615. # net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1616. snd.PlaySound("sound/ui/money.wav")
  1617. else:
  1618. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1619. elif player.SLOT_TYPE_MALL == attachedSlotType:
  1620. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1621. mouseModule.mouseController.DeattachObject()
  1622. def SelectItemSlot(self, itemSlotIndex):
  1623. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS() == 1:
  1624. return
  1625. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1626. if mouseModule.mouseController.isAttached():
  1627. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1628. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1629. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1630. if player.SLOT_TYPE_INVENTORY == attachedSlotType or\
  1631. player.SLOT_TYPE_SKILL_BOOK_INVENTORY == attachedSlotType or\
  1632. player.SLOT_TYPE_UPGRADE_ITEMS_INVENTORY == attachedSlotType or\
  1633. player.SLOT_TYPE_STONE_INVENTORY == attachedSlotType or\
  1634. player.SLOT_TYPE_BOX_INVENTORY == attachedSlotType or\
  1635. player.SLOT_TYPE_EFSUN_INVENTORY == attachedSlotType or\
  1636. player.SLOT_TYPE_CICEK_INVENTORY == attachedSlotType:
  1637. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1638. mouseModule.mouseController.DeattachObject()
  1639. else:
  1640. curCursorNum = app.GetCursor()
  1641. if app.SELL == curCursorNum:
  1642. self.__SellItem(itemSlotIndex)
  1643. elif app.BUY == curCursorNum:
  1644. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1645. elif app.IsPressed(app.DIK_LALT):
  1646. link = player.GetItemLink(itemSlotIndex)
  1647. ime.PasteString(link)
  1648. elif app.IsPressed(app.DIK_LSHIFT):
  1649. itemCount = player.GetItemCount(itemSlotIndex)
  1650. if itemCount > 1:
  1651. self.dlgPickItem.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1652. self.dlgPickItem.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1653. self.dlgPickItem.Open(itemCount)
  1654. self.dlgPickItem.itemGlobalSlotIndex = itemSlotIndex
  1655. #else:
  1656. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1657. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1658. elif app.IsPressed(app.DIK_LCONTROL):
  1659. itemIndex = player.GetItemIndex(itemSlotIndex)
  1660. if TRUE == item.CanAddToQuickSlotItem(itemIndex):
  1661. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1662. else:
  1663. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1664. else:
  1665. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1666. itemCount = player.GetItemCount(itemSlotIndex)
  1667. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1668. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1669. self.wndItem.SetUseMode(TRUE)
  1670. else:
  1671. self.wndItem.SetUseMode(FALSE)
  1672. snd.PlaySound("sound/ui/pick.wav")
  1673. def UseTransportBox(self):
  1674. self.__SendUseItemToItemPacket(self.questionDialog.src, self.questionDialog.dst)
  1675. self.OnCloseQuestionDialog()
  1676. def UseProtein(self):
  1677. self.__SendUseItemToItemPacket(self.questionDialog.src, self.questionDialog.dst)
  1678. self.OnCloseQuestionDialog()
  1679. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1680. if srcItemSlotPos == dstItemSlotPos:
  1681. return
  1682. elif srcItemVID == player.GetItemIndex(dstItemSlotPos):
  1683. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1684. return
  1685. if srcItemVID >= 55701 and srcItemVID <= 55710 and player.GetItemIndex(dstItemSlotPos) == 55002:
  1686. self.questionDialog = uiCommon.QuestionDialog()
  1687. self.questionDialog.SetText(localeInfo.PET_SYSTEM_ADD_BOX_PET)
  1688. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseTransportBox))
  1689. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1690. self.questionDialog.Open()
  1691. self.questionDialog.src = srcItemSlotPos
  1692. self.questionDialog.dst = dstItemSlotPos
  1693. if srcItemVID == 80060:
  1694. self.questionDialog = uiCommon.QuestionDialog()
  1695. self.questionDialog.SetText("4. Taş slotu'nu açmak istiyor musun?")
  1696. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseTransportBox))
  1697. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1698. self.questionDialog.Open()
  1699. self.questionDialog.src = srcItemSlotPos
  1700. self.questionDialog.dst = dstItemSlotPos
  1701. if srcItemVID == 80061:
  1702. self.questionDialog = uiCommon.QuestionDialog()
  1703. self.questionDialog.SetText("4. Taş slotu'nu açmak istiyor musun?")
  1704. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseTransportBox))
  1705. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1706. self.questionDialog.Open()
  1707. self.questionDialog.src = srcItemSlotPos
  1708. self.questionDialog.dst = dstItemSlotPos
  1709. if srcItemVID == 77028 or srcItemVID == 77029 or srcItemVID == 77030:
  1710. self.questionDialog = uiCommon.QuestionDialog()
  1711. self.questionDialog.SetText("Süreyi uzatmak istiyor musun?")
  1712. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseTransportBox))
  1713. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1714. self.questionDialog.Open()
  1715. self.questionDialog.src = srcItemSlotPos
  1716. self.questionDialog.dst = dstItemSlotPos
  1717. if srcItemVID == 55001 and player.GetItemIndex(dstItemSlotPos) >= 55701 and player.GetItemIndex(dstItemSlotPos) <= 55710:
  1718. self.questionDialog = uiCommon.QuestionDialog()
  1719. self.questionDialog.SetText(localeInfo.PET_SYSTEM_FEED_PROTEIN)
  1720. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.UseProtein))
  1721. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1722. self.questionDialog.Open()
  1723. self.questionDialog.src = srcItemSlotPos
  1724. self.questionDialog.dst = dstItemSlotPos
  1725. if srcItemVID == 11113:
  1726. if player.GetItemEvolution(dstItemSlotPos) < 5:
  1727. itemVnum = player.GetItemIndex(dstItemSlotPos)
  1728. item.SelectItem(itemVnum)
  1729. (limitType, limitValue) = item.GetLimit(0)
  1730. if item.GetItemType() == item.ITEM_TYPE_WEAPON and limitType == 1 and limitValue >= 75:
  1731. self.rarityRefineDialog.Open(dstItemSlotPos)
  1732. if player.GetItemIndex(dstItemSlotPos) >= 55701 and player.GetItemIndex(dstItemSlotPos) <= 55710 and srcItemVID == 55030:
  1733. self.interface.OpenInputNameDialogPet(dstItemSlotPos)
  1734. SrcItemVNum = player.GetItemIndex(srcItemSlotPos)
  1735. DstItemVNum = player.GetItemIndex(dstItemSlotPos)
  1736. item.SelectItem(SrcItemVNum)
  1737. SrcSubType = item.GetItemSubType()
  1738. if SrcSubType == item.USE_BIND or SrcSubType == item.USE_UNBIND:
  1739. item.SelectItem(DstItemVNum)
  1740. if item.IsAntiFlag(item.ANTIFLAG_BIND):
  1741. return
  1742. else:
  1743. if SrcSubType == item.USE_BIND and player.GetItemBind(dstItemSlotPos) > 1:
  1744. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SOULBIND_ALERT3)
  1745. elif SrcSubType == item.USE_BIND and player.GetItemBind(dstItemSlotPos) == 1:
  1746. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SOULBIND_ALERT2)
  1747. elif SrcSubType == item.USE_UNBIND and player.GetItemBind(dstItemSlotPos) > 1:
  1748. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SOULBIND_ALERT3)
  1749. elif SrcSubType == item.USE_UNBIND and player.GetItemBind(dstItemSlotPos) != 1:
  1750. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SOULBIND_ALERT1)
  1751. else:
  1752. action = "bind"
  1753. if SrcSubType == item.USE_UNBIND:
  1754. action = "unbind"
  1755. self.__SoulBindItem(srcItemSlotPos, dstItemSlotPos, action)
  1756. return
  1757. else:
  1758. if item.IsRefineScroll(srcItemVID):
  1759. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1760. self.wndItem.SetUseMode(FALSE)
  1761. elif item.IsMetin(srcItemVID):
  1762. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1763. elif item.IsDetachScroll(srcItemVID):
  1764. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1765. elif item.IsKey(srcItemVID):
  1766. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1767. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1768. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1769. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1770. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1771. else:
  1772. if player.IsEquipmentSlot(dstItemSlotPos):
  1773. if item.IsEquipmentVID(srcItemVID):
  1774. self.__UseItem(srcItemSlotPos)
  1775. else:
  1776. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1777. def __SellItem(self, itemSlotPos):
  1778. if not player.IsEquipmentSlot(itemSlotPos):
  1779. self.sellingSlotNumber = itemSlotPos
  1780. itemIndex = player.GetItemIndex(itemSlotPos)
  1781. itemCount = player.GetItemCount(itemSlotPos)
  1782. self.sellingSlotitemIndex = itemIndex
  1783. self.sellingSlotitemCount = itemCount
  1784. item.SelectItem(itemIndex)
  1785. if item.IsAntiFlag(item.ANTIFLAG_SELL):
  1786. popup = uiCommon.PopupDialog()
  1787. popup.SetText(localeInfo.SHOP_CANNOT_SELL_ITEM)
  1788. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1789. popup.Open()
  1790. self.popup = popup
  1791. return
  1792. itemPrice = item.GetISellItemPrice()
  1793. if item.Is1GoldItem():
  1794. itemPrice = itemCount / itemPrice / 5
  1795. else:
  1796. itemPrice = itemPrice * itemCount / 5
  1797. item.GetItemName(itemIndex)
  1798. itemName = item.GetItemName()
  1799. self.questionDialog = uiCommon.QuestionDialogShop()
  1800. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1801. self.questionDialog.SetText2(localeInfo.SATMAK_ISTIYOR_MUSUN)
  1802. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1803. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1804. self.questionDialog.Open()
  1805. self.questionDialog.count = itemCount
  1806. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  1807. def __OnClosePopupDialog(self):
  1808. self.pop = None
  1809. def RefineItem(self, scrollSlotPos, targetSlotPos):
  1810. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1811. targetIndex = player.GetItemIndex(targetSlotPos)
  1812. item.SelectItem(targetIndex)
  1813. if scrollIndex == 25042:
  1814. for i in xrange(item.LIMIT_MAX_NUM):
  1815. (limitType, limitValue) = item.GetLimit(i)
  1816. if item.LIMIT_LEVEL == limitType:
  1817. if limitValue < 80:
  1818. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_SOUL_PAPER_WARNING)
  1819. return
  1820. elif scrollIndex == 70602 or scrollIndex == 70602:
  1821. for i in xrange(item.LIMIT_MAX_NUM):
  1822. (limitType, itemVnum) = item.GetLimit(i)
  1823. if item.LIMIT_LEVEL == limitType:
  1824. if itemVnum != 70500 or itemVnum != 70501 or itemVnum != 70502 or itemVnum != 70503 or itemVnum != 70505 or itemVnum != 70506 or itemVnum != 70507 or itemVnum != 70508:
  1825. chat.AppendChat()
  1826. return
  1827. elif scrollIndex == 25044:
  1828. for i in xrange(item.LIMIT_MAX_NUM):
  1829. (limitType, limitValue) = item.GetLimit(i)
  1830. if item.LIMIT_LEVEL == limitType:
  1831. if limitValue > 40:
  1832. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_SOUL_PAPER_WARNING2)
  1833. return
  1834. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1835. return
  1836. if app.ENABLE_REFINE_RENEWAL:
  1837. constInfo.AUTO_REFINE_TYPE = 1
  1838. constInfo.AUTO_REFINE_DATA["ITEM"][0] = scrollSlotPos
  1839. constInfo.AUTO_REFINE_DATA["ITEM"][1] = targetSlotPos
  1840. ###########################################################
  1841. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1842. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1843. return
  1844. ###########################################################
  1845. ###########################################################
  1846. #net.SendRequestRefineInfoPacket(targetSlotPos)
  1847. #return
  1848. ###########################################################
  1849. result = player.CanRefine(scrollIndex, targetSlotPos)
  1850. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1851. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1852. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1853. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1854. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1855. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1856. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1857. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1858. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1859. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1860. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1861. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1862. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1863. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1864. if player.REFINE_OK != result:
  1865. return
  1866. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1867. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1868. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1869. targetIndex = player.GetItemIndex(targetSlotPos)
  1870. if app.ENABLE_SASH_SYSTEM:
  1871. if not player.CanDetach(scrollIndex, targetSlotPos):
  1872. item.SelectItem(scrollIndex)
  1873. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1874. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SASH_FAILURE_CLEAN)
  1875. else:
  1876. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1877. return
  1878. else:
  1879. if not player.CanDetach(scrollIndex, targetSlotPos):
  1880. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1881. return
  1882. self.questionDialog = uiCommon.QuestionDialog()
  1883. self.questionDialog.SetText(localeInfo.REFINE_DO_YOU_SEPARATE_METIN)
  1884. if app.ENABLE_SASH_SYSTEM:
  1885. item.SelectItem(targetIndex)
  1886. if item.GetItemType() == item.ITEM_TYPE_COSTUME and item.GetItemSubType() == item.COSTUME_TYPE_SASH:
  1887. item.SelectItem(scrollIndex)
  1888. if item.GetValue(0) == sash.CLEAN_ATTR_VALUE0:
  1889. self.questionDialog.SetText(localeInfo.SASH_DO_YOU_CLEAN)
  1890. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnDetachMetinFromItem))
  1891. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1892. self.questionDialog.Open()
  1893. self.questionDialog.sourcePos = scrollSlotPos
  1894. self.questionDialog.targetPos = targetSlotPos
  1895. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1896. metinIndex = player.GetItemIndex(metinSlotPos)
  1897. targetIndex = player.GetItemIndex(targetSlotPos)
  1898. item.SelectItem(metinIndex)
  1899. itemName = item.GetItemName()
  1900. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1901. #if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1902. #chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1903. #Bvural41 Taş Fixi
  1904. #if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1905. #chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1906. #elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1907. #chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1908. #elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1909. #chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1910. if player.ATTACH_METIN_OK != result:
  1911. return
  1912. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1913. def OverOutItem(self):
  1914. self.wndItem.SetUsableItem(FALSE)
  1915. if None != self.tooltipItem:
  1916. self.tooltipItem.HideToolTip()
  1917. def OverInItem(self, overSlotPos):
  1918. if app.ENABLE_HIGHLIGHT_SYSTEM:
  1919. stat = 0
  1920. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1921. itemVnum = player.GetItemIndex(slotNumber)
  1922. if constInfo.IS_AUTO_POTION(itemVnum):
  1923. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1924. if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
  1925. slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex
  1926. isActivated = 0 != metinSocket[0]
  1927. if isActivated:
  1928. stat = 1
  1929. if not stat:
  1930. if slotNumber in self.listHighlightedSlot:
  1931. self.wndItem.DeactivateSlot(overSlotPos)
  1932. try:
  1933. if app.ENABLE_SASH_SYSTEM and app.ENABLE_CHANGELOOK_SYSTEM:
  1934. if not slotNumber in self.listAttachedSashs:
  1935. self.listHighlightedSlot.remove(slotNumber)
  1936. if not slotNumber in self.listAttachedCl:
  1937. self.listHighlightedSlot.remove(slotNumber)
  1938. else:
  1939. self.listHighlightedSlot.remove(slotNumber)
  1940. except:
  1941. pass
  1942. overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1943. self.wndItem.SetUsableItem(FALSE)
  1944. if mouseModule.mouseController.isAttached():
  1945. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1946. if player.SLOT_TYPE_INVENTORY == attachedItemType or player.SLOT_TYPE_STONE_INVENTORY == attachedItemType or player.SLOT_TYPE_EFSUN_INVENTORY == attachedItemType:
  1947. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1948. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1949. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1950. self.wndItem.SetUsableItem(TRUE)
  1951. self.ShowToolTip(overSlotPos)
  1952. return
  1953. self.ShowToolTip(overSlotPos)
  1954. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1955. "´Ù¸¥ ¾ÆÀÌÅÛ¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ¾ÆÀÌÅÛÀΰ¡?"
  1956. if srcItemVNum >= 55701 and srcItemVNum <= 55710:
  1957. return True
  1958. if srcItemVNum == 55001:
  1959. return True
  1960. if srcItemVNum == 55030:
  1961. return True
  1962. if srcItemVNum == 11113:
  1963. return True
  1964. if item.IsRefineScroll(srcItemVNum):
  1965. return TRUE
  1966. elif item.IsMetin(srcItemVNum):
  1967. return TRUE
  1968. elif item.IsDetachScroll(srcItemVNum):
  1969. return TRUE
  1970. elif item.IsKey(srcItemVNum):
  1971. return TRUE
  1972. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1973. return TRUE
  1974. else:
  1975. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1976. return TRUE
  1977. return FALSE
  1978. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1979. "´ë»ó ¾ÆÀÌÅÛ¿¡ »ç¿ëÇÒ ¼ö Àִ°¡?"
  1980. if srcSlotPos == dstSlotPos:
  1981. return FALSE
  1982. if srcItemVNum == 77028 or srcItemVNum == 77029 or srcItemVNum == 77030:
  1983. return True
  1984. if srcItemVNum >= 55701 and srcItemVNum <= 55710 and player.GetItemIndex(dstSlotPos) == 55002:
  1985. return True
  1986. if srcItemVNum == 55001 and player.GetItemIndex(dstSlotPos) >= 55701 and player.GetItemIndex(dstSlotPos) <= 55710:
  1987. return True
  1988. if srcItemVNum == 11113:
  1989. if player.GetItemEvolution(dstSlotPos) < 5:
  1990. itemVnum = player.GetItemIndex(dstSlotPos)
  1991. item.SelectItem(itemVnum)
  1992. (limitType, limitValue) = item.GetLimit(0)
  1993. if item.GetItemType() == item.ITEM_TYPE_WEAPON and limitType == 1 and limitValue >= 75:
  1994. return TRUE
  1995. if srcItemVNum == 55030 and player.GetItemIndex(dstSlotPos) >= 55701 and player.GetItemIndex(dstSlotPos) <= 55710:
  1996. return True
  1997. elif item.IsRefineScroll(srcItemVNum):
  1998. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1999. return TRUE
  2000. if srcItemVNum == player.GetItemIndex(dstSlotPos):
  2001. if player.GetItemCount(dstSlotPos) < 200:
  2002. return TRUE
  2003. elif item.IsMetin(srcItemVNum):
  2004. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  2005. return TRUE
  2006. elif item.IsDetachScroll(srcItemVNum):
  2007. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  2008. return TRUE
  2009. elif item.IsKey(srcItemVNum):
  2010. if player.CanUnlock(srcItemVNum, dstSlotPos):
  2011. return TRUE
  2012. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  2013. return TRUE
  2014. else:
  2015. useType=item.GetUseType(srcItemVNum)
  2016. if "USE_CLEAN_SOCKET" == useType:
  2017. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  2018. return TRUE
  2019. elif "USE_CHANGE_ATTRIBUTE" == useType:
  2020. if self.__CanChangeItemAttrList(dstSlotPos):
  2021. return TRUE
  2022. elif "USE_ADD_ATTRIBUTE" == useType:
  2023. if self.__CanAddItemAttr(dstSlotPos):
  2024. return TRUE
  2025. elif "USE_ADD_ATTRIBUTE2" == useType:
  2026. if self.__CanAddItemAttr(dstSlotPos):
  2027. return TRUE
  2028. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  2029. if self.__CanAddAccessorySocket(dstSlotPos):
  2030. return TRUE
  2031. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  2032. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  2033. return TRUE;
  2034. elif "USE_PUT_INTO_BELT_SOCKET" == useType:
  2035. dstItemVNum = player.GetItemIndex(dstSlotPos)
  2036. print "USE_PUT_INTO_BELT_SOCKET", srcItemVNum, dstItemVNum
  2037. item.SelectItem(dstItemVNum)
  2038. if item.ITEM_TYPE_BELT == item.GetItemType():
  2039. return TRUE
  2040. elif useType == "USE_BIND" or useType == "USE_UNBIND":
  2041. dstItemVNum = player.GetItemIndex(dstSlotPos)
  2042. item.SelectItem(dstItemVNum)
  2043. if item.IsAntiFlag(item.ANTIFLAG_BIND):
  2044. return FALSE
  2045. elif useType == "USE_BIND" and player.GetItemBind(dstSlotPos) == 1:
  2046. return FALSE
  2047. elif useType == "USE_BIND" and player.GetItemBind(dstSlotPos) > 1:
  2048. return FALSE
  2049. elif useType == "USE_UNBIND" and player.GetItemBind(dstSlotPos) != 1:
  2050. return FALSE
  2051. else:
  2052. return TRUE
  2053. elif useType == "USE_COSTUME_ENCHANT" or useType == "USE_COSTUME_TRANSFORM":
  2054. dstItemVNum = player.GetItemIndex(dstSlotPos)
  2055. item.SelectItem(dstItemVNum)
  2056. if item.GetItemType() == item.ITEM_TYPE_COSTUME:
  2057. return TRUE
  2058. return FALSE
  2059. def __SoulBindItem(self, scrollSlotPos, targetSlotPos, action = "bind"):
  2060. DstItemVNum = player.GetItemIndex(targetSlotPos)
  2061. item.SelectItem(DstItemVNum)
  2062. item_name = item.GetItemName()
  2063. self.questionDialog = uiCommon.QuestionDialog()
  2064. if action == "bind":
  2065. self.questionDialog.SetText(localeInfo.SOULBIND_ITEM % (item_name))
  2066. else:
  2067. self.questionDialog.SetText(localeInfo.SOULUNBIND_ITEM % (item_name))
  2068. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.OnAcceptSoulBindItem))
  2069. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  2070. self.questionDialog.Open()
  2071. self.questionDialog.sourcePos = scrollSlotPos
  2072. self.questionDialog.targetPos = targetSlotPos
  2073. def OnAcceptSoulBindItem(self):
  2074. if self.questionDialog == None:
  2075. return
  2076. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  2077. self.OnCloseQuestionDialog()
  2078. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  2079. dstItemVNum = player.GetItemIndex(dstSlotPos)
  2080. if dstItemVNum == 0:
  2081. return FALSE
  2082. item.SelectItem(dstItemVNum)
  2083. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  2084. return FALSE
  2085. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  2086. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  2087. return TRUE
  2088. return FALSE
  2089. def __CanChangeItemAttrList(self, dstSlotPos):
  2090. dstItemVNum = player.GetItemIndex(dstSlotPos)
  2091. if dstItemVNum == 0:
  2092. return FALSE
  2093. item.SelectItem(dstItemVNum)
  2094. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  2095. return FALSE
  2096. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  2097. if player.GetItemAttribute(dstSlotPos, i) != 0:
  2098. return TRUE
  2099. return FALSE
  2100. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  2101. dstItemVNum = player.GetItemIndex(dstSlotPos)
  2102. if dstItemVNum == 0:
  2103. return FALSE
  2104. item.SelectItem(dstItemVNum)
  2105. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  2106. return FALSE
  2107. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  2108. return FALSE
  2109. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  2110. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  2111. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  2112. return FALSE
  2113. if curCount>=maxCount:
  2114. return FALSE
  2115. return TRUE
  2116. def __CanAddAccessorySocket(self, dstSlotPos):
  2117. dstItemVNum = player.GetItemIndex(dstSlotPos)
  2118. if dstItemVNum == 0:
  2119. return FALSE
  2120. item.SelectItem(dstItemVNum)
  2121. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  2122. return FALSE
  2123. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  2124. return FALSE
  2125. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  2126. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  2127. ACCESSORY_SOCKET_MAX_SIZE = 3
  2128. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  2129. return FALSE
  2130. return TRUE
  2131. def __CanAddItemAttr(self, dstSlotPos):
  2132. dstItemVNum = player.GetItemIndex(dstSlotPos)
  2133. if dstItemVNum == 0:
  2134. return FALSE
  2135. item.SelectItem(dstItemVNum)
  2136. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  2137. return FALSE
  2138. attrCount = 0
  2139. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  2140. if player.GetItemAttribute(dstSlotPos, i) != 0:
  2141. attrCount += 1
  2142. if attrCount<5:
  2143. return TRUE
  2144. return FALSE
  2145. def ShowToolTip(self, slotIndex):
  2146. if None != self.tooltipItem:
  2147. self.tooltipItem.SetInventoryItem(slotIndex)
  2148. def OnTop(self):
  2149. if None != self.tooltipItem:
  2150. self.tooltipItem.SetTop()
  2151. if app.WJ_ENABLE_TRADABLE_ICON:
  2152. map(lambda wnd:wnd.RefreshLockedSlot(), self.bindWnds)
  2153. self.RefreshMarkSlots()
  2154. def OnPressEscapeKey(self):
  2155. self.Close()
  2156. return TRUE
  2157. def UseItemSlot(self, slotIndex):
  2158. if constInfo.GET_ITEM_QUESTION_DIALOG_STATUS():
  2159. return
  2160. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  2161. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  2162. if self.wndDragonSoulRefine.IsShow():
  2163. self.wndDragonSoulRefine.AutoSetItem((player.INVENTORY, slotIndex), 1)
  2164. return
  2165. if app.ENABLE_SASH_SYSTEM:
  2166. if self.isShowSashWindow():
  2167. sash.Add(player.INVENTORY, slotIndex, 255)
  2168. return
  2169. if app.ENABLE_CHANGELOOK_SYSTEM:
  2170. if self.isShowChangeLookWindow():
  2171. changelook.Add(player.INVENTORY, slotIndex, 255)
  2172. return
  2173. if constInfo.FEEDWIND == 1 or constInfo.FEEDWIND == 3:
  2174. itemVnum = player.GetItemIndex(slotIndex)
  2175. item.SelectItem(itemVnum)
  2176. itemType = item.GetItemType()
  2177. if item.ITEM_TYPE_COSTUME == itemType or (itemVnum >= 55401 and itemVnum <= 55409) or (itemVnum >= 55701 and itemVnum <= 55709):
  2178. chat.AppendChat(chat.CHAT_TYPE_INFO, "Bu esyayi pete yediremezsin!")
  2179. else:
  2180. constInfo.USE_FEED = slotIndex
  2181. return
  2182. self.__UseItem(slotIndex)
  2183. mouseModule.mouseController.DeattachObject()
  2184. self.OverOutItem()
  2185. if app.ENABLE_10X_CHEST_OPEN:
  2186. def IsTreasureBox(self, slotIndex):
  2187. itemVnum = player.GetItemIndex(slotIndex)
  2188. item.SelectItem(itemVnum)
  2189. #if item.GetItemType() == item.ITEM_TYPE_GIFTBOX or item.GetItemType() == item.ITEM_TYPE_GACHA:
  2190. if itemVnum >= 50255 and itemVnum <= 50260:
  2191. return True
  2192. ##Hızlı Sandık Açma Bvural41
  2193. return False
  2194. def SendMultipleUseItemPacket(self, slotIndex):
  2195. for i in xrange(player.GetItemCount(slotIndex)):
  2196. self.__SendUseItemPacket(slotIndex)
  2197. if app.ENABLE_FAST_ATTACH_ITEMS_SYSTEM:
  2198. def __GetCurrentItemGrid(self):
  2199. itemGrid = [[False for slot in xrange(player.INVENTORY_PAGE_SIZE)] for page in xrange(player.INVENTORY_PAGE_COUNT)]
  2200. for page in xrange(player.INVENTORY_PAGE_COUNT):
  2201. for slot in xrange(player.INVENTORY_PAGE_SIZE):
  2202. itemVnum = player.GetItemIndex(slot + page * player.INVENTORY_PAGE_SIZE)
  2203. if itemVnum <> 0:
  2204. (w, h) = item.GetItemSize(item.SelectItem(itemVnum))
  2205. for i in xrange(h):
  2206. itemGrid[page][slot + i * 5] = True
  2207. return itemGrid
  2208. def __FindEmptyCellForSize(self, itemGrid, size):
  2209. for page in xrange(player.INVENTORY_PAGE_COUNT):
  2210. for slot in xrange(player.INVENTORY_PAGE_SIZE):
  2211. if itemGrid[page][slot] == False:
  2212. possible = True
  2213. for i in xrange(size):
  2214. p = slot + (i * 5)
  2215. try:
  2216. if itemGrid[page][p] == True:
  2217. possible = False
  2218. break
  2219. except IndexError:
  2220. possible = False
  2221. break
  2222. if possible:
  2223. return slot + page * player.INVENTORY_PAGE_SIZE
  2224. return -1
  2225. def AttachItemFromSafebox(self, slotIndex, itemIndex):
  2226. itemGrid = self.__GetCurrentItemGrid()
  2227. if item.GetItemType(item.SelectItem(itemIndex)) == item.ITEM_TYPE_DS:
  2228. return
  2229. emptySlotIndex = self.__FindEmptyCellForSize(itemGrid, item.GetItemSize()[1])
  2230. if emptySlotIndex <> -1:
  2231. net.SendSafeboxCheckoutPacket(slotIndex, player.INVENTORY, emptySlotIndex)
  2232. return True
  2233. def __UseItem(self, slotIndex):
  2234. if app.ENABLE_FAST_ATTACH_ITEMS_SYSTEM:
  2235. if self.interface and self.interface.AttachInvenItemToOtherWindowSlot(player.INVENTORY, slotIndex):
  2236. return
  2237. ItemVNum = player.GetItemIndex(slotIndex)
  2238. item.SelectItem(ItemVNum)
  2239. if app.ENABLE_10X_CHEST_OPEN:
  2240. if app.IsPressed(app.DIK_LCONTROL) and self.IsTreasureBox(slotIndex):
  2241. self.SendMultipleUseItemPacket(slotIndex)
  2242. return
  2243. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  2244. self.questionDialog = uiCommon.QuestionDialog()
  2245. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  2246. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  2247. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  2248. self.questionDialog.Open()
  2249. self.questionDialog.slotIndex = slotIndex
  2250. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  2251. elif 70005 == ItemVNum or 70043 == ItemVNum or 79000 == ItemVNum or 79001 == ItemVNum or 79002 == ItemVNum or 79003 == ItemVNum or 79004 == ItemVNum or 79005 == ItemVNum or 79006 == ItemVNum or 79007 == ItemVNum or 79008 == ItemVNum:
  2252. self.questionDialog = uiCommon.QuestionDialog()
  2253. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  2254. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  2255. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  2256. self.questionDialog.Open()
  2257. self.questionDialog.slotIndex = slotIndex
  2258. constInfo.SET_ITEM_QUESTION_DIALOG_STATUS(1)
  2259. elif app.IsPressed(app.DIK_LSHIFT):
  2260. if player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GACHA or\
  2261. player.GetItemTypeBySlot(slotIndex) == item.ITEM_TYPE_GIFTBOX and\
  2262. ItemVNum != 31374 and ItemVNum != 50255 and\
  2263. ItemVNum != 50187 and ItemVNum != 50197 and\
  2264. ItemVNum != 50188 and ItemVNum != 50189 and\
  2265. ItemVNum != 50190 and ItemVNum != 50191 and\
  2266. ItemVNum != 50192 and ItemVNum != 50193 and\
  2267. ItemVNum != 50194 and ItemVNum != 50195:
  2268. if app.ENABLE_SHOW_CHEST_DROP:
  2269. if self.interface:
  2270. if self.interface.dlgChestDrop:
  2271. if not self.interface.dlgChestDrop.IsShow():
  2272. self.interface.dlgChestDrop.Open(slotIndex)
  2273. net.SendChestDropInfo(slotIndex)
  2274. else:
  2275. self.__SendUseItemPacket(slotIndex)
  2276. def __UseItemQuestionDialog_OnCancel(self):
  2277. self.OnCloseQuestionDialog()
  2278. def __UseItemQuestionDialog_OnAccept(self):
  2279. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  2280. self.OnCloseQuestionDialog()
  2281. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  2282. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2283. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  2284. return
  2285. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  2286. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_OFFLINE_SHOP)
  2287. return
  2288. if (uiOfflineShop.IsEditingOfflineShop()):
  2289. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_OFFLINE_SHOP)
  2290. return
  2291. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  2292. def __SendUseItemPacket(self, slotPos):
  2293. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2294. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  2295. return
  2296. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  2297. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_OFFLINE_SHOP)
  2298. return
  2299. if (uiOfflineShop.IsEditingOfflineShop()):
  2300. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_OFFLINE_SHOP)
  2301. return
  2302. net.SendItemUsePacket(slotPos)
  2303. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  2304. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  2305. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  2306. return
  2307. if (uiOfflineShopBuilder.IsBuildingOfflineShop()):
  2308. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_OFFLINE_SHOP)
  2309. return
  2310. if (uiOfflineShop.IsEditingOfflineShop()):
  2311. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_OFFLINE_SHOP)
  2312. return
  2313. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  2314. def SetDragonSoulRefineWindow(self, wndDragonSoulRefine):
  2315. if app.ENABLE_DRAGON_SOUL_SYSTEM:
  2316. self.wndDragonSoulRefine = wndDragonSoulRefine
  2317. if app.ENABLE_SASH_SYSTEM:
  2318. def SetSashWindow(self, wndSashCombine, wndSashAbsorption):
  2319. self.wndSashCombine = wndSashCombine
  2320. self.wndSashAbsorption = wndSashAbsorption
  2321. def isShowSashWindow(self):
  2322. if self.wndSashCombine:
  2323. if self.wndSashCombine.IsShow():
  2324. return 1
  2325. if self.wndSashAbsorption:
  2326. if self.wndSashAbsorption.IsShow():
  2327. return 1
  2328. return 0
  2329. if app.ENABLE_CHANGELOOK_SYSTEM:
  2330. def SetChangeLookWindow(self, wndChangeLook):
  2331. self.wndChangeLook = wndChangeLook
  2332. def isShowChangeLookWindow(self):
  2333. if self.wndChangeLook:
  2334. if self.wndChangeLook.IsShow():
  2335. return 1
  2336. return 0
  2337. def OnMoveWindow(self, x, y):
  2338. if self.wndBelt:
  2339. self.wndBelt.AdjustPositionAndSize()
  2340. if self.wndBio:
  2341. self.wndBio.AdjustPositionAndSize()

s