Advertisement
Guest User

Untitled

a guest
May 30th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.16 KB | None | 0 0
  1. import app
  2. import event
  3. import net
  4. import player
  5. import item
  6. import ui
  7. import uiToolTip
  8. import mouseModule
  9. import locale
  10. import uiCommon
  11. import constInfo
  12. import dbg
  13. import math
  14. import shop
  15. import chat
  16. import localeInfo
  17. import snd
  18. from _weakref import proxy
  19.  
  20. class GuildStorage(ui.ScriptWindow):
  21.  
  22. def __init__(self):
  23. ui.ScriptWindow.__init__(self)
  24. self.__Initialize()
  25. self.isLoaded = FALSE
  26.  
  27. def __Initialize(self):
  28. self.children = []
  29. self.tab = 0
  30. self.xGuildStorageStart = 0
  31. self.yGuildStorageStart = 0
  32. self.oldtime_ = 0
  33.  
  34. def __LoadScript(self):
  35. try:
  36. pyScrLoader = ui.PythonScriptLoader()
  37. pyScrLoader.LoadScriptFile(self, "uiscript/GuildStorage.py")
  38. except:
  39. import exception
  40. exception.Abort("test.__LoadScript.LoadObject")
  41.  
  42. try:
  43. self.board = self.GetChild("Board")
  44. self.titleBar = self.GetChild("TitleBar")
  45.  
  46. ## Guildstorage
  47. self.GuildStorage = {
  48. "slots" : self.GetChild("GS_Slots"),
  49. "tab00" : self.GetChild("GS_Tab_00"),
  50. "tab01" : self.GetChild("GS_Tab_01"),
  51. "tab02" : self.GetChild("GS_Tab_02"),
  52. "tab03" : self.GetChild("GS_Tab_03"),
  53. "tab04" : self.GetChild("GS_Tab_04"),
  54. "tab05" : self.GetChild("GS_Tab_05"),
  55. }
  56. ## Guildstorage END
  57.  
  58. ## Money
  59. self.MoneyBoard = {
  60. "btn_money" : self.GetChild("MoneyBoard"),
  61. "text" : self.GetChild("MB_Text"),
  62. "board" : GuildStorageMoneyManager(),
  63. }
  64.  
  65. ## Money END
  66.  
  67. ## Logs
  68.  
  69. self.Logs = {
  70. "btn_Logs" : self.GetChild("GS_LogsButton"),
  71. "board" : GuildStorageLogs(),
  72. }
  73.  
  74. ## Logs END
  75.  
  76. ## Adminpanel
  77. self.Adminpanel = {
  78. "btn_Admin" : self.GetChild("GS_AdministrationButton"),
  79. "board" : GuildStorageAdmin(),
  80. }
  81. ## Adminpanel END
  82.  
  83. ##ItemToolTip
  84. self.toolTip = uiToolTip.ItemToolTip()
  85. ##ItemToolTip END
  86. except:
  87. import exception
  88. exception.Abort("test.__LoadScript.BindObject")
  89.  
  90. self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
  91.  
  92. for i in range(6):
  93. self.GuildStorage["tab0"+str(i)].SetEvent(self.ChangeTab,i)
  94.  
  95.  
  96. self.toolTip = uiToolTip.ItemToolTip()
  97. self.GuildStorage["slots"].SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  98. self.GuildStorage["slots"].SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  99. self.GuildStorage["slots"].SetSelectEmptySlotEvent(ui.__mem_func__(self.SelectEmptySlot))
  100. self.GuildStorage["slots"].SetSelectItemSlotEvent(ui.__mem_func__(self.SelectItemSlot))
  101. self.GuildStorage["slots"].SetUnselectItemSlotEvent(ui.__mem_func__(self.UnselectItemSlot))
  102. self.GuildStorage["slots"].SetUsableItem(True)
  103.  
  104. self.MoneyBoard["btn_money"].SetEvent(self.ShowMoneyManager)
  105.  
  106. self.Adminpanel["btn_Admin"].SetEvent(self.ShowAdminPanel)
  107. self.Logs["btn_Logs"].SetEvent(self.ShowLogs)
  108.  
  109. self.isLoaded = TRUE
  110.  
  111. def __del__(self):
  112. ui.ScriptWindow.__del__(self)
  113.  
  114. def Destroy(self):
  115. self.Close()
  116. self.ClearDictionary()
  117.  
  118. def Open(self,mode):
  119. if FALSE == self.isLoaded:
  120. self.__LoadScript()
  121. self.__Initialize()
  122. if constInfo.GET_ITEM_DROP_QUESTION_DIALOG_STATUS() == 1:
  123. chat.AppendChat(chat.CHAT_TYPE_INFO, "Du kannst das Gildenlager nicht oeffnen, solange du ein Item droppst.")
  124. self.Close()
  125. return
  126. if mouseModule.mouseController.isAttached():
  127. chat.AppendChat(chat.CHAT_TYPE_INFO, "Du kannst das Gildenlager nicht oeffnen, solange du ein Item haelst.")
  128. self.Close()
  129. return
  130. constInfo.GUILDSTORAGE["open"] = 1
  131.  
  132. self.StandartInterface()
  133.  
  134. ## clear the slots
  135. for i in range(120):
  136. self.GuildStorage["slots"].ClearSlot(i)
  137.  
  138. if mode == 0:
  139. self.Adminpanel["btn_Admin"].Hide()
  140. self.Logs["btn_Logs"].Hide()
  141. else:
  142. self.Adminpanel["btn_Admin"].Show()
  143. self.Logs["btn_Logs"].Show()
  144.  
  145. (self.xGuildStorageStart, self.yGuildStorageStart, z) = player.GetMainCharacterPosition()
  146. self.SetTop()
  147. self.Show()
  148.  
  149. def StandartInterface(self):
  150. self.GuildStorage["tab00"].Down()
  151. self.GuildStorage["tab01"].SetUp()
  152. self.GuildStorage["tab02"].SetUp()
  153. self.GuildStorage["tab03"].SetUp()
  154. self.GuildStorage["tab04"].SetUp()
  155. self.GuildStorage["tab05"].SetUp()
  156. constInfo.GUILDSTORAGE["slots"] = {"TAB0" : {},"TAB1" : {},"TAB2" : {},"TAB3" : {},"TAB4" : {},"TAB5" : {}}
  157. constInfo.GUILDSTORAGE["members"] = {}
  158. self.tab = 0
  159.  
  160. def SendSystemChat(self, text):
  161. chat.AppendChat(chat.CHAT_TYPE_INFO, "<System>: "+str(text))
  162.  
  163. def ChangeTab(self, tab):
  164. self.tab = tab
  165. for i in range(6):
  166. if i != tab:
  167. self.GuildStorage["tab0"+str(i)].SetUp()
  168. self.RefreshSlots()
  169.  
  170. def AddItemSlot(self, slot, tab ,itemVnum, count, socket0, socket1, socket2, socket3, socket4, socket5, attrtype0,attrvalue0, attrtype1,attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6):
  171. constInfo.GUILDSTORAGE["slots"]["TAB"+tab][int(slot)] = [int(itemVnum),int(count), int(socket0), int(socket1), int(socket2), int(socket3), int(socket4), int(socket5), int(attrtype0),int(attrvalue0), int(attrtype1),int(attrvalue1), int(attrtype2), int(attrvalue2), int(attrtype3), int(attrvalue3), int(attrtype4), int(attrvalue4), int(attrtype5), int(attrvalue5), int(attrtype6), int(attrvalue6)]
  172. self.RefreshSlots()
  173.  
  174. def MoveItemSlot(self,from_,to_):
  175. item = constInfo.GUILDSTORAGE["slots"]["TAB"+str(from_[0])][from_[1]]
  176. constInfo.GUILDSTORAGE["slots"]["TAB"+str(from_[0])].pop(from_[1],None)
  177. constInfo.GUILDSTORAGE["slots"]["TAB"+str(to_[0])][to_[1]] = item
  178. self.RefreshSlots()
  179.  
  180. def RefreshSlots(self):
  181. items = constInfo.GUILDSTORAGE["slots"]["TAB"+str(self.tab)]
  182. for i in range(121):
  183. self.GuildStorage["slots"].ClearSlot(i)
  184. for i in items:
  185. self.GuildStorage["slots"].SetItemSlot(i, items[i][0], items[i][1])
  186.  
  187. self.GuildStorage["slots"].RefreshSlot()
  188.  
  189. ######################
  190. ## MoneyManager START
  191. ######################
  192.  
  193. def SetMoney(self,money):
  194. self.MoneyBoard["text"].SetText(localeInfo.NumberToMoneyString(money))
  195.  
  196. def ShowMoneyManager(self):
  197. self.MoneyBoard["board"].Open()
  198.  
  199. # unused
  200. def HideMoneyManager(self):
  201. self.MoneyBoard["board"].Close()
  202.  
  203. def GetMoneyManager(self):
  204. return self.MoneyBoard["board"]
  205. # unused END
  206.  
  207. ######################
  208. ## MoneyManager END
  209. ######################
  210.  
  211. ######################
  212. ## Item Tool Tip START
  213. ######################
  214.  
  215. def OverInItem(self, index):
  216. items = constInfo.GUILDSTORAGE["slots"]["TAB"+str(self.tab)]
  217. self.toolTip.ClearToolTip()
  218. self.toolTip.AddRefineItemData(items[index][0], [items[index][2],items[index][3],items[index][4],items[index][5],items[index][6],items[index][7]], [(items[index][8],items[index][9]),(items[index][10],items[index][11]),(items[index][12],items[index][13]),(items[index][14],items[index][15]),(items[index][16],items[index][17]),(items[index][18],items[index][19]),(items[index][20],items[index][21])])
  219.  
  220.  
  221. def OverOutItem(self):
  222. self.toolTip.Hide()
  223.  
  224. ######################
  225. ## Item Tool Tip END
  226. ######################
  227.  
  228. ######################
  229. ## Storage Drag START
  230. ######################
  231.  
  232. def SelectEmptySlot(self, selectedSlotPos):
  233. if mouseModule.mouseController.isAttached():
  234. attachedSlotType = mouseModule.mouseController.GetAttachedType()
  235. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  236. if player.SLOT_TYPE_INVENTORY == attachedSlotType:
  237. self.QuestCMD("MOVE_ITEM#INVENTORY#"+str(attachedSlotPos)+"#"+str(selectedSlotPos)+"#"+str(self.tab))
  238. elif player.SLOT_TYPE_INVENTORY != attachedSlotType and player.SLOT_TYPE_MALL != attachedSlotType and player.SLOT_TYPE_SAFEBOX != attachedSlotType and player.SLOT_TYPE_SHOP != attachedSlotType:
  239. self.QuestCMD("MOVE_ITEM#GUILDSTORAGE#"+str(attachedSlotPos)+"#"+str(self.temporaryTab)+"#"+str(selectedSlotPos)+"#"+str(self.tab))
  240. self.MoveItemSlot([self.temporaryTab,attachedSlotPos],[self.tab,selectedSlotPos])
  241.  
  242. mouseModule.mouseController.DeattachObject()
  243.  
  244. def UnselectItemSlot(self, selectedSlotPos):
  245. self.QuestCMD("TAKE_ITEM#"+str(selectedSlotPos)+"#"+str(self.tab))
  246. constInfo.GUILDSTORAGE["slots"]["TAB"+str(self.tab)].pop(selectedSlotPos,None)
  247. self.RefreshSlots()
  248.  
  249.  
  250. def SelectItemSlot(self, selectedSlotPos):
  251. items = constInfo.GUILDSTORAGE["slots"]["TAB"+str(self.tab)]
  252. curCursorNum = app.GetCursor()
  253. selectedSlotPos = selectedSlotPos
  254. selectedItemID = items[selectedSlotPos][0]
  255. itemCount = items[selectedSlotPos][1]
  256.  
  257. type = player.SLOT_TYPE_PRIVATE_SHOP
  258. mouseModule.mouseController.AttachObject(self, type, selectedSlotPos, selectedItemID, itemCount)
  259. self.temporaryTab = self.tab
  260. mouseModule.mouseController.SetCallBack("INVENTORY", ui.__mem_func__(self.DropToInventory))
  261. snd.PlaySound("sound/ui/pick.wav")
  262.  
  263.  
  264. def DropToInventory(self):
  265. attachedSlotPos = mouseModule.mouseController.GetAttachedSlotNumber()
  266. self.QuestCMD("TAKE_ITEM#"+str(attachedSlotPos)+"#"+str(self.tab))
  267. constInfo.GUILDSTORAGE["slots"]["TAB"+str(self.tab)].pop(attachedSlotPos,None)
  268. self.RefreshSlots()
  269.  
  270. ######################
  271. ## Storage Drag END
  272. ######################
  273.  
  274. def QuestCMD(self, command):
  275. constInfo.GUILDSTORAGE["questCMD"] = command
  276. event.QuestButtonClick(int(constInfo.GUILDSTORAGE["qid"]))
  277.  
  278. def ShowAdminPanel(self):
  279. self.Adminpanel['board'].Open()
  280.  
  281. def LogsInsert(self,id,name,date,type,do,desc):
  282. self.Logs['board'].LogsInsert(id,name,date,type,do,desc)
  283.  
  284. def ShowLogs(self):
  285. self.Logs['board'].Open()
  286.  
  287. def OnUpdate(self):
  288. USE_GUILDSTORAGE_LIMIT_RANGE = 1000
  289.  
  290. (x, y, z) = player.GetMainCharacterPosition()
  291. if abs(x - self.xGuildStorageStart) > USE_GUILDSTORAGE_LIMIT_RANGE or abs(y - self.yGuildStorageStart) > USE_GUILDSTORAGE_LIMIT_RANGE:
  292. self.Close()
  293.  
  294. oldtime = self.oldtime_
  295. newtime = app.GetTime()
  296. newcalc = newtime - oldtime
  297. intnewcalc = int(newcalc)
  298. if newcalc > 5:
  299. self.oldtime_ = newtime
  300. self.QuestCMD("UPDATE#")
  301.  
  302. def Close(self):
  303. constInfo.GUILDSTORAGE["open"] = 0
  304. self.Hide()
  305.  
  306. def OnPressEscapeKey(self):
  307. self.Close()
  308. return TRUE
  309.  
  310. def OnPressExitKey(self):
  311. self.Close()
  312. return TRUE
  313.  
  314. def ClearMembers(self):
  315. self.Adminpanel['board'].ClearMembers()
  316.  
  317.  
  318. class MouseReflector(ui.Window):
  319. def __init__(self, parent):
  320. ui.Window.__init__(self)
  321. self.SetParent(parent)
  322. self.AddFlag("not_pick")
  323. self.width = self.height = 0
  324. self.isDown = FALSE
  325.  
  326. def Down(self):
  327. self.isDown = TRUE
  328.  
  329. def Up(self):
  330. self.isDown = FALSE
  331.  
  332. def OnRender(self):
  333. import grp
  334. if self.isDown:
  335. grp.SetColor(ui.WHITE_COLOR)
  336. else:
  337. grp.SetColor(ui.HALF_WHITE_COLOR)
  338.  
  339. x, y = self.GetGlobalPosition()
  340. grp.RenderBar(x+2, y+2, self.GetWidth()-4, self.GetHeight()-4)
  341.  
  342. class CheckBox(ui.ImageBox):
  343. def __init__(self, parent, x, y, event, filename = "d:/ymir work/ui/public/Parameter_Slot_01.sub"):
  344. ui.ImageBox.__init__(self)
  345. self.SetParent(parent)
  346. self.SetPosition(x, y)
  347. self.LoadImage(filename)
  348.  
  349. self.mouseReflector = MouseReflector(self)
  350. self.mouseReflector.SetSize(self.GetWidth(), self.GetHeight())
  351.  
  352. image = ui.MakeImageBox(self, "d:/ymir work/ui/public/check_image.sub", 0, 0)
  353. image.AddFlag("not_pick")
  354. image.SetWindowHorizontalAlignCenter()
  355. image.SetWindowVerticalAlignCenter()
  356. image.Hide()
  357. self.Enable = TRUE
  358. self.Checked = FALSE
  359. self.image = image
  360. self.event = event
  361. self.Show()
  362.  
  363. self.mouseReflector.UpdateRect()
  364.  
  365. def __del__(self):
  366. ui.ImageBox.__del__(self)
  367.  
  368. def SetCheck(self, flag):
  369. if flag:
  370. self.image.Show()
  371. self.Checked = TRUE
  372. else:
  373. self.image.Hide()
  374. self.Checked = FALSE
  375.  
  376. def GetCheck(self):
  377. return self.Checked
  378.  
  379. def Disable(self):
  380. self.Enable = FALSE
  381.  
  382. def OnMouseOverIn(self):
  383. if not self.Enable:
  384. return
  385. self.mouseReflector.Show()
  386.  
  387. def OnMouseOverOut(self):
  388. if not self.Enable:
  389. return
  390. self.mouseReflector.Hide()
  391.  
  392. def OnMouseLeftButtonDown(self):
  393. if not self.Enable:
  394. return
  395. self.mouseReflector.Down()
  396.  
  397. def OnMouseLeftButtonUp(self):
  398. if not self.Enable:
  399. return
  400. self.mouseReflector.Up()
  401. self.event()
  402.  
  403.  
  404.  
  405. class GuildStorageAdmin(ui.ScriptWindow):
  406.  
  407. def __init__(self):
  408. ui.ScriptWindow.__init__(self)
  409. self.__Initialize()
  410. self.isLoaded = FALSE
  411.  
  412. def __Initialize(self):
  413. self.children = []
  414. self.xGuildStorageStart = 0
  415. self.yGuildStorageStart = 0
  416. self.startpos = 0
  417.  
  418. def __LoadScript(self):
  419. try:
  420. pyScrLoader = ui.PythonScriptLoader()
  421. pyScrLoader.LoadScriptFile(self, "uiscript/GuildStorageAdmin.py")
  422. except:
  423. import exception
  424. exception.Abort("test.__LoadScript.LoadObject")
  425.  
  426. try:
  427. self.board = self.GetChild("Board")
  428. self.titleBar = self.GetChild("TitleBar")
  429. self.AddMemberButton = self.GetChild("GS_AddMember")
  430. self.MemberInput = self.GetChild("GS_MemberInputLine")
  431. self.scrollbar = self.GetChild("scrollbar")
  432.  
  433. self.scrollbar.SetScrollEvent(ui.__mem_func__(self.__OnScroll))
  434.  
  435. self.MemberPage = {
  436. }
  437.  
  438. for i in range(12):
  439. event = lambda argSelf=proxy(self), argIndex=i, argAuthority=0: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
  440. self.MemberPage['stock'+str(i)] = (CheckBox(self.board, 130, 60+(20*i), event))
  441.  
  442. event = lambda argSelf=proxy(self), argIndex=i, argAuthority=1: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
  443. self.MemberPage['transfer'+str(i)] = (CheckBox(self.board, 190, 60+(20*i), event))
  444.  
  445. event = lambda argSelf=proxy(self), argIndex=i, argAuthority=2: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
  446. self.MemberPage['payin'+str(i)] = (CheckBox(self.board, 250, 60+(20*i), event))
  447.  
  448. event = lambda argSelf=proxy(self), argIndex=i, argAuthority=3: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
  449. self.MemberPage['payout'+str(i)] = (CheckBox(self.board, 310, 60+(20*i), event))
  450.  
  451. self.MemberPage['membername_slotbar'+str(i)] = ui.MakeSlotBar(self.board, 20, 61+(20*i), 100,16)
  452. self.MemberPage['membername_text'+str(i)] = ui.MakeTextLine(self.MemberPage['membername_slotbar'+str(i)])
  453.  
  454. self.MemberPage['deleteBTN'+str(i)] = ui.MakeButton(self.board, 365, 61+(20*i), "loeschen", "d:/ymir work/ui/public/", "close_button_01.sub", "close_button_02.sub", "close_button_03.sub")
  455. self.MemberPage['deleteBTN'+str(i)].SetEvent(ui.__mem_func__(self.DeleteMember), i)
  456.  
  457. except:
  458. import exception
  459. exception.Abort("test.__LoadScript.BindObject")
  460.  
  461. self.AddMemberButton.SetEvent(self.AddMember)
  462. self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
  463. self.isLoaded = TRUE
  464.  
  465. def __del__(self):
  466. ui.ScriptWindow.__del__(self)
  467.  
  468. def Destroy(self):
  469. self.Close()
  470.  
  471. def Open(self):
  472. if FALSE == self.isLoaded:
  473. self.__LoadScript()
  474. self.__Initialize()
  475. self.QuestCMD("GETMEMBERLIST")
  476. self.SetTop()
  477. self.Show()
  478. self.scrollbar.SetPos(0)
  479. (self.xGuildStorageStart, self.yGuildStorageStart, z) = player.GetMainCharacterPosition()
  480. self.MemberInput.SetText("Membername")
  481.  
  482. def OnUpdate(self):
  483. USE_GUILDSTORAGE_LIMIT_RANGE = 1000
  484.  
  485. (x, y, z) = player.GetMainCharacterPosition()
  486. if abs(x - self.xGuildStorageStart) > USE_GUILDSTORAGE_LIMIT_RANGE or abs(y - self.yGuildStorageStart) > USE_GUILDSTORAGE_LIMIT_RANGE:
  487. self.Close()
  488.  
  489. ######################
  490. ## Gui elements START
  491. ######################
  492.  
  493. def __OnScroll(self):
  494. members = constInfo.GUILDSTORAGE["members"]
  495. memberslen = len(members)##itemlen
  496. self.startpos = int(self.scrollbar.GetPos() * (memberslen-12))
  497.  
  498. # self.SendSystemChat(str(self.startpos))
  499.  
  500. if memberslen > 12:
  501. self.RefreshMembers(self.startpos)
  502.  
  503. def Create_SlotLine(self, parent, editlineText, x, y, width, heigh):
  504. SlotBar = ui.SlotBar()
  505. if parent != None:
  506. SlotBar.SetParent(parent)
  507. SlotBar.SetSize(width, heigh)
  508. SlotBar.SetPosition(x, y)
  509. SlotBar.Show()
  510. textline = ui.TextLine()
  511. textline.SetParent(SlotBar)
  512. textline.SetPosition(2, 2)
  513. textline.SetText(editlineText)
  514. textline.Show()
  515. return textline
  516.  
  517. ######################
  518. ## Gui elements STOP
  519. ######################
  520.  
  521.  
  522. ######################
  523. ## Admininstration Panel START
  524. ######################
  525.  
  526. def AddMember(self):
  527. membername = self.MemberInput.GetText()
  528.  
  529. if membername == "":
  530. self.SendSystemChat("Du musst einen Membernamen eingeben")
  531. return
  532.  
  533. self.QuestCMD("ADD_MEMBER#"+str(membername))
  534. self.MemberInput.SetText("Membername")
  535.  
  536. def RefreshMembers(self,pos):
  537. members = constInfo.GUILDSTORAGE["members"]
  538. if len(members) <= 12:## Set scrollbar middle Size, show or hide
  539.  
  540. self.scrollbar.Hide()
  541. else:
  542. self.scrollbar.SetMiddleBarSize(float(12)/float(len(members)))
  543. self.scrollbar.Show()
  544. for i in range(12):
  545. try:
  546. index = i + pos
  547. member = members["member"+str(index)]
  548. self.MemberPage['membername_text'+str(i)].SetText(member[0])
  549.  
  550. if member[1] == 0:
  551. self.MemberPage['stock'+str(i)].SetCheck(FALSE)
  552. else:
  553. self.MemberPage['stock'+str(i)].SetCheck(TRUE)
  554. if member[2] == 0:
  555. self.MemberPage['transfer'+str(i)].SetCheck(FALSE)
  556. else:
  557. self.MemberPage['transfer'+str(i)].SetCheck(TRUE)
  558. if member[3] == 0:
  559. self.MemberPage['payin'+str(i)].SetCheck(FALSE)
  560. else:
  561. self.MemberPage['payin'+str(i)].SetCheck(TRUE)
  562. if member[4] == 0:
  563. self.MemberPage['payout'+str(i)].SetCheck(FALSE)
  564. else:
  565. self.MemberPage['payout'+str(i)].SetCheck(TRUE)
  566. except:
  567. return
  568.  
  569. def ClearMembers(self):
  570. members = constInfo.GUILDSTORAGE["members"]
  571. self.scrollbar.SetPos(0)
  572. for i in range(12):
  573. self.MemberPage['membername_text'+str(i)].SetText('')
  574. self.MemberPage['stock'+str(i)].SetCheck(FALSE)
  575. self.MemberPage['transfer'+str(i)].SetCheck(FALSE)
  576. self.MemberPage['payin'+str(i)].SetCheck(FALSE)
  577. self.MemberPage['payout'+str(i)].SetCheck(FALSE)
  578.  
  579. def DeleteMember(self, btID):
  580. memberName = self.MemberPage['membername_text'+str(btID)].GetText()
  581. if memberName == "":
  582. return
  583. self.QuestCMD("DELETE_MEMBER#"+memberName)
  584.  
  585. def OnCheckAuthority(self, argIndex, argAuthority):
  586. memberName = self.MemberPage['membername_text'+str(argIndex)].GetText()
  587. if memberName == "":
  588. return
  589. authority = FALSE
  590. if argAuthority == 0:
  591. if self.MemberPage['stock'+str(argIndex)].GetCheck():
  592. self.MemberPage['stock'+str(argIndex)].SetCheck(FALSE)
  593. else:
  594. self.MemberPage['stock'+str(argIndex)].SetCheck(TRUE)
  595. authority = TRUE
  596. elif argAuthority == 1:
  597. if self.MemberPage['transfer'+str(argIndex)].GetCheck():
  598. self.MemberPage['transfer'+str(argIndex)].SetCheck(FALSE)
  599. else:
  600. self.MemberPage['transfer'+str(argIndex)].SetCheck(TRUE)
  601. authority = TRUE
  602. elif argAuthority == 2:
  603. if self.MemberPage['payin'+str(argIndex)].GetCheck():
  604. self.MemberPage['payin'+str(argIndex)].SetCheck(FALSE)
  605. else:
  606. self.MemberPage['payin'+str(argIndex)].SetCheck(TRUE)
  607. authority = TRUE
  608. elif argAuthority == 3:
  609. if self.MemberPage['payout'+str(argIndex)].GetCheck():
  610. self.MemberPage['payout'+str(argIndex)].SetCheck(FALSE)
  611. else:
  612. self.MemberPage['payout'+str(argIndex)].SetCheck(TRUE)
  613. authority = TRUE
  614.  
  615. self.QuestCMD("AUTHORITY#"+memberName+"#"+str(argAuthority)+"#"+str(authority))
  616.  
  617. ######################
  618. ## Admininstration Panel END
  619. ######################
  620.  
  621. def SendSystemChat(self, text):
  622. chat.AppendChat(chat.CHAT_TYPE_INFO, "<System>: "+str(text))
  623.  
  624. def QuestCMD(self, command):
  625. constInfo.GUILDSTORAGE["questCMD"] = command
  626. event.QuestButtonClick(int(constInfo.GUILDSTORAGE["qid"]))
  627.  
  628. def Close(self):
  629. self.Hide()
  630.  
  631. def OnPressEscapeKey(self):
  632. self.Close()
  633. return TRUE
  634.  
  635. def OnPressExitKey(self):
  636. self.Close()
  637. return TRUE
  638.  
  639.  
  640. class GuildStorageLogs(ui.ScriptWindow):
  641.  
  642. def __init__(self):
  643. ui.ScriptWindow.__init__(self)
  644. self.__Initialize()
  645. self.isLoaded = FALSE
  646.  
  647. def __Initialize(self):
  648. self.children = []
  649. self.xGuildStorageStart = 0
  650. self.yGuildStorageStart = 0
  651.  
  652. def __LoadScript(self):
  653. try:
  654. pyScrLoader = ui.PythonScriptLoader()
  655. pyScrLoader.LoadScriptFile(self, "uiscript/GuildStorageLogs.py")
  656. except:
  657. import exception
  658. exception.Abort("test.__LoadScript.LoadObject")
  659.  
  660. try:
  661. self.board = self.GetChild("Board")
  662. self.titleBar = self.GetChild("TitleBar")
  663.  
  664. self.Logs = self.GetChild("LM_LogsGroupBox")
  665.  
  666. self.Search = {
  667. "btn" : self.GetChild("LS_Search"),
  668. "text" : self.GetChild("LS_SearchInputLine"),
  669. }
  670.  
  671. self.DeleteBtn = self.GetChild("LM_Delete")
  672.  
  673. except:
  674. import exception
  675. exception.Abort("test.__LoadScript.BindObject")
  676.  
  677. self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
  678. self.Logs.SetTextCenterAlign(FALSE)
  679.  
  680. self.DeleteBtn.SetEvent(self.DeleteLogs)
  681. self.Search['btn'].SetEvent(self.SearchMember)
  682.  
  683. self.isLoaded = TRUE
  684.  
  685. def __del__(self):
  686. ui.ScriptWindow.__del__(self)
  687.  
  688. def LogsInsert(self,id,name,date,type,do,desc):
  689. self.Logs.InsertItem(id, '[Member]: '+name+'\t'+'[Datum]: '+date+'\t'+'[Art]: '+type+'\t'+'[Taetigkeit]: '+do+'\t'+'-> '+desc)
  690.  
  691. def SearchMember(self):
  692. name = self.Search['text'].GetText()
  693. if name == "":
  694. self.Refresh()
  695. else:
  696. self.Logs.ClearItem()
  697. log = constInfo.GUILDSTORAGE["logs"]
  698. for i in range(len(log)):
  699. # self.SendSystemChat('LOG'+log[i][0])
  700. if log[i][0].find(name) != -1:
  701. self.LogsInsert(i,log[i][0],log[i][1],log[i][2],log[i][3],log[i][4])
  702.  
  703. def Refresh(self):
  704. self.Logs.ClearItem()
  705. log = constInfo.GUILDSTORAGE["logs"]
  706. for i in range(len(log)):
  707. self.LogsInsert(i,log[i][0],log[i][1],log[i][2],log[i][3],log[i][4])
  708.  
  709. def DeleteLogs(self):
  710. self.Logs.ClearItem()
  711. constInfo.GUILDSTORAGE["logs"] = {}
  712. self.QuestCMD("DELETE_LOGS#")
  713.  
  714. def Destroy(self):
  715. self.Close()
  716.  
  717. def Open(self):
  718. if FALSE == self.isLoaded:
  719. self.__LoadScript()
  720. self.__Initialize()
  721. self.SetTop()
  722. self.Show()
  723. (self.xGuildStorageStart, self.yGuildStorageStart, z) = player.GetMainCharacterPosition()
  724. constInfo.GUILDSTORAGE["logs"] = {}
  725. self.Logs.ClearItem()
  726. self.QuestCMD("LOAD_LOGS#")
  727.  
  728. def OnUpdate(self):
  729.  
  730. USE_GUILDSTORAGE_LIMIT_RANGE = 1000
  731.  
  732. (x, y, z) = player.GetMainCharacterPosition()
  733. if abs(x - self.xGuildStorageStart) > USE_GUILDSTORAGE_LIMIT_RANGE or abs(y - self.yGuildStorageStart) > USE_GUILDSTORAGE_LIMIT_RANGE:
  734. self.Close()
  735.  
  736. def SendSystemChat(self, text):
  737. chat.AppendChat(chat.CHAT_TYPE_INFO, "<System>: "+str(text))
  738.  
  739. def QuestCMD(self, command):
  740. constInfo.GUILDSTORAGE["questCMD"] = command
  741. event.QuestButtonClick(int(constInfo.GUILDSTORAGE["qid"]))
  742.  
  743. def Close(self):
  744. self.Hide()
  745.  
  746. def OnPressEscapeKey(self):
  747. self.Close()
  748. return TRUE
  749.  
  750. def OnPressExitKey(self):
  751. self.Close()
  752. return TRUE
  753.  
  754.  
  755. class GuildStorageMoneyManager(ui.ScriptWindow):
  756.  
  757. def __init__(self):
  758. ui.ScriptWindow.__init__(self)
  759. self.__Initialize()
  760. self.isLoaded = FALSE
  761.  
  762. def __Initialize(self):
  763. self.children = []
  764. self.xGuildStorageStart = 0
  765. self.yGuildStorageStart = 0
  766.  
  767. def __LoadScript(self):
  768. try:
  769. pyScrLoader = ui.PythonScriptLoader()
  770. pyScrLoader.LoadScriptFile(self, "uiscript/GuildStorageMoneyManager.py")
  771. except:
  772. import exception
  773. exception.Abort("test.__LoadScript.LoadObject")
  774.  
  775. try:
  776. self.board = self.GetChild("Board")
  777. self.titleBar = self.GetChild("TitleBar")
  778. self.GetChild("CashInButton").SetEvent(self.CashInButton)
  779. self.GetChild("CashOutButton").SetEvent(self.CashOutButton)
  780. self.amountInput = self.GetChild("AmountInput")
  781.  
  782. except:
  783. import exception
  784. exception.Abort("test.__LoadScript.BindObject")
  785.  
  786. self.amountInput.SetNumberMode()
  787.  
  788. self.titleBar.SetCloseEvent(ui.__mem_func__(self.Close))
  789. self.isLoaded = TRUE
  790.  
  791.  
  792. def __del__(self):
  793. ui.ScriptWindow.__del__(self)
  794.  
  795.  
  796. def Destroy(self):
  797. self.Close()
  798.  
  799. def Open(self):
  800. if FALSE == self.isLoaded:
  801. self.__LoadScript()
  802. self.__Initialize()
  803. self.SetTop()
  804. self.Show()
  805. (self.xGuildStorageStart, self.yGuildStorageStart, z) = player.GetMainCharacterPosition()
  806. self.amountInput.SetText("1")
  807.  
  808. def OnUpdate(self):
  809.  
  810. USE_GUILDSTORAGE_LIMIT_RANGE = 1000
  811.  
  812. (x, y, z) = player.GetMainCharacterPosition()
  813. if abs(x - self.xGuildStorageStart) > USE_GUILDSTORAGE_LIMIT_RANGE or abs(y - self.yGuildStorageStart) > USE_GUILDSTORAGE_LIMIT_RANGE:
  814. self.Close()
  815.  
  816. def CashOutButton(self):
  817. money = self.amountInput.GetText()
  818. if money == "":
  819. self.amountInput.SetText("1")
  820. return
  821. self.QuestCMD("TAKE_MONEY#"+str(money))
  822. self.amountInput.SetText("1")
  823. self.Close()
  824.  
  825. def CashInButton(self):
  826. money = self.amountInput.GetText()
  827. if money == "":
  828. self.amountInput.SetText("1")
  829. return
  830. self.QuestCMD("GIVE_MONEY#"+str(money))
  831. self.amountInput.SetText("1")
  832. self.Close()
  833.  
  834. def SendSystemChat(self, text):
  835. chat.AppendChat(chat.CHAT_TYPE_INFO, "<System>: "+str(text))
  836.  
  837. def QuestCMD(self, command):
  838. constInfo.GUILDSTORAGE["questCMD"] = command
  839. event.QuestButtonClick(int(constInfo.GUILDSTORAGE["qid"]))
  840.  
  841. def Close(self):
  842. self.Hide()
  843.  
  844. def OnPressEscapeKey(self):
  845. self.Close()
  846. return TRUE
  847.  
  848. def OnPressExitKey(self):
  849. self.Close()
  850. return TRUE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement