SarkBall
Class sbAdminTool

source: c:\runehov\SarkBall\Classes\sbAdminTool.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Pickup
            |
            +--SarkBall.sbAdminTool
Direct Known Subclasses:None

class sbAdminTool
extends Engine.Pickup

//----------------------------------------------------------- // AdminTool: //-----------------------------------------------------------
Variables
 float AdminToolDeployTime
           for Admin's it's instantaneous...but we'll keep this for modeling player use
 float AdminToolDuration
           for Admin's it's instantaneous...but we'll keep this for modeling player use
 float AdminToolRange
           for Admin's it's instantaneous...but we'll keep this for modeling player use
 enum EAdminDeployType
 enum EAdminToolType
 Int FormerTeam
 UWindowMenuBar Kickers
 Actor LastDebug
 bool bIsAdminTool
 bool bIsPersistent
           effect stays with player for long term(via ip tracking)


Function Summary
 void BalanceTeamsTo(string S)
 void BalanceTeamsWithBots()
 void DeployAdminTool()
 void Ref(string psSwitch)
 void SarkBallType(string psType)
 void TelePhuk(Pawn sucker)
 void buildgreenbot()
 void buildredbot()
 void debugball()
 void debugpawn(string psSwitch)
 void debugshield(string psSwitch)
 void endthegame(string psReason)
 void killgreenbot()
 void killredbot()
 void menu()
 void mydebug(string psSwitch)
 void newround()
 void nextdebug()
 void smite(string S)
 void summonshield()
 void switchteam(string psSwitch)
 void telefrag(string S)



Source Code


