Upload from upload_mods.ps1
This commit is contained in:
130
Scripts/Network/NPCs/NetPackageAddHireRebirth.cs
Normal file
130
Scripts/Network/NPCs/NetPackageAddHireRebirth.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using static RebirthManager;
|
||||
|
||||
public class NetPackageAddHireRebirth : NetPackage
|
||||
{
|
||||
private int playerID;
|
||||
private int hireID;
|
||||
private string name;
|
||||
private string className;
|
||||
private Vector3 spawnPosition;
|
||||
private Vector3 spawnRotation;
|
||||
private Vector3 reSpawnPosition;
|
||||
private Vector3 reSpawnRotation;
|
||||
private int numKills;
|
||||
private int numMine;
|
||||
private int order;
|
||||
private bool playerSpawned;
|
||||
|
||||
public NetPackageAddHireRebirth Setup(int playerID,
|
||||
int hireID,
|
||||
string name,
|
||||
string className,
|
||||
Vector3 spawnPosition,
|
||||
Vector3 spawnRotation,
|
||||
Vector3 reSpawnPosition,
|
||||
Vector3 reSpawnRotation,
|
||||
int numKills,
|
||||
int numMine,
|
||||
int order,
|
||||
bool playerSpawned
|
||||
)
|
||||
{
|
||||
this.playerID = playerID;
|
||||
this.hireID = hireID;
|
||||
this.name = name;
|
||||
this.className = className;
|
||||
this.spawnPosition = spawnPosition;
|
||||
this.spawnRotation = spawnRotation;
|
||||
this.reSpawnPosition = reSpawnPosition;
|
||||
this.reSpawnRotation = reSpawnRotation;
|
||||
this.numKills = numKills;
|
||||
this.numMine = numMine;
|
||||
this.order = order;
|
||||
this.playerSpawned = playerSpawned;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.playerID = _br.ReadInt32();
|
||||
this.hireID = _br.ReadInt32();
|
||||
this.name = _br.ReadString();
|
||||
this.className = _br.ReadString();
|
||||
this.spawnPosition = StringParsers.ParseVector3(_br.ReadString());
|
||||
this.spawnRotation = StringParsers.ParseVector3(_br.ReadString());
|
||||
this.reSpawnPosition = StringParsers.ParseVector3(_br.ReadString());
|
||||
this.reSpawnRotation = StringParsers.ParseVector3(_br.ReadString());
|
||||
this.numKills = _br.ReadInt32();
|
||||
this.numMine = _br.ReadInt32();
|
||||
this.order = _br.ReadInt32();
|
||||
this.playerSpawned = _br.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerID);
|
||||
_bw.Write(this.hireID);
|
||||
_bw.Write(this.name);
|
||||
_bw.Write(this.className);
|
||||
_bw.Write(this.spawnPosition.ToString());
|
||||
_bw.Write(this.spawnRotation.ToString());
|
||||
_bw.Write(this.reSpawnPosition.ToString());
|
||||
_bw.Write(this.reSpawnRotation.ToString());
|
||||
_bw.Write(this.numKills);
|
||||
_bw.Write(this.numMine);
|
||||
_bw.Write(this.order);
|
||||
_bw.Write(this.playerSpawned);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageAddHireRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageAddHireRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
bool foundHire = false;
|
||||
|
||||
foreach (hireInfo hire in playerHires)
|
||||
{
|
||||
if (hire.playerID == this.playerID && hire.hireID == this.hireID)
|
||||
{
|
||||
foundHire = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundHire)
|
||||
{
|
||||
hireInfo newHire = new hireInfo();
|
||||
newHire.playerID = this.playerID;
|
||||
newHire.hireID = this.hireID;
|
||||
newHire.name = this.name;
|
||||
newHire.className = this.className;
|
||||
newHire.spawnPosition = this.spawnPosition;
|
||||
newHire.spawnRotation = this.spawnRotation;
|
||||
newHire.reSpawnPosition = this.reSpawnPosition;
|
||||
newHire.reSpawnRotation = this.reSpawnRotation;
|
||||
newHire.numMine = this.numKills;
|
||||
newHire.numKills = this.numMine;
|
||||
newHire.order = this.order;
|
||||
newHire.playerSpawned = this.playerSpawned;
|
||||
playerHires.Add(newHire);
|
||||
//Log.Out("NetPackageAddHireRebirth-ProcessPackage ADDED HIRE: " + this.hireID);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageAddHireRebirth-ProcessPackage FOUND HIRE: " + this.hireID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user