home *** CD-ROM | disk | FTP | other *** search
Wrap
import netgame import BUIx import CharStats import Netval import Bladex import ScorerWidgets import WidgetsExtra from Reference import ENERGY_LOW_LEVEL VISIBLE=1 CURRENT_STRENGTH_R=251 CURRENT_STRENGTH_G=241 CURRENT_STRENGTH_B=2 __wNULL=BUIx.CreateNULLWidget() wFrame=BUIx.B_FrameWidget(__wNULL,"MainFrame",640,480) # life and level wLeftFrame=BUIx.B_FrameWidget(wFrame,"BarsFrame",195,65) wDownFrame=BUIx.B_FrameWidget(wFrame,"DownFrame",195,73) wChatFrame=BUIx.B_FrameWidget(wFrame,"ChatFrame",195,65) wFragFrame=BUIx.B_FrameWidget(wFrame,"FragFrame",200,200) Bladex.ReadBitMap("..\\..\\Data\\Bar.bmp","BitmapBarra") wLifeBar1=BUIx.B_BarWidget(wLeftFrame,"LifeBar1",180,12) wLifeBar1.SetColor(110,0,5) wLifeBar1.SetBackgroundAlpha(0.4) wLifeBar1.SetAlpha(1.0) wLifeBar1.SetBitmap("BitmapBarra") wLifeBar2=BUIx.B_BarWidget(wLeftFrame,"LifeBar2",180,12) wLifeBar2.SetColor(163,28,0) wLifeBar2.SetBackgroundAlpha(0.0) wLifeBar2.SetAlpha(1.0) wLifeBar2.SetBitmap("BitmapBarra") wLifeBar=BUIx.B_StackBarWidget(wLeftFrame,"LifeBar",180,12) wLifeBar.AddBar(wLifeBar1) wLifeBar.AddBar(wLifeBar2) wLeftFrame.AddWidget(wLifeBar,8,14) wLifeLabel=BUIx.B_TextWidget(wLifeBar,"LifeLabel","100/100",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp") wLifeLabel.SetColor(170,170,170) wLifeLabel.SetAlpha(0.5) wLifeBar.AddLabel(wLifeLabel,0,2, BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_Bottom, BUIx.B_Widget.B_FR_AbsoluteRight,BUIx.B_Widget.B_FR_Right, BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top ) wCurrentLevelLabel=BUIx.B_TextWidget(wLifeBar,"CurrentLevelLabel","Level 5",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp") wCurrentLevelLabel.SetColor(0,159,220) wCurrentLevelLabel.SetAlpha(0.5) wLifeBar.AddLabel(wCurrentLevelLabel,0,2, BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_Bottom, BUIx.B_Widget.B_FR_AbsoluteLeft,BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top ) # Frags wPlayersFrags=BUIx.B_TextWidget(wLifeBar,"FragsLabel","",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp") wPlayersFrags.SetColor(220,220,220) wPlayersFrags.SetAlpha(0.8) wLifeBar.AddLabel(wPlayersFrags,0,2, BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_Bottom, BUIx.B_Widget.B_FR_AbsoluteLeft,BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top ) # versus value wPlayersVS=BUIx.B_TextWidget(wLifeBar,"VersusLabel","Waiting for a combat...",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp") wPlayersVS.SetColor(220,220,220) wPlayersVS.SetAlpha(0.7) wDownFrame.AddWidget(wPlayersVS,0,0) # Status of the client wStatusGame=BUIx.B_TextWidget(wLifeBar,"VersusLabel","",ScorerWidgets.font_server,"..\\..\\Data\\letras menu peq.BMP") wStatusGame.SetColor(0,128,255) wStatusGame.SetAlpha(0.8) wDownFrame.AddWidget(wStatusGame,0,16) # Barra de energy ------------------------------------------------------------------------------------------- Bladex.ReadBitMap("..\\..\\Data\\agotamiento.bmp","BitmapRGBar") wEnergyBar=ScorerWidgets.B_SmoothBarWidget(wLeftFrame,"EnergyBar",180,8) wEnergyBar.SetColor(255,255,255) wEnergyBar.SetAlpha(0.2) wEnergyBar.SetBackgroundAlpha(0.05) wEnergyBar.SetBackgroundColor(64,64,64) wEnergyBar.SetVisible(0) wEnergyBar.SetBitmap("BitmapRGBar") wDangerLabel=WidgetsExtra.B_FlashTextWidget(wEnergyBar,"DangerLabel","LOW ENERGY",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp") wDangerLabel.SetColor(238,191,0) wDangerLabel.SetAlpha(1.0) wDangerLabel.SetVisible(0) wEnergyBar.AddLabel(wDangerLabel,0.5,0.5, BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter ) wDownFrame.AddWidget(wEnergyBar,0,32) # Barra de strength ------------------------------------------------------------------------------------------- wStrengthBar=ScorerWidgets.B_SmoothBarWidget(wLeftFrame,"StrengthBar",180,8) wStrengthBar.SetColor(CURRENT_STRENGTH_R,CURRENT_STRENGTH_G,CURRENT_STRENGTH_B) wStrengthBar.SetAlpha(0.3) wStrengthBar.SetBackgroundAlpha(0.1) wStrengthBar.SetBackgroundColor(CURRENT_STRENGTH_R,CURRENT_STRENGTH_G,CURRENT_STRENGTH_B) wStrengthBar.SetVisible(0) wMaxPowerLabel=WidgetsExtra.B_FlashTextWidget(wStrengthBar,"MaxPowerLabel","MAXIMUM POWER",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp") wMaxPowerLabel.SetColor(255,255,255) wMaxPowerLabel.SetAlpha(1.0) wMaxPowerLabel.SetVisible(0) wStrengthBar.AddLabel(wMaxPowerLabel,0.5,0.5, BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter ) wStrengthLabel=WidgetsExtra.B_FlashTextWidget(wStrengthBar,"StrengthLabel","LAUNCH",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp") wStrengthLabel.SetColor(99,210,251) wStrengthLabel.SetAlpha(1.0) wStrengthLabel.SetFlash(0.0) wStrengthBar.AddLabel(wStrengthLabel,6,0.5, BUIx.B_Widget.B_LAB_Left,BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteRight,BUIx.B_Widget.B_FR_Right, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter ) wDownFrame.AddWidget(wStrengthBar,0,32) wChatLines = ["","","",""] for i in range(len(wChatLines)): wChatLines[i]=BUIx.B_TextWidget(wLifeBar,"VersusLabel","",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp") wChatLines[i].SetColor(220,220,220) wChatLines[i].SetAlpha((i+1.0)/(len(wChatLines))) wChatFrame.AddWidget(wChatLines[i],0,i*14) # FragLimit wFragLimit=BUIx.B_TextWidget(wLifeBar,"FragLimimit","THE CARNAGE IS OVER",ScorerWidgets.font_server,"..\\..\\Data\\letras menu med.BMP") wFragLimit.SetColor(255,0,0) wFragLimit.SetAlpha(0.8) wFragFrame.AddWidget(wFragLimit,0,5) wFragList=BUIx.B_TextWidget(wLifeBar,"FragLimimit","",ScorerWidgets.font_server,"..\\..\\Data\\letras menu med.BMP") wFragList.SetColor(220,220,220) wFragList.SetAlpha(0.8) wFragFrame.AddWidget(wFragList,0,25) ############################################################################################## wFrame.SetVisible(1) wLeftFrame.SetVisible(1) wDownFrame.SetVisible(1) wFragFrame.SetVisible(0) # muestra la lista grande de frags def ShowFragLimit(val): wLeftFrame.SetVisible(val) wDownFrame.SetVisible(val) wChatFrame.SetVisible(val) wFragFrame.SetVisible(val==0) wFrame.AddWidget(wLeftFrame,0,0) wFrame.AddWidget(wDownFrame,0.5,20,BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_VCenter) wFrame.AddWidget(wChatFrame,20,20,BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_Right, BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top) wFrame.AddWidget(wFragFrame,0.5,0.5,BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop) Bladex.SetRootWidget(wFrame.GetPointer()) ScrollLimit = 0 def SetStrengthBarValue(v): wEnergyBar.SetVisible(0) if VISIBLE: wStrengthBar.SetVisible(1) old_pos= wStrengthBar.GetPositionPercentage() wStrengthBar.SetPositionPercentage(v) if v>=1.0: if old_pos<1.0: wMaxPowerLabel.SetFlash(14) wStrengthLabel.SetFlash(14) wMaxPowerLabel.SetVisible(1) else: wMaxPowerLabel.SetVisible(0) wStrengthLabel.SetFlash(0.0) def SetEnergyBarValue(v, max_v): wStrengthBar.SetVisible(0) if VISIBLE: wEnergyBar.SetVisible(1) pos= min(max(v/max_v, 0),1.0) wEnergyBar.SetPositionPercentage(pos) if pos<=ENERGY_LOW_LEVEL: wDangerLabel.SetFlash(14) wDangerLabel.SetVisible(1) else: wDangerLabel.SetVisible(0) def ScrollChatConsole(): global ScrollLimit for i in range(len(wChatLines)-1): wChatLines[i].SetText(wChatLines[i+1].GetTextData()) wChatLines[len(wChatLines)-1].SetText("") ScrollLimit = Bladex.GetTime()+3.0 def ChatClientString(cad): ScrollChatConsole() wChatLines[len(wChatLines)-1].SetText(cad) def AddChatString(cad): if netgame.GetNetState() != 2: ScrollChatConsole() wChatLines[len(wChatLines)-1].SetText(cad) netgame.SendUserString(Netval.NET_GAME_CHAT_STRING,cad) NetPlayer = "Player1" def SetNetPlayerScorer(s): global NetPlayer NetPlayer = s LastFragViewerTime = 0 def SwitchFragViewer(): global LastFragViewerTime LastFragViewerTime = Bladex.GetTime()+4.0 wPlayersFrags.SetVisible(1) ViewStats = 0 def NetScorerAfterFrameFunc(time): import Actions global ScrollLimit global NetPlayer global LastFragViewerTime pj=Bladex.GetEntity(NetPlayer) if "NetLife" in dir(pj.Data): if "NetLevel" in dir(pj.Data): info = netgame.GetPlayerData(NetPlayer) throw_pressed = Bladex.GetTimeActionHeld ("Throw") if throw_pressed: SetStrengthBarValue(Actions.ThrowTime2ThrowForce(throw_pressed)) else: max_energy= CharStats.GetCharMaxEnergy(pj.Kind, 29) wStrengthBar.SetVisible(0) if info[0] < max_energy: SetEnergyBarValue(info[0]*1.0, max_energy*1.0) else: wStrengthBar.SetVisible(0) wEnergyBar.SetVisible(0) wLifeBar.SetPosition(info[1]) wLifeLabel.SetText(str(info[1])+"/"+str(int(pj.Data.NetLife))) wCurrentLevelLabel.SetText("Level "+str(int(pj.Data.NetLevel))) if ScrollLimit<time : ScrollChatConsole() if LastFragViewerTime<time: wPlayersFrags.SetVisible(0) if ViewStats: wStatusGame.SetText(netgame.ServerInfoBlock()) Bladex.SetAfterFrameFunc("DefaultSelectionData",NetScorerAfterFrameFunc) def ActivateScorer(): Bladex.SetRootWidget(wFrame.GetPointer())