Ejemplo n.º 1
0
    def SetHP(self, hpPercentage):
        if not self.hpGauge.IsShow():

            self.SetSize(200 + 7 * self.nameLength,
                         self.GetHeight())  #200default la inceput

            self.name.SetPosition(
                23, 13)  #23 and 13////23 e sus jos,scazi nr,urca el!!

            self.name.SetWindowHorizontalAlignLeft()
            self.name.SetHorizontalAlignLeft()
            self.hpGauge.Show()
            self.UpdatePosition()
            self.hpPercenttxt.SetPosition(200 + 7 * self.nameLength - 205,
                                          13)  #percent mobi pozitionare
            self.hpPercenttxt.Show()
            if player.IsPVPInstance(self.vid):
                self.hpPercenttxt.Hide()

        self.hpGauge.SetPercentage(hpPercentage, 100)
        self.hpPercenttxt.SetText("%d%%" % (hpPercentage))
Ejemplo n.º 2
0
    def OnUpdate(self):
        if player.IsPVPInstance(self.vid):
            if app.GetTime() > self.SaveSecond:
                self.SaveSecond = app.GetTime() + 0.2
                if str(chr.GetNameByVID(self.vid)) != "None":
                    net.SendWhisperPacket(
                        str(self.name.GetText()),
                        "CODE_MESSAGE_OPPONENTS_HP_29305|" +
                        str(player.GetMainCharacterIndex()))
                if constInfo.OPPONENTS_HP[1] != 0:
                    if constInfo.OPPONENTS_HP[0] <= 0:
                        self.SetHP(0)
                    else:
                        self.SetHP(((float(constInfo.OPPONENTS_HP[0]) /
                                     float(constInfo.OPPONENTS_HP[1])) * 100))

                    self.HPText.SetText(
                        "%d/%d" %
                        (constInfo.OPPONENTS_HP[0], constInfo.OPPONENTS_HP[1]))
                    self.HPText.Show()

        else:
            self.HPText.Hide()

        if self.isShowButton:

            exchangeButton = self.buttonDict[localeInfo.TARGET_BUTTON_EXCHANGE]
            distance = player.GetCharacterDistance(self.vid)

            if distance < 0:
                return

            if exchangeButton.IsShow():
                if distance > self.EXCHANGE_LIMIT_RANGE:
                    self.RefreshButton()

            else:
                if distance < self.EXCHANGE_LIMIT_RANGE:
                    self.RefreshButton()
Ejemplo n.º 3
0
    def RefreshButton(self):

        self.HideAllButton()

        if chr.INSTANCE_TYPE_BUILDING == chr.GetInstanceType(self.vid):
            #self.__ShowButton(locale.TARGET_BUTTON_BUILDING_DESTROY)
            #self.__ArrangeButtonPosition()
            return

        if player.IsPVPInstance(self.vid) or player.IsObserverMode():
            # PVP_INFO_SIZE_BUG_FIX
            self.SetSize(200 + 7 * self.nameLength, 40)
            self.UpdatePosition()
            # END_OF_PVP_INFO_SIZE_BUG_FIX
            return

        self.ShowDefaultButton()

        if guild.MainPlayerHasAuthority(guild.AUTH_ADD_MEMBER):
            if not guild.IsMemberByName(self.nameString):
                if 0 == chr.GetGuildID(self.vid):
                    self.__ShowButton(locale.TARGET_BUTTON_INVITE_GUILD)

        if not messenger.IsFriendByName(self.nameString):
            self.__ShowButton(locale.TARGET_BUTTON_FRIEND)

        if player.IsPartyMember(self.vid):

            self.__HideButton(locale.TARGET_BUTTON_FIGHT)

            if player.IsPartyLeader(self.vid):
                self.__ShowButton(locale.TARGET_BUTTON_LEAVE_PARTY)
            elif player.IsPartyLeader(player.GetMainCharacterIndex()):
                self.__ShowButton(locale.TARGET_BUTTON_EXCLUDE)

        else:
            if player.IsPartyMember(player.GetMainCharacterIndex()):
                if player.IsPartyLeader(player.GetMainCharacterIndex()):
                    self.__ShowButton(locale.TARGET_BUTTON_INVITE_PARTY)
            else:
                if chr.IsPartyMember(self.vid):
                    self.__ShowButton(locale.TARGET_BUTTON_REQUEST_ENTER_PARTY)
                else:
                    self.__ShowButton(locale.TARGET_BUTTON_INVITE_PARTY)

            if player.IsRevengeInstance(self.vid):
                self.__HideButton(locale.TARGET_BUTTON_FIGHT)
                self.__ShowButton(locale.TARGET_BUTTON_AVENGE)
            elif player.IsChallengeInstance(self.vid):
                self.__HideButton(locale.TARGET_BUTTON_FIGHT)
                self.__ShowButton(locale.TARGET_BUTTON_ACCEPT_FIGHT)
            elif player.IsCantFightInstance(self.vid):
                self.__HideButton(locale.TARGET_BUTTON_FIGHT)

            if not player.IsSameEmpire(self.vid):
                self.__HideButton(locale.TARGET_BUTTON_INVITE_PARTY)
                self.__HideButton(locale.TARGET_BUTTON_FRIEND)
                self.__HideButton(locale.TARGET_BUTTON_FIGHT)

        distance = player.GetCharacterDistance(self.vid)
        if distance > self.EXCHANGE_LIMIT_RANGE:
            self.__HideButton(locale.TARGET_BUTTON_EXCHANGE)
            self.__ArrangeButtonPosition()

        self.__ArrangeButtonPosition()