Upload from upload_mods.ps1
This commit is contained in:
164
Scripts/Network/NPCs/NetPackageChangeHireInfoRebirth.cs
Normal file
164
Scripts/Network/NPCs/NetPackageChangeHireInfoRebirth.cs
Normal file
@@ -0,0 +1,164 @@
|
||||
using static RebirthManager;
|
||||
|
||||
public class NetPackageChangeHireInfoRebirth : NetPackage
|
||||
{
|
||||
private int playerID;
|
||||
private int hireID;
|
||||
private string name;
|
||||
private Vector3 spawnPosition;
|
||||
private Vector3 spawnRotation;
|
||||
private Vector3 reSpawnPosition;
|
||||
private Vector3 reSpawnRotation;
|
||||
private int numKills;
|
||||
private int numMine;
|
||||
private int order;
|
||||
private bool playerSpawned;
|
||||
private string action;
|
||||
private string value;
|
||||
private int newHireID;
|
||||
|
||||
public NetPackageChangeHireInfoRebirth Setup(int playerID,
|
||||
int hireID,
|
||||
string name,
|
||||
Vector3 spawnPosition,
|
||||
Vector3 spawnRotation,
|
||||
Vector3 reSpawnPosition,
|
||||
Vector3 reSpawnRotation,
|
||||
int numKills,
|
||||
int numMine,
|
||||
int order,
|
||||
bool playerSpawned,
|
||||
string action,
|
||||
string value,
|
||||
int newHireID
|
||||
)
|
||||
{
|
||||
this.playerID = playerID;
|
||||
this.hireID = hireID;
|
||||
this.name = name;
|
||||
this.spawnPosition = spawnPosition;
|
||||
this.spawnRotation = spawnRotation;
|
||||
this.reSpawnPosition = reSpawnPosition;
|
||||
this.reSpawnRotation = reSpawnRotation;
|
||||
this.numKills = numKills;
|
||||
this.numMine = numMine;
|
||||
this.order = order;
|
||||
this.playerSpawned = playerSpawned;
|
||||
this.action = action;
|
||||
this.value = value;
|
||||
this.newHireID = newHireID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.playerID = _br.ReadInt32();
|
||||
this.hireID = _br.ReadInt32();
|
||||
this.name = _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();
|
||||
this.action = _br.ReadString();
|
||||
this.value = _br.ReadString();
|
||||
this.newHireID = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerID);
|
||||
_bw.Write(this.hireID);
|
||||
_bw.Write(this.name);
|
||||
_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);
|
||||
_bw.Write(this.action);
|
||||
_bw.Write(this.value);
|
||||
_bw.Write(this.newHireID);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 26;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (hireInfo hire in playerHires)
|
||||
{
|
||||
if (hire.playerID == this.playerID && hire.hireID == this.hireID)
|
||||
{
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage FOUND HIRE: " + this.hireID);
|
||||
|
||||
bool addObserver = false;
|
||||
bool removeObserver = false;
|
||||
|
||||
if (action == "newid")
|
||||
{
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage CHANGED HIRE ID");
|
||||
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage playerID: " + playerID);
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage hireID: " + hireID);
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage action: " + action);
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage newHireID: " + newHireID);
|
||||
|
||||
hire.hireID = this.newHireID;
|
||||
}
|
||||
else if (action == "order")
|
||||
{
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage order value: " + value);
|
||||
|
||||
if (value == "follow")
|
||||
{
|
||||
hire.order = 0;
|
||||
removeObserver = true;
|
||||
}
|
||||
else if (value == "stay")
|
||||
{
|
||||
hire.order = 1;
|
||||
hire.spawnPosition = this.spawnPosition;
|
||||
hire.spawnRotation = this.spawnRotation;
|
||||
addObserver = true;
|
||||
}
|
||||
else if (value == "guard")
|
||||
{
|
||||
hire.order = 2;
|
||||
hire.spawnPosition = this.spawnPosition;
|
||||
hire.spawnRotation = this.spawnRotation;
|
||||
addObserver = true;
|
||||
}
|
||||
}
|
||||
else if (action == "reSpawnPosition")
|
||||
{
|
||||
//Log.Out("NetPackageChangeHireInfoRebirth-ProcessPackage reSpawnPosition");
|
||||
|
||||
hire.reSpawnPosition = this.reSpawnPosition;
|
||||
hire.reSpawnRotation = this.reSpawnRotation;
|
||||
hire.spawnPosition = this.spawnPosition;
|
||||
hire.spawnRotation = this.spawnRotation;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user