Guest User

Untitled

a guest
Dec 3rd, 2014
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 86.44 KB | None | 0 0
  1. import app
  2. import ui
  3. import guild
  4. import net
  5. import wndMgr
  6. import grp
  7. import grpText
  8. import uiPickMoney
  9. import localeInfo
  10. import player
  11. import skill
  12. import mouseModule
  13. import uiUploadMark
  14. import uiCommon
  15. import uiToolTip
  16. import playerSettingModule
  17. import constInfo
  18. import background
  19. import miniMap
  20. import chr
  21. import uiScriptLocale
  22. from _weakref import proxy
  23.  
  24. DISABLE_GUILD_SKILL = FALSE
  25. DISABLE_DECLARE_WAR = FALSE
  26.  
  27. def NumberToMoneyString(n):
  28. return localeInfo.NumberToMoneyString(n)
  29.  
  30. if (localeInfo.IsEUROPE() and app.GetLocalePath() != "locale/br"):
  31. def NumberToMoneyString(n):
  32. if n <= 0 :
  33. return "0"
  34.  
  35. return "%s" % (','.join([ i-3<0 and str(n)[:i] or str(n)[i-3:i] for i in range(len(str(n))%3, len(str(n))+1, 3) if i ]))
  36.  
  37. MATERIAL_STONE_INDEX = 0
  38. MATERIAL_LOG_INDEX = 1
  39. MATERIAL_PLYWOOD_INDEX = 2
  40.  
  41. MATERIAL_STONE_ID = 90010
  42. MATERIAL_LOG_ID = 90011
  43. MATERIAL_PLYWOOD_ID = 90012
  44.  
  45. BUILDING_DATA_LIST = []
  46.  
  47. def GetGVGKey(srcGuildID, dstGuildID):
  48. minID = min(srcGuildID, dstGuildID)
  49. maxID = max(srcGuildID, dstGuildID)
  50. return minID*1000 + maxID
  51. def unsigned32(n):
  52. return n & 0xFFFFFFFFL
  53.  
  54. class DeclareGuildWarDialog(ui.ScriptWindow):
  55.  
  56. def __init__(self):
  57. ui.ScriptWindow.__init__(self)
  58.  
  59. self.type=0
  60. self.__CreateDialog()
  61.  
  62. def __del__(self):
  63. ui.ScriptWindow.__del__(self)
  64.  
  65. def Open(self):
  66. self.inputValue.SetFocus()
  67. self.SetCenterPosition()
  68. self.SetTop()
  69. self.Show()
  70.  
  71. def Close(self):
  72. self.ClearDictionary()
  73. self.board = None
  74. self.acceptButton = None
  75. self.cancelButton = None
  76. self.inputSlot = None
  77. self.inputValue = None
  78. self.Hide()
  79.  
  80. def __CreateDialog(self):
  81.  
  82. try:
  83. pyScrLoader = ui.PythonScriptLoader()
  84.  
  85. if localeInfo.IsVIETNAM() :
  86. pyScrLoader.LoadScriptFile(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "declareguildwardialog.py")
  87. else:
  88. pyScrLoader.LoadScriptFile(self, "uiscript/declareguildwardialog.py")
  89.  
  90. except:
  91. import exception
  92. exception.Abort("DeclareGuildWarWindow.__CreateDialog - LoadScript")
  93.  
  94. try:
  95. getObject = self.GetChild
  96. self.board = getObject("Board")
  97.  
  98. self.typeButtonList=[]
  99. self.typeButtonList.append(getObject("NormalButton"))
  100. self.typeButtonList.append(getObject("WarpButton"))
  101. self.typeButtonList.append(getObject("CTFButton"))
  102.  
  103. self.acceptButton = getObject("AcceptButton")
  104. self.cancelButton = getObject("CancelButton")
  105. self.inputSlot = getObject("InputSlot")
  106. self.inputValue = getObject("InputValue")
  107.  
  108. gameType=getObject("GameType")
  109.  
  110. except:
  111. import exception
  112. exception.Abort("DeclareGuildWarWindow.__CreateDialog - BindObject")
  113.  
  114. if constInfo.GUILD_WAR_TYPE_SELECT_ENABLE==0:
  115. gameType.Hide()
  116.  
  117. self.typeButtonList[0].SAFE_SetEvent(self.__OnClickTypeButtonNormal)
  118. self.typeButtonList[1].SAFE_SetEvent(self.__OnClickTypeButtonWarp)
  119. self.typeButtonList[2].SAFE_SetEvent(self.__OnClickTypeButtonCTF)
  120.  
  121. self.typeButtonList[0].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_NORMAL_TITLE, localeInfo.GUILDWAR_NORMAL_DESCLIST))
  122. self.typeButtonList[1].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_WARP_TITLE, localeInfo.GUILDWAR_WARP_DESCLIST))
  123. self.typeButtonList[2].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_CTF_TITLE, localeInfo.GUILDWAR_CTF_DESCLIST))
  124.  
  125. self.__ClickRadioButton(self.typeButtonList, 0)
  126.  
  127. self.SetAcceptEvent(ui.__mem_func__(self.__OnOK))
  128. self.SetCancelEvent(ui.__mem_func__(self.__OnCancel))
  129.  
  130. def __OnOK(self):
  131. text = self.GetText()
  132. type = self.GetType()
  133.  
  134. if ""==text:
  135. return
  136.  
  137. net.SendChatPacket("/war %s %d" % (text, type))
  138. self.Close()
  139.  
  140. return 1
  141.  
  142. def __OnCancel(self):
  143. self.Close()
  144. return 1
  145.  
  146. def __OnClickTypeButtonNormal(self):
  147. self.__ClickTypeRadioButton(0)
  148.  
  149. def __OnClickTypeButtonWarp(self):
  150. self.__ClickTypeRadioButton(1)
  151.  
  152. def __OnClickTypeButtonCTF(self):
  153. self.__ClickTypeRadioButton(2)
  154.  
  155. def __ClickTypeRadioButton(self, type):
  156. self.__ClickRadioButton(self.typeButtonList, type)
  157. self.type=type
  158.  
  159. def __ClickRadioButton(self, buttonList, buttonIndex):
  160. try:
  161. selButton=buttonList[buttonIndex]
  162. except IndexError:
  163. return
  164.  
  165. for eachButton in buttonList:
  166. eachButton.SetUp()
  167.  
  168. selButton.Down()
  169.  
  170. def SetTitle(self, name):
  171. self.board.SetTitleName(name)
  172.  
  173. def SetNumberMode(self):
  174. self.inputValue.SetNumberMode()
  175.  
  176. def SetSecretMode(self):
  177. self.inputValue.SetSecret()
  178.  
  179. def SetFocus(self):
  180. self.inputValue.SetFocus()
  181.  
  182. def SetMaxLength(self, length):
  183. width = length * 6 + 10
  184. self.inputValue.SetMax(length)
  185. self.SetSlotWidth(width)
  186. self.SetBoardWidth(max(width + 50, 160))
  187.  
  188. def SetSlotWidth(self, width):
  189. self.inputSlot.SetSize(width, self.inputSlot.GetHeight())
  190. self.inputValue.SetSize(width, self.inputValue.GetHeight())
  191.  
  192. def SetBoardWidth(self, width):
  193. self.board.SetSize(max(width + 50, 160), self.GetHeight())
  194. self.SetSize(max(width + 50, 160), self.GetHeight())
  195. self.UpdateRect()
  196.  
  197. def SetAcceptEvent(self, event):
  198. self.acceptButton.SetEvent(event)
  199. self.inputValue.OnIMEReturn = event
  200.  
  201. def SetCancelEvent(self, event):
  202. self.board.SetCloseEvent(event)
  203. self.cancelButton.SetEvent(event)
  204. self.inputValue.OnPressEscapeKey = event
  205.  
  206. def GetType(self):
  207. return self.type
  208.  
  209. def GetText(self):
  210. return self.inputValue.GetText()
  211.  
  212. def __CreateGameTypeToolTip(self, title, descList):
  213. toolTip = uiToolTip.ToolTip()
  214. toolTip.SetTitle(title)
  215. toolTip.AppendSpace(5)
  216.  
  217. for desc in descList:
  218. toolTip.AutoAppendTextLine(desc)
  219.  
  220. toolTip.AlignHorizonalCenter()
  221. return toolTip
  222.  
  223.  
  224. class AcceptGuildWarDialog(ui.ScriptWindow):
  225.  
  226. def __init__(self):
  227. ui.ScriptWindow.__init__(self)
  228.  
  229. self.type=0
  230. self.__CreateDialog()
  231.  
  232. def __del__(self):
  233. print "---------------------------------------------------------------------------- DELETE AcceptGuildWarDialog"
  234. ui.ScriptWindow.__del__(self)
  235.  
  236. def Open(self, guildName, warType):
  237. self.guildName=guildName
  238. self.warType=warType
  239. self.__ClickSelectedTypeRadioButton()
  240. self.inputValue.SetText(guildName)
  241. self.SetCenterPosition()
  242. self.SetTop()
  243. self.Show()
  244.  
  245. def GetGuildName(self):
  246. return self.guildName
  247.  
  248. def Close(self):
  249. self.ClearDictionary()
  250. self.board = None
  251. self.acceptButton = None
  252. self.cancelButton = None
  253. self.inputSlot = None
  254. self.inputValue = None
  255. self.Hide()
  256.  
  257. def __ClickSelectedTypeRadioButton(self):
  258. self.__ClickTypeRadioButton(self.warType)
  259.  
  260. def __CreateDialog(self):
  261.  
  262. try:
  263. pyScrLoader = ui.PythonScriptLoader()
  264. pyScrLoader.LoadScriptFile(self, "uiscript/acceptguildwardialog.py")
  265. except:
  266. import exception
  267. exception.Abort("DeclareGuildWarWindow.__CreateDialog - LoadScript")
  268.  
  269. try:
  270. getObject = self.GetChild
  271. self.board = getObject("Board")
  272.  
  273. self.typeButtonList=[]
  274. self.typeButtonList.append(getObject("NormalButton"))
  275. self.typeButtonList.append(getObject("WarpButton"))
  276. self.typeButtonList.append(getObject("CTFButton"))
  277.  
  278. self.acceptButton = getObject("AcceptButton")
  279. self.cancelButton = getObject("CancelButton")
  280. self.inputSlot = getObject("InputSlot")
  281. self.inputValue = getObject("InputValue")
  282.  
  283. gameType=getObject("GameType")
  284.  
  285. except:
  286. import exception
  287. exception.Abort("DeclareGuildWarWindow.__CreateDialog - BindObject")
  288.  
  289. if constInfo.GUILD_WAR_TYPE_SELECT_ENABLE==0:
  290. gameType.Hide()
  291.  
  292. self.typeButtonList[0].SAFE_SetEvent(self.__OnClickTypeButtonNormal)
  293. self.typeButtonList[1].SAFE_SetEvent(self.__OnClickTypeButtonWarp)
  294. self.typeButtonList[2].SAFE_SetEvent(self.__OnClickTypeButtonCTF)
  295.  
  296. self.typeButtonList[0].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_NORMAL_TITLE, localeInfo.GUILDWAR_NORMAL_DESCLIST))
  297. self.typeButtonList[1].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_WARP_TITLE, localeInfo.GUILDWAR_WARP_DESCLIST))
  298. self.typeButtonList[2].SetToolTipWindow(self.__CreateGameTypeToolTip(localeInfo.GUILDWAR_CTF_TITLE, localeInfo.GUILDWAR_CTF_DESCLIST))
  299.  
  300. self.__ClickRadioButton(self.typeButtonList, 0)
  301.  
  302. def __OnClickTypeButtonNormal(self):
  303. self.__ClickSelectedTypeRadioButton()
  304.  
  305. def __OnClickTypeButtonWarp(self):
  306. self.__ClickSelectedTypeRadioButton()
  307.  
  308. def __OnClickTypeButtonCTF(self):
  309. self.__ClickSelectedTypeRadioButton()
  310.  
  311. def __ClickTypeRadioButton(self, type):
  312. self.__ClickRadioButton(self.typeButtonList, type)
  313. self.type=type
  314.  
  315. def __ClickRadioButton(self, buttonList, buttonIndex):
  316. try:
  317. selButton=buttonList[buttonIndex]
  318. except IndexError:
  319. return
  320.  
  321. for eachButton in buttonList:
  322. eachButton.SetUp()
  323.  
  324. selButton.Down()
  325.  
  326. def SetTitle(self, name):
  327. self.board.SetTitleName(name)
  328.  
  329. def SetNumberMode(self):
  330. self.inputValue.SetNumberMode()
  331.  
  332. def SetSecretMode(self):
  333. self.inputValue.SetSecret()
  334.  
  335. def SetFocus(self):
  336. self.inputValue.SetFocus()
  337.  
  338. def SetMaxLength(self, length):
  339. width = length * 6 + 10
  340. self.inputValue.SetMax(length)
  341. self.SetSlotWidth(width)
  342. self.SetBoardWidth(max(width + 50, 160))
  343.  
  344. def SetSlotWidth(self, width):
  345. self.inputSlot.SetSize(width, self.inputSlot.GetHeight())
  346. self.inputValue.SetSize(width, self.inputValue.GetHeight())
  347.  
  348. def SetBoardWidth(self, width):
  349. self.board.SetSize(max(width + 50, 160), self.GetHeight())
  350. self.SetSize(max(width + 50, 160), self.GetHeight())
  351. self.UpdateRect()
  352.  
  353. def SAFE_SetAcceptEvent(self, event):
  354. self.SetAcceptEvent(ui.__mem_func__(event))
  355.  
  356. def SAFE_SetCancelEvent(self, event):
  357. self.SetCancelEvent(ui.__mem_func__(event))
  358.  
  359. def SetAcceptEvent(self, event):
  360. self.acceptButton.SetEvent(event)
  361. self.inputValue.OnIMEReturn = event
  362.  
  363. def SetCancelEvent(self, event):
  364. self.board.SetCloseEvent(event)
  365. self.cancelButton.SetEvent(event)
  366. self.inputValue.OnPressEscapeKey = event
  367.  
  368. def GetType(self):
  369. return self.type
  370.  
  371. def GetText(self):
  372. return self.inputValue.GetText()
  373.  
  374. def __CreateGameTypeToolTip(self, title, descList):
  375. toolTip = uiToolTip.ToolTip()
  376. toolTip.SetTitle(title)
  377. toolTip.AppendSpace(5)
  378.  
  379. for desc in descList:
  380. toolTip.AutoAppendTextLine(desc)
  381.  
  382. toolTip.AlignHorizonalCenter()
  383. return toolTip
  384.  
  385.  
  386.  
  387. class GuildWarScoreBoard(ui.ThinBoard):
  388.  
  389. def __init__(self):
  390. ui.ThinBoard.__init__(self)
  391. self.Initialize()
  392.  
  393. def __del__(self):
  394. ui.ThinBoard.__del__(self)
  395.  
  396. def Initialize(self):
  397. self.allyGuildID = 0
  398. self.enemyGuildID = 0
  399. self.allyDataDict = {}
  400. self.enemyDataDict = {}
  401.  
  402. def Open(self, allyGuildID, enemyGuildID):
  403.  
  404. self.allyGuildID = allyGuildID
  405. self.enemyGuildID = enemyGuildID
  406.  
  407. self.SetPosition(10, wndMgr.GetScreenHeight() - 100)
  408.  
  409. mark = ui.MarkBox()
  410. mark.SetParent(self)
  411. mark.SetIndex(allyGuildID)
  412. mark.SetPosition(10, 10 + 18*0)
  413. mark.Show()
  414. scoreText = ui.TextLine()
  415. scoreText.SetParent(self)
  416. scoreText.SetPosition(30, 10 + 18*0)
  417. scoreText.SetHorizontalAlignLeft()
  418. scoreText.Show()
  419. self.allyDataDict["NAME"] = guild.GetGuildName(allyGuildID)
  420. self.allyDataDict["SCORE"] = 0
  421. self.allyDataDict["MEMBER_COUNT"] = -1
  422. self.allyDataDict["MARK"] = mark
  423. self.allyDataDict["TEXT"] = scoreText
  424.  
  425. mark = ui.MarkBox()
  426. mark.SetParent(self)
  427. mark.SetIndex(enemyGuildID)
  428. mark.SetPosition(10, 10 + 18*1)
  429. mark.Show()
  430. scoreText = ui.TextLine()
  431. scoreText.SetParent(self)
  432. scoreText.SetPosition(30, 10 + 18*1)
  433. scoreText.SetHorizontalAlignLeft()
  434. scoreText.Show()
  435. self.enemyDataDict["NAME"] = guild.GetGuildName(enemyGuildID)
  436. self.enemyDataDict["SCORE"] = 0
  437. self.enemyDataDict["MEMBER_COUNT"] = -1
  438. self.enemyDataDict["MARK"] = mark
  439. self.enemyDataDict["TEXT"] = scoreText
  440.  
  441. self.__RefreshName()
  442. self.Show()
  443.  
  444. def __GetDataDict(self, ID):
  445. if self.allyGuildID == ID:
  446. return self.allyDataDict
  447. if self.enemyGuildID == ID:
  448. return self.enemyDataDict
  449.  
  450. return None
  451.  
  452. def SetScore(self, gainGuildID, opponetGuildID, point):
  453. dataDict = self.__GetDataDict(gainGuildID)
  454. if not dataDict:
  455. return
  456. dataDict["SCORE"] = point
  457. self.__RefreshName()
  458.  
  459. def UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2):
  460. dataDict1 = self.__GetDataDict(guildID1)
  461. dataDict2 = self.__GetDataDict(guildID2)
  462. if dataDict1:
  463. dataDict1["MEMBER_COUNT"] = memberCount1
  464. if dataDict2:
  465. dataDict2["MEMBER_COUNT"] = memberCount2
  466. self.__RefreshName()
  467.  
  468. def __RefreshName(self):
  469. nameMaxLen = max(len(self.allyDataDict["NAME"]), len(self.enemyDataDict["NAME"]))
  470.  
  471. if -1 == self.allyDataDict["MEMBER_COUNT"] or -1 == self.enemyDataDict["MEMBER_COUNT"]:
  472. self.SetSize(30+nameMaxLen*6+8*5, 50)
  473. self.allyDataDict["TEXT"].SetText("%s %d" % (self.allyDataDict["NAME"], self.allyDataDict["SCORE"]))
  474. self.enemyDataDict["TEXT"].SetText("%s %d" % (self.enemyDataDict["NAME"], self.enemyDataDict["SCORE"]))
  475.  
  476. else:
  477. self.SetSize(30+nameMaxLen*6+8*5+15, 50)
  478. self.allyDataDict["TEXT"].SetText("%s(%d) %d" % (self.allyDataDict["NAME"], self.allyDataDict["MEMBER_COUNT"], self.allyDataDict["SCORE"]))
  479. self.enemyDataDict["TEXT"].SetText("%s(%d) %d" % (self.enemyDataDict["NAME"], self.enemyDataDict["MEMBER_COUNT"], self.enemyDataDict["SCORE"]))
  480.  
  481. class MouseReflector(ui.Window):
  482. def __init__(self, parent):
  483. ui.Window.__init__(self)
  484. self.SetParent(parent)
  485. self.AddFlag("not_pick")
  486. self.width = self.height = 0
  487. self.isDown = FALSE
  488.  
  489. def Down(self):
  490. self.isDown = TRUE
  491.  
  492. def Up(self):
  493. self.isDown = FALSE
  494.  
  495. def OnRender(self):
  496.  
  497. if self.isDown:
  498. grp.SetColor(ui.WHITE_COLOR)
  499. else:
  500. grp.SetColor(ui.HALF_WHITE_COLOR)
  501.  
  502. x, y = self.GetGlobalPosition()
  503. grp.RenderBar(x+2, y+2, self.GetWidth()-4, self.GetHeight()-4)
  504.  
  505. class EditableTextSlot(ui.ImageBox):
  506. def __init__(self, parent, x, y):
  507. ui.ImageBox.__init__(self)
  508. self.SetParent(parent)
  509. self.SetPosition(x, y)
  510. self.LoadImage("d:/ymir work/ui/public/Parameter_Slot_02.sub")
  511.  
  512. self.mouseReflector = MouseReflector(self)
  513. self.mouseReflector.SetSize(self.GetWidth(), self.GetHeight())
  514.  
  515. self.Enable = TRUE
  516. self.textLine = ui.MakeTextLine(self)
  517. self.event = lambda *arg: None
  518. self.arg = 0
  519. self.Show()
  520.  
  521. self.mouseReflector.UpdateRect()
  522.  
  523. def __del__(self):
  524. ui.ImageBox.__del__(self)
  525.  
  526. def SetText(self, text):
  527. self.textLine.SetText(text)
  528.  
  529. def SetEvent(self, event, arg):
  530. self.event = event
  531. self.arg = arg
  532.  
  533. def Disable(self):
  534. self.Enable = FALSE
  535.  
  536. def OnMouseOverIn(self):
  537. if not self.Enable:
  538. return
  539. self.mouseReflector.Show()
  540.  
  541. def OnMouseOverOut(self):
  542. if not self.Enable:
  543. return
  544. self.mouseReflector.Hide()
  545.  
  546. def OnMouseLeftButtonDown(self):
  547. if not self.Enable:
  548. return
  549. self.mouseReflector.Down()
  550.  
  551. def OnMouseLeftButtonUp(self):
  552. if not self.Enable:
  553. return
  554. self.mouseReflector.Up()
  555. self.event(self.arg)
  556.  
  557. class CheckBox(ui.ImageBox):
  558. def __init__(self, parent, x, y, event, filename = "d:/ymir work/ui/public/Parameter_Slot_01.sub"):
  559. ui.ImageBox.__init__(self)
  560. self.SetParent(parent)
  561. self.SetPosition(x, y)
  562. self.LoadImage(filename)
  563.  
  564. self.mouseReflector = MouseReflector(self)
  565. self.mouseReflector.SetSize(self.GetWidth(), self.GetHeight())
  566.  
  567. image = ui.MakeImageBox(self, "d:/ymir work/ui/public/check_image.sub", 0, 0)
  568. image.AddFlag("not_pick")
  569. image.SetWindowHorizontalAlignCenter()
  570. image.SetWindowVerticalAlignCenter()
  571. image.Hide()
  572. self.Enable = TRUE
  573. self.image = image
  574. self.event = event
  575. self.Show()
  576.  
  577. self.mouseReflector.UpdateRect()
  578.  
  579. def __del__(self):
  580. ui.ImageBox.__del__(self)
  581.  
  582. def SetCheck(self, flag):
  583. if flag:
  584. self.image.Show()
  585. else:
  586. self.image.Hide()
  587.  
  588. def Disable(self):
  589. self.Enable = FALSE
  590.  
  591. def OnMouseOverIn(self):
  592. if not self.Enable:
  593. return
  594. self.mouseReflector.Show()
  595.  
  596. def OnMouseOverOut(self):
  597. if not self.Enable:
  598. return
  599. self.mouseReflector.Hide()
  600.  
  601. def OnMouseLeftButtonDown(self):
  602. if not self.Enable:
  603. return
  604. self.mouseReflector.Down()
  605.  
  606. def OnMouseLeftButtonUp(self):
  607. if not self.Enable:
  608. return
  609. self.mouseReflector.Up()
  610. self.event()
  611.  
  612. class ChangeGradeNameDialog(ui.ScriptWindow):
  613. def __init__(self):
  614. ui.ScriptWindow.__init__(self)
  615. def Open(self):
  616. self.gradeNameSlot.SetText("")
  617. self.gradeNameSlot.SetFocus()
  618. xMouse, yMouse = wndMgr.GetMousePosition()
  619. self.SetPosition(xMouse - self.GetWidth()/2, yMouse + 50)
  620. self.SetTop()
  621. self.Show()
  622. def Close(self):
  623. self.gradeNameSlot.KillFocus()
  624. self.Hide()
  625. return TRUE
  626.  
  627. def SetGradeNumber(self, gradeNumber):
  628. self.gradeNumber = gradeNumber
  629. def GetGradeNumber(self):
  630. return self.gradeNumber
  631. def GetGradeName(self):
  632. return self.gradeNameSlot.GetText()
  633.  
  634. def OnPressEscapeKey(self):
  635. self.Close()
  636. return TRUE
  637.  
  638. class CommentSlot(ui.Window):
  639.  
  640. TEXT_LIMIT = 35
  641.  
  642. def __init__(self):
  643. ui.Window.__init__(self)
  644.  
  645. self.slotImage = ui.MakeImageBox(self, "d:/ymir work/ui/public/Parameter_Slot_06.sub", 0, 0)
  646. self.slotImage.AddFlag("not_pick")
  647.  
  648. self.slotSimpleText = ui.MakeTextLine(self)
  649. self.slotSimpleText.SetPosition(2, 0)
  650. self.slotSimpleText.SetWindowHorizontalAlignLeft()
  651. self.slotSimpleText.SetHorizontalAlignLeft()
  652.  
  653. self.bar = ui.SlotBar()
  654. self.bar.SetParent(self)
  655. self.bar.AddFlag("not_pick")
  656. self.bar.Hide()
  657.  
  658. self.slotFullText = ui.MakeTextLine(self)
  659. self.slotFullText.SetPosition(2, 0)
  660. self.slotFullText.SetWindowHorizontalAlignLeft()
  661. self.slotFullText.SetHorizontalAlignLeft()
  662.  
  663. self.SetSize(self.slotImage.GetWidth(), self.slotImage.GetHeight())
  664. self.len = 0
  665.  
  666. def SetText(self, text):
  667. self.len = len(text)
  668. if len(text) > self.TEXT_LIMIT:
  669. limitText = grpText.GetSplitingTextLine(text, self.TEXT_LIMIT-3, 0)
  670. self.slotSimpleText.SetText(limitText + "...")
  671. self.bar.SetSize(self.len * 6 + 5, 17)
  672.  
  673. else:
  674. self.slotSimpleText.SetText(text)
  675.  
  676. self.slotFullText.SetText(text)
  677. self.slotFullText.SetPosition(2, 0)
  678. self.slotFullText.Hide()
  679.  
  680. def OnMouseOverIn(self):
  681. if self.len > self.TEXT_LIMIT:
  682. self.bar.Show()
  683. self.slotFullText.Show()
  684.  
  685. def OnMouseOverOut(self):
  686. if self.len > self.TEXT_LIMIT:
  687. self.bar.Hide()
  688. self.slotFullText.Hide()
  689.  
  690. class GuildWindow(ui.ScriptWindow):
  691.  
  692. JOB_NAME = { 0 : localeInfo.JOB_WARRIOR,
  693. 1 : localeInfo.JOB_ASSASSIN,
  694. 2 : localeInfo.JOB_SURA,
  695. 3 : localeInfo.JOB_SHAMAN, }
  696.  
  697. GUILD_SKILL_PASSIVE_SLOT = 0
  698. GUILD_SKILL_ACTIVE_SLOT = 1
  699. GUILD_SKILL_AFFECT_SLOT = 2
  700.  
  701. GRADE_SLOT_NAME = 0
  702. GRADE_ADD_MEMBER_AUTHORITY = 1
  703. GRADE_REMOVE_MEMBER_AUTHORITY = 2
  704. GRADE_NOTICE_AUTHORITY = 3
  705. GRADE_SKILL_AUTHORITY = 4
  706.  
  707. MEMBER_LINE_COUNT = 13
  708.  
  709. class PageWindow(ui.ScriptWindow):
  710. def __init__(self, parent, filename):
  711. ui.ScriptWindow.__init__(self)
  712. self.SetParent(parent)
  713. self.filename = filename
  714. def GetScriptFileName(self):
  715. return self.filename
  716.  
  717. def __init__(self):
  718. ui.ScriptWindow.__init__(self)
  719. self.isLoaded=0
  720.  
  721. self.__Initialize()
  722.  
  723. def __del__(self):
  724. ui.ScriptWindow.__del__(self)
  725. print " ==================================== DESTROIED GUILD WINDOW"
  726.  
  727. def __Initialize(self):
  728.  
  729. self.board = None
  730. self.pageName = None
  731. self.tabDict = None
  732. self.tabButtonDict = None
  733. self.pickDialog = None
  734. self.questionDialog = None
  735. self.offerDialog = None
  736. self.popupDialog = None
  737. self.moneyDialog = None
  738. self.changeGradeNameDialog = None
  739. self.popup = None
  740.  
  741. self.popupMessage = None
  742. self.commentSlot = None
  743.  
  744. self.pageWindow = None
  745. self.tooltipSkill = None
  746.  
  747. self.memberLinePos = 0
  748.  
  749. self.enemyGuildNameList = []
  750.  
  751. def Open(self):
  752. self.Show()
  753. self.SetTop()
  754.  
  755. guildID = net.GetGuildID()
  756. self.largeMarkBox.SetIndex(guildID)
  757. self.largeMarkBox.SetScale(3)
  758.  
  759. def Close(self):
  760. self.__CloseAllGuildMemberPageGradeComboBox()
  761. self.offerDialog.Close()
  762. self.popupDialog.Hide()
  763. self.changeGradeNameDialog.Hide()
  764. self.tooltipSkill.Hide()
  765. self.Hide()
  766.  
  767. self.pickDialog = None
  768. self.questionDialog = None
  769. self.popup = None
  770.  
  771. def Destroy(self):
  772. self.ClearDictionary()
  773.  
  774. if self.offerDialog:
  775. self.offerDialog.Destroy()
  776.  
  777. if self.popupDialog:
  778. self.popupDialog.ClearDictionary()
  779.  
  780. if self.changeGradeNameDialog:
  781. self.changeGradeNameDialog.ClearDictionary()
  782.  
  783. if self.pageWindow:
  784. for window in self.pageWindow.values():
  785. window.ClearDictionary()
  786.  
  787. self.__Initialize()
  788.  
  789. def Show(self):
  790. if self.isLoaded==0:
  791. self.isLoaded=1
  792.  
  793. self.__LoadWindow()
  794.  
  795. self.RefreshGuildInfoPage()
  796. self.RefreshGuildBoardPage()
  797. self.RefreshGuildMemberPage()
  798. self.RefreshGuildSkillPage()
  799. self.RefreshGuildGradePage()
  800.  
  801. ui.ScriptWindow.Show(self)
  802.  
  803. def __LoadWindow(self):
  804. global DISABLE_GUILD_SKILL
  805. try:
  806. pyScrLoader = ui.PythonScriptLoader()
  807.  
  808. if localeInfo.IsARABIC() :
  809. pyScrLoader.LoadScriptFile(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "guildwindow.py")
  810. else:
  811. pyScrLoader.LoadScriptFile(self, "uiscript/guildwindow.py")
  812.  
  813. self.popupDialog = ui.ScriptWindow()
  814. pyScrLoader.LoadScriptFile(self.popupDialog, "UIScript/PopupDialog.py")
  815.  
  816. self.changeGradeNameDialog = ChangeGradeNameDialog()
  817. pyScrLoader.LoadScriptFile(self.changeGradeNameDialog, "uiscript/changegradenamedialog.py")
  818.  
  819. if localeInfo.IsARABIC():
  820. self.pageWindow = {
  821. "GUILD_INFO" : self.PageWindow(self, "uiscript/guildwindow_guildinfopage_eu.py"),
  822. "BOARD" : self.PageWindow(self, "uiscript/guildwindow_boardpage.py"),
  823. "MEMBER" : self.PageWindow(self, "uiscript/guildwindow_memberpage.py"),
  824. "BASE_INFO" : self.PageWindow(self, "uiscript/guildwindow_baseinfopage.py"),
  825. "SKILL" : self.PageWindow(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "guildwindow_guildskillpage.py"),
  826. "GRADE" : self.PageWindow(self, "uiscript/guildwindow_gradepage.py"),
  827. }
  828. elif localeInfo.IsJAPAN() :
  829. self.pageWindow = {
  830. "GUILD_INFO" : self.PageWindow(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "guildwindow_guildinfopage.py"),
  831. "BOARD" : self.PageWindow(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "guildwindow_boardpage.py"),
  832. "MEMBER" : self.PageWindow(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "guildwindow_memberpage.py"),
  833. "BASE_INFO" : self.PageWindow(self, "uiscript/guildwindow_baseinfopage.py"),
  834. "SKILL" : self.PageWindow(self, "uiscript/guildwindow_guildskillpage.py"),
  835. "GRADE" : self.PageWindow(self, "uiscript/guildwindow_gradepage.py"),
  836. }
  837. elif localeInfo.IsVIETNAM() : # 다표시
  838. self.pageWindow = {
  839. "GUILD_INFO" : self.PageWindow(self, "uiscript/guildwindow_guildinfopage_eu.py"),
  840. "BOARD" : self.PageWindow(self, "uiscript/guildwindow_boardpage.py"),
  841. "MEMBER" : self.PageWindow(self, "uiscript/guildwindow_memberpage.py"),
  842. "BASE_INFO" : self.PageWindow(self, "uiscript/guildwindow_baseinfopage.py"),
  843. "SKILL" : self.PageWindow(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "guildwindow_guildskillpage.py"),
  844. "GRADE" : self.PageWindow(self, "uiscript/guildwindow_gradepage.py"),
  845. }
  846. elif localeInfo.IsEUROPE() and not app.GetLocalePath() == "locale/ca" :
  847. self.pageWindow = {
  848. "GUILD_INFO" : self.PageWindow(self, "uiscript/guildwindow_guildinfopage_eu.py"),
  849. "BOARD" : self.PageWindow(self, "uiscript/guildwindow_boardpage.py"),
  850. "MEMBER" : self.PageWindow(self, "uiscript/guildwindow_memberpage.py"),
  851. "BASE_INFO" : self.PageWindow(self, "uiscript/guildwindow_baseinfopage.py"),
  852. "SKILL" : self.PageWindow(self, "uiscript/guildwindow_guildskillpage.py"),
  853. "GRADE" : self.PageWindow(self, "uiscript/guildwindow_gradepage.py"),
  854. }
  855. else:
  856. self.pageWindow = {
  857. "GUILD_INFO" : self.PageWindow(self, "uiscript/guildwindow_guildinfopage.py"),
  858. "BOARD" : self.PageWindow(self, "uiscript/guildwindow_boardpage.py"),
  859. "MEMBER" : self.PageWindow(self, "uiscript/guildwindow_memberpage.py"),
  860. "BASE_INFO" : self.PageWindow(self, "uiscript/guildwindow_baseinfopage.py"),
  861. "SKILL" : self.PageWindow(self, "uiscript/guildwindow_guildskillpage.py"),
  862. "GRADE" : self.PageWindow(self, "uiscript/guildwindow_gradepage.py"),
  863. }
  864.  
  865. for window in self.pageWindow.values():
  866. pyScrLoader.LoadScriptFile(window, window.GetScriptFileName())
  867.  
  868. except:
  869. import exception
  870. exception.Abort("GuildWindow.__LoadWindow.LoadScript")
  871.  
  872. try:
  873. getObject = self.GetChild
  874.  
  875. self.board = getObject("Board")
  876. self.pageName = {
  877. "GUILD_INFO" : localeInfo.GUILD_TILE_INFO,
  878. "BOARD" : localeInfo.GUILD_TILE_BOARD,
  879. "MEMBER" : localeInfo.GUILD_TILE_MEMBER,
  880. "BASE_INFO" : localeInfo.GUILD_TILE_BASEINFO,
  881. "SKILL" : localeInfo.GUILD_TILE_SKILL,
  882. "GRADE" : localeInfo.GUILD_TILE_GRADE,
  883. }
  884.  
  885. self.tabDict = {
  886. "GUILD_INFO" : getObject("Tab_01"),
  887. "BOARD" : getObject("Tab_02"),
  888. "MEMBER" : getObject("Tab_03"),
  889. "BASE_INFO" : getObject("Tab_04"),
  890. "SKILL" : getObject("Tab_05"),
  891. "GRADE" : getObject("Tab_06"),
  892. }
  893. self.tabButtonDict = {
  894. "GUILD_INFO" : getObject("Tab_Button_01"),
  895. "BOARD" : getObject("Tab_Button_02"),
  896. "MEMBER" : getObject("Tab_Button_03"),
  897. "BASE_INFO" : getObject("Tab_Button_04"),
  898. "SKILL" : getObject("Tab_Button_05"),
  899. "GRADE" : getObject("Tab_Button_06"),
  900. }
  901.  
  902. ## QuestionDialog
  903. self.popupMessage = self.popupDialog.GetChild("message")
  904. self.popupDialog.GetChild("accept").SetEvent(ui.__mem_func__(self.popupDialog.Hide))
  905.  
  906. ## ChangeGradeName
  907. self.changeGradeNameDialog.GetChild("AcceptButton").SetEvent(ui.__mem_func__(self.OnChangeGradeName))
  908. self.changeGradeNameDialog.GetChild("CancelButton").SetEvent(ui.__mem_func__(self.changeGradeNameDialog.Hide))
  909. self.changeGradeNameDialog.GetChild("Board").SetCloseEvent(ui.__mem_func__(self.changeGradeNameDialog.Hide))
  910. self.changeGradeNameDialog.gradeNameSlot = self.changeGradeNameDialog.GetChild("GradeNameValue")
  911. self.changeGradeNameDialog.gradeNameSlot.OnIMEReturn = ui.__mem_func__(self.OnChangeGradeName)
  912. self.changeGradeNameDialog.gradeNameSlot.OnPressEscapeKey = ui.__mem_func__(self.changeGradeNameDialog.Close)
  913.  
  914. ## Comment
  915. self.commentSlot = self.pageWindow["BOARD"].GetChild("CommentValue")
  916. self.commentSlot.OnIMEReturn = ui.__mem_func__(self.OnPostComment)
  917. #self.commentSlot.OnKeyDown = ui.__mem_func__(self.OnKeyDownInBoardPage)
  918. self.commentSlot.OnKeyDown = lambda key, argSelf=self: argSelf.OnKeyDownInBoardPage(key)
  919.  
  920. ## RefreshButton
  921. self.pageWindow["BOARD"].GetChild("RefreshButton").SetEvent(ui.__mem_func__(self.OnRefreshComments))
  922.  
  923. ## ScrollBar
  924. scrollBar = self.pageWindow["MEMBER"].GetChild("ScrollBar")
  925. scrollBar.SetScrollEvent(ui.__mem_func__(self.OnScrollMemberLine))
  926. self.pageWindow["MEMBER"].scrollBar = scrollBar
  927.  
  928. except:
  929. import exception
  930. exception.Abort("GuildWindow.__LoadWindow.BindObject")
  931.  
  932. self.__MakeInfoPage()
  933. self.__MakeBoardPage()
  934. self.__MakeMemberPage()
  935. self.__MakeBaseInfoPage()
  936. self.__MakeSkillPage()
  937. self.__MakeGradePage()
  938.  
  939. for page in self.pageWindow.values():
  940. page.UpdateRect()
  941.  
  942. for key, btn in self.tabButtonDict.items():
  943. btn.SetEvent(self.SelectPage, key)
  944.  
  945. self.tabButtonDict["BASE_INFO"].Disable()
  946.  
  947. if DISABLE_GUILD_SKILL:
  948. self.tabButtonDict["SKILL"].Disable()
  949.  
  950. self.board.SetCloseEvent(ui.__mem_func__(self.Close))
  951. self.board.SetTitleColor(0xffffffff)
  952. self.SelectPage("GUILD_INFO")
  953.  
  954. self.offerDialog = uiPickMoney.PickMoneyDialog()
  955. self.offerDialog.LoadDialog()
  956. self.offerDialog.SetMax(9)
  957. self.offerDialog.SetTitleName(localeInfo.GUILD_OFFER_EXP)
  958. self.offerDialog.SetAcceptEvent(ui.__mem_func__(self.OnOffer))
  959.  
  960. def __MakeInfoPage(self):
  961. page = self.pageWindow["GUILD_INFO"]
  962.  
  963. try:
  964. page.nameSlot = page.GetChild("GuildNameValue")
  965. page.masterNameSlot = page.GetChild("GuildMasterNameValue")
  966. page.guildLevelSlot = page.GetChild("GuildLevelValue")
  967. page.curExpSlot = page.GetChild("CurrentExperienceValue")
  968. page.lastExpSlot = page.GetChild("LastExperienceValue")
  969. page.memberCountSlot = page.GetChild("GuildMemberCountValue")
  970. page.levelAverageSlot = page.GetChild("GuildMemberLevelAverageValue")
  971. page.uploadMarkButton = page.GetChild("UploadGuildMarkButton")
  972. page.uploadSymbolButton = page.GetChild("UploadGuildSymbolButton")
  973. page.declareWarButton = page.GetChild("DeclareWarButton")
  974.  
  975. try:
  976. page.guildMoneySlot = page.GetChild("GuildMoneyValue")
  977. except KeyError:
  978. page.guildMoneySlot = None
  979.  
  980. try:
  981. page.GetChild("DepositButton").SetEvent(ui.__mem_func__(self.__OnClickDepositButton))
  982. page.GetChild("WithdrawButton").SetEvent(ui.__mem_func__(self.__OnClickWithdrawButton))
  983. except KeyError:
  984. pass
  985.  
  986. page.uploadMarkButton.SetEvent(ui.__mem_func__(self.__OnClickSelectGuildMarkButton))
  987. page.uploadSymbolButton.SetEvent(ui.__mem_func__(self.__OnClickSelectGuildSymbolButton))
  988. page.declareWarButton.SetEvent(ui.__mem_func__(self.__OnClickDeclareWarButton))
  989. page.GetChild("OfferButton").SetEvent(ui.__mem_func__(self.__OnClickOfferButton))
  990. page.GetChild("EnemyGuildCancel1").Hide()
  991. page.GetChild("EnemyGuildCancel2").Hide()
  992. page.GetChild("EnemyGuildCancel3").Hide()
  993. page.GetChild("EnemyGuildCancel4").Hide()
  994. page.GetChild("EnemyGuildCancel5").Hide()
  995. page.GetChild("EnemyGuildCancel6").Hide()
  996.  
  997. self.enemyGuildNameList.append(page.GetChild("EnemyGuildName1"))
  998. self.enemyGuildNameList.append(page.GetChild("EnemyGuildName2"))
  999. self.enemyGuildNameList.append(page.GetChild("EnemyGuildName3"))
  1000. self.enemyGuildNameList.append(page.GetChild("EnemyGuildName4"))
  1001. self.enemyGuildNameList.append(page.GetChild("EnemyGuildName5"))
  1002. self.enemyGuildNameList.append(page.GetChild("EnemyGuildName6"))
  1003.  
  1004. self.largeMarkBox = page.GetChild("LargeGuildMark")
  1005. except:
  1006. import exception
  1007. exception.Abort("GuildWindow.__MakeInfoPage")
  1008.  
  1009. self.largeMarkBox.AddFlag("not_pick")
  1010.  
  1011. self.markSelectDialog=uiUploadMark.MarkSelectDialog()
  1012. self.markSelectDialog.SAFE_SetSelectEvent(self.__OnSelectMark)
  1013.  
  1014. self.symbolSelectDialog=uiUploadMark.SymbolSelectDialog()
  1015. self.symbolSelectDialog.SAFE_SetSelectEvent(self.__OnSelectSymbol)
  1016.  
  1017.  
  1018. def __MakeBoardPage(self):
  1019.  
  1020. i = 0
  1021. lineStep = 20
  1022. page = self.pageWindow["BOARD"]
  1023.  
  1024. page.boardDict = {}
  1025.  
  1026. for i in xrange(12):
  1027.  
  1028. yPos = 25 + i * lineStep
  1029.  
  1030. ## NoticeMark
  1031. if localeInfo.IsJAPAN():
  1032. noticeMarkImage = ui.MakeImageBox(page, "d:/ymir work/ui/game/guild/notice_mark.sub", 15, yPos+3)
  1033. else:
  1034. noticeMarkImage = ui.MakeImageBox(page, "d:/ymir work/ui/game/guild/notice_mark.sub", 5, yPos+3)
  1035. noticeMarkImage.Hide()
  1036. page.Children.append(noticeMarkImage)
  1037.  
  1038. ## Name
  1039. if localeInfo.IsJAPAN():
  1040. nameSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_100x18.sub", 9, yPos)
  1041. else:
  1042. nameSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_03.sub", 15, yPos)
  1043. nameSlot = ui.MakeTextLine(nameSlotImage)
  1044. page.Children.append(nameSlotImage)
  1045. page.Children.append(nameSlot)
  1046.  
  1047. ## Delete Button
  1048. deleteButton = ui.MakeButton(page, 340, yPos + 3, localeInfo.GUILD_DELETE, "d:/ymir work/ui/public/", "close_button_01.sub", "close_button_02.sub", "close_button_03.sub")
  1049. deleteButton.SetEvent(ui.__mem_func__(self.OnDeleteComment), i)
  1050. page.Children.append(deleteButton)
  1051.  
  1052. ## Comment
  1053. commentSlot = CommentSlot()
  1054. commentSlot.SetParent(page)
  1055. commentSlot.SetPosition(114, yPos)
  1056. commentSlot.Show()
  1057. page.Children.append(commentSlot)
  1058.  
  1059. boardSlotList = []
  1060. boardSlotList.append(noticeMarkImage)
  1061. boardSlotList.append(nameSlot)
  1062. boardSlotList.append(commentSlot)
  1063. page.boardDict[i] = boardSlotList
  1064.  
  1065. ## PostComment - Have to make this here for that fit tooltip's position.
  1066. postCommentButton = ui.MakeButton(page, 337, 273, localeInfo.GUILD_COMMENT, "d:/ymir work/ui/game/taskbar/", "Send_Chat_Button_01.sub", "Send_Chat_Button_02.sub", "Send_Chat_Button_03.sub")
  1067. postCommentButton.SetEvent(ui.__mem_func__(self.OnPostComment))
  1068. page.Children.append(postCommentButton)
  1069.  
  1070. def __MakeMemberPage(self):
  1071.  
  1072. page = self.pageWindow["MEMBER"]
  1073.  
  1074. lineStep = 20
  1075. page.memberDict = {}
  1076.  
  1077. for i in xrange(self.MEMBER_LINE_COUNT):
  1078.  
  1079. inverseLineIndex = self.MEMBER_LINE_COUNT - i - 1
  1080. yPos = 28 + inverseLineIndex*lineStep
  1081.  
  1082. ## Name
  1083. if localeInfo.IsJAPAN():
  1084. nameSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_100x18.sub", 15, yPos)
  1085. else:
  1086. nameSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_03.sub", 10, yPos)
  1087. nameSlot = ui.MakeTextLine(nameSlotImage)
  1088. page.Children.append(nameSlotImage)
  1089. page.Children.append(nameSlot)
  1090.  
  1091. ## Grade
  1092. gradeSlot = ui.ComboBox()
  1093. gradeSlot.SetParent(page)
  1094. if localeInfo.IsJAPAN():
  1095. gradeSlot.SetPosition(117, yPos-1)
  1096. else:
  1097. gradeSlot.SetPosition(101, yPos-1)
  1098. gradeSlot.SetSize(61, 18)
  1099. gradeSlot.SetEvent(lambda gradeNumber, lineIndex=inverseLineIndex, argSelf=proxy(self): argSelf.OnChangeMemberGrade(lineIndex, gradeNumber))
  1100. gradeSlot.Show()
  1101. page.Children.append(gradeSlot)
  1102.  
  1103. ## Job
  1104. if localeInfo.IsJAPAN():
  1105. jobSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_00.sub", 181, yPos)
  1106. else:
  1107. jobSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_00.sub", 170, yPos)
  1108. jobSlot = ui.MakeTextLine(jobSlotImage)
  1109. page.Children.append(jobSlotImage)
  1110. page.Children.append(jobSlot)
  1111.  
  1112. ## Level
  1113. if localeInfo.IsJAPAN():
  1114. levelSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_00.sub", 221, yPos)
  1115. else:
  1116. levelSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_00.sub", 210, yPos)
  1117. levelSlot = ui.MakeTextLine(levelSlotImage)
  1118. page.Children.append(levelSlotImage)
  1119. page.Children.append(levelSlot)
  1120.  
  1121. ## Offer
  1122. if localeInfo.IsJAPAN():
  1123. offerSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_00.sub", 261, yPos)
  1124. else:
  1125. offerSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_00.sub", 250, yPos)
  1126. offerSlot = ui.MakeTextLine(offerSlotImage)
  1127. page.Children.append(offerSlotImage)
  1128. page.Children.append(offerSlot)
  1129.  
  1130. ## General Enable
  1131. event = lambda argSelf=proxy(self), argIndex=inverseLineIndex: apply(argSelf.OnEnableGeneral, (argIndex,))
  1132. if localeInfo.IsJAPAN():
  1133. generalEnableCheckBox = CheckBox(page, 307, yPos, event, "d:/ymir work/ui/public/Parameter_Slot_00.sub")
  1134. else:
  1135. generalEnableCheckBox = CheckBox(page, 297, yPos, event, "d:/ymir work/ui/public/Parameter_Slot_00.sub")
  1136. page.Children.append(generalEnableCheckBox)
  1137.  
  1138. memberSlotList = []
  1139. memberSlotList.append(nameSlot)
  1140. memberSlotList.append(gradeSlot)
  1141. memberSlotList.append(jobSlot)
  1142. memberSlotList.append(levelSlot)
  1143. memberSlotList.append(offerSlot)
  1144. memberSlotList.append(generalEnableCheckBox)
  1145. page.memberDict[inverseLineIndex] = memberSlotList
  1146.  
  1147. def __MakeBaseInfoPage(self):
  1148.  
  1149. page = self.pageWindow["BASE_INFO"]
  1150.  
  1151. page.buildingDataDict = {}
  1152.  
  1153. lineStep = 20
  1154. GUILD_BUILDING_MAX_NUM = 7
  1155.  
  1156. yPos = 95 + 35
  1157.  
  1158. for i in xrange(GUILD_BUILDING_MAX_NUM):
  1159.  
  1160. nameSlotImage = ui.MakeSlotBar(page, 15, yPos, 78, 17)
  1161. nameSlot = ui.MakeTextLine(nameSlotImage)
  1162. page.Children.append(nameSlotImage)
  1163. page.Children.append(nameSlot)
  1164. nameSlot.SetText(localeInfo.GUILD_BUILDING_NAME)
  1165.  
  1166. gradeSlotImage = ui.MakeSlotBar(page, 99, yPos, 26, 17)
  1167. gradeSlot = ui.MakeTextLine(gradeSlotImage)
  1168. page.Children.append(gradeSlotImage)
  1169. page.Children.append(gradeSlot)
  1170. gradeSlot.SetText(localeInfo.GUILD_BUILDING_GRADE)
  1171.  
  1172. RESOURCE_MAX_NUM = 6
  1173. for j in xrange(RESOURCE_MAX_NUM):
  1174. resourceSlotImage = ui.MakeSlotBar(page, 131 + 29*j, yPos, 26, 17)
  1175. resourceSlot = ui.MakeTextLine(resourceSlotImage)
  1176. page.Children.append(resourceSlotImage)
  1177. page.Children.append(resourceSlot)
  1178. resourceSlot.SetText(localeInfo.GUILD_GEM)
  1179.  
  1180. event = lambda *arg: None
  1181. powerSlot = CheckBox(page, 308, yPos, event, "d:/ymir work/ui/public/Parameter_Slot_00.sub")
  1182. page.Children.append(powerSlot)
  1183.  
  1184. yPos += lineStep
  1185.  
  1186. def __MakeSkillPage(self):
  1187.  
  1188. page = self.pageWindow["SKILL"]
  1189.  
  1190. page.skillPoint = page.GetChild("Skill_Plus_Value")
  1191. page.passiveSlot = page.GetChild("Passive_Skill_Slot_Table")
  1192. page.activeSlot = page.GetChild("Active_Skill_Slot_Table")
  1193. page.affectSlot = page.GetChild("Affect_Slot_Table")
  1194. page.gpGauge = page.GetChild("Dragon_God_Power_Gauge")
  1195. page.gpValue = page.GetChild("Dragon_God_Power_Value")
  1196. page.btnHealGSP = page.GetChild("Heal_GSP_Button")
  1197.  
  1198. page.activeSlot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  1199. page.activeSlot.SetOverInItemEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OverInItem(slotNumber, type))
  1200. page.activeSlot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  1201. page.activeSlot.SetSelectItemSlotEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnPickUpGuildSkill(slotNumber, type))
  1202. page.activeSlot.SetUnselectItemSlotEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnUseGuildSkill(slotNumber, type))
  1203. page.activeSlot.SetPressedSlotButtonEvent(lambda slotNumber, type=self.GUILD_SKILL_ACTIVE_SLOT: self.OnUpGuildSkill(slotNumber, type))
  1204. page.activeSlot.AppendSlotButton("d:/ymir work/ui/game/windows/btn_plus_up.sub",\
  1205. "d:/ymir work/ui/game/windows/btn_plus_over.sub",\
  1206. "d:/ymir work/ui/game/windows/btn_plus_down.sub")
  1207. page.passiveSlot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  1208. page.passiveSlot.SetOverInItemEvent(lambda slotNumber, type=self.GUILD_SKILL_PASSIVE_SLOT: self.OverInItem(slotNumber, type))
  1209. page.passiveSlot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  1210. page.passiveSlot.SetPressedSlotButtonEvent(lambda slotNumber, type=self.GUILD_SKILL_PASSIVE_SLOT: self.OnUpGuildSkill(slotNumber, type))
  1211. page.passiveSlot.AppendSlotButton("d:/ymir work/ui/game/windows/btn_plus_up.sub",\
  1212. "d:/ymir work/ui/game/windows/btn_plus_over.sub",\
  1213. "d:/ymir work/ui/game/windows/btn_plus_down.sub")
  1214. page.affectSlot.SetSlotStyle(wndMgr.SLOT_STYLE_NONE)
  1215. page.affectSlot.SetOverInItemEvent(lambda slotNumber, type=self.GUILD_SKILL_AFFECT_SLOT: self.OverInItem(slotNumber, type))
  1216. page.affectSlot.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  1217. page.btnHealGSP.SetEvent(ui.__mem_func__(self.__OnOpenHealGSPBoard))
  1218.  
  1219. ## Passive
  1220. """
  1221. for i in xrange(len(playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST)):
  1222.  
  1223. slotIndex = page.passiveSlot.GetStartIndex()+i
  1224. skillIndex = playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST[i]
  1225.  
  1226. page.passiveSlot.SetSkillSlot(slotIndex, skillIndex, 0)
  1227. page.passiveSlot.RefreshSlot()
  1228. guild.SetSkillIndex(slotIndex, i)
  1229. """
  1230.  
  1231. ## Active
  1232. for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)):
  1233.  
  1234. slotIndex = page.activeSlot.GetStartIndex()+i
  1235. skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST[i]
  1236.  
  1237. page.activeSlot.SetSkillSlot(slotIndex, skillIndex, 0)
  1238. page.activeSlot.SetCoverButton(slotIndex)
  1239. page.activeSlot.RefreshSlot()
  1240. guild.SetSkillIndex(slotIndex, len(playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST)+i)
  1241.  
  1242. def __MakeGradePage(self):
  1243.  
  1244. lineStep = 18
  1245. page = self.pageWindow["GRADE"]
  1246.  
  1247. page.gradeDict = {}
  1248.  
  1249. for i in xrange(15):
  1250.  
  1251. yPos = 22 + i*lineStep
  1252. index = i+1
  1253.  
  1254. ## GradeNumber
  1255. gradeNumberSlotImage = ui.MakeImageBox(page, "d:/ymir work/ui/public/Parameter_Slot_00.sub", 14, yPos)
  1256. gradeNumberSlot = ui.MakeTextLine(gradeNumberSlotImage)
  1257. gradeNumberSlot.SetText(str(i+1))
  1258. page.Children.append(gradeNumberSlotImage)
  1259. page.Children.append(gradeNumberSlot)
  1260.  
  1261. ## GradeName
  1262. gradeNameSlot = EditableTextSlot(page, 58, yPos)
  1263. gradeNameSlot.SetEvent(ui.__mem_func__(self.OnOpenChangeGradeName), index)
  1264. page.Children.append(gradeNameSlot)
  1265.  
  1266. ## Invite Authority
  1267. event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<0: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
  1268. inviteAuthorityCheckBox = CheckBox(page, 124, yPos, event)
  1269. page.Children.append(inviteAuthorityCheckBox)
  1270.  
  1271. ## DriveOut Authority
  1272. event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<1: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
  1273. driveoutAuthorityCheckBox = CheckBox(page, 181, yPos, event)
  1274. page.Children.append(driveoutAuthorityCheckBox)
  1275.  
  1276. ## Notice Authority
  1277. event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<2: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
  1278. noticeAuthorityCheckBox = CheckBox(page, 238, yPos, event)
  1279. page.Children.append(noticeAuthorityCheckBox)
  1280.  
  1281. ## Skill Authority
  1282. event = lambda argSelf=proxy(self), argIndex=index, argAuthority=1<<3: apply(argSelf.OnCheckAuthority, (argIndex,argAuthority))
  1283. skillAuthorityCheckBox = CheckBox(page, 295, yPos, event)
  1284. page.Children.append(skillAuthorityCheckBox)
  1285.  
  1286. gradeSlotList = []
  1287. gradeSlotList.append(gradeNameSlot)
  1288. gradeSlotList.append(inviteAuthorityCheckBox)
  1289. gradeSlotList.append(driveoutAuthorityCheckBox)
  1290. gradeSlotList.append(noticeAuthorityCheckBox)
  1291. gradeSlotList.append(skillAuthorityCheckBox)
  1292. page.gradeDict[index] = gradeSlotList
  1293.  
  1294. masterSlotList = page.gradeDict[1]
  1295. for slot in masterSlotList:
  1296. slot.Disable()
  1297.  
  1298. def CanOpen(self):
  1299. return guild.IsGuildEnable()
  1300.  
  1301. def Open(self):
  1302. self.Show()
  1303. self.SetTop()
  1304.  
  1305. guildID = net.GetGuildID()
  1306. self.largeMarkBox.SetIndex(guildID)
  1307. self.largeMarkBox.SetScale(3)
  1308.  
  1309. def Close(self):
  1310. self.__CloseAllGuildMemberPageGradeComboBox()
  1311. self.offerDialog.Close()
  1312. self.popupDialog.Hide()
  1313. self.changeGradeNameDialog.Hide()
  1314. self.Hide()
  1315.  
  1316. if self.tooltipSkill:
  1317. self.tooltipSkill.Hide()
  1318.  
  1319. self.pickDialog = None
  1320. self.questionDialog = None
  1321. self.moneyDialog = None
  1322.  
  1323. def Destroy(self):
  1324. self.ClearDictionary()
  1325. self.board = None
  1326. self.pageName = None
  1327. self.tabDict = None
  1328. self.tabButtonDict = None
  1329. self.pickDialog = None
  1330. self.questionDialog = None
  1331. self.markSelectDialog = None
  1332. self.symbolSelectDialog = None
  1333.  
  1334. if self.offerDialog:
  1335. self.offerDialog.Destroy()
  1336. self.offerDialog = None
  1337.  
  1338. if self.popupDialog:
  1339. self.popupDialog.ClearDictionary()
  1340. self.popupDialog = None
  1341.  
  1342. if self.changeGradeNameDialog:
  1343. self.changeGradeNameDialog.ClearDictionary()
  1344. self.changeGradeNameDialog = None
  1345.  
  1346. self.popupMessage = None
  1347. self.commentSlot = None
  1348.  
  1349. if self.pageWindow:
  1350. for window in self.pageWindow.values():
  1351. window.ClearDictionary()
  1352.  
  1353. self.pageWindow = None
  1354. self.tooltipSkill = None
  1355. self.moneyDialog = None
  1356.  
  1357. self.enemyGuildNameList = []
  1358.  
  1359. def DeleteGuild(self):
  1360. self.RefreshGuildInfoPage()
  1361. self.RefreshGuildBoardPage()
  1362. self.RefreshGuildMemberPage()
  1363. self.RefreshGuildSkillPage()
  1364. self.RefreshGuildGradePage()
  1365. self.Hide()
  1366.  
  1367. def SetSkillToolTip(self, tooltipSkill):
  1368. self.tooltipSkill = tooltipSkill
  1369.  
  1370. def SelectPage(self, arg):
  1371.  
  1372. if "BOARD" == arg:
  1373. self.OnRefreshComments()
  1374.  
  1375. for key, btn in self.tabButtonDict.items():
  1376. if arg != key:
  1377. btn.SetUp()
  1378. for key, img in self.tabDict.items():
  1379. if arg == key:
  1380. img.Show()
  1381. else:
  1382. img.Hide()
  1383. for key, page in self.pageWindow.items():
  1384. if arg == key:
  1385. page.Show()
  1386. else:
  1387. page.Hide()
  1388. self.board.SetTitleName(self.pageName[arg])
  1389. self.__CloseAllGuildMemberPageGradeComboBox()
  1390.  
  1391. def __CloseAllGuildMemberPageGradeComboBox(self):
  1392.  
  1393. page = self.pageWindow["MEMBER"]
  1394. for key, slotList in page.memberDict.items():
  1395. slotList[1].CloseListBox()
  1396.  
  1397. def RefreshGuildInfoPage(self):
  1398.  
  1399. if self.isLoaded==0:
  1400. return
  1401.  
  1402. global DISABLE_DECLARE_WAR
  1403. page = self.pageWindow["GUILD_INFO"]
  1404. page.nameSlot.SetText(guild.GetGuildName())
  1405. page.masterNameSlot.SetText(guild.GetGuildMasterName())
  1406. page.guildLevelSlot.SetText(str(guild.GetGuildLevel()))
  1407. if page.guildMoneySlot:
  1408. page.guildMoneySlot.SetText(str(guild.GetGuildMoney()))
  1409.  
  1410. curExp, lastExp = guild.GetGuildExperience()
  1411. curExp *= 100
  1412. lastExp *= 100
  1413. page.curExpSlot.SetText(str(curExp))
  1414. page.lastExpSlot.SetText(str(lastExp))
  1415.  
  1416. curMemberCount, maxMemberCount = guild.GetGuildMemberCount()
  1417. if maxMemberCount== 0xffff:
  1418. page.memberCountSlot.SetText("%d / %s " % (curMemberCount, localeInfo.GUILD_MEMBER_COUNT_INFINITY))
  1419. else:
  1420. page.memberCountSlot.SetText("%d / %d" % (curMemberCount, maxMemberCount))
  1421.  
  1422. page.levelAverageSlot.SetText(str(guild.GetGuildMemberLevelAverage()))
  1423.  
  1424. ## 길드장만 길드 마크와 길드전 신청 버튼을 볼 수 있음
  1425. mainCharacterName = player.GetMainCharacterName()
  1426. masterName = guild.GetGuildMasterName()
  1427.  
  1428. if mainCharacterName == masterName:
  1429. page.uploadMarkButton.Show()
  1430.  
  1431. if DISABLE_DECLARE_WAR:
  1432. page.declareWarButton.Hide()
  1433. else:
  1434. page.declareWarButton.Show()
  1435.  
  1436. if guild.HasGuildLand():
  1437. page.uploadSymbolButton.Show()
  1438. else:
  1439. page.uploadSymbolButton.Hide()
  1440. else:
  1441. page.uploadMarkButton.Hide()
  1442. page.declareWarButton.Hide()
  1443. page.uploadSymbolButton.Hide()
  1444.  
  1445. ## Refresh 시에 길드전 정보 업데이트
  1446. for i in xrange(guild.ENEMY_GUILD_SLOT_MAX_COUNT):
  1447. name = guild.GetEnemyGuildName(i)
  1448. nameTextLine = self.enemyGuildNameList[i]
  1449. if name:
  1450. nameTextLine.SetText(name)
  1451. else:
  1452. nameTextLine.SetText(localeInfo.GUILD_INFO_ENEMY_GUILD_EMPTY)
  1453.  
  1454. def __GetGuildBoardCommentData(self, index):
  1455. commentID, chrName, comment = guild.GetGuildBoardCommentData(index)
  1456. if 0==commentID:
  1457. if ""==chrName:
  1458. chrName=localeInfo.UI_NONAME
  1459. if ""==comment:
  1460. comment=localeInfo.UI_NOCONTENTS
  1461.  
  1462. return commentID, chrName, comment
  1463.  
  1464. def RefreshGuildBoardPage(self):
  1465.  
  1466. if self.isLoaded==0:
  1467. return
  1468.  
  1469. page = self.pageWindow["BOARD"]
  1470.  
  1471. self.BOARD_LINE_MAX_NUM = 12
  1472. lineIndex = 0
  1473.  
  1474. commentCount = guild.GetGuildBoardCommentCount()
  1475. for i in xrange(commentCount):
  1476.  
  1477. commentID, chrName, comment = self.__GetGuildBoardCommentData(i)
  1478.  
  1479. if not comment:
  1480. continue
  1481.  
  1482. slotList = page.boardDict[lineIndex]
  1483.  
  1484. if "!" == comment[0]:
  1485. slotList[0].Show()
  1486. slotList[1].SetText(chrName)
  1487. slotList[2].SetText(comment[1:])
  1488.  
  1489. else:
  1490. slotList[0].Hide()
  1491. slotList[1].SetText(chrName)
  1492. slotList[2].SetText(comment)
  1493.  
  1494. lineIndex += 1
  1495.  
  1496. for i in xrange(self.BOARD_LINE_MAX_NUM - lineIndex):
  1497. slotList = page.boardDict[lineIndex+i]
  1498. slotList[0].Hide()
  1499. slotList[1].SetText("")
  1500. slotList[2].SetText("")
  1501.  
  1502. def RefreshGuildMemberPage(self):
  1503.  
  1504. if self.isLoaded==0:
  1505. return
  1506.  
  1507. page = self.pageWindow["MEMBER"]
  1508.  
  1509. ## ScrollBar
  1510. count = guild.GetMemberCount()
  1511. if count > self.MEMBER_LINE_COUNT:
  1512. page.scrollBar.SetMiddleBarSize(float(self.MEMBER_LINE_COUNT) / float(count))
  1513. page.scrollBar.Show()
  1514. else:
  1515. page.scrollBar.Hide()
  1516. self.RefreshGuildMemberPageGradeComboBox()
  1517. self.RefreshGuildMemberPageMemberList()
  1518.  
  1519. def RefreshGuildMemberPageMemberList(self):
  1520.  
  1521. if self.isLoaded==0:
  1522. return
  1523.  
  1524. page = self.pageWindow["MEMBER"]
  1525.  
  1526. for line, slotList in page.memberDict.items():
  1527.  
  1528. gradeComboBox = slotList[1]
  1529. gradeComboBox.Disable()
  1530.  
  1531. if not guild.IsMember(line):
  1532. slotList[0].SetText("")
  1533. slotList[2].SetText("")
  1534. slotList[3].SetText("")
  1535. slotList[4].SetText("")
  1536. slotList[5].SetCheck(FALSE)
  1537. continue
  1538.  
  1539. pid, name, grade, race, level, offer, general = self.GetMemberData(line)
  1540. if pid < 0:
  1541. continue
  1542.  
  1543. job = chr.RaceToJob(race)
  1544.  
  1545. guildExperienceSummary = guild.GetGuildExperienceSummary()
  1546.  
  1547. offerPercentage = 0
  1548. if guildExperienceSummary > 0:
  1549. offerPercentage = int(float(offer) / float(guildExperienceSummary) * 100.0)
  1550.  
  1551. slotList[0].SetText(name)
  1552. slotList[2].SetText(self.JOB_NAME.get(job, "?"))
  1553. slotList[3].SetText(str(level))
  1554. slotList[4].SetText(str(offerPercentage) + "%")
  1555. slotList[5].SetCheck(general)
  1556. gradeComboBox.SetCurrentItem(guild.GetGradeName(grade))
  1557. if 1 != grade:
  1558. gradeComboBox.Enable()
  1559.  
  1560. def RefreshGuildMemberPageGradeComboBox(self):
  1561.  
  1562. if self.isLoaded==0:
  1563. return
  1564.  
  1565. page = self.pageWindow["MEMBER"]
  1566.  
  1567. self.CAN_CHANGE_GRADE_COUNT = 15 - 1
  1568. for key, slotList in page.memberDict.items():
  1569.  
  1570. gradeComboBox = slotList[1]
  1571. gradeComboBox.Disable()
  1572.  
  1573. if not guild.IsMember(key):
  1574. continue
  1575.  
  1576. pid, name, grade, job, level, offer, general = self.GetMemberData(key)
  1577. if pid < 0:
  1578. continue
  1579.  
  1580. gradeComboBox.ClearItem()
  1581. for i in xrange(self.CAN_CHANGE_GRADE_COUNT):
  1582. gradeComboBox.InsertItem(i+2, guild.GetGradeName(i+2))
  1583. gradeComboBox.SetCurrentItem(guild.GetGradeName(grade))
  1584. if 1 != grade:
  1585. gradeComboBox.Enable()
  1586.  
  1587. def RefreshGuildSkillPage(self):
  1588.  
  1589. if self.isLoaded==0:
  1590. return
  1591.  
  1592. page = self.pageWindow["SKILL"]
  1593.  
  1594. curPoint, maxPoint = guild.GetDragonPowerPoint()
  1595. maxPoint = max(maxPoint, 1)
  1596. page.gpValue.SetText(str(curPoint) + " / " + str(maxPoint))
  1597.  
  1598. percentage = (float(curPoint) / float(maxPoint) * 100) * (float(173) / float(95))
  1599. page.gpGauge.SetPercentage(int(percentage), 100)
  1600.  
  1601. skillPoint = guild.GetGuildSkillPoint()
  1602. page.skillPoint.SetText(str(skillPoint))
  1603.  
  1604. page.passiveSlot.HideAllSlotButton()
  1605. page.activeSlot.HideAllSlotButton()
  1606.  
  1607. ## Passive
  1608. """
  1609. for i in xrange(len(playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST)):
  1610.  
  1611. slotIndex = page.passiveSlot.GetStartIndex()+i
  1612. skillIndex = playerSettingModule.PASSIVE_GUILD_SKILL_INDEX_LIST[i]
  1613. skillLevel = guild.GetSkillLevel(slotIndex)
  1614. skillMaxLevel = skill.GetSkillMaxLevel(skillIndex)
  1615.  
  1616. page.passiveSlot.SetSlotCount(slotIndex, skillLevel)
  1617. if skillPoint > 0:
  1618. if skillLevel < skillMaxLevel:
  1619. page.passiveSlot.ShowSlotButton(slotIndex)
  1620. """
  1621.  
  1622. ## Active
  1623. for i in xrange(len(playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST)):
  1624.  
  1625. slotIndex = page.activeSlot.GetStartIndex()+i
  1626. skillIndex = playerSettingModule.ACTIVE_GUILD_SKILL_INDEX_LIST[i]
  1627. skillLevel = guild.GetSkillLevel(slotIndex)
  1628. skillMaxLevel = skill.GetSkillMaxLevel(skillIndex)
  1629.  
  1630. page.activeSlot.SetSlotCount(slotIndex, skillLevel)
  1631.  
  1632. if skillLevel <= 0:
  1633. page.activeSlot.DisableCoverButton(slotIndex)
  1634. else:
  1635. page.activeSlot.EnableCoverButton(slotIndex)
  1636.  
  1637. if skillPoint > 0:
  1638. if skillLevel < skillMaxLevel:
  1639. page.activeSlot.ShowSlotButton(slotIndex)
  1640.  
  1641. def RefreshGuildGradePage(self):
  1642.  
  1643. if self.isLoaded==0:
  1644. return
  1645.  
  1646. page = self.pageWindow["GRADE"]
  1647.  
  1648. for key, slotList in page.gradeDict.items():
  1649. name, authority = guild.GetGradeData(int(key))
  1650.  
  1651. slotList[self.GRADE_SLOT_NAME].SetText(name)
  1652. slotList[self.GRADE_ADD_MEMBER_AUTHORITY].SetCheck(authority & guild.AUTH_ADD_MEMBER)
  1653. slotList[self.GRADE_REMOVE_MEMBER_AUTHORITY].SetCheck(authority & guild.AUTH_REMOVE_MEMBER)
  1654. slotList[self.GRADE_NOTICE_AUTHORITY].SetCheck(authority & guild.AUTH_NOTICE)
  1655. slotList[self.GRADE_SKILL_AUTHORITY].SetCheck(authority & guild.AUTH_SKILL)
  1656.  
  1657. ## GuildInfo
  1658.  
  1659. def __PopupMessage(self, msg):
  1660. self.popupMessage.SetText(msg)
  1661. self.popupDialog.SetTop()
  1662. self.popupDialog.Show()
  1663.  
  1664. def __OnClickSelectGuildMarkButton(self):
  1665. if guild.GetGuildLevel() < int(localeInfo.GUILD_MARK_MIN_LEVEL):
  1666. self.__PopupMessage(localeInfo.GUILD_MARK_NOT_ENOUGH_LEVEL)
  1667. elif not guild.MainPlayerHasAuthority(guild.AUTH_NOTICE):
  1668. self.__PopupMessage(localeInfo.GUILD_NO_NOTICE_PERMISSION)
  1669. else:
  1670. self.markSelectDialog.Open()
  1671.  
  1672. def __OnClickSelectGuildSymbolButton(self):
  1673. if guild.MainPlayerHasAuthority(guild.AUTH_NOTICE):
  1674. self.symbolSelectDialog.Open()
  1675. else:
  1676. self.__PopupMessage(localeInfo.GUILD_NO_NOTICE_PERMISSION)
  1677.  
  1678. def __OnClickDeclareWarButton(self):
  1679. inputDialog = DeclareGuildWarDialog()
  1680. inputDialog.Open()
  1681. self.inputDialog = inputDialog
  1682.  
  1683. def __OnSelectMark(self, markFileName):
  1684. ret = net.UploadMark("upload/"+markFileName)
  1685.  
  1686. # MARK_BUG_FIX
  1687. if net.ERROR_MARK_UPLOAD_NEED_RECONNECT == ret:
  1688. self.__PopupMessage(localeInfo.UPLOAD_MARK_UPLOAD_NEED_RECONNECT);
  1689.  
  1690. return ret
  1691. # END_OF_MARK_BUG_FIX
  1692.  
  1693. def __OnSelectSymbol(self, symbolFileName):
  1694. net.UploadSymbol("upload/"+symbolFileName)
  1695.  
  1696. def __OnClickOfferButton(self):
  1697.  
  1698. curEXP = unsigned32(player.GetStatus(player.EXP))
  1699.  
  1700. if curEXP <= 100:
  1701. self.__PopupMessage(localeInfo.GUILD_SHORT_EXP);
  1702. return
  1703.  
  1704. self.offerDialog.Open(curEXP, 100)
  1705.  
  1706. def __OnClickDepositButton(self):
  1707. moneyDialog = uiPickMoney.PickMoneyDialog()
  1708. moneyDialog.LoadDialog()
  1709. moneyDialog.SetMax(6)
  1710. moneyDialog.SetTitleName(localeInfo.GUILD_DEPOSIT)
  1711. moneyDialog.SetAcceptEvent(ui.__mem_func__(self.OnDeposit))
  1712. moneyDialog.Open(player.GetMoney())
  1713. self.moneyDialog = moneyDialog
  1714.  
  1715. def __OnClickWithdrawButton(self):
  1716. moneyDialog = uiPickMoney.PickMoneyDialog()
  1717. moneyDialog.LoadDialog()
  1718. moneyDialog.SetMax(6)
  1719. moneyDialog.SetTitleName(localeInfo.GUILD_WITHDRAW)
  1720. moneyDialog.SetAcceptEvent(ui.__mem_func__(self.OnWithdraw))
  1721. moneyDialog.Open(guild.GetGuildMoney())
  1722. self.moneyDialog = moneyDialog
  1723.  
  1724. def __OnBlock(self):
  1725. popup = uiCommon.PopupDialog()
  1726. popup.SetText(localeInfo.NOT_YET_SUPPORT)
  1727. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  1728. popup.Open()
  1729. self.popup = popup
  1730.  
  1731. def __OnClosePopupDialog(self):
  1732. self.popup = None
  1733.  
  1734. def OnDeposit(self, money):
  1735. net.SendGuildDepositMoneyPacket(money)
  1736.  
  1737. def OnWithdraw(self, money):
  1738. net.SendGuildWithdrawMoneyPacket(money)
  1739.  
  1740. def OnOffer(self, exp):
  1741. net.SendGuildOfferPacket(exp)
  1742.  
  1743. ## Board
  1744. def OnPostComment(self):
  1745.  
  1746. text = self.commentSlot.GetText()
  1747. if not text:
  1748. return FALSE
  1749.  
  1750. net.SendGuildPostCommentPacket(text[:50])
  1751. self.commentSlot.SetText("")
  1752. return TRUE
  1753.  
  1754. def OnDeleteComment(self, index):
  1755.  
  1756. commentID, chrName, comment = self.__GetGuildBoardCommentData(index)
  1757. net.SendGuildDeleteCommentPacket(commentID)
  1758.  
  1759. def OnRefreshComments(self):
  1760. net.SendGuildRefreshCommentsPacket(0)
  1761.  
  1762. def OnKeyDownInBoardPage(self, key):
  1763. if key == 63:
  1764. self.OnRefreshComments()
  1765. return TRUE
  1766.  
  1767. ## Member
  1768. ## OnEnableGeneral
  1769. def OnChangeMemberGrade(self, lineIndex, gradeNumber):
  1770. PID = guild.MemberIndexToPID(lineIndex + self.memberLinePos)
  1771. net.SendGuildChangeMemberGradePacket(PID, gradeNumber)
  1772.  
  1773. def OnEnableGeneral(self, lineIndex):
  1774. if not guild.IsMember(lineIndex):
  1775. return
  1776.  
  1777. pid, name, grade, job, level, offer, general = self.GetMemberData(lineIndex)
  1778. if pid < 0:
  1779. return
  1780.  
  1781. net.SendGuildChangeMemberGeneralPacket(pid, 1 - general)
  1782.  
  1783. ## Grade
  1784. def OnOpenChangeGradeName(self, arg):
  1785. self.changeGradeNameDialog.SetGradeNumber(arg)
  1786. self.changeGradeNameDialog.Open()
  1787.  
  1788. def OnChangeGradeName(self):
  1789. self.changeGradeNameDialog.Hide()
  1790. gradeNumber = self.changeGradeNameDialog.GetGradeNumber()
  1791. gradeName = self.changeGradeNameDialog.GetGradeName()
  1792.  
  1793. if len(gradeName) == 0:
  1794. gradeName = localeInfo.GUILD_DEFAULT_GRADE
  1795.  
  1796. net.SendGuildChangeGradeNamePacket(gradeNumber, gradeName)
  1797. return TRUE
  1798.  
  1799. def OnCheckAuthority(self, argIndex, argAuthority):
  1800. name, authority = guild.GetGradeData(argIndex)
  1801. net.SendGuildChangeGradeAuthorityPacket(argIndex, authority ^ argAuthority)
  1802.  
  1803. def OnScrollMemberLine(self):
  1804. scrollBar = self.pageWindow["MEMBER"].scrollBar
  1805. pos = scrollBar.GetPos()
  1806.  
  1807. count = guild.GetMemberCount()
  1808. newLinePos = int(float(count - self.MEMBER_LINE_COUNT) * pos)
  1809.  
  1810. if newLinePos != self.memberLinePos:
  1811. self.memberLinePos = newLinePos
  1812. self.RefreshGuildMemberPageMemberList()
  1813. self.__CloseAllGuildMemberPageGradeComboBox()
  1814.  
  1815. def GetMemberData(self, localPos):
  1816. return guild.GetMemberData(localPos + self.memberLinePos)
  1817.  
  1818. ## Guild Skill
  1819. def __OnOpenHealGSPBoard(self):
  1820.  
  1821. curPoint, maxPoint = guild.GetDragonPowerPoint()
  1822.  
  1823. if maxPoint - curPoint <= 0:
  1824. self.__PopupMessage(localeInfo.GUILD_CANNOT_HEAL_GSP_ANYMORE)
  1825. return
  1826.  
  1827. pickDialog = uiPickMoney.PickMoneyDialog()
  1828. pickDialog.LoadDialog()
  1829. pickDialog.SetMax(9)
  1830. pickDialog.SetTitleName(localeInfo.GUILD_HEAL_GSP)
  1831. pickDialog.SetAcceptEvent(ui.__mem_func__(self.__OnOpenHealGSPQuestionDialog))
  1832. pickDialog.Open(maxPoint - curPoint, 1)
  1833. self.pickDialog = pickDialog
  1834.  
  1835. def __OnOpenHealGSPQuestionDialog(self, healGSP):
  1836.  
  1837. money = healGSP * constInfo.GUILD_MONEY_PER_GSP
  1838.  
  1839. questionDialog = uiCommon.QuestionDialog()
  1840. questionDialog.SetText(localeInfo.GUILD_DO_YOU_HEAL_GSP % (money, healGSP))
  1841. questionDialog.SetAcceptEvent(ui.__mem_func__(self.__OnHealGSP))
  1842. questionDialog.SetCancelEvent(ui.__mem_func__(self.__OnCloseQuestionDialog))
  1843. questionDialog.SetWidth(400)
  1844. questionDialog.Open()
  1845. questionDialog.healGSP = healGSP
  1846. self.questionDialog = questionDialog
  1847.  
  1848. def __OnHealGSP(self):
  1849. net.SendGuildChargeGSPPacket(self.questionDialog.healGSP)
  1850. self.__OnCloseQuestionDialog()
  1851.  
  1852. def __OnCloseQuestionDialog(self):
  1853. if self.questionDialog:
  1854. self.questionDialog.Close()
  1855. self.questionDialog = None
  1856.  
  1857. def OnPickUpGuildSkill(self, skillSlotIndex, type):
  1858.  
  1859. mouseController = mouseModule.mouseController
  1860.  
  1861. if FALSE == mouseController.isAttached():
  1862.  
  1863. skillIndex = player.GetSkillIndex(skillSlotIndex)
  1864. skillLevel = guild.GetSkillLevel(skillSlotIndex)
  1865.  
  1866. if skill.CanUseSkill(skillIndex) and skillLevel > 0:
  1867.  
  1868. if app.IsPressed(app.DIK_LCONTROL):
  1869.  
  1870. player.RequestAddToEmptyLocalQuickSlot(player.SLOT_TYPE_SKILL, skillSlotIndex)
  1871. return
  1872.  
  1873. mouseController.AttachObject(self, player.SLOT_TYPE_SKILL, skillSlotIndex, skillIndex)
  1874.  
  1875. else:
  1876. mouseController.DeattachObject()
  1877.  
  1878. def OnUseGuildSkill(self, slotNumber, type):
  1879. skillIndex = player.GetSkillIndex(slotNumber)
  1880. skillLevel = guild.GetSkillLevel(slotNumber)
  1881.  
  1882. if skillLevel <= 0:
  1883. return
  1884.  
  1885. player.UseGuildSkill(slotNumber)
  1886.  
  1887. def OnUpGuildSkill(self, slotNumber, type):
  1888. skillIndex = player.GetSkillIndex(slotNumber)
  1889. net.SendChatPacket("/gskillup " + str(skillIndex))
  1890.  
  1891. def OnUseSkill(self, slotNumber, coolTime):
  1892.  
  1893. if self.isLoaded==0:
  1894. return
  1895.  
  1896. page = self.pageWindow["SKILL"]
  1897.  
  1898. if page.activeSlot.HasSlot(slotNumber):
  1899. page.activeSlot.SetSlotCoolTime(slotNumber, coolTime)
  1900.  
  1901. def OnStartGuildWar(self, guildSelf, guildOpp):
  1902.  
  1903. if self.isLoaded==0:
  1904. return
  1905.  
  1906. if guild.GetGuildID() != guildSelf:
  1907. return
  1908.  
  1909. guildName = guild.GetGuildName(guildOpp)
  1910. for guildNameTextLine in self.enemyGuildNameList:
  1911. if localeInfo.GUILD_INFO_ENEMY_GUILD_EMPTY == guildNameTextLine.GetText():
  1912. guildNameTextLine.SetText(guildName)
  1913. return
  1914.  
  1915. def OnEndGuildWar(self, guildSelf, guildOpp):
  1916.  
  1917. if self.isLoaded==0:
  1918. return
  1919.  
  1920. if guild.GetGuildID() != guildSelf:
  1921. return
  1922.  
  1923. guildName = guild.GetGuildName(guildOpp)
  1924. for guildNameTextLine in self.enemyGuildNameList:
  1925. if guildName == guildNameTextLine.GetText():
  1926. guildNameTextLine.SetText(localeInfo.GUILD_INFO_ENEMY_GUILD_EMPTY)
  1927. return
  1928.  
  1929. ## ToolTip
  1930. def OverInItem(self, slotNumber, type):
  1931.  
  1932. if mouseModule.mouseController.isAttached():
  1933. return
  1934.  
  1935. if None != self.tooltipSkill:
  1936. skillIndex = player.GetSkillIndex(slotNumber)
  1937. skillLevel = guild.GetSkillLevel(slotNumber)
  1938.  
  1939. self.tooltipSkill.SetSkill(skillIndex, skillLevel)
  1940.  
  1941. def OverOutItem(self):
  1942. if None != self.tooltipSkill:
  1943. self.tooltipSkill.HideToolTip()
  1944.  
  1945. def OnPressEscapeKey(self):
  1946. self.Close()
  1947. return TRUE
  1948.  
  1949.  
  1950. class BuildGuildBuildingWindow(ui.ScriptWindow):
  1951.  
  1952. if localeInfo.IsJAPAN():
  1953. GUILD_CATEGORY_LIST = (
  1954. ("HEADQUARTER", "Š?bŒš’z•?),
  1955. ("FACILITY", "Šg’?š’z•?),
  1956. ("OBJECT", "‚???),
  1957. )
  1958. elif localeInfo.IsYMIR() or localeInfo.IsWE_KOREA():
  1959. GUILD_CATEGORY_LIST = (
  1960. ("HEADQUARTER", "본건물"),
  1961. ("FACILITY", "기능건물"),
  1962. ("OBJECT", "조경물"),
  1963. )
  1964. elif localeInfo.IsEUROPE() or localeInfo.IsHONGKONG():
  1965. GUILD_CATEGORY_LIST = (
  1966. ("HEADQUARTER", localeInfo.GUILD_HEADQUARTER),
  1967. ("FACILITY", localeInfo.GUILD_FACILITY),
  1968. ("OBJECT", localeInfo.GUILD_OBJECT),
  1969. )
  1970. else:
  1971. try :
  1972. GUILD_CATEGORY_LIST = (
  1973. ("HEADQUARTER", localeInfo.GUILD_HEADQUARTER),
  1974. ("FACILITY", localeInfo.GUILD_FACILITY),
  1975. ("OBJECT", localeInfo.GUILD_OBJECT),
  1976. )
  1977. except:
  1978. GUILD_CATEGORY_LIST = (
  1979. ("HEADQUARTER", "Main Building"),
  1980. ("FACILITY", "Facility"),
  1981. ("OBJECT", "Object"),
  1982. )
  1983.  
  1984. MODE_VIEW = 0
  1985. MODE_POSITIONING = 1
  1986. MODE_PREVIEW = 2
  1987.  
  1988. BUILDING_ALPHA = 0.55
  1989.  
  1990. ENABLE_COLOR = grp.GenerateColor(0.7607, 0.7607, 0.7607, 1.0)
  1991. DISABLE_COLOR = grp.GenerateColor(0.9, 0.4745, 0.4627, 1.0)
  1992.  
  1993. START_INSTANCE_INDEX = 123450
  1994. #WALL_SET_INSTANCE = 14105
  1995.  
  1996. def __init__(self):
  1997. ui.ScriptWindow.__init__(self)
  1998. self.__LoadWindow()
  1999.  
  2000. self.closeEvent = None
  2001. self.popup = None
  2002. self.mode = self.MODE_VIEW
  2003. self.race = 0
  2004. self.type = None
  2005. self.x = 0
  2006. self.y = 0
  2007. self.z = 0
  2008. self.rot_x = 0
  2009. self.rot_y = 0
  2010. self.rot_z = 0
  2011. self.rot_x_limit = 0
  2012. self.rot_y_limit = 0
  2013. self.rot_z_limit = 0
  2014. self.needMoney = 0
  2015. self.needStoneCount = 0
  2016. self.needLogCount = 0
  2017. self.needPlywoodCount = 0
  2018.  
  2019. #self.index = 0
  2020. self.indexList = []
  2021. self.raceList = []
  2022. self.posList = []
  2023. self.rotList = []
  2024.  
  2025. index = 0
  2026. for category in self.GUILD_CATEGORY_LIST:
  2027. self.categoryList.InsertItem(index, category[1])
  2028. index += 1
  2029.  
  2030. def __del__(self):
  2031. ui.ScriptWindow.__del__(self)
  2032.  
  2033. def __LoadWindow(self):
  2034.  
  2035. try:
  2036. pyScrLoader = ui.PythonScriptLoader()
  2037. if localeInfo.IsARABIC():
  2038. pyScrLoader.LoadScriptFile(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "buildguildbuildingwindow.py")
  2039. elif localeInfo.IsVIETNAM():
  2040. pyScrLoader.LoadScriptFile(self, uiScriptlocale.LOCALE_UISCRIPT_PATH + "buildguildbuildingwindow.py")
  2041. else:
  2042. pyScrLoader.LoadScriptFile(self, "uiscript/buildguildbuildingwindow.py")
  2043. except:
  2044. import exception
  2045. exception.Abort("DeclareGuildWarWindow.__CreateDialog - LoadScript")
  2046.  
  2047. try:
  2048. getObject = self.GetChild
  2049. self.board = getObject("Board")
  2050. self.categoryList = getObject("CategoryList")
  2051. self.buildingList = getObject("BuildingList")
  2052. self.listScrollBar = getObject("ListScrollBar")
  2053. self.positionButton = getObject("PositionButton")
  2054. self.previewButton = getObject("PreviewButton")
  2055. self.posValueX = getObject("BuildingPositionXValue")
  2056. self.posValueY = getObject("BuildingPositionYValue")
  2057. self.ctrlRotationX = getObject("BuildingRotationX")
  2058. self.ctrlRotationY = getObject("BuildingRotationY")
  2059. self.ctrlRotationZ = getObject("BuildingRotationZ")
  2060. self.buildingPriceValue = getObject("BuildingPriceValue")
  2061. self.buildingMaterialStoneValue = getObject("BuildingMaterialStoneValue")
  2062. self.buildingMaterialLogValue = getObject("BuildingMaterialLogValue")
  2063. self.buildingMaterialPlywoodValue = getObject("BuildingMaterialPlywoodValue")
  2064.  
  2065. self.positionButton.SetEvent(ui.__mem_func__(self.__OnSelectPositioningMode))
  2066. self.previewButton.SetToggleDownEvent(ui.__mem_func__(self.__OnEnterPreviewMode))
  2067. self.previewButton.SetToggleUpEvent(ui.__mem_func__(self.__OnLeavePreviewMode))
  2068. self.ctrlRotationX.SetEvent(ui.__mem_func__(self.__OnChangeRotation))
  2069. self.ctrlRotationY.SetEvent(ui.__mem_func__(self.__OnChangeRotation))
  2070. self.ctrlRotationZ.SetEvent(ui.__mem_func__(self.__OnChangeRotation))
  2071. self.listScrollBar.SetScrollEvent(ui.__mem_func__(self.__OnScrollBuildingList))
  2072.  
  2073. getObject("CategoryList").SetEvent(ui.__mem_func__(self.__OnSelectCategory))
  2074. getObject("BuildingList").SetEvent(ui.__mem_func__(self.__OnSelectBuilding))
  2075. getObject("AcceptButton").SetEvent(ui.__mem_func__(self.Build))
  2076. getObject("CancelButton").SetEvent(ui.__mem_func__(self.Close))
  2077. self.board.SetCloseEvent(ui.__mem_func__(self.Close))
  2078.  
  2079. except:
  2080. import exception
  2081. exception.Abort("BuildGuildBuildingWindow.__LoadWindow - BindObject")
  2082.  
  2083. def __CreateWallBlock(self, race, x, y, rot=0.0 ):
  2084. idx = self.START_INSTANCE_INDEX + len(self.indexList)
  2085. self.indexList.append(idx)
  2086. self.raceList.append(race)
  2087. self.posList.append((x, y))
  2088. self.rotList.append(rot)
  2089. chr.CreateInstance(idx)
  2090. chr.SelectInstance(idx)
  2091. chr.SetVirtualID(idx)
  2092. chr.SetInstanceType(chr.INSTANCE_TYPE_OBJECT)
  2093.  
  2094. chr.SetRace(race)
  2095. chr.SetArmor(0)
  2096. chr.Refresh()
  2097. chr.SetLoopMotion(chr.MOTION_WAIT)
  2098. chr.SetBlendRenderMode(idx, self.BUILDING_ALPHA)
  2099. chr.SetRotationAll(0.0, 0.0, rot)
  2100.  
  2101. self.ctrlRotationX.SetSliderPos(0.5)
  2102. self.ctrlRotationY.SetSliderPos(0.5)
  2103. self.ctrlRotationZ.SetSliderPos(0.5)
  2104.  
  2105. def __GetObjectSize(self, race):
  2106. idx = self.START_INSTANCE_INDEX + 1000
  2107. chr.CreateInstance(idx)
  2108. chr.SelectInstance(idx)
  2109. chr.SetVirtualID(idx)
  2110. chr.SetInstanceType(chr.INSTANCE_TYPE_OBJECT)
  2111.  
  2112. chr.SetRace(race)
  2113. chr.SetArmor(0)
  2114. chr.Refresh()
  2115. chr.SetLoopMotion(chr.MOTION_WAIT)
  2116. sx, sy, ex, ey = chr.GetBoundBoxOnlyXY(idx)
  2117. chr.DeleteInstance(idx)
  2118. return sx, sy, ex, ey
  2119.  
  2120. def __GetBuildInPosition(self):
  2121.  
  2122. zList = []
  2123. zList.append( background.GetHeight(self.x+self.sxPos, self.y+self.syPos) )
  2124. zList.append( background.GetHeight(self.x+self.sxPos, self.y+self.eyPos) )
  2125. zList.append( background.GetHeight(self.x+self.exPos, self.y+self.syPos) )
  2126. zList.append( background.GetHeight(self.x+self.exPos, self.y+self.eyPos) )
  2127. zList.append( background.GetHeight(self.x+(self.exPos+self.sxPos)/2, self.y+(self.eyPos+self.syPos)/2) )
  2128. zList.sort()
  2129. return zList[3]
  2130.  
  2131. def __CreateBuildInInstance(self,race):
  2132.  
  2133. self.__DeleteInstance()
  2134.  
  2135. object_base = race - race%10
  2136.  
  2137. door_minX, door_minY, door_maxX, door_maxY = self.__GetObjectSize(object_base+4)
  2138. corner_minX, corner_minY, corner_maxX, corner_maxY = self.__GetObjectSize(object_base+1)
  2139. line_minX, line_minY, line_maxX, line_maxY = self.__GetObjectSize(object_base+2)
  2140. line_width = line_maxX - line_minX
  2141. line_width_half = line_width / 2
  2142.  
  2143. X_SIZE_STEP = 2 * 2 ## 2의 단위로만 증가해야 함
  2144. Y_SIZE_STEP = 8
  2145. sxPos = door_maxX - corner_minX + (line_width_half*X_SIZE_STEP)
  2146. exPos = -sxPos
  2147. syPos = 0
  2148. eyPos = -(corner_maxY*2 + line_width*Y_SIZE_STEP)
  2149.  
  2150. self.sxPos = sxPos
  2151. self.syPos = syPos
  2152. self.exPos = exPos
  2153. self.eyPos = eyPos
  2154.  
  2155. z = self.__GetBuildInPosition()
  2156.  
  2157. ## Door
  2158. self.__CreateWallBlock(object_base+4, 0.0, syPos)
  2159.  
  2160. ## Corner
  2161. self.__CreateWallBlock(object_base+1, sxPos, syPos)
  2162. self.__CreateWallBlock(object_base+1, exPos, syPos, 270.0)
  2163. self.__CreateWallBlock(object_base+1, sxPos, eyPos, 90.0)
  2164. self.__CreateWallBlock(object_base+1, exPos, eyPos,180.0 )
  2165.  
  2166. ## Line
  2167. lineBlock = object_base+2
  2168. line_startX = -door_maxX - line_minX - (line_width_half*X_SIZE_STEP)
  2169. self.__CreateWallBlock(lineBlock, line_startX, eyPos)
  2170. self.__CreateWallBlock(lineBlock, line_startX+line_width*1, eyPos)
  2171. self.__CreateWallBlock(lineBlock, line_startX+line_width*2, eyPos)
  2172. self.__CreateWallBlock(lineBlock, line_startX+line_width*3, eyPos)
  2173. for i in xrange(X_SIZE_STEP):
  2174. self.__CreateWallBlock(lineBlock, line_startX+line_width*(3+i+1), eyPos)
  2175. for i in xrange(X_SIZE_STEP/2):
  2176. self.__CreateWallBlock(lineBlock, door_minX - line_maxX - line_width*i, syPos)
  2177. self.__CreateWallBlock(lineBlock, door_maxX - line_minX + line_width*i, syPos)
  2178. for i in xrange(Y_SIZE_STEP):
  2179. self.__CreateWallBlock(lineBlock, sxPos, line_minX + corner_minX - line_width*i, 90.0)
  2180. self.__CreateWallBlock(lineBlock, exPos, line_minX + corner_minX - line_width*i, 90.0)
  2181.  
  2182. self.SetBuildingPosition(int(self.x), int(self.y), self.__GetBuildInPosition())
  2183.  
  2184. def __DeleteInstance(self):
  2185. if not self.indexList:
  2186. return
  2187.  
  2188. for index in self.indexList:
  2189. chr.DeleteInstance(index)
  2190.  
  2191. self.indexList = []
  2192. self.raceList = []
  2193. self.posList = []
  2194. self.rotList = []
  2195.  
  2196. def __CreateInstance(self, race):
  2197.  
  2198. self.__DeleteInstance()
  2199.  
  2200. self.race = race
  2201.  
  2202. idx = self.START_INSTANCE_INDEX
  2203. self.indexList.append(idx)
  2204. self.posList.append((0, 0))
  2205. self.rotList.append(0)
  2206.  
  2207. chr.CreateInstance(idx)
  2208. chr.SelectInstance(idx)
  2209. chr.SetVirtualID(idx)
  2210. chr.SetInstanceType(chr.INSTANCE_TYPE_OBJECT)
  2211.  
  2212. chr.SetRace(race)
  2213. chr.SetArmor(0)
  2214. chr.Refresh()
  2215. chr.SetLoopMotion(chr.MOTION_WAIT)
  2216. chr.SetBlendRenderMode(idx, self.BUILDING_ALPHA)
  2217.  
  2218. self.SetBuildingPosition(int(self.x), int(self.y), 0)
  2219. self.ctrlRotationX.SetSliderPos(0.5)
  2220. self.ctrlRotationY.SetSliderPos(0.5)
  2221. self.ctrlRotationZ.SetSliderPos(0.5)
  2222.  
  2223. def Build(self):
  2224.  
  2225. if not self.__IsEnoughMoney():
  2226. self.__PopupDialog(localeInfo.GUILD_NOT_ENOUGH_MONEY)
  2227. return
  2228. if not self.__IsEnoughMaterialStone():
  2229. self.__PopupDialog(localeInfo.GUILD_NOT_ENOUGH_MATERIAL)
  2230. return
  2231. if not self.__IsEnoughMaterialLog():
  2232. self.__PopupDialog(localeInfo.GUILD_NOT_ENOUGH_MATERIAL)
  2233. return
  2234. if not self.__IsEnoughMaterialPlywood():
  2235. self.__PopupDialog(localeInfo.GUILD_NOT_ENOUGH_MATERIAL)
  2236. return
  2237.  
  2238. ## /build c vnum x y x_rot y_rot z_rot
  2239. ## /build d vnum
  2240. if "BUILDIN" == self.type:
  2241. for i in xrange(len(self.raceList)):
  2242. race = self.raceList[i]
  2243. xPos, yPos = self.posList[i]
  2244. rot = self.rotList[i]
  2245. net.SendChatPacket("/build c %d %d %d %d %d %d" % (race, int(self.x+xPos), int(self.y+yPos), self.rot_x, self.rot_y, rot))
  2246. else:
  2247. net.SendChatPacket("/build c %d %d %d %d %d %d" % (self.race, int(self.x), int(self.y), self.rot_x, self.rot_y, self.rot_z))
  2248.  
  2249. self.Close()
  2250.  
  2251. def Open(self):
  2252. x, y, z = player.GetMainCharacterPosition()
  2253. app.SetCameraSetting(int(x), int(-y), int(z), 3000, 0, 30)
  2254.  
  2255. background.VisibleGuildArea()
  2256.  
  2257. self.x = x
  2258. self.y = y
  2259. self.z = z
  2260. self.categoryList.SelectItem(0)
  2261. self.buildingList.SelectItem(0)
  2262. self.SetTop()
  2263. self.Show()
  2264. self.__DisablePCBlocker()
  2265.  
  2266. import debugInfo
  2267. if debugInfo.IsDebugMode():
  2268. self.categoryList.SelectItem(2)
  2269. self.buildingList.SelectItem(0)
  2270.  
  2271. def Close(self):
  2272.  
  2273. self.__DeleteInstance()
  2274.  
  2275. background.DisableGuildArea()
  2276.  
  2277. self.Hide()
  2278. self.__OnClosePopupDialog()
  2279. self.__EnablePCBlocker()
  2280. self.__UnlockCameraMoving()
  2281. if self.closeEvent:
  2282. self.closeEvent()
  2283.  
  2284. def Destory(self):
  2285. self.Close()
  2286.  
  2287. self.ClearDictionary()
  2288. self.board = None
  2289. self.categoryList = None
  2290. self.buildingList = None
  2291. self.listScrollBar = None
  2292. self.positionButton = None
  2293. self.previewButton = None
  2294. self.posValueX = None
  2295. self.posValueY = None
  2296. self.ctrlRotationX = None
  2297. self.ctrlRotationY = None
  2298. self.ctrlRotationZ = None
  2299. self.buildingPriceValue = None
  2300. self.buildingMaterialStoneValue = None
  2301. self.buildingMaterialLogValue = None
  2302. self.buildingMaterialPlywoodValue = None
  2303. self.closeEvent = None
  2304.  
  2305. def SetCloseEvent(self, event):
  2306. self.closeEvent = event
  2307.  
  2308. def __PopupDialog(self, text):
  2309. popup = uiCommon.PopupDialog()
  2310. popup.SetText(text)
  2311. popup.SetAcceptEvent(self.__OnClosePopupDialog)
  2312. popup.Open()
  2313. self.popup = popup
  2314.  
  2315. def __OnClosePopupDialog(self):
  2316. self.popup = None
  2317.  
  2318. def __EnablePCBlocker(self):
  2319. ## PC Blocker 처리를 켠다. (투명해짐)
  2320. chr.SetInstanceType(chr.INSTANCE_TYPE_BUILDING)
  2321.  
  2322. for idx in self.indexList:
  2323. chr.SetBlendRenderMode(idx, 1.0)
  2324.  
  2325. def __DisablePCBlocker(self):
  2326. ## PC Blocker 처리를 끈다. (안투명해짐)
  2327. chr.SetInstanceType(chr.INSTANCE_TYPE_OBJECT)
  2328.  
  2329. for idx in self.indexList:
  2330. chr.SetBlendRenderMode(idx, self.BUILDING_ALPHA)
  2331.  
  2332. def __OnSelectPositioningMode(self):
  2333. if self.MODE_PREVIEW == self.mode:
  2334. self.positionButton.SetUp()
  2335. return
  2336.  
  2337. self.mode = self.MODE_POSITIONING
  2338. self.Hide()
  2339.  
  2340. def __OnEnterPreviewMode(self):
  2341.  
  2342. if self.MODE_POSITIONING == self.mode:
  2343. self.previewButton.SetUp()
  2344. return
  2345.  
  2346. self.mode = self.MODE_PREVIEW
  2347. self.positionButton.SetUp()
  2348. self.__UnlockCameraMoving()
  2349. self.__EnablePCBlocker()
  2350.  
  2351. def __OnLeavePreviewMode(self):
  2352. self.__RestoreViewMode()
  2353.  
  2354. def __RestoreViewMode(self):
  2355. self.__DisablePCBlocker()
  2356. self.__LockCameraMoving()
  2357. self.mode = self.MODE_VIEW
  2358. self.positionButton.SetUp()
  2359. self.previewButton.SetUp()
  2360.  
  2361. def __IsEnoughMoney(self):
  2362.  
  2363. if app.IsEnableTestServerFlag():
  2364. return TRUE
  2365.  
  2366. curMoney = player.GetMoney()
  2367. if curMoney < self.needMoney:
  2368. return FALSE
  2369. return TRUE
  2370.  
  2371. def __IsEnoughMaterialStone(self):
  2372.  
  2373. if app.IsEnableTestServerFlag():
  2374. return TRUE
  2375.  
  2376. curStoneCount = player.GetItemCountByVnum(MATERIAL_STONE_ID)
  2377. if curStoneCount < self.needStoneCount:
  2378. return FALSE
  2379. return TRUE
  2380.  
  2381. def __IsEnoughMaterialLog(self):
  2382.  
  2383. if app.IsEnableTestServerFlag():
  2384. return TRUE
  2385.  
  2386. curLogCount = player.GetItemCountByVnum(MATERIAL_LOG_ID)
  2387. if curLogCount < self.needLogCount:
  2388. return FALSE
  2389. return TRUE
  2390.  
  2391. def __IsEnoughMaterialPlywood(self):
  2392.  
  2393. if app.IsEnableTestServerFlag():
  2394. return TRUE
  2395.  
  2396. curPlywoodCount = player.GetItemCountByVnum(MATERIAL_PLYWOOD_ID)
  2397. if curPlywoodCount < self.needPlywoodCount:
  2398. return FALSE
  2399. return TRUE
  2400.  
  2401. def __OnSelectCategory(self):
  2402. self.listScrollBar.SetPos(0.0)
  2403. self.__RefreshItem()
  2404.  
  2405. def __SetBuildingData(self, data):
  2406. self.buildingPriceValue.SetText(NumberToMoneyString(data["PRICE"]))
  2407.  
  2408. self.needMoney = int(data["PRICE"])
  2409.  
  2410. materialList = data["MATERIAL"]
  2411. self.needStoneCount = int(materialList[MATERIAL_STONE_INDEX])
  2412. self.needLogCount = int(materialList[MATERIAL_LOG_INDEX])
  2413. self.needPlywoodCount = int(materialList[MATERIAL_PLYWOOD_INDEX])
  2414.  
  2415. if (localeInfo.IsEUROPE() and app.GetLocalePath() != "locale/ca") and (localeInfo.IsEUROPE() and app.GetLocalePath() != "locale/br"):
  2416. self.buildingMaterialStoneValue.SetText(materialList[MATERIAL_STONE_INDEX])
  2417. self.buildingMaterialLogValue.SetText(materialList[MATERIAL_LOG_INDEX] )
  2418. self.buildingMaterialPlywoodValue.SetText(materialList[MATERIAL_PLYWOOD_INDEX])
  2419. else:
  2420. self.buildingMaterialStoneValue.SetText(materialList[MATERIAL_STONE_INDEX] + localeInfo.THING_COUNT)
  2421. self.buildingMaterialLogValue.SetText(materialList[MATERIAL_LOG_INDEX] + localeInfo.THING_COUNT)
  2422. self.buildingMaterialPlywoodValue.SetText(materialList[MATERIAL_PLYWOOD_INDEX] + localeInfo.THING_COUNT)
  2423. if self.__IsEnoughMoney():
  2424. self.buildingPriceValue.SetPackedFontColor(self.ENABLE_COLOR)
  2425. else:
  2426. self.buildingPriceValue.SetPackedFontColor(self.DISABLE_COLOR)
  2427.  
  2428. if self.__IsEnoughMaterialStone():
  2429. self.buildingMaterialStoneValue.SetPackedFontColor(self.ENABLE_COLOR)
  2430. else:
  2431. self.buildingMaterialStoneValue.SetPackedFontColor(self.DISABLE_COLOR)
  2432.  
  2433. if self.__IsEnoughMaterialLog():
  2434. self.buildingMaterialLogValue.SetPackedFontColor(self.ENABLE_COLOR)
  2435. else:
  2436. self.buildingMaterialLogValue.SetPackedFontColor(self.DISABLE_COLOR)
  2437.  
  2438. if self.__IsEnoughMaterialPlywood():
  2439. self.buildingMaterialPlywoodValue.SetPackedFontColor(self.ENABLE_COLOR)
  2440. else:
  2441. self.buildingMaterialPlywoodValue.SetPackedFontColor(self.DISABLE_COLOR)
  2442.  
  2443. self.rot_x_limit = data["X_ROT_LIMIT"]
  2444. self.rot_y_limit = data["Y_ROT_LIMIT"]
  2445. self.rot_z_limit = data["Z_ROT_LIMIT"]
  2446. self.ctrlRotationX.Enable()
  2447. self.ctrlRotationY.Enable()
  2448. self.ctrlRotationZ.Enable()
  2449. if 0 == self.rot_x_limit:
  2450. self.ctrlRotationX.Disable()
  2451. if 0 == self.rot_y_limit:
  2452. self.ctrlRotationY.Disable()
  2453. if 0 == self.rot_z_limit:
  2454. self.ctrlRotationZ.Disable()
  2455.  
  2456. def __OnSelectBuilding(self):
  2457. buildingIndex = self.buildingList.GetSelectedItem()
  2458. if buildingIndex >= len(BUILDING_DATA_LIST):
  2459. return
  2460.  
  2461. categoryIndex = self.categoryList.GetSelectedItem()
  2462. if categoryIndex >= len(self.GUILD_CATEGORY_LIST):
  2463. return
  2464. selectedType = self.GUILD_CATEGORY_LIST[categoryIndex][0]
  2465.  
  2466. index = 0
  2467. for data in BUILDING_DATA_LIST:
  2468. type = data["TYPE"]
  2469. vnum = data["VNUM"]
  2470. if selectedType != type:
  2471. continue
  2472.  
  2473. if index == buildingIndex:
  2474. self.type = type
  2475. if "BUILDIN" == self.type:
  2476. self.__CreateBuildInInstance(vnum)
  2477. else:
  2478. self.__CreateInstance(vnum)
  2479.  
  2480. self.__SetBuildingData(data)
  2481.  
  2482. index += 1
  2483.  
  2484. def __OnScrollBuildingList(self):
  2485. viewItemCount = self.buildingList.GetViewItemCount()
  2486. itemCount = self.buildingList.GetItemCount()
  2487. pos = self.listScrollBar.GetPos() * (itemCount-viewItemCount)
  2488. self.buildingList.SetBasePos(int(pos))
  2489.  
  2490. def __OnChangeRotation(self):
  2491. self.rot_x = self.ctrlRotationX.GetSliderPos() * self.rot_x_limit - self.rot_x_limit/2
  2492. self.rot_y = self.ctrlRotationY.GetSliderPos() * self.rot_y_limit - self.rot_y_limit/2
  2493. self.rot_z = (self.ctrlRotationZ.GetSliderPos() * 360 + 180) % 360
  2494. if "BUILDIN" == self.type:
  2495. chr.SetRotationAll(self.rot_x, self.rot_y, self.rot_z)
  2496. else:
  2497. chr.SetRotationAll(self.rot_x, self.rot_y, self.rot_z)
  2498.  
  2499. def __LockCameraMoving(self):
  2500. app.SetCameraSetting(int(self.x), int(-self.y), int(self.z), 3000, 0, 30)
  2501.  
  2502. def __UnlockCameraMoving(self):
  2503. app.SetDefaultCamera()
  2504.  
  2505. def __RefreshItem(self):
  2506.  
  2507. self.buildingList.ClearItem()
  2508.  
  2509. categoryIndex = self.categoryList.GetSelectedItem()
  2510. if categoryIndex >= len(self.GUILD_CATEGORY_LIST):
  2511. return
  2512. selectedType = self.GUILD_CATEGORY_LIST[categoryIndex][0]
  2513.  
  2514. index = 0
  2515. for data in BUILDING_DATA_LIST:
  2516. if selectedType != data["TYPE"]:
  2517. continue
  2518.  
  2519. if data["SHOW"]:
  2520. self.buildingList.InsertItem(index, data["LOCAL_NAME"])
  2521.  
  2522. index += 1
  2523.  
  2524. self.buildingList.SelectItem(0)
  2525.  
  2526. if self.buildingList.GetItemCount() < self.buildingList.GetViewItemCount():
  2527. self.buildingList.SetSize(120, self.buildingList.GetHeight())
  2528. self.buildingList.LocateItem()
  2529. self.listScrollBar.Hide()
  2530. else:
  2531. self.buildingList.SetSize(105, self.buildingList.GetHeight())
  2532. self.buildingList.LocateItem()
  2533. self.listScrollBar.Show()
  2534.  
  2535. def SettleCurrentPosition(self):
  2536. guildID = miniMap.GetGuildAreaID(self.x, self.y)
  2537.  
  2538. import debugInfo
  2539. if debugInfo.IsDebugMode():
  2540. guildID = player.GetGuildID()
  2541.  
  2542. if guildID != player.GetGuildID():
  2543. return
  2544.  
  2545. self.__RestoreViewMode()
  2546. self.__LockCameraMoving()
  2547. self.Show()
  2548.  
  2549. def SetBuildingPosition(self, x, y, z):
  2550. self.x = x
  2551. self.y = y
  2552. self.posValueX.SetText(str(int(x)))
  2553. self.posValueY.SetText(str(int(y)))
  2554.  
  2555. for i in xrange(len(self.indexList)):
  2556. idx = self.indexList[i]
  2557. xPos, yPos = self.posList[i]
  2558.  
  2559. chr.SelectInstance(idx)
  2560. if 0 != z:
  2561. self.z = z
  2562. chr.SetPixelPosition(int(x+xPos), int(y+yPos), int(z))
  2563. else:
  2564. chr.SetPixelPosition(int(x+xPos), int(y+yPos))
  2565.  
  2566. def IsPositioningMode(self):
  2567. if self.MODE_POSITIONING == self.mode:
  2568. return TRUE
  2569. return FALSE
  2570.  
  2571. def IsPreviewMode(self):
  2572. if self.MODE_PREVIEW == self.mode:
  2573. return TRUE
  2574. return FALSE
  2575.  
  2576. def OnPressEscapeKey(self):
  2577. self.Close()
  2578. return TRUE
  2579.  
  2580. """
  2581. - 프로토콜
  2582.  
  2583. 게임돌입시:
  2584. RecvLandPacket:
  2585. CPythonMiniMap::RegisterGuildArea
  2586.  
  2587. 게임이동중:
  2588. PythonPlayer::Update()
  2589. CPythonPlayer::__Update_NotifyGuildAreaEvent()
  2590. game.py.BINARY_Guild_EnterGuildArea
  2591. uigameButton.GameButtonWindow.ShowBuildButton()
  2592. game.py.BINARY_Guild_ExitGuildArea
  2593. uigameButton.GameButtonWindow.HideBuildButton()
  2594.  
  2595. BuildButton:
  2596. !길드장인지 처리 없음
  2597. !건물이 있어도 짓기 버튼은 있음
  2598.  
  2599. !건물이 임시로 사용하는 VID 는 서버가 보내주는 것과 혼동될 염려가 있음
  2600. !건물 VNUM 은 BuildGuildBuildingWindow.BUILDING_VNUM_LIST 를 이용해 변환
  2601.  
  2602. !건물 지을때는 /build c(reate)
  2603. !건물 부술때는 /build d(estroy)
  2604. !rotation 의 단위는 degree
  2605.  
  2606. interfaceModule.interface.__OnClickBuildButton:
  2607. interfaceModule.interface.BUILD_OpenWindow:
  2608.  
  2609. AcceptButton:
  2610. BuildGuildBuildingWindow.Build:
  2611. net.SendChatPacket("/build c vnum x y x_rot y_rot z_rot")
  2612.  
  2613. PreviewButton:
  2614. __OnPreviewMode:
  2615. __RestoreViewMode:
  2616.  
  2617. 건물 부수기:
  2618. uiTarget.TargetBoard.__OnDestroyBuilding
  2619. net.SendChatPacket("/build d vid")
  2620. """
  2621.  
  2622. if __name__ == "__main__":
  2623.  
  2624. import app
  2625. import wndMgr
  2626. import systemSetting
  2627. import mouseModule
  2628. import grp
  2629. import ui
  2630.  
  2631. #wndMgr.SetOutlineFlag(TRUE)
  2632.  
  2633. app.SetMouseHandler(mouseModule.mouseController)
  2634. app.SetHairColorEnable(TRUE)
  2635. wndMgr.SetMouseHandler(mouseModule.mouseController)
  2636. wndMgr.SetScreenSize(systemSetting.GetWidth(), systemSetting.GetHeight())
  2637. app.Create("METIN2 CLOSED BETA", systemSetting.GetWidth(), systemSetting.GetHeight(), 1)
  2638. mouseModule.mouseController.Create()
  2639.  
  2640. import chrmgr
  2641. chrmgr.CreateRace(0)
  2642. chrmgr.SelectRace(0)
  2643. chrmgr.SetPathName("d:/ymir Work/pc/warrior/")
  2644. chrmgr.LoadRaceData("warrior.msm")
  2645. chrmgr.SetPathName("d:/ymir work/pc/warrior/general/")
  2646. chrmgr.RegisterMotionMode(chr.MOTION_MODE_GENERAL)
  2647. chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_WAIT, "wait.msa")
  2648. chrmgr.RegisterMotionData(chr.MOTION_MODE_GENERAL, chr.MOTION_RUN, "run.msa")
  2649.  
  2650. def LoadGuildBuildingList(filename):
  2651. handle = app.OpenTextFile(filename)
  2652. count = app.GetTextFileLineCount(handle)
  2653. for i in xrange(count):
  2654. line = app.GetTextFileLine(handle, i)
  2655. tokens = line.split("\t")
  2656.  
  2657. TOKEN_VNUM = 0
  2658. TOKEN_TYPE = 1
  2659. TOKEN_NAME = 2
  2660. TOKEN_LOCAL_NAME = 3
  2661. NO_USE_TOKEN_SIZE_1 = 4
  2662. NO_USE_TOKEN_SIZE_2 = 5
  2663. NO_USE_TOKEN_SIZE_3 = 6
  2664. NO_USE_TOKEN_SIZE_4 = 7
  2665. TOKEN_X_ROT_LIMIT = 8
  2666. TOKEN_Y_ROT_LIMIT = 9
  2667. TOKEN_Z_ROT_LIMIT = 10
  2668. TOKEN_PRICE = 11
  2669. TOKEN_MATERIAL = 12
  2670. TOKEN_NPC = 13
  2671. TOKEN_GROUP = 14
  2672. TOKEN_DEPEND_GROUP = 15
  2673. TOKEN_ENABLE_FLAG = 16
  2674. LIMIT_TOKEN_COUNT = 17
  2675.  
  2676. if not tokens[TOKEN_VNUM].isdigit():
  2677. continue
  2678.  
  2679. if not int(tokens[TOKEN_ENABLE_FLAG]):
  2680. continue
  2681.  
  2682. if len(tokens) < LIMIT_TOKEN_COUNT:
  2683. import dbg
  2684. dbg.TraceError("Strange token count [%d/%d] [%s]" % (len(tokens), TOKEN_COUNT, line))
  2685. continue
  2686.  
  2687. ENABLE_FLAG_TYPE_NOT_USE = FALSE
  2688. ENABLE_FLAG_TYPE_USE = TRUE
  2689. ENABLE_FLAG_TYPE_USE_BUT_HIDE = 2
  2690.  
  2691. if ENABLE_FLAG_TYPE_NOT_USE == int(tokens[TOKEN_ENABLE_FLAG]):
  2692. continue
  2693.  
  2694. vnum = int(tokens[TOKEN_VNUM])
  2695. type = tokens[TOKEN_TYPE]
  2696. name = tokens[TOKEN_NAME]
  2697. localName = tokens[TOKEN_LOCAL_NAME]
  2698. xRotLimit = int(tokens[TOKEN_X_ROT_LIMIT])
  2699. yRotLimit = int(tokens[TOKEN_Y_ROT_LIMIT])
  2700. zRotLimit = int(tokens[TOKEN_Z_ROT_LIMIT])
  2701. price = tokens[TOKEN_PRICE]
  2702. material = tokens[TOKEN_MATERIAL]
  2703.  
  2704. folderName = ""
  2705. if "HEADQUARTER" == type:
  2706. folderName = "headquarter"
  2707. elif "FACILITY" == type:
  2708. folderName = "facility"
  2709. elif "OBJECT" == type:
  2710. folderName = "object"
  2711. ##"BuildIn" Is made by exist instance.
  2712.  
  2713. materialList = ["0", "0", "0"]
  2714. if material[0] == "\"":
  2715. material = material[1:]
  2716. if material[-1] == "\"":
  2717. material = material[:-1]
  2718. for one in material.split("/"):
  2719. data = one.split(",")
  2720. if 2 != len(data):
  2721. continue
  2722. itemID = int(data[0])
  2723. count = data[1]
  2724.  
  2725. if itemID == MATERIAL_STONE_ID:
  2726. materialList[MATERIAL_STONE_INDEX] = count
  2727. elif itemID == MATERIAL_LOG_ID:
  2728. materialList[MATERIAL_LOG_INDEX] = count
  2729. elif itemID == MATERIAL_PLYWOOD_ID:
  2730. materialList[MATERIAL_PLYWOOD_INDEX] = count
  2731.  
  2732. import chrmgr
  2733. chrmgr.RegisterRaceSrcName(name, folderName)
  2734. chrmgr.RegisterRaceName(vnum, name)
  2735.  
  2736. appendingData = { "VNUM":vnum,
  2737. "TYPE":type,
  2738. "NAME":name,
  2739. "LOCAL_NAME":localName,
  2740. "X_ROT_LIMIT":xRotLimit,
  2741. "Y_ROT_LIMIT":yRotLimit,
  2742. "Z_ROT_LIMIT":zRotLimit,
  2743. "PRICE":price,
  2744. "MATERIAL":materialList,
  2745. "SHOW" : TRUE }
  2746.  
  2747. if ENABLE_FLAG_TYPE_USE_BUT_HIDE == int(tokens[TOKEN_ENABLE_FLAG]):
  2748. appendingData["SHOW"] = FALSE
  2749.  
  2750. BUILDING_DATA_LIST.append(appendingData)
  2751.  
  2752. app.CloseTextFile(handle)
  2753.  
  2754. LoadGuildBuildingList(app.GetLocalePath()+"/GuildBuildingList.txt")
  2755.  
  2756. class TestGame(ui.Window):
  2757. def __init__(self):
  2758. ui.Window.__init__(self)
  2759.  
  2760. x = 30000
  2761. y = 40000
  2762.  
  2763. self.wndGuildBuilding = None
  2764. self.onClickKeyDict = {}
  2765. self.onClickKeyDict[app.DIK_SPACE] = lambda: self.OpenBuildGuildBuildingWindow()
  2766.  
  2767. background.Initialize()
  2768. background.LoadMap("metin2_map_a1", x, y, 0)
  2769. background.SetShadowLevel(background.SHADOW_ALL)
  2770.  
  2771. self.MakeCharacter(1, 0, x, y)
  2772. player.SetMainCharacterIndex(1)
  2773. chr.SelectInstance(1)
  2774.  
  2775. def __del__(self):
  2776. ui.Window.__del__(self)
  2777.  
  2778. def MakeCharacter(self, index, race, x, y):
  2779. chr.CreateInstance(index)
  2780. chr.SelectInstance(index)
  2781. chr.SetVirtualID(index)
  2782. chr.SetInstanceType(chr.INSTANCE_TYPE_PLAYER)
  2783.  
  2784. chr.SetRace(race)
  2785. chr.SetArmor(0)
  2786. chr.SetHair(0)
  2787. chr.Refresh()
  2788. chr.SetMotionMode(chr.MOTION_MODE_GENERAL)
  2789. chr.SetLoopMotion(chr.MOTION_WAIT)
  2790.  
  2791. chr.SetPixelPosition(x, y)
  2792. chr.SetDirection(chr.DIR_NORTH)
  2793.  
  2794. def OpenBuildGuildBuildingWindow(self):
  2795. self.wndGuildBuilding = BuildGuildBuildingWindow()
  2796. self.wndGuildBuilding.Open()
  2797. self.wndGuildBuilding.SetParent(self)
  2798. self.wndGuildBuilding.SetTop()
  2799.  
  2800. def OnKeyUp(self, key):
  2801. if key in self.onClickKeyDict:
  2802. self.onClickKeyDict[key]()
  2803. return TRUE
  2804.  
  2805. def OnMouseLeftButtonDown(self):
  2806. if self.wndGuildBuilding:
  2807. if self.wndGuildBuilding.IsPositioningMode():
  2808. self.wndGuildBuilding.SettleCurrentPosition()
  2809. return
  2810.  
  2811. player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
  2812. return TRUE
  2813.  
  2814. def OnMouseLeftButtonUp(self):
  2815. if self.wndGuildBuilding:
  2816. return
  2817.  
  2818. player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
  2819. return TRUE
  2820.  
  2821. def OnMouseRightButtonDown(self):
  2822. player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS);
  2823. return TRUE
  2824.  
  2825. def OnMouseRightButtonUp(self):
  2826. player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK);
  2827. return TRUE
  2828.  
  2829. def OnMouseMiddleButtonDown(self):
  2830. player.SetMouseMiddleButtonState(player.MBS_PRESS)
  2831.  
  2832. def OnMouseMiddleButtonUp(self):
  2833. player.SetMouseMiddleButtonState(player.MBS_CLICK)
  2834.  
  2835. def OnUpdate(self):
  2836. app.UpdateGame()
  2837.  
  2838. if self.wndGuildBuilding:
  2839. if self.wndGuildBuilding.IsPositioningMode():
  2840. x, y, z = background.GetPickingPoint()
  2841. self.wndGuildBuilding.SetBuildingPosition(x, y, z)
  2842.  
  2843. def OnRender(self):
  2844. app.RenderGame()
  2845. grp.PopState()
  2846. grp.SetInterfaceRenderState()
  2847.  
  2848. game = TestGame()
  2849. game.SetSize(systemSetting.GetWidth(), systemSetting.GetHeight())
  2850. game.Show()
  2851.  
  2852. wndGuildBuilding = BuildGuildBuildingWindow()
  2853. wndGuildBuilding.Open()
  2854. wndGuildBuilding.SetTop()
  2855.  
  2856. app.Loop()
  2857.  
  2858. """
  2859. - 프로토콜
  2860.  
  2861. 게임돌입시:
  2862. RecvLandPacket:
  2863. CPythonMiniMap::RegisterGuildArea
  2864.  
  2865. 게임이동중:
  2866. PythonPlayer::Update()
  2867. CPythonPlayer::__Update_NotifyGuildAreaEvent()
  2868. game.py.BINARY_Guild_EnterGuildArea
  2869. uigameButton.GameButtonWindow.ShowBuildButton()
  2870. game.py.BINARY_Guild_ExitGuildArea
  2871. uigameButton.GameButtonWindow.HideBuildButton()
  2872.  
  2873. BuildButton:
  2874. !길드장인지 처리 없음
  2875. !건물이 있어도 짓기 버튼은 있음
  2876.  
  2877. !건물이 임시로 사용하는 VID 는 서버가 보내주는 것과 혼동될 염려가 있음
  2878. !건물 VNUM 은 BuildGuildBuildingWindow.BUILDING_VNUM_LIST 를 이용해 변환
  2879.  
  2880. !건물 지을때는 /build c(reate)
  2881. !건물 부술때는 /build d(estroy)
  2882. !rotation 의 단위는 degree
  2883.  
  2884. interfaceModule.interface.__OnClickBuildButton:
  2885. interfaceModule.interface.BUILD_OpenWindow:
  2886.  
  2887. AcceptButton:
  2888. BuildGuildBuildingWindow.Build:
  2889. net.SendChatPacket("/build c vnum x y x_rot y_rot z_rot")
  2890.  
  2891. x_rot, y_rot 는 AffectContainer에 저장
  2892.  
  2893. PreviewButton:
  2894. __OnPreviewMode:
  2895. __RestoreViewMode:
  2896.  
  2897. 건물 부수기:
  2898. uiTarget.TargetBoard.__OnDestroyBuilding
  2899. net.SendChatPacket("/build d vid")
  2900. """
Advertisement
Add Comment
Please, Sign In to add comment