00001	//-----------------------------------------------------------
00002	// AdminTool:
00003	//-----------------------------------------------------------
00004	class sbAdminTool expands PickUp;
00005	
00006	Var Uwindowmenubar Kickers;
00007	Var Actor LastDebug;
00008	Var Int FormerTeam;
00009	
00010	var() enum EAdminToolType
00011	{
00012	     ADMIN_CURSE,
00013	     ADMIN_BLESS,
00014	     ADMIN_CONTROLS,
00015	     ADMIN_SUMMON,
00016	     ADMIN_POSSESS
00017	} AdminToolType;
00018	
00019	var() enum EAdminDeployType
00020	{
00021	     ADMIN_SELF,
00022	     ADMIN_TOUCH,
00023	     ADMIN_TRACE,
00024	     ADMIN_PROJECTILE,
00025	     ADMIN_RADIUS,
00026	     ADMIN_NAMED,
00027	     ADMIN_TEAM,
00028	     ADMIN_ALLPLAYERS
00029	} AdminDeployType;
00030	
00031	var() bool bIsAdminTool;
00032	var() bool bIsPersistent;//effect stays with player for long term(via ip tracking)
00033	var() float AdminToolDeployTime;//for Admin's it's instantaneous...but we'll keep this for modeling player use
00034	var() float AdminToolRange;
00035	var() float AdminToolDuration;
00036	
00037	//=============================================================================
00038	// Network related
00039	//=============================================================================
00040	
00041	replication
00042	{
00043	// Functions the client calls on the server.
00044	     unreliable if( Role<ROLE_Authority )
00045	     newround,debugball,switchteam,debugpawn,balanceteamsto,
00046	     balanceteamswithbots,buildgreenbot,buildredbot,
00047	     killgreenbot,killredbot,menu,mydebug,nextdebug,ref,
00048	     sarkballtype,endthegame;
00049	}
00050	
00051	Exec Function menu(){
00052	  Pawn(Owner).ClientMessage("--------------------------------------------------");
00053	  Pawn(Owner).ClientMessage("                  Referee Menu");
00054	  Pawn(Owner).ClientMessage("--------------------------------------------------");
00055	  Pawn(Owner).ClientMessage("newround - Starts A New Round");
00056	  Pawn(Owner).ClientMessage("balanceteamswithbots - toggles bot team balancing");
00057	  Pawn(Owner).ClientMessage("killgreenbot - kills a green bot");
00058	  Pawn(Owner).ClientMessage("killredbot - kills a red bot");
00059	  Pawn(Owner).ClientMessage("sarkballtype X - sets the current sarkballtype");
00060	  Pawn(Owner).ClientMessage("ref off - deactivates ref mode");
00061	  Pawn(Owner).ClientMessage("balanceteamsto X - sets the game to balance teams to X players");
00062	  Pawn(Owner).ClientMessage("buildgreenbot - builds a green bot");
00063	  Pawn(Owner).ClientMessage("buildredbot - builds a red bot");
00064	  Pawn(Owner).ClientMessage("endthegame - Ends The Current Game");
00065	  Pawn(Owner).ClientMessage("--------------------------------------------------");
00066	  //BroadcastMessage("Referee Menu",True);
00067	
00068	}
00069	
00070	Exec Function endthegame(string psReason){
00071	  Pawn(Owner).ClientMessage("Ending The Game");
00072	  //EndGame("Referee "$Pawn(Owner).PlayerReplicationInfo.PlayerName$" has ended the Match: "$psReason);
00073	  //SarkBallGame(level.game).bGameOver=true;
00074	  SarkBallGame(level.game).EndTheGame(psReason);
00075	}
00076	
00077	Exec Function debugball(){
00078	
00079	  If (SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).bDebugBall){
00080	    SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).bDebugBall=False;
00081	  }else{
00082	    SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).bDebugBall=True;
00083	  }
00084	
00085	}
00086	
00087	exec function debugpawn(string psSwitch){
00088	  local Pawn P;
00089	  local String sCurrentBot;
00090	  local bool bFoundName;
00091	  local String sFirstPawn;
00092	  sCurrentBot=SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).sDebugBotName;
00093	  foreach AllActors(class'Pawn', P){
00094	    If (sFirstPawn==""){
00095	      sFirstPawn=string(P.Name);
00096	    }
00097	
00098	    If (bFoundName){
00099	      SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).sDebugBotName=string(P.Name);
00100	      BroadcastMessage("debugging:" $P.Name,True);
00101	      Return;
00102	    }
00103	    If (sCurrentBot==string(P.Name)){
00104	      bFoundName=True;
00105	      P.Style = STY_Normal;
00106	
00107	    }
00108	  }
00109	
00110	  If (bFoundName){
00111	    //BroadcastMessage("debugging off",True);
00112	    SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).sDebugBotName="";
00113	  }else{
00114	  SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).sDebugBotName=sFirstPawn;
00115	  //BroadcastMessage("debugging:" $sFirstPawn,True);
00116	  }
00117	}
00118	
00119	Exec Function switchteam(string psSwitch){
00120	  local Pawn P;
00121	
00122	  //BroadcastMessage("ChangeTeam:"$psSwitch,True);
00123	  foreach AllActors(class'Pawn', P){
00124	
00125	    If (psSwitch==P.PlayerReplicationInfo.PlayerName){
00126	      //BroadcastMessage("Found:"$P.PlayerReplicationInfo.Team,True);
00127	      If (P.PlayerReplicationInfo.Team==0){
00128	        SarkBallGame(level.game).ChangeTeam(P,2);
00129	      }else{
00130	        SarkBallGame(level.game).ChangeTeam(P,0);
00131	
00132	      }
00133	
00134	    }
00135	  }
00136	}
00137	
00138	exec function debugshield(string psSwitch){
00139	  local Shield P;
00140	  local String sCurrentBot;
00141	  local bool bFoundName;
00142	  local String sFirstPawn;
00143	  sCurrentBot=SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).sDebugShieldName;
00144	  foreach AllActors(class'Shield', P){
00145	    If (sFirstPawn==""){
00146	      sFirstPawn=string(P.Name);
00147	    }
00148	
00149	    If (bFoundName){
00150	      SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).sDebugShieldName=string(P.Name);
00151	      BroadcastMessage("debugging:" $P.Name,True);
00152	      Return;
00153	    }
00154	
00155	    If (sCurrentBot==string(P.Name)){
00156	      bFoundName=True;
00157	      P.Style = STY_Normal;
00158	
00159	    }
00160	  }
00161	  If (bFoundName){
00162	    BroadcastMessage("debugging off",True);
00163	    SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).sDebugShieldName="";
00164	  }else{
00165	  SarkBallGameReplicationInfo(PlayerPawn(Owner).GameReplicationInfo).sDebugShieldName=sFirstPawn;
00166	  BroadcastMessage("debugging:" $sFirstPawn,True);
00167	  }
00168	}
00169	
00170	
00171	Exec Function mydebug(string psSwitch){
00172	  //IF(psSwitch=="off"){
00173	    Pawn(Owner).ClientMessage("Debug "$psSwitch);
00174	    PlayerPawn(Owner).myDebugHUD.DebugMode = int(psSwitch);
00175	    PlayerPawn(Owner).myDebugHUD.ChangeHudMode(0,1);
00176	    PlayerPawn(Owner).myDebugHUD.SetWatch(Owner);
00177	    //Owner.myDebugHUD.SetWatch(Owner);
00178	
00179	  //}else{
00180	  //  Broadcastmessage("Debug On",True);
00181	
00182	   // PlayerPawn(Owner).myDebugHUD.DebugMode = 10;
00183	   // PlayerPawn(Owner).myDebugHUD.DebugHudMode = 10;
00184	   // PlayerPawn(Owner).myDebugHUD.SetWatch(None);
00185	    //PlayerPawn(Owner).myDebugHUD.SetWatch(Owner);
00186	
00187	
00188	  //}
00189	
00190	}
00191	
00192	Exec Function nextdebug(){
00193	
00194	  local actor A;
00195	  local bool bFoundLast;
00196	
00197	  bFoundLast=False;
00198	  If (LastDebug==None){
00199	    BroadcastMessage("LastDebug is None",True);
00200	    bFoundLast=True;
00201	  }else{
00202	    BroadcastMessage("Looking for LastDebug:"$LastDebug.Name,True);
00203	  }
00204	  foreach AllActors(class'Actor',A){
00205	    If (bFoundLast){
00206	      BroadcastMessage("Setting New LastDebug:"$A.Name,True);
00207	      LastDebug=A;
00208	      PlayerPawn(Owner).myDebugHUD.SetWatch(LastDebug);
00209	      Return;
00210	    }else if(LastDebug==A){
00211	      BroadcastMessage("Found LastDebug",True);
00212	      bFoundLast=True;
00213	    }
00214	  }
00215	}
00216	
00217	Exec Function SarkBallType(string psType){
00218	  SarkBallGame(level.Game).SarkBallType=psType;
00219	  BroadcastMessage("SarkBall Changed To "$psType,True);
00220	
00221	}
00222	
00223	Exec Function Ref(string psSwitch){
00224	  IF(psSwitch=="off"){
00225	    SarkBallGame(level.game).ChangeTeam(Pawn(Owner),0);
00226	  }else{
00227	    SarkBallGame(level.game).DestroyInventory(Pawn(Owner));
00228	     SarkBallGame(level.game).ChangeTeam(Pawn(Owner),FormerTeam);
00229	
00230	     //theAdminTool=spawn(class'SarkBall.sbAdminTool',,,sender.Location);
00231	     //theAdminTool.bTossedOut=true;
00232	     //theAdminTool.Instigator=Sender;
00233	     //theAdminTool.BecomeItem();
00234	     //Sender.AddInventory(theAdminTool);
00235	
00236	  }
00237	
00238	}
00239	
00240	Exec Function BalanceTeamsWithBots(){
00241	  SarkBallGame(level.game).bBalanceTeamsWithBots=! SarkBallGame(level.game).bBalanceTeamsWithBots;
00242	
00243	  If ( SarkBallGame(level.game).bBalanceTeamsWithBots){
00244	    BroadcastMessage("Balance Teams With Bots On",True);
00245	  }else{
00246	    BroadcastMessage("Balance Teams With Bots Off",True);
00247	  }
00248	
00249	}
00250	
00251	Exec Function BalanceTeamsTo (string S){
00252	
00253	  SarkBallGame(level.game).iDesiredTeamCount=int(S);
00254	  //BroadcastMessage("Balance Teams To:"$SarkBallGame(level.game).iDesiredTeamCount,True);
00255	
00256	}
00257	
00258	
00259	exec function newround(){
00260	  SarkBallGame(level.game).NewRound();
00261	}
00262	
00263	Exec Function buildgreenbot(){
00264	  SarkBallGame(level.game).BuildGreenBot();
00265	}
00266	
00267	Exec Function buildredbot(){
00268	  SarkBallGame(level.game).BuildRedBot();
00269	}
00270	
00271	
00272	Exec Function killredbot(){
00273	  SarkBallGame(level.game).KillRedBot();
00274	}
00275	
00276	Exec Function killgreenbot(){
00277	  SarkBallGame(level.game).KillGreenBot();
00278	}
00279	
00280	
00281	exec function smite(string S)
00282	{
00283	     local Pawn sucker;
00284	     for( sucker=Level.PawnList; sucker!=None; sucker=sucker.NextPawn )
00285	          if  ( sucker.bIsPlayer && sucker.PlayerReplicationInfo.PlayerName~=S )
00286	          {
00287	          sucker.TakeDamage(10000, None, sucker.Location, vect(0,0,0), 'Crushed');
00288	               return;
00289	          }
00290	}
00291	
00292	
00293	exec function telefrag(string S)
00294	{
00295	     local Pawn sucker;
00296	     for( sucker=Level.PawnList; sucker!=None; sucker=sucker.NextPawn )
00297	          if  ( sucker.bIsPlayer && sucker.PlayerReplicationInfo.PlayerName~=S )
00298	          {
00299	          TelePhuk(sucker);
00300	               return;
00301	          }
00302	}
00303	
00304	function TelePhuk(pawn sucker)
00305	{
00306	local vector loc;
00307	
00308	if (sucker != none)
00309	Owner.SetLocation(sucker.Location);
00310	
00311	}
00312	
00313	
00314	exec function summonshield()
00315	{
00316	     local Pawn PawnOwner;
00317	     local Shield shield;
00318	
00319	     PawnOwner = Pawn(Owner);
00320	     if (PawnOwner!=None)
00321	     {    // Give a magic shield
00322	               shield = Spawn(class'DwarfBattleShield',,,PawnOwner.Location);
00323	               PawnOwner.AddInventory( shield );
00324	               PawnOwner.AttachActorToJoint(shield, PawnOwner.JointNamed(PawnOwner.ShieldJoint));
00325	               PawnOwner.Shield = shield;
00326	               Shield.GotoState('Active');
00327	               PawnOwner.Shield.DrawScale=2.0;
00328	               PawnOwner.Shield.Style = STY_Translucent;
00329	               PawnOwner.Shield.bBreakable=false;
00330	     }
00331	}
00332	
00333	exec function DeployAdminTool()
00334	{
00335	          switch (AdminDeployType)
00336	          {
00337	          case ADMIN_SELF:
00338	               //do something here;
00339	               break;
00340	          case ADMIN_TOUCH:
00341	               //do something here;
00342	               break;
00343	          case ADMIN_TRACE:
00344	               //do something here;
00345	               break;
00346	          case ADMIN_PROJECTILE:
00347	               //do something here;
00348	               break;
00349	          case ADMIN_RADIUS:
00350	               //do something here;
00351	               break;
00352	          case ADMIN_NAMED:
00353	               //do something here;
00354	               break;
00355	          case ADMIN_TEAM:
00356	               //do something here;
00357	               break;
00358	          case ADMIN_ALLPLAYERS:
00359	               //do something here;
00360	               break;
00361	          case ADMIN_RADIUS:
00362	               //do something here;
00363	               break;
00364	          default:
00365	               //else case defined here
00366	               break;
00367	          }
00368	}
00369	
00370	defaultproperties
00371	{
00372	    bIsPersistent=True
00373	}

End Source Code