And now tutorial how add it into client:
You must add following code to costinfo.py
Code:
INPUT_IGNORE = 0 VID = 0 STHX = 0 HPXD = 0 PLAYER_HP = 0 PLAYER_MAX_HP = 0 PLAYER_SP = 0 PLAYER_MAX_SP = 0 PLAYER_NAME = ""
Code:
import uiHealth #wskaznikiHP "super_quest" : self.Tabulejtor, "pvp_zdruwko" : self.Mozart, #inputpowerdziwko "get_input_value" : self.GetInputValue, "get_input_start" : self.GetInputOn, "get_input_end" : self.GetInputOff, def Mozart(self, data): dane = data.split("|") constInfo.PLAYER_NAME = str(dane[0]) constInfo.PLAYER_HP = int(dane[1]) constInfo.PLAYER_MAX_HP = int(dane[2]) constInfo.PLAYER_SP = int(dane[3]) constInfo.PLAYER_MAX_SP = int(dane[4]) def Tabulejtor(self, id): constInfo.STHX = int(id) def GetInputOn(self): constInfo.INPUT_IGNORE = 1 def GetInputOff(self): constInfo.INPUT_IGNORE = 0 def GetInputValue(self): net.SendQuestInputStringPacket(str(constInfo.VID)) def OpenQuestWindow(self, skin, idx): if constInfo.INPUT_IGNORE == 1: return else: self.interface.OpenQuestWindow(skin, idx)
Code:
import uiHealth import constInfo def OnUpdate(self): if player.IsPVPInstance(self.vid): constInfo.VID = self.vid event.QuestButtonClick(constInfo.STHX) if not self.healthBoard.IsShow() and self.vid != 0: self.healthBoard.Show() else: self.healthBoard.Hide() if self.isShowButton: exchangeButton = self.buttonDict[locale.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()
Code:
self.healthBoard = uiHealth.HealthBoard()
Code:
self.healthBoard.Hide()
Code:
def Close(self): self.__Initialize() self.healthBoard.Hide() self.Hide()
Code:
#Krzywy import ui import constInfo def GetInfoFrom(id): table = { 1 : constInfo.PLAYER_NAME, 2 : constInfo.PLAYER_HP, 3 : constInfo.PLAYER_MAX_HP, 4 : constInfo.PLAYER_SP, 5 : constInfo.PLAYER_MAX_SP} if table.has_key(id): return table[id] class HealthBoard(ui.ThinBoard): def __init__(self): ui.ThinBoard.__init__(self) self.Config() def __del__(self): ui.ThinBoard.__del__(self) def Config(self): self.SetSize(200, 120) self.SetPosition(0, 20) self.hp_bar = ui.Gauge() self.hp_bar.SetParent(self) self.hp_bar.SetPosition(30, 30+20) self.hp_bar.MakeGauge(130, "red") self.hp_bar.Show() self.sp_bar = ui.Gauge() self.sp_bar.SetParent(self) self.sp_bar.SetPosition(30, 60+20) self.sp_bar.MakeGauge(130, "blue") self.sp_bar.Show() self.name = ui.TextLine() self.name.SetParent(self) self.name.SetDefaultFontName() self.name.SetPosition(45, 30) self.name.SetText("") self.name.Show() self.hp_show = ui.TextLine() self.hp_show.SetParent(self) self.hp_show.SetDefaultFontName() self.hp_show.SetPosition(60-15, 57) self.hp_show.SetText("") self.hp_show.Show() self.sp_show = ui.TextLine() self.sp_show.SetParent(self) self.sp_show.SetDefaultFontName() self.sp_show.SetPosition(60-15, 80+7) self.sp_show.SetText("") self.sp_show.Show() def OnUpdate(self): if (GetInfoFrom(2)+GetInfoFrom(3)+GetInfoFrom(4)+GetInfoFrom(5)) == 0: self.Hide() self.hp_bar.SetPercentage(GetInfoFrom(2), GetInfoFrom(3)) self.sp_bar.SetPercentage(GetInfoFrom(4), GetInfoFrom(5)) self.name.SetText(GetInfoFrom(1)) self.hp_show.SetText("Health Points: %s / %s" % (GetInfoFrom(2), GetInfoFrom(3))) self.sp_show.SetText("Mana Points: %s / %s" % (GetInfoFrom(4), GetInfoFrom(5))) self.name.SetText("Character: %s" % (GetInfoFrom(1)))
Code:
-- Quest Opponents HP and MP during pvp -- Made by: Endymion_ -- Server: Ascarial.pl quest wskaznikHpWroga begin state start begin when login begin cmdchat("super_quest "..q.getcurrentquestindex()) end when info or button begin cmdchat("get_input_start") local vid = input(cmdchat("get_input_value")) cmdchat("get_input_end") local old_pc = pc.select(vid) local name = pc.get_name() local hp = pc.get_hp() local max_hp = pc.get_max_hp() local mp = pc.get_sp() local max_mp = pc.get_max_sp() pc.select(old_pc) cmdchat("pvp_zdruwko "..name.."|"..hp.."|"..max_hp.."|"..mp.."|"..max_mp) end end end