Advertisement
Guest User

Untitled

a guest
Sep 6th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 16.26 KB | None | 0 0
  1. import app
  2. import ui
  3. import player
  4. import net
  5. import wndMgr
  6. import messenger
  7. import guild
  8. import chr
  9. import nonplayer
  10. import localeInfo
  11. import constInfo
  12.  
  13. class TargetBoard(ui.ThinBoard):
  14.  
  15.     BUTTON_NAME_LIST = (
  16.         localeInfo.TARGET_BUTTON_WHISPER,
  17.         localeInfo.TARGET_BUTTON_EXCHANGE,
  18.         localeInfo.TARGET_BUTTON_FIGHT,
  19.         localeInfo.TARGET_BUTTON_ACCEPT_FIGHT,
  20.         localeInfo.TARGET_BUTTON_AVENGE,
  21.         localeInfo.TARGET_BUTTON_FRIEND,
  22.         localeInfo.TARGET_BUTTON_INVITE_PARTY,
  23.         localeInfo.TARGET_BUTTON_LEAVE_PARTY,
  24.         localeInfo.TARGET_BUTTON_EXCLUDE,
  25.         localeInfo.TARGET_BUTTON_INVITE_GUILD,
  26.         localeInfo.TARGET_BUTTON_DISMOUNT,
  27.         localeInfo.TARGET_BUTTON_EXIT_OBSERVER,
  28.         localeInfo.TARGET_BUTTON_VIEW_EQUIPMENT,
  29.         localeInfo.TARGET_BUTTON_REQUEST_ENTER_PARTY,
  30.         localeInfo.TARGET_BUTTON_BUILDING_DESTROY,
  31.         localeInfo.TARGET_BUTTON_EMOTION_ALLOW,
  32.         "VOTE_BLOCK_CHAT",
  33.     )
  34.  
  35.     GRADE_NAME =    {
  36.                         nonplayer.PAWN : localeInfo.TARGET_LEVEL_PAWN,
  37.                         nonplayer.S_PAWN : localeInfo.TARGET_LEVEL_S_PAWN,
  38.                         nonplayer.KNIGHT : localeInfo.TARGET_LEVEL_KNIGHT,
  39.                         nonplayer.S_KNIGHT : localeInfo.TARGET_LEVEL_S_KNIGHT,
  40.                         nonplayer.BOSS : localeInfo.TARGET_LEVEL_BOSS,
  41.                         nonplayer.KING : localeInfo.TARGET_LEVEL_KING,
  42.                     }
  43.     EXCHANGE_LIMIT_RANGE = 3000
  44.  
  45.     def __init__(self):
  46.         ui.ThinBoard.__init__(self)
  47.  
  48.         name = ui.TextLine()
  49.         name.SetParent(self)
  50.         name.SetDefaultFontName()
  51.         name.SetOutline()
  52.         name.Show()
  53.  
  54.         hpGauge = ui.Gauge()
  55.         hpGauge.SetParent(self)
  56.         hpGauge.MakeGauge(130, "red")
  57.         hpGauge.Hide()
  58.     if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  59.         hpDecimal = ui.TextLine()
  60.         hpDecimal.SetParent(hpGauge)
  61.         hpDecimal.SetDefaultFontName()
  62.         hpDecimal.SetPosition(5, 5)
  63.         hpDecimal.SetOutline()
  64.         hpDecimal.Hide()
  65.  
  66.         closeButton = ui.Button()
  67.         closeButton.SetParent(self)
  68.         closeButton.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub")
  69.         closeButton.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
  70.         closeButton.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
  71.         closeButton.SetPosition(30, 13)
  72.  
  73.         hpGauge.SetPosition(175, 17)
  74.         hpGauge.SetWindowHorizontalAlignRight()
  75.         closeButton.SetWindowHorizontalAlignRight()
  76.  
  77.         closeButton.SetEvent(ui.__mem_func__(self.OnPressedCloseButton))
  78.         closeButton.Show()
  79.  
  80.         self.buttonDict = {}
  81.         self.showingButtonList = []
  82.         for buttonName in self.BUTTON_NAME_LIST:
  83.             button = ui.Button()
  84.             button.SetParent(self)
  85.        
  86.             button.SetUpVisual("d:/ymir work/ui/public/small_thin_button_01.sub")
  87.             button.SetOverVisual("d:/ymir work/ui/public/small_thin_button_02.sub")
  88.             button.SetDownVisual("d:/ymir work/ui/public/small_thin_button_03.sub")
  89.            
  90.             button.SetWindowHorizontalAlignCenter()
  91.             button.SetText(buttonName)
  92.             button.Hide()
  93.             self.buttonDict[buttonName] = button
  94.             self.showingButtonList.append(button)
  95.  
  96.         self.buttonDict[localeInfo.TARGET_BUTTON_WHISPER].SetEvent(ui.__mem_func__(self.OnWhisper))
  97.         self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE].SetEvent(ui.__mem_func__(self.OnExchange))
  98.         self.buttonDict[localeInfo.TARGET_BUTTON_FIGHT].SetEvent(ui.__mem_func__(self.OnPVP))
  99.         self.buttonDict[localeInfo.TARGET_BUTTON_ACCEPT_FIGHT].SetEvent(ui.__mem_func__(self.OnPVP))
  100.         self.buttonDict[localeInfo.TARGET_BUTTON_AVENGE].SetEvent(ui.__mem_func__(self.OnPVP))
  101.         self.buttonDict[localeInfo.TARGET_BUTTON_FRIEND].SetEvent(ui.__mem_func__(self.OnAppendToMessenger))
  102.         self.buttonDict[localeInfo.TARGET_BUTTON_FRIEND].SetEvent(ui.__mem_func__(self.OnAppendToMessenger))
  103.         self.buttonDict[localeInfo.TARGET_BUTTON_INVITE_PARTY].SetEvent(ui.__mem_func__(self.OnPartyInvite))
  104.         self.buttonDict[localeInfo.TARGET_BUTTON_LEAVE_PARTY].SetEvent(ui.__mem_func__(self.OnPartyExit))
  105.         self.buttonDict[localeInfo.TARGET_BUTTON_EXCLUDE].SetEvent(ui.__mem_func__(self.OnPartyRemove))
  106.  
  107.         self.buttonDict[localeInfo.TARGET_BUTTON_INVITE_GUILD].SAFE_SetEvent(self.__OnGuildAddMember)
  108.         self.buttonDict[localeInfo.TARGET_BUTTON_DISMOUNT].SAFE_SetEvent(self.__OnDismount)
  109.         self.buttonDict[localeInfo.TARGET_BUTTON_EXIT_OBSERVER].SAFE_SetEvent(self.__OnExitObserver)
  110.         self.buttonDict[localeInfo.TARGET_BUTTON_VIEW_EQUIPMENT].SAFE_SetEvent(self.__OnViewEquipment)
  111.         self.buttonDict[localeInfo.TARGET_BUTTON_REQUEST_ENTER_PARTY].SAFE_SetEvent(self.__OnRequestParty)
  112.         self.buttonDict[localeInfo.TARGET_BUTTON_BUILDING_DESTROY].SAFE_SetEvent(self.__OnDestroyBuilding)
  113.         self.buttonDict[localeInfo.TARGET_BUTTON_EMOTION_ALLOW].SAFE_SetEvent(self.__OnEmotionAllow)
  114.        
  115.         self.buttonDict["VOTE_BLOCK_CHAT"].SetEvent(ui.__mem_func__(self.__OnVoteBlockChat))
  116.        
  117.         self.name = name
  118.         self.hpGauge = hpGauge
  119.         if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  120.             self.hpDecimal = hpDecimal
  121.         self.closeButton = closeButton
  122.         self.nameString = 0
  123.         self.nameLength = 0
  124.         self.vid = 0
  125.         self.eventWhisper = None
  126.         self.isShowButton = FALSE
  127.  
  128.         self.__Initialize()
  129.         self.ResetTargetBoard()
  130.  
  131.     def __del__(self):
  132.         ui.ThinBoard.__del__(self)
  133.  
  134.         print "===================================================== DESTROYED TARGET BOARD"
  135.  
  136.     def __Initialize(self):
  137.         self.nameString = ""
  138.         self.nameLength = 0
  139.         self.vid = 0
  140.         self.isShowButton = FALSE
  141.  
  142.     def Destroy(self):
  143.         self.eventWhisper = None
  144.         self.closeButton = None
  145.         self.showingButtonList = None
  146.         self.buttonDict = None
  147.         self.name = None
  148.         self.hpGauge = None
  149.         if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  150.             self.hpDecimal = None
  151.         self.__Initialize()
  152.  
  153.     def OnPressedCloseButton(self):
  154.         player.ClearTarget()
  155.         self.Close()
  156.  
  157.     def Close(self):
  158.         self.__Initialize()
  159.         self.Hide()
  160.  
  161.     def Open(self, vid, name):
  162.         if vid:
  163.             if not constInfo.GET_VIEW_OTHER_EMPIRE_PLAYER_TARGET_BOARD():
  164.                 if not player.IsSameEmpire(vid):
  165.                     self.Hide()
  166.                     return
  167.  
  168.             if vid != self.GetTargetVID():
  169.                 self.ResetTargetBoard()
  170.                 self.SetTargetVID(vid)
  171.                 self.SetTargetName(name)
  172.  
  173.             if player.IsMainCharacterIndex(vid):
  174.                 self.__ShowMainCharacterMenu()     
  175.             elif chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(self.vid):
  176.                 self.Hide()
  177.             else:
  178.                 self.RefreshButton()
  179.                 self.Show()
  180.         else:
  181.             self.HideAllButton()
  182.             self.__ShowButton(localeInfo.TARGET_BUTTON_WHISPER)
  183.             self.__ShowButton("VOTE_BLOCK_CHAT")
  184.             self.__ArrangeButtonPosition()
  185.             self.SetTargetName(name)
  186.             self.Show()
  187.            
  188.     def Refresh(self):
  189.         if self.IsShow():
  190.             if self.IsShowButton():        
  191.                 self.RefreshButton()       
  192.  
  193.     def RefreshByVID(self, vid):
  194.         if vid == self.GetTargetVID():         
  195.             self.Refresh()
  196.            
  197.     def RefreshByName(self, name):
  198.         if name == self.GetTargetName():
  199.             self.Refresh()
  200.  
  201.     def __ShowMainCharacterMenu(self):
  202.         canShow=0
  203.  
  204.         self.HideAllButton()
  205.  
  206.         if player.IsMountingHorse():
  207.             self.__ShowButton(localeInfo.TARGET_BUTTON_DISMOUNT)
  208.             canShow=1
  209.  
  210.         if player.IsObserverMode():
  211.             self.__ShowButton(localeInfo.TARGET_BUTTON_EXIT_OBSERVER)
  212.             canShow=1
  213.  
  214.         if canShow:
  215.             self.__ArrangeButtonPosition()
  216.             self.Show()
  217.         else:
  218.             self.Hide()
  219.            
  220.     def __ShowNameOnlyMenu(self):
  221.         self.HideAllButton()
  222.  
  223.     def SetWhisperEvent(self, event):
  224.         self.eventWhisper = event
  225.  
  226.     def UpdatePosition(self):
  227.         self.SetPosition(wndMgr.GetScreenWidth()/2 - self.GetWidth()/2, 10)
  228.  
  229.     def ResetTargetBoard(self):
  230.  
  231.         for btn in self.buttonDict.values():
  232.             btn.Hide()
  233.  
  234.         self.__Initialize()
  235.  
  236.         self.name.SetPosition(0, 13)
  237.         self.name.SetHorizontalAlignCenter()
  238.         self.name.SetWindowHorizontalAlignCenter()
  239.         self.hpGauge.Hide()
  240.         if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  241.             self.hpDecimal.Hide()
  242.         self.SetSize(250, 40)
  243.  
  244.     def SetTargetVID(self, vid):
  245.         self.vid = vid
  246.  
  247.     def SetEnemyVID(self, vid):
  248.         self.SetTargetVID(vid)
  249.  
  250.         name = chr.GetNameByVID(vid)
  251.         level = nonplayer.GetLevelByVID(vid)
  252.         grade = nonplayer.GetGradeByVID(vid)
  253.  
  254.         nameFront = ""
  255.         if -1 != level:
  256.             nameFront += "Lv." + str(level) + " "
  257.         if self.GRADE_NAME.has_key(grade):
  258.             nameFront += "(" + self.GRADE_NAME[grade] + ") "
  259.  
  260.         self.SetTargetName(nameFront + name)
  261.  
  262.     def GetTargetVID(self):
  263.         return self.vid
  264.  
  265.     def GetTargetName(self):
  266.         return self.nameString
  267.  
  268.     def SetTargetName(self, name):
  269.         self.nameString = name
  270.         self.nameLength = len(name)
  271.         self.name.SetText(name)
  272.  
  273.     if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  274.         def SetHP(self, hpPercentage, iMinHP, iMaxHP):
  275.             if not self.hpGauge.IsShow():
  276.                 if app.ENABLE_VIEW_TARGET_PLAYER_HP:
  277.                     showingButtonCount = len(self.showingButtonList)
  278.                     if showingButtonCount > 0:
  279.                         if chr.GetInstanceType(self.vid) == chr.INSTANCE_TYPE_PLAYER:
  280.                             self.SetSize(max(150 + 75 * 3, showingButtonCount * 75), self.GetHeight())
  281.                         else:
  282.                             self.SetSize(200 + 7*self.nameLength, self.GetHeight())
  283.                     else:
  284.                         self.SetSize(200 + 7*self.nameLength, self.GetHeight())
  285.                 else:
  286.                     self.SetSize(200 + 7*self.nameLength, self.GetHeight())
  287.                
  288.                 if localeInfo.IsARABIC():
  289.                     self.name.SetPosition( self.GetWidth()-23, 13)
  290.                 else:
  291.                     self.name.SetPosition(23, 13)
  292.                
  293.                 self.name.SetWindowHorizontalAlignLeft()
  294.                 self.name.SetHorizontalAlignLeft()
  295.                 self.hpGauge.Show()
  296.                 self.UpdatePosition()
  297.            
  298.             self.hpGauge.SetPercentage(hpPercentage, 100)
  299.             if app.ENABLE_VIEW_TARGET_DECIMAL_HP:
  300.                 iMinHPText = '.'.join([i - 3 < 0 and str(iMinHP)[:i] or str(iMinHP)[i-3:i] for i in range(len(str(iMinHP)) % 3, len(str(iMinHP))+1, 3) if i])
  301.                 iMaxHPText = '.'.join([i - 3 < 0 and str(iMaxHP)[:i] or str(iMaxHP)[i-3:i] for i in range(len(str(iMaxHP)) % 3, len(str(iMaxHP))+1, 3) if i])
  302.                 self.hpDecimal.SetText(str(iMinHPText) + "/" + str(iMaxHPText))
  303.                 (textWidth, textHeight)=self.hpDecimal.GetTextSize()
  304.                 if localeInfo.IsARABIC():
  305.                     self.hpDecimal.SetPosition(120 / 2 + textWidth / 2, -13)
  306.                 else:
  307.                     self.hpDecimal.SetPosition(130 / 2 - textWidth / 2, -13)
  308.                
  309.                 self.hpDecimal.Show()
  310.     else:
  311.         def SetHP(self, hpPercentage):
  312.             if not self.hpGauge.IsShow():
  313.                 if app.ENABLE_VIEW_TARGET_PLAYER_HP:
  314.                     showingButtonCount = len(self.showingButtonList)
  315.                     if showingButtonCount > 0:
  316.                         if chr.GetInstanceType(self.GetTargetVID) != chr.INSTANCE_TYPE_PLAYER:
  317.                             if showingButtonCount != 1:
  318.                                 self.SetSize(max(150, showingButtonCount * 75), self.GetHeight())
  319.                             else:
  320.                                 self.SetSize(max(150, 2 * 75), self.GetHeight())
  321.                         else:
  322.                             self.SetSize(200 + 7*self.nameLength, self.GetHeight())
  323.                     else:
  324.                         self.SetSize(200 + 7*self.nameLength, self.GetHeight())
  325.                 else:
  326.                     self.SetSize(200 + 7*self.nameLength, self.GetHeight())
  327.  
  328.                 if localeInfo.IsARABIC():
  329.                     self.name.SetPosition( self.GetWidth()-23, 13)
  330.                 else:
  331.                     self.name.SetPosition(23, 13)
  332.  
  333.                 self.name.SetWindowHorizontalAlignLeft()
  334.                 self.name.SetHorizontalAlignLeft()
  335.                 self.hpGauge.Show()
  336.                 self.UpdatePosition()
  337.  
  338.         self.hpGauge.SetPercentage(hpPercentage, 100)
  339.  
  340.     def ShowDefaultButton(self):
  341.  
  342.         self.isShowButton = TRUE
  343.         self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_WHISPER])
  344.         self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE])
  345.         self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_FIGHT])
  346.         self.showingButtonList.append(self.buttonDict[localeInfo.TARGET_BUTTON_EMOTION_ALLOW])
  347.         for button in self.showingButtonList:
  348.             button.Show()
  349.  
  350.     def HideAllButton(self):
  351.         self.isShowButton = FALSE
  352.         for button in self.showingButtonList:
  353.             button.Hide()
  354.         self.showingButtonList = []
  355.  
  356.     def __ShowButton(self, name):
  357.  
  358.         if not self.buttonDict.has_key(name):
  359.             return
  360.  
  361.         self.buttonDict[name].Show()
  362.         self.showingButtonList.append(self.buttonDict[name])
  363.  
  364.     def __HideButton(self, name):
  365.  
  366.         if not self.buttonDict.has_key(name):
  367.             return
  368.  
  369.         button = self.buttonDict[name]
  370.         button.Hide()
  371.  
  372.         for btnInList in self.showingButtonList:
  373.             if btnInList == button:
  374.                 self.showingButtonList.remove(button)
  375.                 break
  376.  
  377.     def OnWhisper(self):
  378.         if None != self.eventWhisper:
  379.             self.eventWhisper(self.nameString)
  380.  
  381.     def OnExchange(self):
  382.         net.SendExchangeStartPacket(self.vid)
  383.  
  384.     def OnPVP(self):
  385.         net.SendChatPacket("/pvp %d" % (self.vid))
  386.  
  387.     def OnAppendToMessenger(self):
  388.         net.SendMessengerAddByVIDPacket(self.vid)
  389.  
  390.     def OnPartyInvite(self):
  391.         net.SendPartyInvitePacket(self.vid)
  392.  
  393.     def OnPartyExit(self):
  394.         net.SendPartyExitPacket()
  395.  
  396.     def OnPartyRemove(self):
  397.         net.SendPartyRemovePacket(self.vid)
  398.  
  399.     def __OnGuildAddMember(self):
  400.         net.SendGuildAddMemberPacket(self.vid)
  401.  
  402.     def __OnDismount(self):
  403.         net.SendChatPacket("/unmount")
  404.  
  405.     def __OnExitObserver(self):
  406.         net.SendChatPacket("/observer_exit")
  407.  
  408.     def __OnViewEquipment(self):
  409.         net.SendChatPacket("/view_equip " + str(self.vid))
  410.  
  411.     def __OnRequestParty(self):
  412.         net.SendChatPacket("/party_request " + str(self.vid))
  413.  
  414.     def __OnDestroyBuilding(self):
  415.         net.SendChatPacket("/build d %d" % (self.vid))
  416.  
  417.     def __OnEmotionAllow(self):
  418.         net.SendChatPacket("/emotion_allow %d" % (self.vid))
  419.        
  420.     def __OnVoteBlockChat(self):
  421.         cmd = "/vote_block_chat %s" % (self.nameString)
  422.         net.SendChatPacket(cmd)
  423.  
  424.     def OnPressEscapeKey(self):
  425.         self.OnPressedCloseButton()
  426.         return TRUE
  427.  
  428.     def IsShowButton(self):
  429.         return self.isShowButton
  430.  
  431.     def RefreshButton(self):
  432.  
  433.         self.HideAllButton()
  434.  
  435.         if chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(self.vid):
  436.             #self.__ShowButton(localeInfo.TARGET_BUTTON_BUILDING_DESTROY)
  437.             #self.__ArrangeButtonPosition()
  438.             return
  439.        
  440.         if player.IsPVPInstance(self.vid) or player.IsObserverMode():
  441.             # PVP_INFO_SIZE_BUG_FIX
  442.             self.SetSize(200 + 7*self.nameLength, 40)
  443.             self.UpdatePosition()
  444.             # END_OF_PVP_INFO_SIZE_BUG_FIX         
  445.             return 
  446.  
  447.         self.ShowDefaultButton()
  448.  
  449.         if guild.MainPlayerHasAuthority(guild.AUTH_ADD_MEMBER):
  450.             if not guild.IsMemberByName(self.nameString):
  451.                 if 0 == chr.GetGuildID(self.vid):
  452.                     self.__ShowButton(localeInfo.TARGET_BUTTON_INVITE_GUILD)
  453.  
  454.         if not messenger.IsFriendByName(self.nameString):
  455.             self.__ShowButton(localeInfo.TARGET_BUTTON_FRIEND)
  456.  
  457.         if player.IsPartyMember(self.vid):
  458.  
  459.             self.__HideButton(localeInfo.TARGET_BUTTON_FIGHT)
  460.  
  461.             if player.IsPartyLeader(self.vid):
  462.                 self.__ShowButton(localeInfo.TARGET_BUTTON_LEAVE_PARTY)
  463.             elif player.IsPartyLeader(player.GetMainCharacterIndex()):
  464.                 self.__ShowButton(localeInfo.TARGET_BUTTON_EXCLUDE)
  465.  
  466.         else:
  467.             if player.IsPartyMember(player.GetMainCharacterIndex()):
  468.                 if player.IsPartyLeader(player.GetMainCharacterIndex()):
  469.                     self.__ShowButton(localeInfo.TARGET_BUTTON_INVITE_PARTY)
  470.             else:
  471.                 if chr.IsPartyMember(self.vid):
  472.                     self.__ShowButton(localeInfo.TARGET_BUTTON_REQUEST_ENTER_PARTY)
  473.                 else:
  474.                     self.__ShowButton(localeInfo.TARGET_BUTTON_INVITE_PARTY)
  475.  
  476.             if player.IsRevengeInstance(self.vid):
  477.                 self.__HideButton(localeInfo.TARGET_BUTTON_FIGHT)
  478.                 self.__ShowButton(localeInfo.TARGET_BUTTON_AVENGE)
  479.             elif player.IsChallengeInstance(self.vid):
  480.                 self.__HideButton(localeInfo.TARGET_BUTTON_FIGHT)
  481.                 self.__ShowButton(localeInfo.TARGET_BUTTON_ACCEPT_FIGHT)
  482.             elif player.IsCantFightInstance(self.vid):
  483.                 self.__HideButton(localeInfo.TARGET_BUTTON_FIGHT)
  484.  
  485.             if not player.IsSameEmpire(self.vid):
  486.                 self.__HideButton(localeInfo.TARGET_BUTTON_INVITE_PARTY)
  487.                 self.__HideButton(localeInfo.TARGET_BUTTON_FRIEND)
  488.                 self.__HideButton(localeInfo.TARGET_BUTTON_FIGHT)
  489.  
  490.         distance = player.GetCharacterDistance(self.vid)
  491.         if distance > self.EXCHANGE_LIMIT_RANGE:
  492.             self.__HideButton(localeInfo.TARGET_BUTTON_EXCHANGE)
  493.             self.__ArrangeButtonPosition()
  494.  
  495.         self.__ArrangeButtonPosition()
  496.  
  497.     def __ArrangeButtonPosition(self):
  498.         showingButtonCount = len(self.showingButtonList)
  499.         pos = -(showingButtonCount / 2) * 68
  500.         if 0 == showingButtonCount % 2:
  501.             pos += 34
  502.  
  503.         for button in self.showingButtonList:
  504.             button.SetPosition(pos, 33)
  505.             pos += 68
  506.        
  507.         if app.ENABLE_VIEW_TARGET_PLAYER_HP:
  508.             if showingButtonCount <= 2:
  509.                 self.SetSize(max(150 + 125, showingButtonCount * 75), 65)
  510.             else:
  511.                 self.SetSize(max(150, showingButtonCount * 75), 65)
  512.         else:
  513.             self.SetSize(max(150, showingButtonCount * 75), 65)
  514.        
  515.             self.UpdatePosition()
  516.  
  517.     def OnUpdate(self):
  518.         if self.isShowButton:
  519.  
  520.             exchangeButton = self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE]
  521.             distance = player.GetCharacterDistance(self.vid)
  522.  
  523.             if distance < 0:
  524.                 return
  525.  
  526.             if exchangeButton.IsShow():
  527.                 if distance > self.EXCHANGE_LIMIT_RANGE:
  528.                     self.RefreshButton()
  529.  
  530.             else:
  531.                 if distance < self.EXCHANGE_LIMIT_RANGE:
  532.                     self.RefreshButton()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement