Guest User

Untitled

a guest
Jun 17th, 2019
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 53.20 KB | None | 0 0
  1. import ui
  2. import player
  3. import mouseModule
  4. import net
  5. import app
  6. import snd
  7. import item
  8. import chat
  9. import grp
  10. import uiScriptLocale
  11. import uiRefine
  12. import uiAttachMetin
  13. import uiPickMoney
  14. import uiCommon
  15. import uiPrivateShopBuilder
  16. import localeInfo
  17. import constInfo
  18. import ime
  19. import wndMgr
  20. import uiToolTip
  21. import event
  22. import player
  23.  
  24. from uiToolTip import ItemToolTip
  25. AFFECT_DICT = ItemToolTip.AFFECT_DICT
  26.  
  27. ITEM_MALL_BUTTON_ENABLE = True
  28. ITEM_FLAG_APPLICABLE = 1 << 14
  29.  
  30. class CostumeWindow(ui.ScriptWindow):
  31.  
  32. def __init__(self, wndInventory):
  33. import exception
  34.  
  35. if not app.ENABLE_COSTUME_SYSTEM:
  36. exception.Abort("What do you do?")
  37. return
  38.  
  39. if not wndInventory:
  40. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  41. return
  42.  
  43. ui.ScriptWindow.__init__(self)
  44.  
  45. self.isLoaded = 0
  46. self.wndInventory = wndInventory;
  47.  
  48. self.__LoadWindow()
  49.  
  50. def __del__(self):
  51. ui.ScriptWindow.__del__(self)
  52.  
  53. def Show(self):
  54. self.__LoadWindow()
  55. self.RefreshCostumeSlot()
  56.  
  57. ui.ScriptWindow.Show(self)
  58.  
  59. def Close(self):
  60. self.Hide()
  61.  
  62. def __LoadWindow(self):
  63. if self.isLoaded == 1:
  64. return
  65.  
  66. self.isLoaded = 1
  67.  
  68. try:
  69. pyScrLoader = ui.PythonScriptLoader()
  70. pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
  71. except:
  72. import exception
  73. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  74.  
  75. try:
  76. wndEquip = self.GetChild("CostumeSlot")
  77. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  78.  
  79. self.button_wid=[]
  80. for i in xrange(1,5):
  81. self.button_wid.append(self.GetChild("wid"+str(i)))
  82. self.button_wid[i-1].SetEvent(ui.__mem_func__(self.ChangeWid), i)
  83.  
  84. except:
  85. import exception
  86. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  87.  
  88. ## Equipment
  89. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  90. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  91. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  92. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  93. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  94. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  95.  
  96. self.wndEquip = wndEquip
  97.  
  98. def ChangeWid(self, arg):
  99. net.SendChatPacket("/change_wid %d %d" % (2,arg))
  100.  
  101. def RefreshCostumeSlot(self):
  102. getItemVNum=player.GetItemIndex
  103.  
  104. for i in xrange(item.COSTUME_SLOT_COUNT):
  105. slotNumber = item.COSTUME_SLOT_START + i
  106. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  107.  
  108. slotAce = item.COSTUME_SLOT_ACCE
  109. self.wndEquip.SetItemSlot(slotAce, getItemVNum(slotAce), 0)
  110.  
  111. self.wndEquip.RefreshSlot()
  112.  
  113.  
  114. class BeltInventoryWindow(ui.ScriptWindow):
  115.  
  116. def __init__(self, wndInventory):
  117. import exception
  118.  
  119. if not app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  120. exception.Abort("What do you do?")
  121. return
  122.  
  123. if not wndInventory:
  124. exception.Abort("wndInventory parameter must be set to InventoryWindow")
  125. return
  126.  
  127. ui.ScriptWindow.__init__(self)
  128.  
  129. self.isLoaded = 0
  130. self.wndInventory = wndInventory;
  131.  
  132. self.wndBeltInventoryLayer = None
  133. self.wndBeltInventorySlot = None
  134. self.expandBtn = None
  135. self.minBtn = None
  136.  
  137. self.__LoadWindow()
  138.  
  139. def __del__(self):
  140. ui.ScriptWindow.__del__(self)
  141.  
  142. def Show(self, openBeltSlot = FALSE):
  143. self.__LoadWindow()
  144. self.RefreshSlot()
  145.  
  146. ui.ScriptWindow.Show(self)
  147.  
  148. if openBeltSlot:
  149. self.OpenInventory()
  150. else:
  151. self.CloseInventory()
  152.  
  153. def Close(self):
  154. self.Hide()
  155.  
  156. def IsOpeningInventory(self):
  157. return self.wndBeltInventoryLayer.IsShow()
  158.  
  159. def OpenInventory(self):
  160. self.wndBeltInventoryLayer.Show()
  161. self.expandBtn.Hide()
  162.  
  163. self.AdjustPositionAndSize()
  164.  
  165. def CloseInventory(self):
  166. self.wndBeltInventoryLayer.Hide()
  167. self.expandBtn.Show()
  168.  
  169.  
  170. self.AdjustPositionAndSize()
  171.  
  172.  
  173. ## ?? ???? ??? ???? BASE ??? ??, ??.. ?? ?????? ?? ??? ??? ??..
  174. def GetBasePosition(self):
  175. x, y = self.wndInventory.GetGlobalPosition()
  176. return x - 148, y + 255
  177.  
  178. def AdjustPositionAndSize(self):
  179. bx, by = self.GetBasePosition()
  180.  
  181. if self.IsOpeningInventory():
  182. self.SetPosition(bx, by)
  183. self.SetSize(self.ORIGINAL_WIDTH, self.GetHeight())
  184.  
  185. else:
  186. self.SetPosition(bx + 138, by);
  187. self.SetSize(10, self.GetHeight())
  188.  
  189. def __LoadWindow(self):
  190. if self.isLoaded == 1:
  191. return
  192.  
  193. self.isLoaded = 1
  194.  
  195. try:
  196. pyScrLoader = ui.PythonScriptLoader()
  197. pyScrLoader.LoadScriptFile(self, "UIScript/BeltInventoryWindow.py")
  198. except:
  199. import exception
  200. exception.Abort("CostumeWindow.LoadWindow.LoadObject")
  201.  
  202. try:
  203. self.ORIGINAL_WIDTH = self.GetWidth()
  204. wndBeltInventorySlot = self.GetChild("BeltInventorySlot")
  205. self.wndBeltInventoryLayer = self.GetChild("BeltInventoryLayer")
  206. self.expandBtn = self.GetChild("ExpandBtn")
  207. self.minBtn = self.GetChild("MinimizeBtn")
  208.  
  209. self.expandBtn.SetEvent(ui.__mem_func__(self.OpenInventory))
  210. self.minBtn.SetEvent(ui.__mem_func__(self.CloseInventory))
  211.  
  212. #if localeInfo.IsARABIC() :
  213. #self.expandBtn.SetPosition(self.expandBtn.GetWidth() - 2, 15)
  214. #self.wndBeltInventoryLayer.SetPosition(self.wndBeltInventoryLayer.GetWidth() - 5, 0)
  215. #self.minBtn.SetPosition(self.minBtn.GetWidth() + 3, 15)
  216.  
  217. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  218. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  219. wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  220. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  221. "d:/ymir work/ui/game/quest/slot_button_01.sub",\
  222. "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", FALSE, FALSE)
  223.  
  224. except:
  225. import exception
  226. exception.Abort("CostumeWindow.LoadWindow.BindObject")
  227.  
  228. ## Equipment
  229. wndBeltInventorySlot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  230. wndBeltInventorySlot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  231. wndBeltInventorySlot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  232. wndBeltInventorySlot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  233. wndBeltInventorySlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  234. wndBeltInventorySlot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  235.  
  236. self.wndBeltInventorySlot = wndBeltInventorySlot
  237.  
  238. def RefreshSlot(self):
  239. getItemVNum=player.GetItemIndex
  240.  
  241. for i in xrange(item.BELT_INVENTORY_SLOT_COUNT):
  242. slotNumber = item.BELT_INVENTORY_SLOT_START + i
  243. self.wndBeltInventorySlot.SetItemSlot(slotNumber, getItemVNum(slotNumber), player.GetItemCount(slotNumber))
  244. self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, TRUE)
  245.  
  246. avail = "0"
  247.  
  248. if player.IsAvailableBeltInventoryCell(slotNumber):
  249. self.wndBeltInventorySlot.EnableCoverButton(slotNumber)
  250. else:
  251. self.wndBeltInventorySlot.DisableCoverButton(slotNumber)
  252.  
  253. self.wndBeltInventorySlot.RefreshSlot()
  254.  
  255.  
  256.  
  257. class Pety(ui.ScriptWindow):
  258. def __init__(self, wndInventory):
  259. ui.ScriptWindow.__init__(self)
  260. self.toolTip = uiToolTip.ToolTip()
  261. self.toolTip.Hide()
  262. self.tooltipItem = uiToolTip.ItemToolTip()
  263. self.tooltipItem.Hide()
  264. self.wndInventory = wndInventory;
  265. self.__Initialize()
  266. self.__Load()
  267.  
  268. def __del__(self):
  269. ui.ScriptWindow.__del__(self)
  270.  
  271. def __Initialize(self):
  272. self.titleBar = 0
  273.  
  274. def Destroy(self):
  275. self.Hide()
  276. self.ClearDictionary()
  277. self.toolTip = None
  278. self.__Initialize()
  279.  
  280. def __Load_LoadScript(self, fileName):
  281. try:
  282. pyScriptLoader = ui.PythonScriptLoader()
  283. pyScriptLoader.LoadScriptFile(self, fileName)
  284. except:
  285. import exception
  286. exception.Abort("Load_Error: Pety")
  287.  
  288. def __Load(self):
  289. self.__Load_LoadScript("UIScript/Pety.py")
  290. self.__Load_BindObject()
  291. self.SetCenterPosition()
  292. self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
  293.  
  294. def __Load_BindObject(self):
  295. try:
  296. GetObject = self.GetChild
  297. self.titleBar = GetObject("titlebar")
  298. #
  299. self.thin1 = GetObject("thin1")
  300. self.pet_avatar = GetObject("pet_avatar")
  301. self.pet_lv = GetObject("pet_lv")
  302. self.pet_name = GetObject("pet_name")
  303. self.pet_exp = GetObject("pet_exp")
  304. self.slots = GetObject("slots")
  305. #
  306. self.tip_lv = GetObject("tip_lv")
  307. self.tip_exp = GetObject("tip_exp")
  308. self.tip_lv.ShowToolTip = lambda : self.OverInPetyButton(20)
  309. self.tip_lv.HideToolTip = lambda : self.OverOutPetyButton()
  310. self.tip_exp.ShowToolTip = lambda : self.OverInPetyButton(30)
  311. self.tip_exp.HideToolTip = lambda : self.OverOutPetyButton()
  312. #
  313. self.slots.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  314. self.slots.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  315. self.slots.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  316. self.slots.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  317. self.slots.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  318. self.slots.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  319. #
  320. self.bon = []
  321. self.bon_slot = []
  322. self.bon_mix = []
  323. for i in xrange(1,5):
  324. self.bon.append(self.GetChild("bon"+str(i)))
  325. self.bon_slot.append(self.GetChild("bon"+str(i)+"_img"))
  326. self.bon_slot[i-1].SetEvent(ui.__mem_func__(self.BonusAdd), i)
  327. self.bon_slot[i-1].ShowToolTip = lambda arg=i: self.OverInPetyButton(arg+40)
  328. self.bon_slot[i-1].HideToolTip = lambda : self.OverOutPetyButton()
  329. self.bon_mix.append(self.GetChild("bon"+str(i)+"_mix"))
  330. self.bon_mix[i-1].SetEvent(ui.__mem_func__(self.BonusMix), i)
  331. self.bon_mix[i-1].ShowToolTip = lambda arg=i: self.OverInPetyButton(arg)
  332. self.bon_mix[i-1].HideToolTip = lambda : self.OverOutPetyButton()
  333.  
  334. self.SetSlots()
  335. except:
  336. import exception
  337. exception.Abort("Pety.__Load_BindObject")
  338.  
  339. def SetSlots(self):
  340. getItemVNum=player.GetItemIndex
  341. self.slots.SetItemSlot(item.EQUIPMENT_ITEM_NEW_SLOT_7, getItemVNum(item.EQUIPMENT_ITEM_NEW_SLOT_7), 0)
  342. self.slots.SetItemSlot(item.EQUIPMENT_ITEM_NEW_SLOT_8, getItemVNum(item.EQUIPMENT_ITEM_NEW_SLOT_8), 0)
  343. self.slots.RefreshSlot()
  344.  
  345. def BonusAdd(self, arg):
  346. constInfo.PetBonus = int(arg)
  347. event.QuestButtonClick(constInfo.PetyTab['id'])
  348.  
  349. def BonusMix(self, arg):
  350. constInfo.PetBonus = int(arg+4)
  351. event.QuestButtonClick(constInfo.PetyTab['id'])
  352.  
  353. def OverInPetyButton(self, arg):
  354. self.tooltipItem.ClearToolTip()
  355. if arg <= 4:
  356. self.tooltipItem.SetTitle(uiScriptLocale.pet_tip1 % str(arg))
  357. self.tooltipItem.SetTitle(uiScriptLocale.pet_tip2)
  358. self.tooltipItem.AppendSpace(5)
  359. item.SelectItem(53202)
  360. self.tooltipItem.SetTextGift(item.GetItemName())
  361. self.tooltipItem.SetTitle(uiScriptLocale.pet_tip3)
  362. self.tooltipItem.Show()
  363. elif arg == 20:
  364. self.tooltipItem.SetTitle(uiScriptLocale.pet_tip4)
  365. self.tooltipItem.SetTextGift(str(constInfo.PetyTab['max_lv']))
  366. self.tooltipItem.Show()
  367. elif arg == 30:
  368. self.tooltipItem.SetTitle(uiScriptLocale.pet_tip5)
  369. self.tooltipItem.AppendSpace(5)
  370. self.tooltipItem.SetTextGift(uiScriptLocale.pet_tip6)
  371. self.tooltipItem.SetTextGift(uiScriptLocale.pet_tip7)
  372. self.tooltipItem.AppendSpace(5)
  373. self.tooltipItem.Show()
  374. elif arg >= 40:
  375. tab_lv=[3,5,8,10]
  376. self.tooltipItem.SetTitle(uiScriptLocale.pet_tip9)
  377. self.tooltipItem.SetTextGift(str(tab_lv[arg-41]))
  378. self.tooltipItem.Show()
  379.  
  380. def OnUpdate(self):
  381. if int(constInfo.PetActive) == 0:
  382. self.Hide()
  383. return
  384.  
  385. self.pet_lv.SetText(str(constInfo.PetyTab['lv']))
  386. if int(constInfo.PetyTab['lv']) >= int(constInfo.PetyTab['max_lv']):
  387. self.pet_exp.SetText(uiScriptLocale.pet_tip10)
  388. else:
  389. self.pet_exp.SetText(str(constInfo.PetyTab['exp'])+"/"+str(constInfo.PetyTab['exp_need']))
  390.  
  391. if int(constInfo.PetId) == 0:
  392. self.pet_name.SetText(uiScriptLocale.pet_tip11)
  393. self.pet_avatar.Hide()
  394. else:
  395. item.SelectItem(int(constInfo.PetId))
  396. pet_name = item.GetItemName()
  397. self.pet_avatar.Show()
  398. avatar = int(constInfo.PetId)-54000
  399. self.pet_avatar.LoadImage("gui/pety/pet"+str(avatar)+".tga")
  400. rep = pet_name.replace('Pet', '')
  401. self.pet_name.SetText(str(rep))
  402.  
  403. for i in xrange(1,5):
  404. if constInfo.PetBonusTab['bon'+str(i)] != 0:
  405. bonus_id=int(constInfo.PetBonusTab['bon'+str(i)])
  406. bonus_name=AFFECT_DICT[bonus_id](constInfo.PetBonusTab['bon'+str(i)+'_val'])
  407. self.bon[i-1].SetText(str(bonus_name))
  408. else:
  409. self.bon[i-1].SetText(uiScriptLocale.pet_tip12)
  410.  
  411. def OverOutPetyButton(self):
  412. self.tooltipItem.Hide()
  413.  
  414. def OnPressEscapeKey(self):
  415. self.Close()
  416. return True
  417.  
  418. def Show(self):
  419. ui.ScriptWindow.Show(self)
  420.  
  421. def Close(self):
  422. self.Hide()
  423.  
  424. class Runy(ui.ScriptWindow):
  425. def __init__(self, wndInventory):
  426. ui.ScriptWindow.__init__(self)
  427. self.wndInventory = wndInventory;
  428. self.__Initialize()
  429. self.__Load()
  430.  
  431. def __del__(self):
  432. ui.ScriptWindow.__del__(self)
  433.  
  434. def __Initialize(self):
  435. self.titleBar = 0
  436.  
  437. def Destroy(self):
  438. self.ClearDictionary()
  439. self.Hide()
  440. self.__Initialize()
  441.  
  442. def __Load_LoadScript(self, fileName):
  443. try:
  444. pyScriptLoader = ui.PythonScriptLoader()
  445. pyScriptLoader.LoadScriptFile(self, fileName)
  446. except:
  447. import exception
  448. exception.Abort("Load_Error: Runy")
  449.  
  450. def __Load(self):
  451. self.__Load_LoadScript("UIScript/Runy.py")
  452. self.__Load_BindObject()
  453. self.SetCenterPosition()
  454. self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
  455.  
  456. def __Load_BindObject(self):
  457. try:
  458. GetObject = self.GetChild
  459. self.titleBar = GetObject("titlebar")
  460.  
  461. wndEquip = self.GetChild("slot_table")
  462.  
  463. except:
  464. import exception
  465. exception.Abort("OptionDialog.__Load_BindObject")
  466.  
  467. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
  468. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
  469. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  470. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlot))
  471. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
  472. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
  473. self.wndEquip = wndEquip
  474.  
  475. def OnUpdate(self):
  476. getItemVNum=player.GetItemIndex
  477. for i in xrange(4):
  478. slotNumber = item.EQUIPMENT_ITEM_NEW_SLOT_1 + i
  479. self.wndEquip.SetItemSlot(slotNumber, getItemVNum(slotNumber), 0)
  480. self.wndEquip.RefreshSlot()
  481.  
  482. def OnPressEscapeKey(self):
  483. self.Close()
  484. return True
  485.  
  486. def Show(self):
  487. ui.ScriptWindow.Show(self)
  488.  
  489. def Close(self):
  490. self.Hide()
  491.  
  492. class InventoryWindow(ui.ScriptWindow):
  493.  
  494. 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_RING_SOCKET")
  495.  
  496. questionDialog = None
  497. tooltipItem = None
  498. wndCostume = None
  499. wndPet = None
  500. wndRuny = None
  501. dlgPickMoney = None
  502.  
  503. sellingSlotNumber = -1
  504. isLoaded = 0
  505. isOpenedCostumeWindowWhenClosingInventory = 0
  506. isOpenedBeltWindowWhenClosingInventory = 0
  507.  
  508. def __init__(self):
  509. ui.ScriptWindow.__init__(self)
  510. self.toolTip = uiToolTip.ToolTip()
  511. self.toolTip.Hide()
  512.  
  513. self.yangTextLine = []
  514. self.deleteyangTextLine = 0
  515.  
  516. self.yangcheck = 0
  517. self.bpcheck = 0
  518.  
  519. self.bpTextLine = []
  520. self.deletebpTextLine = 0
  521.  
  522. self.temp_yangTextLine = 0
  523. self.temp_bpTextLine = 0
  524.  
  525. self.__LoadWindow()
  526.  
  527. def __del__(self):
  528. ui.ScriptWindow.__del__(self)
  529.  
  530. def Show(self):
  531. self.__LoadWindow()
  532.  
  533. ui.ScriptWindow.Show(self)
  534.  
  535.  
  536. if self.isOpenedCostumeWindowWhenClosingInventory and self.wndCostume:
  537. self.wndCostume.Show()
  538.  
  539. def BindInterfaceClass(self, interface):
  540. self.interface = interface
  541.  
  542. def __LoadWindow(self):
  543. if self.isLoaded == 1:
  544. return
  545.  
  546. self.isLoaded = 1
  547.  
  548. try:
  549. pyScrLoader = ui.PythonScriptLoader()
  550. pyScrLoader.LoadScriptFile(self, "UIScript/InventoryWindow.py")
  551.  
  552. except:
  553. import exception
  554. exception.Abort("InventoryWindow.LoadWindow.LoadObject")
  555.  
  556. try:
  557. wndItem = self.GetChild("ItemSlot")
  558. wndEquip = self.GetChild("EquipmentSlot")
  559. self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
  560. self.wndMoney = self.GetChild("Money")
  561. self.BP_points_slot = self.GetChild("BP_points_slot")
  562. self.BP_points = self.GetChild("BP_points")
  563. self.yang_add = self.GetChild("yang_add")
  564. self.bp_add = self.GetChild("bp_add")
  565. self.mallButton = self.GetChild2("MallButton")
  566. self.DSSButton = self.GetChild2("DSSButton")
  567. self.costumeButton = self.GetChild2("CostumeButton")
  568.  
  569. self.inventoryTab = []
  570. self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
  571. self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
  572. self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
  573. self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
  574. self.inventoryTab.append(self.GetChild("Inventory_Tab_05"))
  575.  
  576. self.belt_buttons = []
  577. self.belt_buttons.append(self.GetChild("teleportacja"))
  578. self.belt_buttons.append(self.GetChild("sklep"))
  579. self.belt_buttons.append(self.GetChild("kon"))
  580. self.belt_buttons.append(self.GetChild("marmur_sklep"))
  581. self.belt_buttons.append(self.GetChild("marmur_odmien"))
  582. self.belt_buttons.append(self.GetChild("zmiana_eq"))
  583. self.belt_buttons.append(self.GetChild("bs"))
  584. self.belt_buttons.append(self.GetChild("drop"))
  585. self.belt_buttons.append(self.GetChild("autopot_czerwony"))
  586. self.belt_buttons.append(self.GetChild("autopot_niebieski"))
  587. self.belt_buttons.append(self.GetChild("wspomagacze"))
  588.  
  589. if self.costumeButton and not app.ENABLE_COSTUME_SYSTEM:
  590. self.costumeButton.Hide()
  591. self.costumeButton.Destroy()
  592. self.costumeButton = 0
  593.  
  594. except:
  595. import exception
  596. exception.Abort("InventoryWindow.LoadWindow.BindObject")
  597.  
  598. for i in xrange(len(self.belt_buttons)):
  599. self.belt_buttons[i].SetEvent(ui.__mem_func__(self.function_belt_buttons), i)
  600. self.belt_buttons[i].ShowToolTip = lambda arg=i: self.show_tooltip(arg)
  601. self.belt_buttons[i].HideToolTip = lambda : self.hide_tooltip()
  602.  
  603. self.BP_points_slot.ShowToolTip = lambda : self.show_tooltip(40)
  604. self.BP_points_slot.HideToolTip = lambda : self.hide_tooltip()
  605.  
  606. ## Item
  607. wndItem.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  608. wndItem.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  609. wndItem.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  610. wndItem.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  611. wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  612. wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  613.  
  614. ## Equipment
  615. wndEquip.SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  616. wndEquip.SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  617. wndEquip.SetUnselectItemSlotEvent(ui.__mem_func__(self.UseItemSlot))
  618. wndEquip.SetUseSlotEvent(ui.__mem_func__(self.UseItemSlot))
  619. wndEquip.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  620. wndEquip.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  621.  
  622. ## PickMoneyDialog
  623. dlgPickMoney = uiPickMoney.PickMoneyDialog()
  624. dlgPickMoney.LoadDialog()
  625. dlgPickMoney.Hide()
  626.  
  627. ## RefineDialog
  628. self.refineDialog = uiRefine.RefineDialog()
  629. self.refineDialog.Hide()
  630.  
  631. ## AttachMetinDialog
  632. self.attachMetinDialog = uiAttachMetin.AttachMetinDialog()
  633. self.attachMetinDialog.Hide()
  634.  
  635. self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
  636. self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
  637. self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
  638. self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
  639. self.inventoryTab[4].SetEvent(lambda arg=4: self.SetInventoryPage(arg))
  640. self.inventoryTab[0].Down()
  641. self.inventoryPageIndex = 0
  642.  
  643. self.wndItem = wndItem
  644. self.wndEquip = wndEquip
  645. self.dlgPickMoney = dlgPickMoney
  646.  
  647. #new_fnc
  648. import uiDozorcaIs
  649. self.dozorca_is = uiDozorcaIs.Dozorca_Is()
  650. #import uiTeleportacja
  651. #self.teleportacja = uiTeleportacja.Teleportacja()
  652. import uiMarmury
  653. self.marmury = uiMarmury.Marmury()
  654. import uiZmianaEq
  655. self.zmianaeq = uiZmianaEq.ZmianaEq()
  656. import uiWspomagacze
  657. self.wspomagacze = uiWspomagacze.Wspomagacze()
  658. import uiBs
  659. self.bs = uiBs.Bs()
  660. self.bs_minimal = uiBs.Zminimalizuj()
  661. self.bs_tab = uiBs.bs_tab
  662. import uiWikiDropu
  663. self.wiki = uiWikiDropu.WikiDropu()
  664. import uiWyciaganieKd
  665. self.wyciaganiekd = uiWyciaganieKd.WyciaganieKd()
  666.  
  667.  
  668. # MallButton
  669. if self.mallButton:
  670. self.mallButton.SetEvent(ui.__mem_func__(self.ClickMallButton))
  671.  
  672. if self.DSSButton:
  673. self.DSSButton.SetEvent(ui.__mem_func__(self.ClickDSSButton))
  674.  
  675. # Costume Button
  676. if self.costumeButton:
  677. self.costumeButton.SetEvent(ui.__mem_func__(self.ClickCostumeButton))
  678.  
  679. self.costumeButton.ShowToolTip = lambda : self.__OverInCostumeButton()
  680. self.costumeButton.HideToolTip = lambda : self.__OverOutPanelButton()
  681.  
  682. self.mallButton.ShowToolTip = lambda : self.__OverInMallButton()
  683. self.mallButton.HideToolTip = lambda : self.__OverOutPanelButton()
  684.  
  685. self.wndCostume = None
  686. self.wndPet = None
  687. self.wndRuny = None
  688.  
  689. #####
  690.  
  691. ## Refresh
  692. self.SetInventoryPage(0)
  693. self.RefreshItemSlot()
  694. self.RefreshStatus()
  695.  
  696. def Destroy(self):
  697. self.dozorca_is.Hide()
  698. #self.teleportacja.Hide()
  699. self.marmury.Hide()
  700. self.zmianaeq.Hide()
  701. self.wspomagacze.Hide()
  702. self.bs.Destroy()
  703. #self.bs_minimal.Hide()
  704. self.wiki.Hide()
  705. self.wyciaganiekd.Hide()
  706. #hide_gui
  707.  
  708. self.ClearDictionary()
  709.  
  710. self.dlgPickMoney.Destroy()
  711. self.dlgPickMoney = 0
  712.  
  713. self.refineDialog.Destroy()
  714. self.refineDialog = 0
  715.  
  716. self.attachMetinDialog.Destroy()
  717. self.attachMetinDialog = 0
  718.  
  719. self.tooltipItem = None
  720. self.wndItem = 0
  721. self.wndEquip = 0
  722. self.dlgPickMoney = 0
  723. self.wndMoney = 0
  724. self.questionDialog = None
  725. self.mallButton = None
  726. self.DSSButton = None
  727. self.interface = None
  728. self.toolTip = None
  729.  
  730. if self.wndCostume:
  731. self.wndCostume.Destroy()
  732. self.wndCostume = 0
  733.  
  734. if self.wndPet:
  735. self.wndPet.Destroy()
  736. self.wndPet = 0
  737.  
  738. if self.wndRuny:
  739. self.wndRuny.Destroy()
  740. self.wndRuny = 0
  741.  
  742. self.inventoryTab = []
  743.  
  744. def Hide(self):
  745. if None != self.tooltipItem:
  746. self.tooltipItem.HideToolTip()
  747.  
  748. if self.wndCostume:
  749. self.isOpenedCostumeWindowWhenClosingInventory = self.wndCostume.IsShow()
  750. self.wndCostume.Close()
  751.  
  752. if self.dlgPickMoney:
  753. self.dlgPickMoney.Close()
  754.  
  755. self.OnCloseQuestionDialog()
  756.  
  757. wndMgr.Hide(self.hWnd)
  758.  
  759.  
  760. def Close(self):
  761. self.Hide()
  762.  
  763. def SetInventoryPage(self, page):
  764. self.inventoryTab[self.inventoryPageIndex].SetUp()
  765. self.inventoryPageIndex = page
  766. self.inventoryTab[self.inventoryPageIndex].Down()
  767. self.RefreshBagSlotWindow()
  768.  
  769. def ClickMallButton(self):
  770. self.ShowBeltGui(self.dozorca_is)
  771.  
  772. # DSSButton
  773. def ClickDSSButton(self):
  774. print "click_dss_button"
  775. self.interface.ToggleDragonSoulWindow()
  776.  
  777. def ClickCostumeButton(self):
  778. print "Click Costume Button"
  779. if self.wndCostume:
  780. if self.wndCostume.IsShow():
  781. self.wndCostume.Hide()
  782. else:
  783. self.wndCostume.Show()
  784. self.wndCostume.SetTop()
  785. else:
  786. self.wndCostume = CostumeWindow(self)
  787. self.wndCostume.Show()
  788. self.wndCostume.SetTop()
  789.  
  790. def OpenPetGui(self):
  791. print "Pet Gui"
  792. if self.wndPet:
  793. if self.wndPet.IsShow():
  794. self.wndPet.Hide()
  795. else:
  796. self.wndPet.Show()
  797. self.wndPet.SetTop()
  798. else:
  799. self.wndPet = Pety(self)
  800. self.wndPet.Show()
  801. self.wndPet.SetTop()
  802.  
  803. def OpenRunyGui(self):
  804. print "Runy Gui"
  805. if self.wndRuny:
  806. if self.wndRuny.IsShow():
  807. self.wndRuny.Hide()
  808. else:
  809. self.wndRuny.Show()
  810. self.wndRuny.SetTop()
  811. else:
  812. self.wndRuny = Runy(self)
  813. self.wndRuny.Show()
  814. self.wndRuny.SetTop()
  815.  
  816. def OpenRefineWiki(self, name):
  817. self.wiki.Show()
  818. self.wiki.RefineSearch(str(name))
  819. if not self.wiki.IsShow():
  820. self.wiki.Show()
  821.  
  822. ###YangIp
  823. def MakeTextLine(self, text, id):
  824. textLine = ui.TextLine()
  825. textLine.SetParent(self)
  826. if id == 1:
  827. textLine.SetText("+%s" % localeInfo.NumberToMoneyString(text))
  828. textLine.SetPackedFontColor(0xffd7ab49)
  829. textLine.SetPosition(9, 530)
  830. elif id == 2:
  831. textLine.SetText("+%s" % localeInfo.NumberToSecondaryCoinString(text))
  832. textLine.SetPackedFontColor(0xffd7ab49)
  833. textLine.SetPosition(9, 560)
  834. textLine.SetOutline()
  835. textLine.Show()
  836. return textLine
  837.  
  838. def UpdateMoneyBp(self, id):
  839. if id == 1:
  840. for i in xrange(len(self.yangTextLine)-1):
  841. text_size = str(self.yangTextLine[i].GetTextSize())
  842. textw1 = text_size.replace('(','')
  843. textw2 = textw1.replace(')','')
  844. text_n = textw2.split(",")
  845.  
  846. if len(self.yangTextLine) > 1:
  847. self.yangTextLine[i].SetPosition(9-(int(text_n[0])-38), 530-15*int(len(self.yangTextLine)-(i+1)))
  848.  
  849. wtext_size = str(self.yangTextLine[len(self.yangTextLine)-1].GetTextSize())
  850. wtextw1 = wtext_size.replace('(','')
  851. wtextw2 = wtextw1.replace(')','')
  852. wtext_n = wtextw2.split(",")
  853. self.yangTextLine[len(self.yangTextLine)-1].SetPosition(9-(int(wtext_n[0])-38), 530)
  854.  
  855. elif id == 2:
  856. text_size = str(self.bpTextLine[0].GetTextSize())
  857. textw1 = text_size.replace('(','')
  858. textw2 = textw1.replace(')','')
  859. text_n = textw2.split(",")
  860. self.bpTextLine[0].SetPosition(9-(int(text_n[0])-38), 560)
  861.  
  862. #YangInfo
  863. def YangInfo(self, money):
  864. if len(self.yangTextLine) > 8:
  865. self.yangTextLine.pop(0)
  866. self.yangTextLine.append(self.MakeTextLine(money,1))
  867. self.UpdateMoneyBp(1)
  868. self.yangcheck = app.GetTime()
  869.  
  870. #BpInfo
  871. def BpInfo(self, ip):
  872. if len(self.bpTextLine) > 0:
  873. self.bpTextLine.pop(0)
  874. self.bpTextLine.append(self.MakeTextLine(ip,2))
  875. self.UpdateMoneyBp(2)
  876. self.bpcheck = app.GetTime()
  877.  
  878. def update_bp(self, il):
  879. self.BP_points.SetText(localeInfo.NumberToSecondaryCoinString(il))
  880.  
  881. def OnUpdate(self):
  882. if app.GetTime() <= 2:
  883. self.yangcheck=0
  884.  
  885. if app.GetTime() <= 2:
  886. self.bpcheck=0
  887.  
  888. if len(self.yangTextLine) <= 0:
  889. self.yang_add.Hide()
  890. else:
  891. self.yang_add.Show()
  892. if app.GetTime() < self.yangcheck + 10:
  893. pass
  894. else:
  895. self.yangTextLine = []
  896. self.ipyangcheck = app.GetTime()
  897.  
  898. if len(self.bpTextLine) <= 0:
  899. self.bp_add.Hide()
  900. else:
  901. self.bp_add.Show()
  902. if app.GetTime() < self.bpcheck + 10:
  903. pass
  904. else:
  905. self.bpTextLine = []
  906. self.bpcheck = app.GetTime()
  907.  
  908. ###YangIp
  909.  
  910. def __OverInCostumeButton(self):
  911. self.toolTip.ClearToolTip()
  912. self.toolTip.SetTitle(localeInfo.btn_COSTUME)
  913. self.toolTip.Show()
  914.  
  915. def __OverInMallButton(self):
  916. self.toolTip.ClearToolTip()
  917. self.toolTip.SetTitle(localeInfo.btn_DOZ_IS)
  918. self.toolTip.Show()
  919.  
  920. def __OverOutPanelButton(self):
  921. self.toolTip.Hide()
  922.  
  923. def ShowBeltGui(self, gui):
  924. if gui.IsShow():
  925. gui.Hide()
  926. else:
  927. gui.Show()
  928. gui.SetTop()
  929.  
  930. def PotionId(self, arg):
  931. potions = {
  932. 8 : constInfo.Potred,
  933. 9 : constInfo.Potblue,
  934. 10 : constInfo.Potred_id,
  935. 11 : constInfo.Potblue_id,
  936. }
  937. return potions[arg]
  938.  
  939. def save_pots(self, id, status):
  940. try:
  941. f = open("TwojeDane/autopoty/"+str(id)+".txt","wb")
  942. f.write(str(status))
  943. f.close()
  944. except:
  945. pass
  946.  
  947. def function_belt_buttons(self, arg):
  948. if arg == 0:
  949. #self.ShowBeltGui(self.teleportacja)
  950. constInfo.Teleportacja_show=1
  951. elif arg == 1:
  952. net.SendChatPacket("/offline_shop")
  953. elif arg == 2:
  954. event.QuestButtonClick(constInfo.Kon)
  955. elif arg == 3:
  956. self.ShowBeltGui(self.marmury)
  957. elif arg == 4:
  958. constInfo.MarmuryIndex = 4
  959. event.QuestButtonClick(constInfo.Marmury)
  960. elif arg == 5:
  961. self.ShowBeltGui(self.zmianaeq)
  962. elif arg == 6:
  963. minimal = self.bs.Minimal()
  964. if self.bs.IsShow():
  965. if int(minimal) == 0:
  966. self.bs.Close()
  967. elif int(minimal) == 1 and self.bs.IsShow():
  968. self.bs.Hide()
  969. else:
  970. self.bs.Show()
  971. self.bs.SetTop()
  972. elif arg == 7:
  973. self.ShowBeltGui(self.wiki)
  974. elif arg == 8 or arg == 9:
  975. vnum = self.PotionId(arg+2)
  976. item.SelectItem(vnum)
  977. if player.GetItemCountByVnum(int(vnum)) <= 0:
  978. chat.AppendChat(chat.CHAT_TYPE_INFO, "[Autopot] - Nie posiadasz: %s" % item.GetItemName())
  979. else:
  980. if arg == 8:
  981. if constInfo.Potred==0:
  982. constInfo.Potred=1
  983. self.save_pots(1,1)
  984. else:
  985. constInfo.Potred=0
  986. self.save_pots(1,0)
  987. elif arg == 9:
  988. if constInfo.Potblue==0:
  989. constInfo.Potblue=1
  990. self.save_pots(2,1)
  991. else:
  992. constInfo.Potblue=0
  993. self.save_pots(2,0)
  994. self.show_tooltip(arg)
  995.  
  996. elif arg == 10:
  997. self.ShowBeltGui(self.wspomagacze)
  998.  
  999. def show_tooltip(self, arg):
  1000. buttons_tooltip = [
  1001. [localeInfo.btn_TP],
  1002. [localeInfo.btn_SHOP],
  1003. [localeInfo.btn_HORSE],
  1004. [localeInfo.btn_BYTPOLLY],
  1005. [localeInfo.btn_REMOVEPOLLY],
  1006. [localeInfo.btn_CHANGEEQ],
  1007. [localeInfo.btn_BS],
  1008. [localeInfo.btn_INFODROP],
  1009. [localeInfo.btn_AUTOPOT1],
  1010. [localeInfo.btn_AUTOPOT2],
  1011. [localeInfo.btn_AUTOITEMS]
  1012. ]
  1013. self.toolTip.ClearToolTip()
  1014. if arg != 40:
  1015. name_tooltip_1 = buttons_tooltip[arg][0]
  1016. self.toolTip.SetTitle(name_tooltip_1)
  1017. if arg == 8 or arg == 9:
  1018. potion=self.PotionId(arg)
  1019. self.toolTip.AppendSpace(5)
  1020. if potion == 1:
  1021. self.toolTip.AppendTextLine(uiScriptLocale.potions_on)
  1022. else:
  1023. self.toolTip.AppendTextLine(uiScriptLocale.potions_off)
  1024. elif arg == 10:
  1025. self.toolTip.AppendSpace(5)
  1026. self.toolTip.AppendTextLine(uiScriptLocale.TIP_INVE1)
  1027. self.toolTip.SetTextGift(uiScriptLocale.TIP_INVE2)
  1028. elif arg == 40:
  1029. self.toolTip.SetTitle(uiScriptLocale.TIP_INVE3)
  1030. self.toolTip.AppendSpace(5)
  1031. self.toolTip.AppendTextLine(uiScriptLocale.TIP_INVE4)
  1032. self.toolTip.SetTextGift(uiScriptLocale.TIP_INVE5)
  1033. self.toolTip.SetTextGift(uiScriptLocale.TIP_INVE6)
  1034. self.toolTip.AppendTextLine(uiScriptLocale.TIP_INVE9,0xffffe3ad)
  1035. self.toolTip.AppendSpace(2)
  1036. self.toolTip.SetTextGift(uiScriptLocale.TIP_INVE7)
  1037. self.toolTip.SetTextGift(uiScriptLocale.TIP_INVE8)
  1038.  
  1039. self.toolTip.Show()
  1040.  
  1041. def hide_tooltip(self):
  1042. self.toolTip.Hide()
  1043.  
  1044. def OnPickMoney(self, money):
  1045. mouseModule.mouseController.AttachMoney(self, player.SLOT_TYPE_INVENTORY, money)
  1046.  
  1047. def OnPickItem(self, count):
  1048. itemSlotIndex = self.dlgPickMoney.itemGlobalSlotIndex
  1049. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1050. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, count)
  1051.  
  1052. def __InventoryLocalSlotPosToGlobalSlotPos(self, local):
  1053.  
  1054. if player.IsEquipmentSlot(local) or player.IsCostumeSlot(local):
  1055. return local
  1056.  
  1057. return self.inventoryPageIndex*player.INVENTORY_PAGE_SIZE + local
  1058.  
  1059. def RefreshBagSlotWindow(self):
  1060. getItemVNum=player.GetItemIndex
  1061. getItemCount=player.GetItemCount
  1062. setItemVNum=self.wndItem.SetItemSlot
  1063.  
  1064. for i in xrange(player.INVENTORY_PAGE_SIZE):
  1065. slotNumber = self.__InventoryLocalSlotPosToGlobalSlotPos(i)
  1066.  
  1067. itemCount = getItemCount(slotNumber)
  1068.  
  1069. if 0 == itemCount:
  1070. self.wndItem.ClearSlot(i)
  1071. continue
  1072. elif 1 == itemCount:
  1073. itemCount = 0
  1074.  
  1075. itemVnum = getItemVNum(slotNumber)
  1076. setItemVNum(i, itemVnum, itemCount)
  1077.  
  1078. if constInfo.IS_AUTO_POTION(itemVnum):
  1079. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1080.  
  1081. if slotNumber >= player.INVENTORY_PAGE_SIZE:
  1082. slotNumber -= player.INVENTORY_PAGE_SIZE
  1083.  
  1084. isActivated = 0 != metinSocket[0]
  1085.  
  1086. if isActivated:
  1087. self.wndItem.ActivateSlot(slotNumber)
  1088. potionType = 0;
  1089. if constInfo.IS_AUTO_POTION_HP(itemVnum):
  1090. potionType = player.AUTO_POTION_TYPE_HP
  1091. elif constInfo.IS_AUTO_POTION_SP(itemVnum):
  1092. potionType = player.AUTO_POTION_TYPE_SP
  1093.  
  1094. usedAmount = int(metinSocket[1])
  1095. totalAmount = int(metinSocket[2])
  1096. player.SetAutoPotionInfo(potionType, isActivated, (totalAmount - usedAmount), totalAmount, self.__InventoryLocalSlotPosToGlobalSlotPos(i))
  1097.  
  1098. else:
  1099. self.wndItem.DeactivateSlot(slotNumber)
  1100.  
  1101. elif itemVnum >= 54001 and itemVnum < 54012:
  1102. metinSocket = [player.GetItemMetinSocket(slotNumber, j) for j in xrange(player.METIN_SOCKET_MAX_NUM)]
  1103. isActivated = 0 != metinSocket[1]
  1104. if isActivated:
  1105. self.wndItem.ActivateSlot(i, (181.00 / 255.0), (113.00 / 255.0), (21.00 / 255.0), 1.0)
  1106. else:
  1107. self.wndItem.DeactivateSlot(i)
  1108.  
  1109. self.wndItem.RefreshSlot()
  1110.  
  1111. def RefreshEquipSlotWindow(self):
  1112. getItemVNum=player.GetItemIndex
  1113. getItemCount=player.GetItemCount
  1114. setItemVNum=self.wndEquip.SetItemSlot
  1115. for i in xrange(player.EQUIPMENT_PAGE_COUNT):
  1116. slotNumber = player.EQUIPMENT_SLOT_START + i
  1117. itemCount = getItemCount(slotNumber)
  1118. if itemCount <= 1:
  1119. itemCount = 0
  1120. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1121.  
  1122. if app.ENABLE_NEW_EQUIPMENT_SYSTEM:
  1123. for i in xrange(player.NEW_EQUIPMENT_SLOT_COUNT):
  1124. slotNumber = player.NEW_EQUIPMENT_SLOT_START + i
  1125. itemCount = getItemCount(slotNumber)
  1126. if itemCount <= 1:
  1127. itemCount = 0
  1128. setItemVNum(slotNumber, getItemVNum(slotNumber), itemCount)
  1129. print "ENABLE_NEW_EQUIPMENT_SYSTEM", slotNumber, itemCount, getItemVNum(slotNumber)
  1130.  
  1131.  
  1132. self.wndEquip.RefreshSlot()
  1133.  
  1134. if self.wndCostume:
  1135. self.wndCostume.RefreshCostumeSlot()
  1136.  
  1137. if self.wndPet:
  1138. self.wndPet.SetSlots()
  1139.  
  1140. def RefreshItemSlot(self):
  1141. self.RefreshBagSlotWindow()
  1142. self.RefreshEquipSlotWindow()
  1143.  
  1144. def RefreshStatus(self):
  1145. money = player.GetElk()
  1146. self.wndMoney.SetText(localeInfo.NumberToMoneyString(money))
  1147.  
  1148. def SetItemToolTip(self, tooltipItem):
  1149. self.tooltipItem = tooltipItem
  1150.  
  1151. def SellItem(self):
  1152. net.SendShopSellPacketNew(self.sellingSlotNumber, self.questionDialog.count)
  1153. snd.PlaySound("sound/ui/money.wav")
  1154. self.OnCloseQuestionDialog()
  1155.  
  1156. def OnDetachMetinFromItem(self):
  1157. if None == self.questionDialog:
  1158. return
  1159.  
  1160. #net.SendItemUseToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1161. self.__SendUseItemToItemPacket(self.questionDialog.sourcePos, self.questionDialog.targetPos)
  1162. self.OnCloseQuestionDialog()
  1163.  
  1164. def OnCloseQuestionDialog(self):
  1165. if self.questionDialog:
  1166. self.questionDialog.Close()
  1167.  
  1168. self.questionDialog = None
  1169.  
  1170. ## Slot Event
  1171. def SelectEmptySlot(self, selectedSlotPos):
  1172. selectedSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(selectedSlotPos)
  1173. if self.CheckBs(selectedSlotPos) == True:
  1174. chat.AppendChat(chat.CHAT_TYPE_INFO, uiScriptLocale.bs33)
  1175. mouseModule.mouseController.DeattachObject()
  1176. return
  1177.  
  1178. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
  1179. return
  1180.  
  1181. if mouseModule.mouseController.isAttached():
  1182.  
  1183. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1184. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1185. attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
  1186. attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
  1187.  
  1188. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1189. itemCount = player.GetItemCount(attachedSlotPos)
  1190. attachedCount = mouseModule.mouseController.GetAttachedItemCount()
  1191. self.__SendMoveItemPacket(attachedSlotPos, selectedSlotPos, attachedCount)
  1192.  
  1193. if item.IsRefineScroll(attachedItemIndex):
  1194. self.wndItem.SetUseMode(False)
  1195.  
  1196. elif player.SLOT_TYPE_PRIVATE_SHOP == attachedSlotType:
  1197. mouseModule.mouseController.RunCallBack("INVENTORY")
  1198.  
  1199. elif player.SLOT_TYPE_SHOP == attachedSlotType:
  1200. net.SendShopBuyPacket(attachedSlotPos)
  1201.  
  1202. elif player.SLOT_TYPE_SAFEBOX == attachedSlotType:
  1203.  
  1204. if player.ITEM_MONEY == attachedItemIndex:
  1205. net.SendSafeboxWithdrawMoneyPacket(mouseModule.mouseController.GetAttachedItemCount())
  1206. snd.PlaySound("sound/ui/money.wav")
  1207.  
  1208. else:
  1209. net.SendSafeboxCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1210.  
  1211. elif player.SLOT_TYPE_MALL == attachedSlotType:
  1212. net.SendMallCheckoutPacket(attachedSlotPos, selectedSlotPos)
  1213.  
  1214. mouseModule.mouseController.DeattachObject()
  1215.  
  1216. def SelectItemSlot(self, itemSlotIndex):
  1217. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
  1218. return
  1219.  
  1220. itemSlotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(itemSlotIndex)
  1221.  
  1222. if self.CheckBs(itemSlotIndex) == True:
  1223. chat.AppendChat(chat.CHAT_TYPE_INFO, uiScriptLocale.bs33)
  1224. mouseModule.mouseController.DeattachObject()
  1225. return
  1226.  
  1227. if mouseModule.mouseController.isAttached():
  1228. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  1229. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1230. attachedItemVID = mouseModule.mouseController.GetAttachedItemIndex()
  1231.  
  1232. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  1233. self.__DropSrcItemToDestItemInInventory(attachedItemVID, attachedSlotPos, itemSlotIndex)
  1234.  
  1235. mouseModule.mouseController.DeattachObject()
  1236.  
  1237. else:
  1238.  
  1239. curCursorNum = app.GetCursor()
  1240. if app.SELL == curCursorNum:
  1241. self.__SellItem(itemSlotIndex)
  1242.  
  1243. elif app.BUY == curCursorNum:
  1244. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.SHOP_BUY_INFO)
  1245.  
  1246. elif app.IsPressed(app.DIK_LALT):
  1247. link = player.GetItemLink(itemSlotIndex)
  1248. ime.PasteString(link)
  1249.  
  1250. elif app.IsPressed(app.DIK_LSHIFT):
  1251. itemCount = player.GetItemCount(itemSlotIndex)
  1252.  
  1253. if itemCount > 1:
  1254. self.dlgPickMoney.SetTitleName(localeInfo.PICK_ITEM_TITLE)
  1255. self.dlgPickMoney.SetAcceptEvent(ui.__mem_func__(self.OnPickItem))
  1256. self.dlgPickMoney.Open(itemCount)
  1257. self.dlgPickMoney.itemGlobalSlotIndex = itemSlotIndex
  1258. #else:
  1259. #selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1260. #mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum)
  1261.  
  1262. elif app.IsPressed(app.DIK_LCONTROL):
  1263. itemIndex = player.GetItemIndex(itemSlotIndex)
  1264.  
  1265. if True == item.CanAddToQuickSlotItem(itemIndex):
  1266. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_INVENTORY, itemSlotIndex)
  1267. else:
  1268. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.QUICKSLOT_REGISTER_DISABLE_ITEM)
  1269.  
  1270. else:
  1271. selectedItemVNum = player.GetItemIndex(itemSlotIndex)
  1272. itemCount = player.GetItemCount(itemSlotIndex)
  1273. mouseModule.mouseController.AttachObject(self, player.SLOT_TYPE_INVENTORY, itemSlotIndex, selectedItemVNum, itemCount)
  1274.  
  1275. if self.__IsUsableItemToItem(selectedItemVNum, itemSlotIndex):
  1276. self.wndItem.SetUseMode(True)
  1277. else:
  1278. self.wndItem.SetUseMode(False)
  1279.  
  1280. snd.PlaySound("sound/ui/pick.wav")
  1281.  
  1282. def __DropSrcItemToDestItemInInventory(self, srcItemVID, srcItemSlotPos, dstItemSlotPos):
  1283. if srcItemSlotPos == dstItemSlotPos:
  1284. return
  1285.  
  1286. if item.IsRefineScroll(srcItemVID):
  1287. self.RefineItem(srcItemSlotPos, dstItemSlotPos)
  1288. self.wndItem.SetUseMode(False)
  1289.  
  1290. elif item.IsMetin(srcItemVID):
  1291. self.AttachMetinToItem(srcItemSlotPos, dstItemSlotPos)
  1292.  
  1293. elif item.IsDetachScroll(srcItemVID):
  1294. self.DetachMetinFromItem(srcItemSlotPos, dstItemSlotPos)
  1295.  
  1296. elif item.IsKey(srcItemVID):
  1297. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1298.  
  1299. elif (player.GetItemFlags(srcItemSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1300. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1301.  
  1302. elif item.GetUseType(srcItemVID) in self.USE_TYPE_TUPLE:
  1303. self.__SendUseItemToItemPacket(srcItemSlotPos, dstItemSlotPos)
  1304.  
  1305. else:
  1306. #snd.PlaySound("sound/ui/drop.wav")
  1307.  
  1308. ##
  1309. if player.IsEquipmentSlot(dstItemSlotPos):
  1310.  
  1311. ##
  1312. if item.IsEquipmentVID(srcItemVID):
  1313. self.__UseItem(srcItemSlotPos)
  1314.  
  1315. else:
  1316. self.__SendMoveItemPacket(srcItemSlotPos, dstItemSlotPos, 0)
  1317. #net.SendItemMovePacket(srcItemSlotPos, dstItemSlotPos, 0)
  1318.  
  1319. def __SellItem(self, itemSlotPos):
  1320. if not player.IsEquipmentSlot(itemSlotPos):
  1321. self.sellingSlotNumber = itemSlotPos
  1322. itemIndex = player.GetItemIndex(itemSlotPos)
  1323. itemCount = player.GetItemCount(itemSlotPos)
  1324.  
  1325. item.SelectItem(itemIndex)
  1326. itemPrice = item.GetISellItemPrice()
  1327.  
  1328. if item.Is1GoldItem():
  1329. itemPrice = itemCount / itemPrice / 5
  1330. else:
  1331. itemPrice = itemPrice * itemCount / 5
  1332.  
  1333. item.GetItemName(itemIndex)
  1334. itemName = item.GetItemName()
  1335.  
  1336. self.questionDialog = uiCommon.QuestionDialog()
  1337. self.questionDialog.SetText(localeInfo.DO_YOU_SELL_ITEM(itemName, itemCount, itemPrice))
  1338. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.SellItem))
  1339. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.OnCloseQuestionDialog))
  1340. self.questionDialog.Open()
  1341. self.questionDialog.count = itemCount
  1342.  
  1343. def RefineItem(self, scrollSlotPos, targetSlotPos):
  1344.  
  1345. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1346. targetIndex = player.GetItemIndex(targetSlotPos)
  1347.  
  1348. if player.REFINE_OK != player.CanRefine(scrollIndex, targetSlotPos):
  1349. return
  1350.  
  1351. ###########################################################
  1352. self.__SendUseItemToItemPacket(scrollSlotPos, targetSlotPos)
  1353. #net.SendItemUseToItemPacket(scrollSlotPos, targetSlotPos)
  1354. return
  1355. ###########################################################
  1356.  
  1357. ###########################################################
  1358. #net.SendRequestRefineInfoPacket(targetSlotPos)
  1359. #return
  1360. ###########################################################
  1361.  
  1362. result = player.CanRefine(scrollIndex, targetSlotPos)
  1363.  
  1364. if player.REFINE_ALREADY_MAX_SOCKET_COUNT == result:
  1365. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1366. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_MORE_SOCKET)
  1367.  
  1368. elif player.REFINE_NEED_MORE_GOOD_SCROLL == result:
  1369. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1370. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NEED_BETTER_SCROLL)
  1371.  
  1372. elif player.REFINE_CANT_MAKE_SOCKET_ITEM == result:
  1373. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1374. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_SOCKET_DISABLE_ITEM)
  1375.  
  1376. elif player.REFINE_NOT_NEXT_GRADE_ITEM == result:
  1377. #snd.PlaySound("sound/ui/jaeryun_fail.wav")
  1378. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_UPGRADE_DISABLE_ITEM)
  1379.  
  1380. elif player.REFINE_CANT_REFINE_METIN_TO_EQUIPMENT == result:
  1381. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1382.  
  1383. if player.REFINE_OK != result:
  1384. return
  1385.  
  1386. self.refineDialog.Open(scrollSlotPos, targetSlotPos)
  1387.  
  1388. def DetachMetinFromItem(self, scrollSlotPos, targetSlotPos):
  1389. scrollIndex = player.GetItemIndex(scrollSlotPos)
  1390. targetIndex = player.GetItemIndex(targetSlotPos)
  1391.  
  1392. if not (targetSlotPos >= 0 and targetSlotPos <= 224):
  1393. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM_EQ)
  1394. return
  1395.  
  1396. if not player.CanDetach(scrollIndex, targetSlotPos):
  1397. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_METIN_INSEPARABLE_ITEM)
  1398. return
  1399.  
  1400. constInfo.WyciaganieKdSlotEq=targetSlotPos
  1401. itemVnum = player.GetItemIndex(constInfo.WyciaganieKdSlotEq)
  1402. constInfo.WyciaganieKdVnum=itemVnum
  1403.  
  1404. if self.wyciaganiekd.IsShow():
  1405. pass
  1406. else:
  1407. self.wyciaganiekd.Show()
  1408.  
  1409. def AttachMetinToItem(self, metinSlotPos, targetSlotPos):
  1410. metinIndex = player.GetItemIndex(metinSlotPos)
  1411. targetIndex = player.GetItemIndex(targetSlotPos)
  1412.  
  1413. item.SelectItem(metinIndex)
  1414. itemName = item.GetItemName()
  1415.  
  1416. result = player.CanAttachMetin(metinIndex, targetSlotPos)
  1417.  
  1418. if player.ATTACH_METIN_NOT_MATCHABLE_ITEM == result:
  1419. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_CAN_NOT_ATTACH(itemName))
  1420.  
  1421. if player.ATTACH_METIN_NO_MATCHABLE_SOCKET == result:
  1422. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_SOCKET(itemName))
  1423.  
  1424. elif player.ATTACH_METIN_NOT_EXIST_GOLD_SOCKET == result:
  1425. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_NO_GOLD_SOCKET(itemName))
  1426.  
  1427. elif player.ATTACH_METIN_CANT_ATTACH_TO_EQUIPMENT == result:
  1428. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.REFINE_FAILURE_EQUIP_ITEM)
  1429.  
  1430. if player.ATTACH_METIN_OK != result:
  1431. return
  1432.  
  1433. self.attachMetinDialog.Open(metinSlotPos, targetSlotPos)
  1434.  
  1435. def OverOutItem(self):
  1436. self.wndItem.SetUsableItem(False)
  1437. if None != self.tooltipItem:
  1438. self.tooltipItem.HideToolTip()
  1439.  
  1440. def OverInItem(self, overSlotPos):
  1441. overSlotPos = self.__InventoryLocalSlotPosToGlobalSlotPos(overSlotPos)
  1442. self.wndItem.SetUsableItem(False)
  1443.  
  1444. if mouseModule.mouseController.isAttached():
  1445. attachedItemType = mouseModule.mouseController.GetAttachedType()
  1446. if player.SLOT_TYPE_INVENTORY == attachedItemType:
  1447.  
  1448. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  1449. attachedItemVNum = mouseModule.mouseController.GetAttachedItemIndex()
  1450.  
  1451. if self.__CanUseSrcItemToDstItem(attachedItemVNum, attachedSlotPos, overSlotPos):
  1452. self.wndItem.SetUsableItem(True)
  1453. self.ShowToolTip(overSlotPos)
  1454. return
  1455.  
  1456. self.ShowToolTip(overSlotPos)
  1457.  
  1458.  
  1459. def __IsUsableItemToItem(self, srcItemVNum, srcSlotPos):
  1460.  
  1461. if item.IsRefineScroll(srcItemVNum):
  1462. return True
  1463. elif item.IsMetin(srcItemVNum):
  1464. return True
  1465. elif item.IsDetachScroll(srcItemVNum):
  1466. return True
  1467. elif item.IsKey(srcItemVNum):
  1468. return True
  1469. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1470. return True
  1471. else:
  1472. if item.GetUseType(srcItemVNum) in self.USE_TYPE_TUPLE:
  1473. return True
  1474.  
  1475. return False
  1476.  
  1477. def __CanUseSrcItemToDstItem(self, srcItemVNum, srcSlotPos, dstSlotPos):
  1478.  
  1479. if srcSlotPos == dstSlotPos:
  1480. return False
  1481.  
  1482. if item.IsMetin(player.GetItemIndex(srcSlotPos)):
  1483. return False
  1484.  
  1485. if item.IsRefineScroll(srcItemVNum):
  1486. if player.REFINE_OK == player.CanRefine(srcItemVNum, dstSlotPos):
  1487. return True
  1488. elif item.IsMetin(srcItemVNum):
  1489. if player.ATTACH_METIN_OK == player.CanAttachMetin(srcItemVNum, dstSlotPos):
  1490. return True
  1491. elif item.IsDetachScroll(srcItemVNum):
  1492. if player.DETACH_METIN_OK == player.CanDetach(srcItemVNum, dstSlotPos):
  1493. return True
  1494. elif item.IsKey(srcItemVNum):
  1495. if player.CanUnlock(srcItemVNum, dstSlotPos):
  1496. return True
  1497.  
  1498. elif (player.GetItemFlags(srcSlotPos) & ITEM_FLAG_APPLICABLE) == ITEM_FLAG_APPLICABLE:
  1499. return True
  1500.  
  1501. else:
  1502. useType=item.GetUseType(srcItemVNum)
  1503.  
  1504. if "USE_CLEAN_SOCKET" == useType:
  1505. if self.__CanCleanBrokenMetinStone(dstSlotPos):
  1506. return True
  1507. elif "USE_CHANGE_ATTRIBUTE" == useType:
  1508. if self.__CanChangeItemAttrList(dstSlotPos):
  1509. return True
  1510. elif "USE_ADD_ATTRIBUTE" == useType:
  1511. i_vnum = player.GetItemIndex(srcSlotPos)
  1512. if i_vnum == 98001 or i_vnum == 98002:
  1513. if self.__CanAddItemAttrIs(dstSlotPos):
  1514. return True
  1515. else:
  1516. if self.__CanAddItemAttr(dstSlotPos):
  1517. return True
  1518. elif "USE_ADD_ATTRIBUTE2" == useType:
  1519. if self.__CanAddItemAttr(dstSlotPos):
  1520. return True
  1521. elif "USE_ADD_ACCESSORY_SOCKET" == useType:
  1522. if self.__CanAddAccessorySocket(dstSlotPos):
  1523. return True
  1524. elif "USE_PUT_INTO_ACCESSORY_SOCKET" == useType:
  1525. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1526. if self.__CanPutAccessorySocket(dstSlotPos, srcItemVNum):
  1527. return True;
  1528.  
  1529. item.SelectItem(dstItemVNum)
  1530.  
  1531. return False
  1532.  
  1533. def __CanCleanBrokenMetinStone(self, dstSlotPos):
  1534. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1535. if dstItemVNum == 0:
  1536. return False
  1537.  
  1538. item.SelectItem(dstItemVNum)
  1539.  
  1540. if item.ITEM_TYPE_WEAPON != item.GetItemType():
  1541. return False
  1542.  
  1543. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1544. if player.GetItemMetinSocket(dstSlotPos, i) == constInfo.ERROR_METIN_STONE:
  1545. return True
  1546.  
  1547. return False
  1548.  
  1549. def __CanChangeItemAttrList(self, dstSlotPos):
  1550. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1551. if dstItemVNum == 0:
  1552. return False
  1553.  
  1554. item.SelectItem(dstItemVNum)
  1555.  
  1556. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1557. return False
  1558.  
  1559. attrCount = 0
  1560. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1561. id, value = player.GetItemAttribute(dstSlotPos, i)
  1562. if id != 0:
  1563. attrCount += 1
  1564.  
  1565. if attrCount!=0:
  1566. return True
  1567.  
  1568. return False
  1569.  
  1570. def __CanPutAccessorySocket(self, dstSlotPos, mtrlVnum):
  1571. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1572. if dstItemVNum == 0:
  1573. return False
  1574.  
  1575. item.SelectItem(dstItemVNum)
  1576.  
  1577. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1578. return False
  1579.  
  1580. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1581. return False
  1582.  
  1583. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1584. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1585.  
  1586. if mtrlVnum != constInfo.GET_ACCESSORY_MATERIAL_VNUM(dstItemVNum, item.GetItemSubType()):
  1587. return False
  1588.  
  1589. if curCount>=maxCount:
  1590. return False
  1591.  
  1592. return True
  1593.  
  1594. def __CanAddAccessorySocket(self, dstSlotPos):
  1595. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1596. if dstItemVNum == 0:
  1597. return False
  1598.  
  1599. item.SelectItem(dstItemVNum)
  1600.  
  1601. if item.GetItemType() != item.ITEM_TYPE_ARMOR:
  1602. return False
  1603.  
  1604. if not item.GetItemSubType() in (item.ARMOR_WRIST, item.ARMOR_NECK, item.ARMOR_EAR):
  1605. return False
  1606.  
  1607. curCount = player.GetItemMetinSocket(dstSlotPos, 0)
  1608. maxCount = player.GetItemMetinSocket(dstSlotPos, 1)
  1609.  
  1610. ACCESSORY_SOCKET_MAX_SIZE = 3
  1611. if maxCount >= ACCESSORY_SOCKET_MAX_SIZE:
  1612. return False
  1613.  
  1614. return True
  1615.  
  1616. #sielu
  1617. def __CanAddItemAttr(self, dstSlotPos):
  1618. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1619. if dstItemVNum == 0:
  1620. return False
  1621.  
  1622. item.SelectItem(dstItemVNum)
  1623.  
  1624. if not item.GetItemType() in (item.ITEM_TYPE_WEAPON, item.ITEM_TYPE_ARMOR):
  1625. return False
  1626.  
  1627. attrCount = 0
  1628. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1629. id, value = player.GetItemAttribute(dstSlotPos, i)
  1630. if id != 0:
  1631. attrCount += 1
  1632.  
  1633. if attrCount<5:
  1634. return True
  1635.  
  1636. return False
  1637.  
  1638. def __CanAddItemAttrIs(self, dstSlotPos):
  1639. dstItemVNum = player.GetItemIndex(dstSlotPos)
  1640. if dstItemVNum == 0:
  1641. return False
  1642.  
  1643. item.SelectItem(dstItemVNum)
  1644.  
  1645. if not item.GetItemType() == item.ITEM_TYPE_COSTUME:
  1646. return False
  1647.  
  1648. attrCount = 0
  1649. for i in xrange(player.METIN_SOCKET_MAX_NUM):
  1650. id, value = player.GetItemAttribute(dstSlotPos, i)
  1651. if id != 0:
  1652. attrCount += 1
  1653.  
  1654. if attrCount==0:
  1655. return True
  1656.  
  1657. return False
  1658.  
  1659. def ShowToolTip(self, slotIndex):
  1660. if None != self.tooltipItem:
  1661. self.tooltipItem.SetInventoryItem(slotIndex)
  1662.  
  1663. def OnTop(self):
  1664. if None != self.tooltipItem:
  1665. self.tooltipItem.SetTop()
  1666.  
  1667. def OnPressEscapeKey(self):
  1668. self.Close()
  1669. return True
  1670.  
  1671. def UseItemSlot(self, slotIndex):
  1672. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS():
  1673. return
  1674.  
  1675. slotIndex = self.__InventoryLocalSlotPosToGlobalSlotPos(slotIndex)
  1676.  
  1677. self.__UseItem(slotIndex)
  1678. mouseModule.mouseController.DeattachObject()
  1679. self.OverOutItem()
  1680.  
  1681. def __UseItem(self, slotIndex):
  1682. ItemVNum = player.GetItemIndex(slotIndex)
  1683. item.SelectItem(ItemVNum)
  1684. if item.IsFlag(item.ITEM_FLAG_CONFIRM_WHEN_USE):
  1685. self.questionDialog = uiCommon.QuestionDialog()
  1686. self.questionDialog.SetText(localeInfo.INVENTORY_REALLY_USE_ITEM)
  1687. self.questionDialog.SetAcceptEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnAccept))
  1688. self.questionDialog.SetCancelEvent(ui.__mem_func__(self.__UseItemQuestionDialog_OnCancel))
  1689. self.questionDialog.Open()
  1690. self.questionDialog.slotIndex = slotIndex
  1691.  
  1692. else:
  1693. self.__SendUseItemPacket(slotIndex)
  1694. #net.SendItemUsePacket(slotIndex)
  1695.  
  1696. def __UseItemQuestionDialog_OnCancel(self):
  1697. self.OnCloseQuestionDialog()
  1698.  
  1699. def __UseItemQuestionDialog_OnAccept(self):
  1700. self.__SendUseItemPacket(self.questionDialog.slotIndex)
  1701.  
  1702. if self.questionDialog:
  1703. self.questionDialog.Close()
  1704. self.questionDialog = None
  1705.  
  1706. def __SendUseItemToItemPacket(self, srcSlotPos, dstSlotPos):
  1707. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1708. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1709. return
  1710.  
  1711. if self.CheckBs(srcSlotPos) == True:
  1712. chat.AppendChat(chat.CHAT_TYPE_INFO, uiScriptLocale.bs33)
  1713. return
  1714.  
  1715. net.SendItemUseToItemPacket(srcSlotPos, dstSlotPos)
  1716.  
  1717. def __SendUseItemPacket(self, slotPos):
  1718. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1719. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.USE_ITEM_FAILURE_PRIVATE_SHOP)
  1720. return
  1721.  
  1722. if self.CheckBs(slotPos) == True:
  1723. chat.AppendChat(chat.CHAT_TYPE_INFO, uiScriptLocale.bs33)
  1724. return
  1725.  
  1726. net.SendItemUsePacket(slotPos)
  1727.  
  1728. def __SendMoveItemPacket(self, srcSlotPos, dstSlotPos, srcItemCount):
  1729. if uiPrivateShopBuilder.IsBuildingPrivateShop():
  1730. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.MOVE_ITEM_FAILURE_PRIVATE_SHOP)
  1731. return
  1732.  
  1733. if self.CheckBs(srcSlotPos) == True:
  1734. chat.AppendChat(chat.CHAT_TYPE_INFO, uiScriptLocale.bs33)
  1735. return
  1736.  
  1737. net.SendItemMovePacket(srcSlotPos, dstSlotPos, srcItemCount)
  1738.  
  1739. def CheckBs(self, srcSlotPos):
  1740. for i in xrange(0,15):
  1741. if int(self.bs_tab[i]['slot']) == srcSlotPos and int(self.bs_tab[i]['vnum']) != 0:
  1742. return True
  1743. return False
Advertisement
Add Comment
Please, Sign In to add comment