1. uiprivateshopbuilder.py
  2. ##############
  3. import ui
  4. import snd
  5. import shop
  6. import mouseModule
  7. import player
  8. import chr
  9. import net
  10. import uiCommon
  11. import localeInfo
  12. import chat
  13. import item
  14. import systemSetting #±čÁŘČŁ
  15. import player #±čÁŘČŁ
  16. import constInfo
  17. import app
  18. import os
  19. ##### DISABLE/ENABLE SHOP VISIT COLOR ###
  20. SHOP_VISIT=TRUE
  21. ##### SHOP VISIT COLOR #####
  22. SHOP_VISIT_COLOR=0xFF00C8FF
  23. ###########################
  24. g_isBuildingPrivateShop = FALSE
  25. g_itemPriceDict={}
  26. g_privateShopAdvertisementBoardDict={}
  27. def GetShopNamesRange():
  28. val=1.0
  29. try:
  30. with open("shop.cfg", 'r') as f:
  31. val=float(f.read().replace('\n', ''))
  32. except IOError:
  33. pass
  34. return float(val)
  35. def SetShopNamesRange(pos):
  36. with open("shop.cfg", 'w+') as f:
  37. f.write(str(pos))
  38. f.close()
  39. def Clear():
  40. global g_itemPriceDict
  41. global g_isBuildingPrivateShop
  42. g_itemPriceDict={}
  43. g_isBuildingPrivateShop = FALSE
  44. def IsPrivateShopItemPriceList():
  45. global g_itemPriceDict
  46. if g_itemPriceDict:
  47. return TRUE
  48. else:
  49. return FALSE
  50. def IsBuildingPrivateShop():
  51. global g_isBuildingPrivateShop
  52. if player.IsOpenPrivateShop() or g_isBuildingPrivateShop:
  53. return TRUE
  54. else:
  55. return FALSE
  56. def SetPrivateShopItemPrice(itemVNum, itemPrice):
  57. global g_itemPriceDict
  58. g_itemPriceDict[int(itemVNum)]=itemPrice
  59. def GetPrivateShopItemPrice(itemVNum):
  60. try:
  61. global g_itemPriceDict
  62. return g_itemPriceDict[itemVNum]
  63. except KeyError:
  64. return 0
  65. def UpdateADBoard():
  66. for key in g_privateShopAdvertisementBoardDict.keys():
  67. g_privateShopAdvertisementBoardDict[key].Show()
  68. def DeleteADBoard(vid):
  69. if not g_privateShopAdvertisementBoardDict.has_key(vid):
  70. return
  71. del g_privateShopAdvertisementBoardDict[vid]
  72. class PrivateShopAdvertisementBoard(ui.ThinBoard):
  73. def __init__(self):
  74. ui.ThinBoard.__init__(self, "UI_BOTTOM")
  75. self.shopAdvertismentBoardSeen = []
  76. self.vid = None
  77. self.__MakeTextLine()
  78. def __del__(self):
  79. ui.ThinBoard.__del__(self)
  80. def __MakeTextLine(self):
  81. self.textLine = ui.TextLine()
  82. self.textLine.SetParent(self)
  83. self.textLine.SetWindowHorizontalAlignCenter()
  84. self.textLine.SetWindowVerticalAlignCenter()
  85. self.textLine.SetHorizontalAlignCenter()
  86. self.textLine.SetVerticalAlignCenter()
  87. self.textLine.Show()
  88. def Open(self, vid, text):
  89. self.vid = vid
  90. self.textLine.SetText(text)
  91. if vid in self.shopAdvertismentBoardSeen:
  92. self.textLine.SetPackedFontColor(SHOP_VISIT_COLOR)
  93. self.textLine.UpdateRect()
  94. self.SetSize(len(text)*6 + 10*2, 20)
  95. self.Show()
  96. g_privateShopAdvertisementBoardDict[vid] = self
  97. def OnMouseLeftButtonUp(self):
  98. if not self.vid:
  99. return
  100. net.SendOnClickPacket(self.vid)
  101. if self.vid != player.GetMainCharacterIndex():
  102. self.textLine.SetPackedFontColor(SHOP_VISIT_COLOR)
  103. self.shopAdvertismentBoardSeen.append(self.vid)
  104. return TRUE
  105. def OnUpdate(self):
  106. if not self.vid:
  107. return
  108. if systemSetting.IsShowSalesText():
  109. for key in g_privateShopAdvertisementBoardDict.keys():
  110. if player.GetMainCharacterIndex() == key:
  111. g_privateShopAdvertisementBoardDict[key].Show()
  112. x, y = chr.GetProjectPosition(player.GetMainCharacterIndex(), 220)
  113. g_privateShopAdvertisementBoardDict[key].SetPosition(x - self.GetWidth()/2, y - self.GetHeight()/2)
  114. else:
  115. g_privateShopAdvertisementBoardDict[key].Hide()
  116. class PrivateShopBuilder(ui.ScriptWindow):
  117. def __init__(self):
  118. ui.ScriptWindow.__init__(self)
  119. self.__LoadWindow()
  120. self.itemStock = {}
  121. self.tooltipItem = None
  122. self.priceInputBoard = None
  123. self.days = 0
  124. self.title = ""
  125. def __del__(self):
  126. ui.ScriptWindow.__del__(self)
  127. def __LoadWindow(self):
  128. try:
  129. pyScrLoader = ui.PythonScriptLoader()
  130. pyScrLoader.LoadScriptFile(self, "UIScript/PrivateShopBuilder.py")
  131. except:
  132. import exception
  133. exception.Abort("PrivateShopBuilderWindow.LoadWindow.LoadObject")
  134. try:
  135. GetObject = self.GetChild
  136. self.nameLine = GetObject("NameLine")
  137. self.itemSlot = GetObject("ItemSlot")
  138. self.btnOk = GetObject("OkButton")
  139. self.btnClose = GetObject("CloseButton")
  140. self.titleBar = GetObject("TitleBar")
  141. except:
  142. import exception
  143. exception.Abort("PrivateShopBuilderWindow.LoadWindow.BindObject")
  144. self.btnOk.SetEvent(ui.__mem_func__(self.OnOk))
  145. self.btnClose.SetEvent(ui.__mem_func__(self.OnClose))
  146. self.titleBar.SetCloseEvent(ui.__mem_func__(self.OnClose))
  147. self.itemSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
  148. self.itemSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
  149. self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
  150. self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
  151. def Destroy(self):
  152. self.ClearDictionary()
  153. self.nameLine = None
  154. self.itemSlot = None
  155. self.btnOk = None
  156. self.btnClose = None
  157. self.titleBar = None
  158. self.priceInputBoard = None
  159. def Open(self, title,days):
  160. self.days = days
  161. self.title = title
  162. if len(title) > 25:
  163. title = title[:22] + "..."
  164. self.itemStock = {}
  165. shop.ClearPrivateShopStock()
  166. self.nameLine.SetText(title)
  167. self.SetCenterPosition()
  168. self.Refresh()
  169. self.Show()
  170. global g_isBuildingPrivateShop
  171. g_isBuildingPrivateShop = TRUE
  172. def Close(self):
  173. global g_isBuildingPrivateShop
  174. g_isBuildingPrivateShop = FALSE
  175. self.title = ""
  176. self.itemStock = {}
  177. shop.ClearPrivateShopStock()
  178. self.Hide()
  179. def SetItemToolTip(self, tooltipItem):
  180. self.tooltipItem = tooltipItem
  181. def Refresh(self):
  182. getitemVNum=player.GetItemIndex
  183. getItemCount=player.GetItemCount
  184. setitemVNum=self.itemSlot.SetItemSlot
  185. delItem=self.itemSlot.ClearSlot
  186. for i in xrange(shop.SHOP_SLOT_COUNT):
  187. if not self.itemStock.has_key(i):
  188. delItem(i)
  189. continue
  190. pos = self.itemStock[i]
  191. itemCount = getItemCount(*pos)
  192. if itemCount <= 1:
  193. itemCount = 0
  194. setitemVNum(i, getitemVNum(*pos), itemCount)
  195. self.itemSlot.RefreshSlot()
  196. def ReadFilePrice(self,vnum,count):
  197. d = "shops"
  198. if not os.path.exists(d):
  199. os.makedirs(d)
  200. oldPrice=0
  201. n=d+"/"+str(vnum)+"_"+str(count)+".txt"
  202. if os.path.exists(n):
  203. fd = open( n,'r')
  204. oldPrice=int(fd.readlines()[0])
  205. return oldPrice
  206. def SaveFilePrice(self,vnum,count,price):
  207. d = "shops"
  208. if not os.path.exists(d):
  209. os.makedirs(d)
  210. n=d+"/"+str(vnum)+"_"+str(count)+".txt"
  211. f = file(n, "w+")
  212. f.write(str(price))
  213. f.close()
  214. def OnSelectEmptySlot(self, selectedSlotPos):
  215. isAttached = mouseModule.mouseController.isAttached()
  216. if isAttached:
  217. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  218. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  219. mouseModule.mouseController.DeattachObject()
  220. if player.SLOT_TYPE_INVENTORY != attachedSlotType and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedSlotType:
  221. return
  222. attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
  223. count = player.GetItemCount(attachedInvenType, attachedSlotPos)
  224. itemVNum = player.GetItemIndex(attachedInvenType, attachedSlotPos)
  225. item.SelectItem(itemVNum)
  226. if item.IsAntiFlag(item.ANTIFLAG_GIVE) or item.IsAntiFlag(item.ANTIFLAG_MYSHOP):
  227. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.PRIVATE_SHOP_CANNOT_SELL_ITEM)
  228. return
  229. priceInputBoard = uiCommon.MoneyInputDialog()
  230. priceInputBoard.SetTitle(localeInfo.PRIVATE_SHOP_INPUT_PRICE_DIALOG_TITLE)
  231. priceInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrice))
  232. priceInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrice))
  233. priceInputBoard.SetMaxLength(16)
  234. priceInputBoard.Open()
  235. itemPrice=self.ReadFilePrice(itemVNum,count)
  236. if itemPrice>0:
  237. priceInputBoard.SetValue(itemPrice)
  238. self.priceInputBoard = priceInputBoard
  239. self.priceInputBoard.itemVNum = itemVNum
  240. self.priceInputBoard.sourceWindowType = attachedInvenType
  241. self.priceInputBoard.sourceSlotPos = attachedSlotPos
  242. self.priceInputBoard.targetSlotPos = selectedSlotPos
  243. def OnSelectItemSlot(self, selectedSlotPos):
  244. isAttached = mouseModule.mouseController.isAttached()
  245. if isAttached:
  246. snd.PlaySound("sound/ui/loginfail.wav")
  247. mouseModule.mouseController.DeattachObject()
  248. else:
  249. if not selectedSlotPos in self.itemStock:
  250. return
  251. invenType, invenPos = self.itemStock[selectedSlotPos]
  252. shop.DelPrivateShopItemStock(invenType, invenPos)
  253. snd.PlaySound("sound/ui/drop.wav")
  254. del self.itemStock[selectedSlotPos]
  255. self.Refresh()
  256. def AcceptInputPrice(self):
  257. if not self.priceInputBoard:
  258. return TRUE
  259. text = self.priceInputBoard.GetText()
  260. if not text:
  261. return TRUE
  262. if not text.isdigit():
  263. return TRUE
  264. if int(text) <= 0:
  265. return TRUE
  266. attachedInvenType = self.priceInputBoard.sourceWindowType
  267. sourceSlotPos = self.priceInputBoard.sourceSlotPos
  268. targetSlotPos = self.priceInputBoard.targetSlotPos
  269. for privatePos, (itemWindowType, itemSlotIndex) in self.itemStock.items():
  270. if itemWindowType == attachedInvenType and itemSlotIndex == sourceSlotPos:
  271. shop.DelPrivateShopItemStock(itemWindowType, itemSlotIndex)
  272. del self.itemStock[privatePos]
  273. price = int(self.priceInputBoard.GetText())
  274. if IsPrivateShopItemPriceList():
  275. SetPrivateShopItemPrice(self.priceInputBoard.itemVNum, price)
  276. shop.AddPrivateShopItemStock(attachedInvenType, sourceSlotPos, targetSlotPos, price)
  277. count = player.GetItemCount(attachedInvenType, sourceSlotPos)
  278. vnum = player.GetItemIndex(attachedInvenType, sourceSlotPos)
  279. self.SaveFilePrice(vnum,count,price)
  280. self.itemStock[targetSlotPos] = (attachedInvenType, sourceSlotPos)
  281. snd.PlaySound("sound/ui/drop.wav")
  282. self.Refresh()
  283. #####
  284. self.priceInputBoard = None
  285. return TRUE
  286. def CancelInputPrice(self):
  287. self.priceInputBoard = None
  288. return TRUE
  289. def OnOk(self):
  290. if not self.title:
  291. return
  292. if 0 == len(self.itemStock):
  293. return
  294. shop.BuildPrivateShop(self.title,self.days)
  295. self.Close()
  296. def OnClose(self):
  297. self.Close()
  298. def OnPressEscapeKey(self):
  299. self.Close()
  300. return TRUE
  301. def OnOverInItem(self, slotIndex):
  302. if self.tooltipItem:
  303. if self.itemStock.has_key(slotIndex):
  304. self.tooltipItem.SetPrivateShopBuilderItem(*self.itemStock[slotIndex] + (slotIndex,))
  305. def OnOverOutItem(self):
  306. if self.tooltipItem:
  307. self.tooltipItem.HideToolTip()
  308. uiofflineshopbuilder.py
  309. #########################
  310. import ui
  311. import snd
  312. import shop
  313. import mouseModule
  314. import player
  315. import chr
  316. import net
  317. import uiCommon
  318. import localeInfo
  319. import chat
  320. import systemSetting
  321. import item
  322. import app
  323. g_isBuildingOfflineShop = False
  324. g_itemPriceDict = {}
  325. g_offlineShopAdvertisementBoardDict = {}
  326. def Clear():
  327. global g_itemPriceDict
  328. global g_isBuildingOfflineShop
  329. g_itemPriceDict = {}
  330. g_isBuildingOfflineShop = False
  331. def IsOfflineShopItemPriceList():
  332. global g_itemPriceDict
  333. if (g_itemPriceDict):
  334. return True
  335. else:
  336. return False
  337. def IsBuildingOfflineShop():
  338. global g_isBuildingOfflineShop
  339. if (g_isBuildingOfflineShop):
  340. return True
  341. else:
  342. return False
  343. def SetOfflineShopItemPrice(itemVnum, itemPrice):
  344. global g_itemPriceDict
  345. g_itemPriceDict[int(itemVnum)] = itemPrice
  346. def GetOfflineShopItemPrice(itemVnum):
  347. try:
  348. global g_itemPriceDict
  349. return g_itemPriceDict[itemVnum]
  350. except KeyError:
  351. return 0
  352. def UpdateADBoard():
  353. for key in g_offlineShopAdvertisementBoardDict.keys():
  354. g_offlineShopAdvertisementBoardDict[key].Show()
  355. def DeleteADBoard():
  356. if (not g_offlineShopAdvertisementBoardDict.has_key(vid)):
  357. return
  358. del g_offlineShopAdvertisementBoardDict[vid]
  359. class OfflineShopAdvertisementBoard(ui.ThinBoard):
  360. def __init__(self):
  361. ui.ThinBoard.__init__(self, "UI_BOTTOM")
  362. self.shopAdvertismentBoardSeen =[]
  363. self.vid = None
  364. self.__MakeTextLine()
  365. def __del__(self):
  366. ui.ThinBoard.__del__(self)
  367. def __MakeTextLine(self):
  368. self.textLine = ui.TextLine()
  369. self.textLine.SetParent(self)
  370. self.textLine.SetWindowHorizontalAlignCenter()
  371. self.textLine.SetWindowVerticalAlignCenter()
  372. self.textLine.SetHorizontalAlignCenter()
  373. self.textLine.SetVerticalAlignCenter()
  374. self.textLine.Show()
  375. def Open(self, vid, text):
  376. self.vid = vid
  377. self.textLine.SetText(text)
  378. if vid in self.shopAdvertismentBoardSeen:
  379. self.textLine.SetFontColor(0.1, 0.6, 0.6)
  380. self.textLine.UpdateRect()
  381. self.SetSize(len(text) * 6 + 10 * 2, 20)
  382. self.Show()
  383. g_offlineShopAdvertisementBoardDict[vid] = self
  384. def OnMouseLeftButtonUp(self):
  385. if (not self.vid):
  386. return
  387. net.SendOnClickPacket(self.vid)
  388. if self.vid != player.GetMainCharacterIndex():
  389. self.textLine.SetFontColor(0.1, 0.6, 0.6)
  390. self.shopAdvertismentBoardSeen.append(self.vid)
  391. return True
  392. def OnUpdate(self):
  393. if (not self.vid):
  394. return
  395. for key in g_offlineShopAdvertisementBoardDict.keys():
  396. g_offlineShopAdvertisementBoardDict[key].Hide()
  397. class OfflineShopBuilder(ui.ScriptWindow):
  398. def __init__(self):
  399. ui.ScriptWindow.__init__(self)
  400. self.LoadWindow()
  401. self.itemStock = {}
  402. self.tooltipItem = None
  403. self.priceInputBoard = None
  404. self.title = ""
  405. self.time = -1
  406. def __del__(self):
  407. ui.ScriptWindow.__del__(self)
  408. def LoadWindow(self):
  409. try:
  410. pyScrLoader = ui.PythonScriptLoader()
  411. pyScrLoader.LoadScriptFile(self, "UIScript/OfflineShopBuilder.py")
  412. except:
  413. import exception
  414. exception.Abort("OfflineShopBuilderWindow.LoadWindow.LoadObject")
  415. try:
  416. self.nameLine = self.GetChild("NameLine")
  417. self.itemSlot = self.GetChild("ItemSlot")
  418. self.btnOk = self.GetChild("OkButton")
  419. self.btnClose = self.GetChild("CloseButton")
  420. self.board = self.GetChild("Board")
  421. except:
  422. import exception
  423. exception.Abort("OfflineShopBuilderWindow.LoadWindow.BindObject")
  424. self.btnOk.SetEvent(ui.__mem_func__(self.OnOk))
  425. self.btnClose.SetEvent(ui.__mem_func__(self.OnClose))
  426. self.board.SetCloseEvent(ui.__mem_func__(self.OnClose))
  427. self.itemSlot.SetSelectEmptySlotEvent(ui.__mem_func__(self.OnSelectEmptySlot))
  428. self.itemSlot.SetSelectItemSlotEvent(ui.__mem_func__(self.OnSelectItemSlot))
  429. self.itemSlot.SetOverInItemEvent(ui.__mem_func__(self.OnOverInItem))
  430. self.itemSlot.SetOverOutItemEvent(ui.__mem_func__(self.OnOverOutItem))
  431. def Destroy(self):
  432. self.ClearDictionary()
  433. self.nameLine = None
  434. self.itemSlot = None
  435. self.btnOk = None
  436. self.btnClose = None
  437. self.board = None
  438. self.priceInputBoard = None
  439. def Open(self, title, time):
  440. self.title = title
  441. self.time = time
  442. if (len(title) > 25):
  443. self.title = title[:22] + "..."
  444. self.itemStock = {}
  445. shop.ClearOfflineShopStock()
  446. self.nameLine.SetText(title)
  447. self.SetCenterPosition()
  448. self.Refresh()
  449. self.Show()
  450. global g_isBuildingOfflineShop
  451. g_isBuildingOfflineShop = True
  452. def Close(self):
  453. global g_isBuildingOfflineShop
  454. g_isBuildingOfflineShop = False
  455. self.title = ""
  456. self.time = -1
  457. shop.ClearOfflineShopStock()
  458. self.Hide()
  459. def SetItemToolTip(self, tooltipItem):
  460. self.tooltipItem = tooltipItem
  461. def Refresh(self):
  462. for i in xrange(shop.OFFLINE_SHOP_SLOT_COUNT):
  463. if (not self.itemStock.has_key(i)):
  464. self.itemSlot.ClearSlot(i)
  465. continue
  466. pos = self.itemStock[i]
  467. itemCount = player.GetItemCount(*pos)
  468. if (itemCount <= 1):
  469. itemCount = 0
  470. self.itemSlot.SetItemSlot(i, player.GetItemIndex(*pos), itemCount)
  471. self.itemSlot.RefreshSlot()
  472. def OnSelectEmptySlot(self, selectedSlotPos):
  473. isAttached = mouseModule.mouseController.isAttached()
  474. if (isAttached):
  475. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  476. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  477. mouseModule.mouseController.DeattachObject()
  478. if (player.SLOT_TYPE_INVENTORY != attachedSlotType and player.SLOT_TYPE_DRAGON_SOUL_INVENTORY != attachedSlotType):
  479. return
  480. attachedInvenType = player.SlotTypeToInvenType(attachedSlotType)
  481. itemVNum = player.GetItemIndex(attachedInvenType, attachedSlotPos)
  482. item.SelectItem(itemVNum)
  483. if item.IsAntiFlag(item.ANTIFLAG_GIVE) or item.IsAntiFlag(item.ANTIFLAG_MYSHOP):
  484. chat.AppendChat(chat.CHAT_TYPE_INFO, localeInfo.OFFLINE_SHOP_CANNOT_SELL_ITEM)
  485. return
  486. priceInputBoard = uiCommon.MoneyInputDialog()
  487. priceInputBoard.SetTitle(localeInfo.OFFLINE_SHOP_INPUT_PRICE_DIALOG_TITLE)
  488. priceInputBoard.SetAcceptEvent(ui.__mem_func__(self.AcceptInputPrice))
  489. priceInputBoard.SetCancelEvent(ui.__mem_func__(self.CancelInputPrice))
  490. priceInputBoard.Open()
  491. itemPrice = GetOfflineShopItemPrice(itemVNum)
  492. if (itemPrice > 0):
  493. priceInputBoard.SetValue(itemPrice)
  494. self.priceInputBoard = priceInputBoard
  495. self.priceInputBoard.itemVNum = itemVNum
  496. self.priceInputBoard.sourceWindowType = attachedInvenType
  497. self.priceInputBoard.sourceSlotPos = attachedSlotPos
  498. self.priceInputBoard.targetSlotPos = selectedSlotPos
  499. def OnSelectItemSlot(self, selectedSlotPos):
  500. isAttached = mouseModule.mouseController.isAttached()
  501. if (isAttached):
  502. snd.PlaySound("sound/ui/loginfail.wav")
  503. mouseModule.mouseController.DeattachObject()
  504. else:
  505. if (not selectedSlotPos in self.itemStock):
  506. return
  507. invenType, invenPos = self.itemStock[selectedSlotPos]
  508. shop.DelOfflineShopItemStock(invenType, invenPos)
  509. snd.PlaySound("sound/ui/drop.wav")
  510. del self.itemStock[selectedSlotPos]
  511. self.Refresh()
  512. def AcceptInputPrice(self):
  513. if (not self.priceInputBoard):
  514. return True
  515. text = self.priceInputBoard.GetText()
  516. if (not text):
  517. return True
  518. if (not text.isdigit()):
  519. return True
  520. if (int(text) <= 0):
  521. return True
  522. attachedInvenType = self.priceInputBoard.sourceWindowType
  523. sourceSlotPos = self.priceInputBoard.sourceSlotPos
  524. targetSlotPos = self.priceInputBoard.targetSlotPos
  525. for privatePos, (itemWindowType, itemSlotIndex) in self.itemStock.items():
  526. if (itemWindowType == attachedInvenType and itemSlotIndex == sourceSlotPos):
  527. shop.DelOfflineShopItemStock(itemWindowType, itemSlotIndex)
  528. del self.itemStock[privatePos]
  529. price = int(self.priceInputBoard.GetText())
  530. if (IsOfflineShopItemPriceList()):
  531. SetOfflineShopItemPrice(self.priceInputBoard.itemVNum, price)
  532. shop.AddOfflineShopItemStock(attachedInvenType, sourceSlotPos, targetSlotPos, price)
  533. self.itemStock[targetSlotPos] = (attachedInvenType, sourceSlotPos)
  534. snd.PlaySound("sound/ui/drop.wav")
  535. self.Refresh()
  536. self.priceInputBoard = None
  537. return True
  538. def CancelInputPrice(self):
  539. self.priceInputBoard = None
  540. return True
  541. def OnOk(self):
  542. if (not self.title):
  543. return
  544. if (len(self.itemStock) == 0):
  545. return
  546. if (self.time < 0 or self.time == 0):
  547. return
  548. shop.BuildOfflineShop(self.title, self.time)
  549. self.Close()
  550. def OnClose(self):
  551. self.Close()
  552. def OnPressEscapeKey(self):
  553. self.Close()
  554. return True
  555. def OnOverInItem(self, slotIndex):
  556. if (self.tooltipItem):
  557. if (self.itemStock.has_key(slotIndex)):
  558. self.tooltipItem.SetOfflineShopBuilderItem(*self.itemStock[slotIndex] + (slotIndex,))
  559. def OnOverOutItem(self):
  560. if (self.tooltipItem):
  561. self.tooltipItem.HideToolTip()

files