Upload from upload_mods.ps1
This commit is contained in:
43
Scripts/Network/Inactive/NetPackageAdjustStats.cs
Normal file
43
Scripts/Network/Inactive/NetPackageAdjustStats.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
public class NetPackageAdjustStats : global::NetPackage
|
||||
{
|
||||
private int _entityId;
|
||||
|
||||
public NetPackageAdjustStats Setup(int entityId)
|
||||
{
|
||||
_entityId = entityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader br)
|
||||
{
|
||||
_entityId = br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter bw)
|
||||
{
|
||||
base.write(bw);
|
||||
bw.Write(_entityId);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World world, GameManager callbacks)
|
||||
{
|
||||
Log.Out("NetPackageAdjustStats-ProcessPackage START");
|
||||
if (world == null)
|
||||
{
|
||||
Log.Out("NetPackageAdjustStats-ProcessPackage WORLD IS NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityNPCRebirth npc = (EntityNPCRebirth)world.GetEntity(this._entityId);
|
||||
|
||||
if (npc != null)
|
||||
{
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.adjustNPCStats(npc));
|
||||
}
|
||||
}
|
||||
}
|
||||
40
Scripts/Network/NPCs/NetPackageAddChunkObserver.cs
Normal file
40
Scripts/Network/NPCs/NetPackageAddChunkObserver.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
public class NetPackageAddChunkObserver : NetPackage
|
||||
{
|
||||
private int playerID;
|
||||
public Vector3 position;
|
||||
|
||||
public NetPackageAddChunkObserver Setup(Vector3 _position)
|
||||
{
|
||||
this.position = _position;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.position = StreamUtils.ReadVector3(_br);
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
StreamUtils.Write(_bw, this.position);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
ChunkManager.ChunkObserver observerRef = GameManager.Instance.AddChunkObserver(position, false, 3, -1);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
public class NetPackageEntityLootContainerWriteRebirth : NetPackage
|
||||
{
|
||||
private int entityId;
|
||||
private ItemStack[] items;
|
||||
|
||||
public NetPackageEntityLootContainerWriteRebirth Setup(int _lootEntityId, ItemStack[] _items)
|
||||
{
|
||||
this.entityId = _lootEntityId;
|
||||
this.items = _items;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.entityId = _reader.ReadInt32();
|
||||
this.items = GameUtils.ReadItemStack(_reader);
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityId);
|
||||
_writer.Write((ushort)this.items.Length);
|
||||
for (int i = 0; i < this.items.Length; i++)
|
||||
{
|
||||
this.items[i].Write(_writer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("NetPackageEntityLootContainerWriteRebirth-ProcessPackage this.entityId: " + this.entityId);
|
||||
|
||||
Entity entity = GameManager.Instance.World.GetEntity(this.entityId);
|
||||
|
||||
if (entity != null && entity is EntityNPCRebirth)
|
||||
{
|
||||
EntityNPCRebirth entityAlive = (EntityNPCRebirth)entity;
|
||||
|
||||
if (entityAlive != null && entityAlive.lootContainer != null && this.items.Length > 0)
|
||||
{
|
||||
//Log.Out("NetPackageEntityLootContainerWriteRebirth-ProcessPackage entityAlive: " + entityAlive.EntityName);
|
||||
|
||||
for (int i = 0; i < this.items.Length; i++)
|
||||
{
|
||||
if (this.items[i].count > 0)
|
||||
{
|
||||
entityAlive.lootContainer.items[i] = this.items[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
entityAlive.lootContainer.items[i] = ItemStack.Empty.Clone();
|
||||
}
|
||||
}
|
||||
|
||||
PooledBinaryWriter stream = new PooledBinaryWriter();
|
||||
TileEntity.StreamModeWrite _eStreamMode = new TileEntity.StreamModeWrite();
|
||||
entityAlive.lootContainer.write(stream, _eStreamMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
153
Scripts/Network/NPCs/NetPackageForceTeleportRebirth.cs
Normal file
153
Scripts/Network/NPCs/NetPackageForceTeleportRebirth.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
public class NetPackageForceTeleportRebirth : NetPackage
|
||||
{
|
||||
private int entityToUpdate;
|
||||
|
||||
public NetPackageForceTeleportRebirth Setup(int _entityToUpdate)
|
||||
{
|
||||
this.entityToUpdate = _entityToUpdate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityToUpdate = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityToUpdate);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageForceTeleportRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageForceTeleportRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (!_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageForceTeleportRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}*/
|
||||
|
||||
Entity myEntity = _world.GetEntity(this.entityToUpdate);
|
||||
if (myEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageForceTeleportRebirth-ProcessPackage 3");
|
||||
if (myEntity is EntityNPCRebirth)
|
||||
{
|
||||
//Log.Out("NetPackageForceTeleportRebirth-ProcessPackage 4");
|
||||
EntityNPCRebirth follower = (EntityNPCRebirth)myEntity;
|
||||
|
||||
if (follower.LeaderUtils.Owner)
|
||||
{
|
||||
//Log.Out("NetPackageForceTeleportRebirth-ProcessPackage 5");
|
||||
|
||||
//Log.Out("NetPackageForceTeleportRebirth-ProcessPackage 6");
|
||||
|
||||
bool hasFireBuff = follower.Buffs.HasBuff("buffBurningFlamingArrow") ||
|
||||
follower.Buffs.HasBuff("buffBurningMolotov") ||
|
||||
follower.Buffs.HasBuff("buffBurningEnvironmentHack") ||
|
||||
follower.Buffs.HasBuff("buffBurningEnvironment") ||
|
||||
follower.Buffs.HasBuff("buffBurningElement") ||
|
||||
follower.Buffs.HasBuff("buffIsOnFire") ||
|
||||
follower.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamage") ||
|
||||
follower.Buffs.HasBuff("FuriousRamsayFireZombieAoEDamageDisplay") ||
|
||||
follower.Buffs.HasBuff("FuriousRamsayAddBurningEnemyBoss") ||
|
||||
follower.Buffs.HasBuff("FuriousRamsayBurningTrapDamage");
|
||||
// On Fire
|
||||
if (hasFireBuff && follower.Buffs.GetCustomVar("CurrentOrder") == (int)EntityUtilities.Orders.Follow)
|
||||
{
|
||||
ItemValue itemBoiledWater = ItemClass.GetItem("drinkJarBoiledWater", false);
|
||||
ItemClass itemClassBoiledWater = itemBoiledWater.ItemClass;
|
||||
int itemCountBoiledWater = follower.LeaderUtils.Owner.bag.GetItemCount(itemBoiledWater, -1, -1, false);
|
||||
int itemCount2BoiledWater = follower.LeaderUtils.Owner.inventory.GetItemCount(itemBoiledWater, false, -1, -1);
|
||||
if (itemClassBoiledWater != null)
|
||||
{
|
||||
itemCountBoiledWater = follower.LeaderUtils.Owner.bag.GetItemCount(itemBoiledWater, -1, -1, false);
|
||||
itemCount2BoiledWater = follower.LeaderUtils.Owner.inventory.GetItemCount(itemBoiledWater, false, -1, -1);
|
||||
}
|
||||
|
||||
ItemValue itemDistilledWater = ItemClass.GetItem("drinkJarPureMineralWater", false);
|
||||
ItemClass itemClassDistilledWater = itemDistilledWater.ItemClass;
|
||||
int itemCountDistilledWater = follower.LeaderUtils.Owner.bag.GetItemCount(itemDistilledWater, -1, -1, false);
|
||||
int itemCount2DistilledWater = follower.LeaderUtils.Owner.inventory.GetItemCount(itemDistilledWater, false, -1, -1);
|
||||
if (itemClassDistilledWater != null)
|
||||
{
|
||||
itemCountDistilledWater = follower.LeaderUtils.Owner.bag.GetItemCount(itemDistilledWater, -1, -1, false);
|
||||
itemCount2DistilledWater = follower.LeaderUtils.Owner.inventory.GetItemCount(itemDistilledWater, false, -1, -1);
|
||||
}
|
||||
|
||||
if ((itemCountDistilledWater + itemCount2DistilledWater) > 0)
|
||||
{
|
||||
if (itemCount2DistilledWater > 0)
|
||||
{
|
||||
follower.LeaderUtils.Owner.inventory.DecItem(itemDistilledWater, 1, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
follower.LeaderUtils.Owner.bag.DecItem(itemDistilledWater, 1, false);
|
||||
}
|
||||
//LocalPlayerUI.GetUIForPlayer(entityPlayer).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemDistilledWater, 1));
|
||||
follower.Buffs.AddBuff("buffExtinguishFire");
|
||||
follower.Buffs.RemoveBuff("buffBurningFlamingArrow");
|
||||
follower.Buffs.RemoveBuff("buffBurningMolotov");
|
||||
follower.Buffs.RemoveBuff("buffBurningEnvironmentHack");
|
||||
follower.Buffs.RemoveBuff("buffBurningEnvironment");
|
||||
follower.Buffs.RemoveBuff("buffBurningElement");
|
||||
follower.Buffs.RemoveBuff("buffIsOnFire");
|
||||
follower.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamage");
|
||||
follower.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamageDisplay");
|
||||
follower.Buffs.RemoveBuff("FuriousRamsayAddBurningEnemyBoss");
|
||||
follower.Buffs.RemoveBuff("FuriousRamsayBurningTrapDamage");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((itemCountBoiledWater + itemCount2BoiledWater) > 0)
|
||||
{
|
||||
if (itemCount2BoiledWater > 0)
|
||||
{
|
||||
follower.LeaderUtils.Owner.inventory.DecItem(itemBoiledWater, 1, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
follower.LeaderUtils.Owner.bag.DecItem(itemBoiledWater, 1, false);
|
||||
}
|
||||
//LocalPlayerUI.GetUIForPlayer(entityPlayer).xui.CollectedItemList.RemoveItemStack(new ItemStack(itemBoiledWater, 1));
|
||||
follower.Buffs.AddBuff("buffExtinguishFire");
|
||||
follower.Buffs.RemoveBuff("buffBurningFlamingArrow");
|
||||
follower.Buffs.RemoveBuff("buffBurningMolotov");
|
||||
follower.Buffs.RemoveBuff("buffBurningEnvironmentHack");
|
||||
follower.Buffs.RemoveBuff("buffBurningEnvironment");
|
||||
follower.Buffs.RemoveBuff("buffBurningElement");
|
||||
follower.Buffs.RemoveBuff("buffIsOnFire");
|
||||
follower.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamage");
|
||||
follower.Buffs.RemoveBuff("FuriousRamsayFireZombieAoEDamageDisplay");
|
||||
follower.Buffs.RemoveBuff("FuriousRamsayAddBurningEnemyBoss");
|
||||
follower.Buffs.RemoveBuff("FuriousRamsayBurningTrapDamage");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
follower.Buffs.SetCustomVar("$FR_NPC_ForceTeleport", 1f);
|
||||
follower.Buffs.AddBuff("FuriousRamsayStandStill");
|
||||
follower.TeleportToPlayer(follower.LeaderUtils.Owner, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageForceTeleportRebirth-ProcessPackage CAN'T FIND THE ENTITY");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
65
Scripts/Network/NPCs/NetPackageGetHiresRebirth.cs
Normal file
65
Scripts/Network/NPCs/NetPackageGetHiresRebirth.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using static RebirthManager;
|
||||
|
||||
public class NetPackageGetHiresRebirth : NetPackage
|
||||
{
|
||||
private int entityPlayerID;
|
||||
|
||||
public NetPackageGetHiresRebirth Setup(int _entityPlayerID)
|
||||
{
|
||||
this.entityPlayerID = _entityPlayerID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityPlayerID = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityPlayerID);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageGetHiresRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageGetHiresRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (hireInfo hire in playerHires)
|
||||
{
|
||||
if (hire.playerID == entityPlayerID)
|
||||
{
|
||||
//Log.Out("NetPackageGetHiresRebirth-ProcessPackage hire.hireID: " + hire.hireID);
|
||||
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageAddHireRebirth>().Setup(hire.playerID,
|
||||
hire.hireID,
|
||||
hire.name,
|
||||
hire.className,
|
||||
hire.spawnPosition,
|
||||
hire.spawnRotation,
|
||||
hire.reSpawnPosition,
|
||||
hire.reSpawnRotation,
|
||||
hire.numKills,
|
||||
hire.numMine,
|
||||
hire.order,
|
||||
hire.playerSpawned
|
||||
), false, hire.playerID, -1, -1, null, 192);
|
||||
|
||||
//Log.Out("NetPackageGetHiresRebirth-ProcessPackage SENT HIRE: " + hire.hireID + " TO: " + hire.playerID);
|
||||
}
|
||||
}
|
||||
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSentHiresRebirth>().Setup(), false, entityPlayerID, -1, -1, null, 192);
|
||||
}
|
||||
}
|
||||
|
||||
58
Scripts/Network/NPCs/NetPackageMoveToBedroll.cs
Normal file
58
Scripts/Network/NPCs/NetPackageMoveToBedroll.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using static SleeperVolume;
|
||||
|
||||
public class NetPackageMoveToBedroll : NetPackage
|
||||
{
|
||||
private int entityID;
|
||||
public Vector3 position;
|
||||
|
||||
public NetPackageMoveToBedroll Setup(int _entityID, Vector3 _position)
|
||||
{
|
||||
this.entityID = _entityID;
|
||||
this.position = _position;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityID = _br.ReadInt32();
|
||||
this.position = StreamUtils.ReadVector3(_br);
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityID);
|
||||
StreamUtils.Write(_bw, this.position);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
Entity myEntity = _world.GetEntity(this.entityID);
|
||||
if (myEntity is EntityNPCRebirth hiredNPC)
|
||||
{
|
||||
hiredNPC.HideNPC(false);
|
||||
hiredNPC.guardPosition = Vector3.zero;
|
||||
hiredNPC.attackTarget = null;
|
||||
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "order", "stay", position.ToString(), new Vector3(0, hiredNPC.rotation.y, 0).ToString());
|
||||
hiredNPC.Buffs.SetCustomVar("CurrentOrder", (int)EntityUtilities.Orders.Stay);
|
||||
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "reSpawnPosition", "", Vector3.zero.ToString(), new Vector3(0, hiredNPC.rotation.y, 0).ToString());
|
||||
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "spawnPosition", "", position.ToString(), new Vector3(0, hiredNPC.rotation.y, 0).ToString());
|
||||
RebirthManager.UpdateHireInfo(hiredNPC.entityId, "order", "guard", Vector3.zero.ToString(), Vector3.zero.ToString());
|
||||
hiredNPC.SetPosition(new Vector3(position.x, position.y + 1f, position.z));
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.pauseSleep(hiredNPC, 1f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
64
Scripts/Network/NPCs/NetPackageRemoveHireRebirth.cs
Normal file
64
Scripts/Network/NPCs/NetPackageRemoveHireRebirth.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using static RebirthManager;
|
||||
|
||||
public class NetPackageRemoveHireRebirth : NetPackage
|
||||
{
|
||||
private int hireID;
|
||||
|
||||
public NetPackageRemoveHireRebirth Setup(int hireID
|
||||
)
|
||||
{
|
||||
this.hireID = hireID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.hireID = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.hireID);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageRemoveHireRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageRemoveHireRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < playerHires.Count; i++)
|
||||
{
|
||||
if (playerHires[i].hireID == this.hireID)
|
||||
{
|
||||
playerHires.RemoveAt(i);
|
||||
//Log.Out("NetPackageRemoveHireRebirth-ProcessPackage REMOVED HIRE: " + this.hireID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < observers.Count; i++)
|
||||
{
|
||||
if (observers[i].entityID == this.hireID)
|
||||
{
|
||||
GameManager.Instance.RemoveChunkObserver(observers[i].observerRef);
|
||||
observers.RemoveAt(i);
|
||||
//Log.Out("NetPackageRemoveHireRebirth-ProcessPackage REMOVED OBSERVER");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RebirthManager.SaveCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
49
Scripts/Network/NPCs/NetPackageRespawnHireRebirth.cs
Normal file
49
Scripts/Network/NPCs/NetPackageRespawnHireRebirth.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using static RebirthManager;
|
||||
using static SleeperVolume;
|
||||
|
||||
public class NetPackageRespawnHireRebirth : NetPackage
|
||||
{
|
||||
private int hireID;
|
||||
private Vector3 spawnPosition;
|
||||
|
||||
public NetPackageRespawnHireRebirth Setup(int hireID,
|
||||
Vector3 spawnPosition
|
||||
)
|
||||
{
|
||||
this.hireID = hireID;
|
||||
this.spawnPosition = spawnPosition;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.hireID = _br.ReadInt32();
|
||||
this.spawnPosition = StringParsers.ParseVector3(_br.ReadString());
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.hireID);
|
||||
_bw.Write(this.spawnPosition.ToString());
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageRespawnHireRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageRespawnHireRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
RebirthUtilities.SpawnHire(this.hireID, this.spawnPosition);
|
||||
}
|
||||
}
|
||||
|
||||
36
Scripts/Network/NPCs/NetPackageSentHiresRebirth.cs
Normal file
36
Scripts/Network/NPCs/NetPackageSentHiresRebirth.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
public class NetPackageSentHiresRebirth : NetPackage
|
||||
{
|
||||
public NetPackageSentHiresRebirth Setup(
|
||||
)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSentHiresRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageSentHiresRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
RebirthManager.loadedHires = true;
|
||||
//Log.Out("NetPackageSentHiresRebirth-ProcessPackage HIRES HAVE BEEN LOADED");
|
||||
}
|
||||
}
|
||||
|
||||
71
Scripts/Network/NPCs/NetPackageTeleportTo.cs
Normal file
71
Scripts/Network/NPCs/NetPackageTeleportTo.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
public class NetPackageTeleportTo : NetPackage
|
||||
{
|
||||
private int playerID;
|
||||
public Vector3 position;
|
||||
|
||||
public NetPackageTeleportTo Setup(int _playerID, Vector3 _position)
|
||||
{
|
||||
this.playerID = _playerID;
|
||||
this.position = _position;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.playerID = _br.ReadInt32();
|
||||
this.position = StreamUtils.ReadVector3(_br);
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerID);
|
||||
StreamUtils.Write(_bw, this.position);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
Entity myEntity = _world.GetEntity(this.playerID);
|
||||
if (myEntity is EntityPlayer)
|
||||
{
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
float height1 = GameManager.Instance.World.GetHeight((int)position.x, (int)position.z);
|
||||
float height2 = GameManager.Instance.World.GetHeight((int)position.x, (int)position.z);
|
||||
|
||||
float height = ((height1 + height2) / 2f) + 1.5f;
|
||||
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage height1: " + height1);
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage height2: " + height2);
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage height: " + height);
|
||||
|
||||
if (height <= position.y)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageTeleportTo>().Setup(playerID, position), false, playerID);
|
||||
}
|
||||
else
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageTeleportTo>().Setup(playerID, new Vector3(position.x, height, position.x)), false, playerID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageTeleporTo-ProcessPackage position: " + position);
|
||||
myEntity.SetPosition(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
61
Scripts/Network/NetPackageAddCompanion.cs
Normal file
61
Scripts/Network/NetPackageAddCompanion.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageAddCompanion : NetPackage
|
||||
{
|
||||
public NetPackageAddCompanion Setup(int _npcEntityID, int _ownerID)
|
||||
{
|
||||
this.npcEntityID = _npcEntityID;
|
||||
this.ownerID = _ownerID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.npcEntityID = _reader.ReadInt32();
|
||||
this.ownerID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.npcEntityID);
|
||||
_writer.Write(this.ownerID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageAddCompanion-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageAddCompanion-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityNPCRebirth npc = _world.GetEntity(this.npcEntityID) as EntityNPCRebirth;
|
||||
|
||||
if (npc != null)
|
||||
{
|
||||
//Log.Out("NetPackageAddCompanion-ProcessPackage 3, ownerID: " + ownerID);
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null && ownerID == primaryPlayer.entityId)
|
||||
{
|
||||
//Log.Out("NetPackageAddCompanion-ProcessPackage 4");
|
||||
npc.Buffs.SetCustomVar("$Leader", primaryPlayer.entityId);
|
||||
npc.Buffs.SetCustomVar("$delayedPickup", 1f);
|
||||
|
||||
npc.LeaderUtils.AddCompanion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
private int npcEntityID;
|
||||
private int ownerID;
|
||||
}
|
||||
56
Scripts/Network/NetPackageAddPlayerItem.cs
Normal file
56
Scripts/Network/NetPackageAddPlayerItem.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
public class NetPackageAddPlayerItem : NetPackage
|
||||
{
|
||||
public NetPackageAddPlayerItem Setup(string itemName, int _ownerID, int _count, string _soundName)
|
||||
{
|
||||
this.itemName = itemName;
|
||||
this.ownerID = _ownerID;
|
||||
this.count = _count;
|
||||
this.soundName = _soundName;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.itemName = _reader.ReadString();
|
||||
this.ownerID = _reader.ReadInt32();
|
||||
this.count = _reader.ReadInt32();
|
||||
this.soundName = _reader.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.itemName);
|
||||
_writer.Write(this.ownerID);
|
||||
_writer.Write(this.count);
|
||||
_writer.Write(this.soundName);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageAddPlayerItem-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageAddPlayerItem-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayerLocal playerLocal = _world.GetEntity(this.ownerID) as EntityPlayerLocal;
|
||||
|
||||
if (playerLocal != null)
|
||||
{
|
||||
RebirthUtilities.addToPlayerInventory(ItemClass.GetItem(this.itemName, false), playerLocal, this.count, this.soundName);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
private string itemName;
|
||||
private int ownerID;
|
||||
private int count;
|
||||
private string soundName;
|
||||
}
|
||||
51
Scripts/Network/NetPackageChangeNPCName.cs
Normal file
51
Scripts/Network/NetPackageChangeNPCName.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageChangeNPCName : NetPackage
|
||||
{
|
||||
public NetPackageChangeNPCName Setup(int _npcEntityID, string _newName)
|
||||
{
|
||||
this.npcEntityID = _npcEntityID;
|
||||
this.newName = _newName;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.npcEntityID = _reader.ReadInt32();
|
||||
this.newName = _reader.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.npcEntityID);
|
||||
_writer.Write(this.newName);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageChangeNPCName-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageChangeNPCName-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityNPCRebirth npc = _world.GetEntity(this.npcEntityID) as EntityNPCRebirth;
|
||||
|
||||
if (npc != null)
|
||||
{
|
||||
npc.SetEntityName(this.newName);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
private int npcEntityID;
|
||||
private string newName;
|
||||
}
|
||||
46
Scripts/Network/NetPackageChangeOption.cs
Normal file
46
Scripts/Network/NetPackageChangeOption.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
public class NetPackageChangeOption : NetPackage
|
||||
{
|
||||
string option = "";
|
||||
string value = "";
|
||||
|
||||
public NetPackageChangeOption Setup(string _option, string _value)
|
||||
{
|
||||
//Log.Out("NetPackageChangeOption-Setup START");
|
||||
this.option = _option;
|
||||
this.value = _value;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.option = _br.ReadString();
|
||||
this.value = _br.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.option);
|
||||
_bw.Write(this.value);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageChangeOption-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageChangeOption-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("NetPackageChangeOption-ProcessPackage 2");
|
||||
RebirthUtilities.ChangeOption(this.option, this.value);
|
||||
}
|
||||
}
|
||||
|
||||
65
Scripts/Network/NetPackageCheckAchievementRebirth.cs
Normal file
65
Scripts/Network/NetPackageCheckAchievementRebirth.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageCheckAchievementRebirth : NetPackage
|
||||
{
|
||||
public NetPackageCheckAchievementRebirth Setup(int _biomeID, int _leaderID, int _targetID)
|
||||
{
|
||||
this.biomeID = _biomeID;
|
||||
this.leaderID = _leaderID;
|
||||
this.targetID = _targetID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.biomeID = _reader.ReadInt32();
|
||||
this.leaderID = _reader.ReadInt32();
|
||||
this.targetID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.biomeID);
|
||||
_writer.Write(this.leaderID);
|
||||
_writer.Write(this.targetID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
EntityAlive leader = _world.GetEntity(this.leaderID) as EntityAlive;
|
||||
if (leader == null)
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 3");
|
||||
return;
|
||||
}
|
||||
EntityAlive target = _world.GetEntity(this.targetID) as EntityAlive;
|
||||
if (leader == null)
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 3");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!RebirthUtilities.IsHordeNight())
|
||||
{
|
||||
RebirthUtilities.ProcessCheckAchievements(biomeID, leader, target);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
private int biomeID;
|
||||
private int leaderID;
|
||||
private int targetID;
|
||||
}
|
||||
82
Scripts/Network/NetPackageCheckBlockPositionRebirth.cs
Normal file
82
Scripts/Network/NetPackageCheckBlockPositionRebirth.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
public class NetPackageCheckBlockPositionRebirth : NetPackage
|
||||
{
|
||||
int clrIdx = 0;
|
||||
Vector3i blockPos;
|
||||
String blockName = "";
|
||||
int lightOpacity = 0;
|
||||
int blockID = 0;
|
||||
ulong tickRate = 0;
|
||||
|
||||
public NetPackageCheckBlockPositionRebirth Setup(int _clrIdx, Vector3i _blockPos, String _blockName, int _lightOpacity, int _blockID, ulong _tickRate)
|
||||
{
|
||||
//Log.Out("NetPackageCheckBlockPositionRebirth-Setup START");
|
||||
this.clrIdx = _clrIdx;
|
||||
this.blockPos = _blockPos;
|
||||
this.blockName = _blockName;
|
||||
this.lightOpacity = _lightOpacity;
|
||||
this.blockID = _blockID;
|
||||
this.tickRate = _tickRate;
|
||||
|
||||
/*Log.Out("NetPackageCheckBlockPositionRebirth-Setup this.clrIdx: " + this.clrIdx);
|
||||
Log.Out("NetPackageCheckBlockPositionRebirth-Setup this.blockPos: " + this.blockPos);
|
||||
Log.Out("NetPackageCheckBlockPositionRebirth-Setup this.blockName: " + this.blockName);*/
|
||||
//Log.Out("NetPackageCheckBlockPositionRebirth-Setup this.lightOpacity: " + this.lightOpacity);
|
||||
/*Log.Out("NetPackageCheckBlockPositionRebirth-Setup this.blockID: " + this.blockID);
|
||||
Log.Out("NetPackageCheckBlockPositionRebirth-Setup this.tickRate: " + this.tickRate);*/
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.blockPos = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.clrIdx = _br.ReadInt32();
|
||||
this.lightOpacity = _br.ReadInt32();
|
||||
this.blockName = _br.ReadString();
|
||||
this.blockID = _br.ReadInt32();
|
||||
this.tickRate = _br.ReadUInt64();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write((int)this.blockPos.x);
|
||||
_bw.Write((int)this.blockPos.y);
|
||||
_bw.Write((int)this.blockPos.z);
|
||||
_bw.Write(this.clrIdx);
|
||||
_bw.Write(this.lightOpacity);
|
||||
_bw.Write(this.blockName);
|
||||
_bw.Write(this.blockID);
|
||||
_bw.Write(this.tickRate);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 32 + (this.blockName.Length * 2);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageCheckBlockPositionRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageCheckBlockPositionRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
BlockValue block = GameManager.Instance.World.GetBlock(this.clrIdx, this.blockPos);
|
||||
block.Block.lightOpacity = this.lightOpacity;
|
||||
//Log.Out("NetPackageCheckBlockPositionRebirth-ProcessPackage CLIENT block.Block.lightOpacity: " + block.Block.lightOpacity);
|
||||
}
|
||||
else
|
||||
{
|
||||
BlockValue block = GameManager.Instance.World.GetBlock(this.clrIdx, this.blockPos);
|
||||
block.Block.lightOpacity = this.lightOpacity;
|
||||
//Log.Out("NetPackageCheckBlockPositionRebirth-ProcessPackage SERVER block.Block.lightOpacity: " + block.Block.lightOpacity);
|
||||
_world.GetWBT().AddScheduledBlockUpdate(this.clrIdx, this.blockPos, this.blockID, this.tickRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
76
Scripts/Network/NetPackageCheckPurgeProgress.cs
Normal file
76
Scripts/Network/NetPackageCheckPurgeProgress.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageCheckPurgeProgress : NetPackage
|
||||
{
|
||||
public NetPackageCheckPurgeProgress Setup(int _entityPlayerID)
|
||||
{
|
||||
this.entityPlayerID = _entityPlayerID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.entityPlayerID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityPlayerID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageCheckPurgeProgress-ProcessPackage START");
|
||||
EntityPlayer player = _world.GetEntity(this.entityPlayerID) as EntityPlayer;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
//Log.Out("NetPackageCheckPurgeProgress-ProcessPackage PLAYER EXISTS");
|
||||
//Log.Out("NetPackageCheckPurgeProgress-ProcessPackage BIOME EXISTS");
|
||||
string biomeName = RebirthUtilities.GetBiomeName(player);
|
||||
|
||||
int clearedPrefabs = RebirthManager.GetTotalClearedPrefabCount(biomeName);
|
||||
int totalPrefabs = RebirthUtilities.GetTotalSpawnedPrefab(biomeName);
|
||||
|
||||
float purgeDisplayPercentage = ((float)clearedPrefabs / totalPrefabs) * 100;
|
||||
|
||||
int numPrefabs = clearedPrefabs;
|
||||
|
||||
if (clearedPrefabs > totalPrefabs)
|
||||
{
|
||||
numPrefabs = totalPrefabs;
|
||||
}
|
||||
|
||||
string purgeLabel = numPrefabs + "/" + totalPrefabs;
|
||||
|
||||
RebirthUtilities.ChangePurgeBiome(biomeName, clearedPrefabs);
|
||||
|
||||
int currentClearedPrefabs = RebirthUtilities.GetPurgeBiome(biomeName);
|
||||
|
||||
float percentage = ((float)currentClearedPrefabs / totalPrefabs) * 100;
|
||||
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.CheckPurgeProgress(player, false));
|
||||
|
||||
if (RebirthVariables.testPurge)
|
||||
{
|
||||
Log.Out("NetPackageCheckPurgeProgress-ProcessPackage clearedPrefabs: " + clearedPrefabs);
|
||||
Log.Out("NetPackageCheckPurgeProgress-ProcessPackage totalPrefabs: " + totalPrefabs);
|
||||
Log.Out("NetPackageCheckPurgeProgress-ProcessPackage currentClearedPrefabs: " + currentClearedPrefabs);
|
||||
Log.Out("NetPackageCheckPurgeProgress-ProcessPackage percentage: " + percentage);
|
||||
Log.Out("NetPackageCheckPurgeProgress-ProcessPackage purgeDisplayPercentage: " + purgeDisplayPercentage);
|
||||
}
|
||||
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetPurgeProgress>().Setup(purgeDisplayPercentage, purgeLabel), false, this.entityPlayerID);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
private int entityPlayerID;
|
||||
}
|
||||
92
Scripts/Network/NetPackageCheckPurgeSupplyDrops.cs
Normal file
92
Scripts/Network/NetPackageCheckPurgeSupplyDrops.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageCheckPurgeSupplyDrops : NetPackage
|
||||
{
|
||||
public NetPackageCheckPurgeSupplyDrops Setup(int _entityPlayerID)
|
||||
{
|
||||
this.entityPlayerID = _entityPlayerID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.entityPlayerID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityPlayerID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageCheckPurgeSupplyDrops-ProcessPackage START");
|
||||
EntityPlayer player = _world.GetEntity(this.entityPlayerID) as EntityPlayer;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
float numSupplyDrops = player.Buffs.GetCustomVar("$numSupplyDrops");
|
||||
|
||||
if (numSupplyDrops > 0)
|
||||
{
|
||||
// Reset skipSupplyDrops before calling SpawnAirDrop()
|
||||
RebirthVariables.skipSupplyDrops = false;
|
||||
|
||||
// Spawn the air drop
|
||||
bool canSpawn = GameManager.Instance.World.aiDirector.GetComponent<AIDirectorAirDropComponent>().SpawnAirDrop();
|
||||
|
||||
// Restore skipSupplyDrops to true after the air drop logic
|
||||
RebirthVariables.skipSupplyDrops = true;
|
||||
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive canSpawn: " + canSpawn);
|
||||
|
||||
if (canSpawn)
|
||||
{
|
||||
RebirthVariables.playerAirDrops.Add(new Vector3(player.position.x, player.position.y, player.position.z));
|
||||
|
||||
numSupplyDrops--;
|
||||
|
||||
if (numSupplyDrops < 0)
|
||||
{
|
||||
numSupplyDrops = 0;
|
||||
}
|
||||
|
||||
float numTotalSupplyDrops = player.Buffs.GetCustomVar("$numTotalSupplyDrops");
|
||||
if (numTotalSupplyDrops == 0f)
|
||||
{
|
||||
//RebirthUtilities.addToPlayerBag(ItemClass.GetItem("FuriousRamsayInfo_Purge3SuppliesUpdate"), player, 1, "");
|
||||
if (RebirthUtilities.EnnemiesAround(player) > 0)
|
||||
{
|
||||
RebirthUtilities.addToPlayerBag(ItemClass.GetItem("FuriousRamsayInfo_Purge3SuppliesUpdate"), player, 1, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
GameEventManager.Current.HandleAction("info_purge_suppliesupdate", player, player, false, sequenceLink: "");
|
||||
}
|
||||
player.Buffs.SetCustomVar("FuriousRamsayInfo_Purge3SuppliesUpdate", 1f);
|
||||
}
|
||||
numTotalSupplyDrops++;
|
||||
player.Buffs.SetCustomVar("$numTotalSupplyDrops", numTotalSupplyDrops);
|
||||
|
||||
player.Buffs.SetCustomVar("$numSupplyDrops", numSupplyDrops);
|
||||
|
||||
// Play the sound and show the tooltip
|
||||
string message = "[936fbf]PURGE[-] OBJECTIVE REACHED. ADDITIONAL [bfbc7a]SUPPLIES[-] ARE ON THE WAY";
|
||||
string soundName = "purge_airdrop";
|
||||
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage((NetPackage)NetPackageManager.GetPackage<NetPackageShowToolbetlMessage>().Setup(message, player.entityId, soundName), false, player.entityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
private int entityPlayerID;
|
||||
}
|
||||
119
Scripts/Network/NetPackageCheckSleeperVolumes.cs
Normal file
119
Scripts/Network/NetPackageCheckSleeperVolumes.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageCheckSleeperVolumes : NetPackage
|
||||
{
|
||||
public NetPackageCheckSleeperVolumes Setup(int _entityPlayerID, int _maxSleeperVolumeCount)
|
||||
{
|
||||
this.entityPlayerID = _entityPlayerID;
|
||||
this.maxSleeperVolumeCount = _maxSleeperVolumeCount;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.entityPlayerID = _reader.ReadInt32();
|
||||
this.maxSleeperVolumeCount = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityPlayerID);
|
||||
_writer.Write(this.maxSleeperVolumeCount);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageCheckSleeperVolumes-ProcessPackage START");
|
||||
EntityPlayer player = _world.GetEntity(this.entityPlayerID) as EntityPlayer;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
//Log.Out("NetPackageCheckSleeperVolumes-ProcessPackage PLAYER EXISTS");
|
||||
int totalKills = RebirthManager.GetTotalKills(player.entityId);
|
||||
player.Buffs.SetCustomVar("$totalPurgeKills", totalKills);
|
||||
//Log.Out("NetPackageCheckSleeperVolumes-ProcessPackage totalKills: " + totalKills);
|
||||
//Log.Out("NetPackageCheckSleeperVolumes-ProcessPackage $purgeKills: " + player.Buffs.GetCustomVar("$purgeKills"));
|
||||
int numKills = RebirthManager.AutoRedeemKills(player.entityId);
|
||||
|
||||
//Log.Out("NetPackageCheckSleeperVolumes-ProcessPackage numKills: " + numKills);
|
||||
|
||||
if (numKills > 0)
|
||||
{
|
||||
player.Buffs.SetCustomVar("$purgeKills", player.Buffs.GetCustomVar("$purgeKills") + numKills);
|
||||
|
||||
int numInterations = 0;
|
||||
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RebirthVariables.purgeAirDropNumKills: " + RebirthVariables.purgeAirDropNumKills);
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive RebirthVariables.purgeAirDropNumKillsIncrement: " + RebirthVariables.purgeAirDropNumKillsIncrement);
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive A $purgeKillsIncrement: " + __instance.Buffs.GetCustomVar("$purgeKillsIncrement"));
|
||||
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive compared to: " + RebirthVariables.purgeAirDropNumKills + RebirthVariables.purgeAirDropNumKillsIncrement * (int)__instance.Buffs.GetCustomVar("$purgeKillsIncrement"));
|
||||
|
||||
int purgeAirDropNumKills = RebirthVariables.purgeAirDropNumKills - (int)player.Buffs.GetCustomVar("$ModPurge") * 10;
|
||||
|
||||
// Enter the while loop as long as the condition holds true
|
||||
while (player.Buffs.GetCustomVar("$purgeKills") >= (purgeAirDropNumKills + RebirthVariables.purgeAirDropNumKillsIncrement * (int)player.Buffs.GetCustomVar("$purgeKillsIncrement")))
|
||||
{
|
||||
// Recalculate target kills for each iteration
|
||||
int numTargetKills = purgeAirDropNumKills + RebirthVariables.purgeAirDropNumKillsIncrement * (int)player.Buffs.GetCustomVar("$purgeKillsIncrement");
|
||||
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numTargetKills: " + numTargetKills);
|
||||
|
||||
numInterations++;
|
||||
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numInterations: " + numInterations);
|
||||
|
||||
float purgeKillsIncrement = player.Buffs.GetCustomVar("$purgeKillsIncrement");
|
||||
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive purgeKillsIncrement: " + purgeKillsIncrement);
|
||||
|
||||
// Reduce $purgeKills by the number of target kills
|
||||
player.Buffs.SetCustomVar("$purgeKills", player.Buffs.GetCustomVar("$purgeKills") - numTargetKills);
|
||||
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B $purgeKills: " + player.Buffs.GetCustomVar("$purgeKills"));
|
||||
|
||||
// Check if the incremented kills are below the max and increase accordingly
|
||||
if ((RebirthVariables.purgeAirDropNumKillsIncrement * purgeKillsIncrement) < RebirthVariables.purgeAirDropNumKillsMax)
|
||||
{
|
||||
player.Buffs.SetCustomVar("$purgeKillsIncrement", purgeKillsIncrement + 1);
|
||||
}
|
||||
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive B $purgeKillsIncrement: " + player.Buffs.GetCustomVar("$purgeKillsIncrement"));
|
||||
}
|
||||
|
||||
if (numInterations > 0)
|
||||
{
|
||||
//Log.Out("EntityPlayerLocalPatches-OnUpdateLive numInterations: " + numInterations);
|
||||
player.Buffs.SetCustomVar("$numSupplyDrops", numInterations);
|
||||
}
|
||||
}
|
||||
|
||||
PrefabInstance poiatPosition = RebirthUtilities.GetPrefabAtPosition(player.position); // player.world.GetPOIAtPosition(player.position, false);
|
||||
if (poiatPosition != null)
|
||||
{
|
||||
//Log.Out("NetPackageCheckSleeperVolumes-ProcessPackage POI EXISTS, prefabName: " + poiatPosition.prefab.PrefabName);
|
||||
//Log.Out("NetPackageCheckSleeperVolumes-ProcessPackage POI EXISTS, RebirthVariables.checkSleeperVolumes: " + RebirthVariables.checkSleeperVolumes);
|
||||
if (!RebirthVariables.checkSleeperVolumes)
|
||||
{
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.checkSleeperVolumes(poiatPosition, player, this.maxSleeperVolumeCount, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageCheckSleeperVolumes-ProcessPackage POI DOES NOT EXIST, TURN DISPLAY OFF");
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageSetScenarioDisplay>().Setup(1, false), false, this.entityPlayerID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
private int entityPlayerID;
|
||||
private int maxSleeperVolumeCount;
|
||||
}
|
||||
48
Scripts/Network/NetPackageClearBagSlot.cs
Normal file
48
Scripts/Network/NetPackageClearBagSlot.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
public class NetPackageClearBagSlot : NetPackage
|
||||
{
|
||||
private int playerID;
|
||||
private int slot;
|
||||
|
||||
public NetPackageClearBagSlot Setup(int playerID, int slot)
|
||||
{
|
||||
this.playerID = playerID;
|
||||
this.slot = slot;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.playerID = _br.ReadInt32();
|
||||
this.slot = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerID);
|
||||
_bw.Write(this.slot);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
Log.Out("NetPackageClearBagSlot-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
Log.Out("NetPackageClearBagSlot-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameManager.Instance.World.GetEntity(this.playerID) is EntityPlayer player)
|
||||
{
|
||||
Log.Out("NetPackageClearBagSlot-ProcessPackage 2");
|
||||
player.bag.SetSlot(this.slot, ItemStack.Empty.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
56
Scripts/Network/NetPackageCloseTileEntityRebirth.cs
Normal file
56
Scripts/Network/NetPackageCloseTileEntityRebirth.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
public class NetPackageCloseTileEntityRebirth : NetPackage
|
||||
{
|
||||
public NetPackageCloseTileEntityRebirth Setup(int _posX, int _posY, int _posZ)
|
||||
{
|
||||
//Log.Out("NetPackageCloseVehicleRepairRebirth-Setup");
|
||||
this.posX = _posX;
|
||||
this.posY = _posY;
|
||||
this.posZ = _posZ;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
//Log.Out("NetPackageCloseVehicleRepairRebirth-read");
|
||||
this.posX = _br.ReadInt32();
|
||||
this.posY = _br.ReadInt32();
|
||||
this.posZ = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
//Log.Out("NetPackageCloseVehicleRepairRebirth-write");
|
||||
base.write(_bw);
|
||||
_bw.Write(this.posX);
|
||||
_bw.Write(this.posY);
|
||||
_bw.Write(this.posZ);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageCloseVehicleRepairRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3i location = new Vector3i();
|
||||
location.x = this.posX;
|
||||
location.y = this.posY;
|
||||
location.z = this.posZ;
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
RebirthUtilities.removeTileEntityAccess(location);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
private int posX = -1;
|
||||
private int posY = -1;
|
||||
private int posZ = -1;
|
||||
}
|
||||
63
Scripts/Network/NetPackageDespawnBackpackRebirth.cs
Normal file
63
Scripts/Network/NetPackageDespawnBackpackRebirth.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
public class NetPackageDespawnBackpackRebirth : NetPackage
|
||||
{
|
||||
private int entityToUpdate;
|
||||
|
||||
public NetPackageDespawnBackpackRebirth Setup(int _entityToUpdate)
|
||||
{
|
||||
this.entityToUpdate = _entityToUpdate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityToUpdate = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityToUpdate);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageDespawnBackpackRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageDespawnBackpackRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (!_world.IsRemote())
|
||||
{
|
||||
Log.Out("NetPackageDespawnBackpackRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}*/
|
||||
|
||||
Entity myEntity = _world.GetEntity(this.entityToUpdate);
|
||||
if (myEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageDespawnBackpackRebirth-ProcessPackage FOUND THE ENTITY");
|
||||
ItemStack[] items = myEntity.lootContainer.items;
|
||||
|
||||
for (int k = 0; k < items.Length; k++)
|
||||
{
|
||||
if (!items[k].IsEmpty())
|
||||
{
|
||||
//Log.Out("NetPackageDespawnBackpackRebirth-ProcessPackage remove item");
|
||||
myEntity.lootContainer.UpdateSlot(k, ItemStack.Empty.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageDespawnBackpackRebirth-ProcessPackage CAN'T FIND THE ENTITY");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
97
Scripts/Network/NetPackageDespawnEntityRebirth.cs
Normal file
97
Scripts/Network/NetPackageDespawnEntityRebirth.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
public class NetPackageDespawnEntityRebirth : NetPackage
|
||||
{
|
||||
private int entityToUpdate;
|
||||
|
||||
public NetPackageDespawnEntityRebirth Setup(int _entityToUpdate)
|
||||
{
|
||||
this.entityToUpdate = _entityToUpdate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityToUpdate = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityToUpdate);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (!_world.IsRemote())
|
||||
{
|
||||
Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}*/
|
||||
|
||||
EntityAlive myEntity = (EntityAlive)_world.GetEntity(this.entityToUpdate);
|
||||
|
||||
if (myEntity != null)
|
||||
{
|
||||
RebirthUtilities.DespawnEntity(myEntity);
|
||||
}
|
||||
/*if (myEntity != null)
|
||||
{
|
||||
EntityAlive entity = (EntityAlive)myEntity;
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
entity.bIsChunkObserver = false;
|
||||
entity.bWillRespawn = false;
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage REMOVED HIRE, hire: " + entity.entityId);
|
||||
int OwnerID = (int)entity.Buffs.GetCustomVar("$Leader");
|
||||
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage OwnerID: " + OwnerID);
|
||||
|
||||
EntityPlayer owner = null;
|
||||
|
||||
if (OwnerID > 0)
|
||||
{
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage A");
|
||||
EntityPlayer entityPlayer = (EntityPlayer)entity.world.GetEntity(OwnerID);
|
||||
if (entityPlayer != null)
|
||||
{
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage B");
|
||||
owner = entityPlayer;
|
||||
if (owner.Companions.IndexOf(entity) >= 0)
|
||||
{
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage C");
|
||||
owner.Companions.Remove(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.Buffs.GetCustomVar("$Leader") > 0)
|
||||
{
|
||||
entity.lootDropProb = 0;
|
||||
GameManager.Instance.DropContentOfLootContainerServer(BlockValue.Air, new Vector3i(entity.position), entity.entityId);
|
||||
//RebirthUtilities.DropBackpack(myEntity);
|
||||
}
|
||||
|
||||
RebirthManager.RemoveHire(entity.entityId);
|
||||
GameManager.Instance.World.RemoveEntity(entity.entityId, EnumRemoveEntityReason.Despawned);
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage FOUND THE ENTITY");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageDespawnEntityRebirth-ProcessPackage CAN'T FIND THE ENTITY");
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
43
Scripts/Network/NetPackageEntityLootContainerOpenRebirth.cs
Normal file
43
Scripts/Network/NetPackageEntityLootContainerOpenRebirth.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
public class NetPackageEntityLootContainerOpenRebirth : NetPackage
|
||||
{
|
||||
public NetPackageEntityLootContainerOpenRebirth Setup(int _entityId)
|
||||
{
|
||||
//Log.Out("NetPackageEntityLootContainerOpenRebirth-Setup START");
|
||||
this.entityId = _entityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.entityId = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityId);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageEntityLootContainerOpenRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageEntityLootContainerOpenRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
EntityAlive entityAlive = (EntityAlive)_world.GetEntity(this.entityId);
|
||||
if (entityAlive != null)
|
||||
{
|
||||
//Log.Out("NetPackageEntityLootContainerOpenRebirth-ProcessPackage 2");
|
||||
entityAlive.FireEvent(MinEventTypes.onSelfLootContainer, true);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
protected int entityId;
|
||||
}
|
||||
41
Scripts/Network/NetPackageEntityPrimeDetonatorRebirth.cs
Normal file
41
Scripts/Network/NetPackageEntityPrimeDetonatorRebirth.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
public class NetPackageEntityPrimeDetonatorRebirth : NetPackage
|
||||
{
|
||||
public NetPackageEntityPrimeDetonatorRebirth Setup(EntityZombieCopRebirth entity)
|
||||
{
|
||||
this.id = entity.entityId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.id = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.id);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
EntityZombieCopRebirth entityZombieCop = _world.GetEntity(this.id) as EntityZombieCopRebirth;
|
||||
if (entityZombieCop == null)
|
||||
{
|
||||
Log.Out("Discarding " + base.GetType().Name);
|
||||
return;
|
||||
}
|
||||
entityZombieCop.PrimeDetonator();
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
private int id;
|
||||
}
|
||||
74
Scripts/Network/NetPackageGetHeatMapValue.cs
Normal file
74
Scripts/Network/NetPackageGetHeatMapValue.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageGetHeatMapValue : NetPackage
|
||||
{
|
||||
public NetPackageGetHeatMapValue Setup(int _entityPlayerID)
|
||||
{
|
||||
this.entityPlayerID = _entityPlayerID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.entityPlayerID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityPlayerID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageGetHeatMapValue-ProcessPackage 1");
|
||||
/*if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
Log.Out("NetPackageGetHeatMapValue-ProcessPackage 2");
|
||||
return;
|
||||
}*/
|
||||
|
||||
EntityPlayer player = _world.GetEntity(this.entityPlayerID) as EntityPlayer;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
//Log.Out("NetPackageGetHeatMapValue-ProcessPackage 3");
|
||||
if (GameManager.Instance.World.aiDirector != null)
|
||||
{
|
||||
//Log.Out("NetPackageGetHeatMapValue-ProcessPackage 4");
|
||||
AIDirectorChunkEventComponent component = GameManager.Instance.World.aiDirector.GetComponent<AIDirectorChunkEventComponent>();
|
||||
|
||||
AIDirectorChunkData dataFromPosition = component.GetChunkDataFromPosition(new Vector3i(player.position.x, player.position.y, player.position.z), false);
|
||||
|
||||
float percentage = 0f;
|
||||
float cooldown = 0f;
|
||||
|
||||
if (dataFromPosition != null)
|
||||
{
|
||||
//Log.Out("NetPackageGetHeatMapValue-ProcessPackage 5");
|
||||
percentage = dataFromPosition.ActivityLevel;
|
||||
if (dataFromPosition.cooldownDelay > 0.0)
|
||||
{
|
||||
cooldown = dataFromPosition.cooldownDelay;
|
||||
}
|
||||
}
|
||||
|
||||
player.Buffs.SetCustomVar("$ModHeatMapDetectionValue", percentage);
|
||||
player.Buffs.SetCustomVar("$ModHeatMapDetectionCooldown", cooldown);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Out("NetPackageGetHeatMapValue-ProcessPackage 6");
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
private int entityPlayerID;
|
||||
}
|
||||
77
Scripts/Network/NetPackageGetLightLevelsRebirth.cs
Normal file
77
Scripts/Network/NetPackageGetLightLevelsRebirth.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
public class NetPackageGetLightLevelsRebirth : NetPackage
|
||||
{
|
||||
int clrIdx = 0;
|
||||
Vector3i blockPos;
|
||||
|
||||
public NetPackageGetLightLevelsRebirth Setup(int _clrIdx, Vector3i _blockPos)
|
||||
{
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-Setup START");
|
||||
this.clrIdx = _clrIdx;
|
||||
this.blockPos = _blockPos;
|
||||
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-Setup this.clrIdx: " + this.clrIdx);
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-Setup this.blockPos: " + this.blockPos);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.blockPos = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.clrIdx = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write((int)this.blockPos.x);
|
||||
_bw.Write((int)this.blockPos.y);
|
||||
_bw.Write((int)this.blockPos.z);
|
||||
_bw.Write(this.clrIdx);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
////Log.Out("NetPackageGetLightLevelsRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-ProcessPackage 1");
|
||||
BlockValue block = GameManager.Instance.World.GetBlock(this.clrIdx, this.blockPos);
|
||||
|
||||
ChunkCluster chunkCluster = _world.ChunkClusters[this.clrIdx];
|
||||
if (chunkCluster != null)
|
||||
{
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-ProcessPackage 2");
|
||||
byte light = chunkCluster.GetLight(blockPos, Chunk.LIGHT_TYPE.SUN);
|
||||
byte light2 = chunkCluster.GetLight(blockPos, Chunk.LIGHT_TYPE.BLOCK);
|
||||
|
||||
BlockPlantGrowingRebirth plant = (BlockPlantGrowingRebirth)block.Block;
|
||||
|
||||
if (plant != null)
|
||||
{
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-ProcessPackage 3");
|
||||
plant.sunLight = light;
|
||||
plant.blockLight = light2;
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-ProcessPackage CLIENT plant.sunLight: " + plant.sunLight);
|
||||
////Log.Out("NetPackageGetLightLevelsRebirth-ProcessPackage CLIENT plant.blockLight: " + plant.blockLight);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageGetLightLevelsRebirth-ProcessPackage 4");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
48
Scripts/Network/NetPackageGetPurgePrefabs.cs
Normal file
48
Scripts/Network/NetPackageGetPurgePrefabs.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageGetPurgePrefabs : NetPackage
|
||||
{
|
||||
public NetPackageGetPurgePrefabs Setup(int _entityPlayerID)
|
||||
{
|
||||
this.entityPlayerID = _entityPlayerID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.entityPlayerID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityPlayerID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageGetPurgePrefabs-ProcessPackage START");
|
||||
foreach (var prefab in RebirthManager.ClearedPrefabs)
|
||||
{
|
||||
Vector3 vector = new Vector3(prefab.Position.x + prefab.Size.x / 2f, prefab.Position.y, prefab.Position.z + prefab.Size.z / 2f);
|
||||
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageRegisterPrefabNavIcon>().Setup("purge_waypoint", vector.x, vector.x, vector.z, "", ""), false, this.entityPlayerID);
|
||||
}
|
||||
|
||||
foreach (var prefab in RebirthManager.DiscoveredPrefabs)
|
||||
{
|
||||
Vector3 vector = new Vector3(prefab.Position.x + prefab.Size.x / 2f, prefab.Position.y, prefab.Position.z + prefab.Size.z / 2f);
|
||||
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageRegisterPrefabNavIcon>().Setup("discovered_waypoint_" + prefab.Difficulty, vector.x, vector.x, vector.z, "", ""), false, this.entityPlayerID);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
private int entityPlayerID;
|
||||
}
|
||||
50
Scripts/Network/NetPackageGetServerVariablesRebirth.cs
Normal file
50
Scripts/Network/NetPackageGetServerVariablesRebirth.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
public class NetPackageGetServerVariablesRebirth : NetPackage
|
||||
{
|
||||
private int entityPlayerID;
|
||||
private int dayLightLength;
|
||||
|
||||
public NetPackageGetServerVariablesRebirth Setup(int _entityPlayerID, int _dayLightLength)
|
||||
{
|
||||
this.entityPlayerID = _entityPlayerID;
|
||||
this.dayLightLength = _dayLightLength;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityPlayerID = _br.ReadInt32();
|
||||
this.dayLightLength = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityPlayerID);
|
||||
_bw.Write((int)this.dayLightLength);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsClient)
|
||||
{
|
||||
//Log.Out("NetPackageGetServerVariablesRebirth-ProcessPackage SEND TO CLIENT");
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageGetServerVariablesRebirth>().Setup(this.entityPlayerID, GamePrefs.GetInt(EnumGamePrefs.DayLightLength)), false, entityPlayerID, -1, -1, null, 192);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageGetServerVariablesRebirth-ProcessPackage this.dayLightLength: " + this.dayLightLength);
|
||||
RebirthVariables.DayLightLength = this.dayLightLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
142
Scripts/Network/NetPackageOpenTileEntityRebirth.cs
Normal file
142
Scripts/Network/NetPackageOpenTileEntityRebirth.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
public class NetPackageOpenTileEntityRebirth : NetPackage
|
||||
{
|
||||
public NetPackageOpenTileEntityRebirth Setup(int _playerId, int _posX, int _posY, int _posZ, string _window, string _windowGroup, string _sound, bool _isAccessed = false, bool _setOpen = false)
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-Setup");
|
||||
this.playerId = _playerId;
|
||||
this.posX = _posX;
|
||||
this.posY = _posY;
|
||||
this.posZ = _posZ;
|
||||
this.window = _window;
|
||||
this.windowGroup = _windowGroup;
|
||||
this.sound = _sound;
|
||||
this.isAccessed = _isAccessed;
|
||||
this.setOpen = _setOpen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-read");
|
||||
this.playerId = _br.ReadInt32();
|
||||
this.posX = _br.ReadInt32();
|
||||
this.posY = _br.ReadInt32();
|
||||
this.posZ = _br.ReadInt32();
|
||||
this.window = _br.ReadString();
|
||||
this.windowGroup = _br.ReadString();
|
||||
this.sound = _br.ReadString();
|
||||
this.isAccessed = _br.ReadBoolean();
|
||||
this.setOpen = _br.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-write");
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerId);
|
||||
_bw.Write(this.posX);
|
||||
_bw.Write(this.posY);
|
||||
_bw.Write(this.posZ);
|
||||
_bw.Write(this.window);
|
||||
_bw.Write(this.windowGroup);
|
||||
_bw.Write(this.sound);
|
||||
_bw.Write(this.isAccessed);
|
||||
_bw.Write(this.setOpen);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3i location = new Vector3i();
|
||||
location.x = this.posX;
|
||||
location.y = this.posY;
|
||||
location.z = this.posZ;
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage IsServer");
|
||||
|
||||
if (!this.setOpen)
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage Check if Open");
|
||||
this.isAccessed = false;
|
||||
|
||||
foreach (TileEntityOwners tileEntityOwner in RebirthVariables.accessedTileEntities)
|
||||
{
|
||||
if (tileEntityOwner.location == location)
|
||||
{
|
||||
this.isAccessed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage Send to Client, this.isAccessed: " + this.isAccessed);
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage this.playerId: " + this.playerId);
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage location: " + location);
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageOpenTileEntityRebirth>().Setup(this.playerId, location.x, location.y, location.z, this.window, this.windowGroup, this.sound, this.isAccessed), false, this.playerId, -1, -1, null, 192);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage Add Restriction");
|
||||
TileEntityOwners tileEntityOwner = new TileEntityOwners();
|
||||
tileEntityOwner.location = location;
|
||||
tileEntityOwner.owner = this.playerId;
|
||||
|
||||
RebirthVariables.accessedTileEntities.Add(tileEntityOwner);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage IsClient");
|
||||
EntityPlayerLocal _player = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (_player != null)
|
||||
{
|
||||
LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer((EntityPlayerLocal)_player);
|
||||
GUIWindowManager windowManager = uiforPlayer.windowManager;
|
||||
|
||||
if (!this.isAccessed)
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage Not Accessed");
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage this.playerId: " + this.playerId);
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage location: " + location);
|
||||
|
||||
Chunk chunk = (Chunk)_world.GetChunkFromWorldPos(location.x, location.z);
|
||||
|
||||
TileEntity tileEntity = _world.GetTileEntity(chunk.ClrIdx, location) as TileEntity;
|
||||
|
||||
bool isOpen = RebirthUtilities.OpenTileWindow(_player, tileEntity, windowGroup, window, sound);
|
||||
|
||||
if (isOpen)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendToServer(NetPackageManager.GetPackage<NetPackageOpenTileEntityRebirth>().Setup(uiforPlayer.entityPlayer.entityId, location.x, location.y, location.z, window, windowGroup, sound, true, true), false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageOpenVehicleRepairRebirth-ProcessPackage Is Accessed");
|
||||
GameManager.ShowTooltip(uiforPlayer.entityPlayer, Localization.Get("ttNoInteractItem"), string.Empty, "ui_denied", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
private int playerId = -1;
|
||||
private int posX = 0;
|
||||
private int posY = 0;
|
||||
private int posZ = 0;
|
||||
private string window;
|
||||
private string windowGroup;
|
||||
private string sound;
|
||||
private bool isAccessed = false;
|
||||
private bool setOpen = false;
|
||||
}
|
||||
50
Scripts/Network/NetPackagePickUpNPCRebirth.cs
Normal file
50
Scripts/Network/NetPackagePickUpNPCRebirth.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class NetPackagePickUpNPCRebirth : global::NetPackage
|
||||
{
|
||||
private int _entityId;
|
||||
private int _playerId;
|
||||
|
||||
public NetPackagePickUpNPCRebirth Setup(int entityId, int playerId)
|
||||
{
|
||||
_entityId = entityId;
|
||||
_playerId = playerId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader br)
|
||||
{
|
||||
_entityId = br.ReadInt32();
|
||||
_playerId = br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter bw)
|
||||
{
|
||||
base.write(bw);
|
||||
bw.Write(_entityId);
|
||||
bw.Write(_playerId);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World world, GameManager callbacks)
|
||||
{
|
||||
if (world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!world.IsRemote())
|
||||
{
|
||||
EntityUtilities.CollectEntityServer(_entityId, _playerId);
|
||||
return;
|
||||
}
|
||||
|
||||
EntityUtilities.CollectEntityClient(_entityId, _playerId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
62
Scripts/Network/NetPackageProcessDamageXP.cs
Normal file
62
Scripts/Network/NetPackageProcessDamageXP.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageProcessDamageXP : NetPackage
|
||||
{
|
||||
public NetPackageProcessDamageXP Setup(string _heldItem, int _biomeID, bool _isHeadShot, int _playerEntityID, int _targetEntityID, int _eventType)
|
||||
{
|
||||
this.heldItem = _heldItem;
|
||||
this.biomeID = _biomeID;
|
||||
this.isHeadShot = _isHeadShot;
|
||||
this.playerEntityID = _playerEntityID;
|
||||
this.targetEntityID = _targetEntityID;
|
||||
this.eventType = _eventType;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.heldItem = _reader.ReadString();
|
||||
this.biomeID = _reader.ReadInt32();
|
||||
this.isHeadShot = _reader.ReadBoolean();
|
||||
this.playerEntityID = _reader.ReadInt32();
|
||||
this.targetEntityID = _reader.ReadInt32();
|
||||
this.eventType = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(heldItem);
|
||||
_writer.Write(this.biomeID);
|
||||
_writer.Write(this.isHeadShot);
|
||||
_writer.Write(this.playerEntityID);
|
||||
_writer.Write(this.targetEntityID);
|
||||
_writer.Write(this.eventType);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageProcessDamageXP-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageProcessDamageXP-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
RebirthUtilities.ProcessDamageXP(heldItem, biomeID, isHeadShot, playerEntityID, targetEntityID, eventType);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
private string heldItem;
|
||||
private int biomeID;
|
||||
private bool isHeadShot;
|
||||
private int playerEntityID;
|
||||
private int targetEntityID;
|
||||
private int eventType;
|
||||
}
|
||||
132
Scripts/Network/NetPackageQuestNamedPOIGotoRebirth.cs
Normal file
132
Scripts/Network/NetPackageQuestNamedPOIGotoRebirth.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class NetPackageQuestNamedPOIGotoRebirth : NetPackage
|
||||
{
|
||||
public NetPackageQuestNamedPOIGotoRebirth Setup(string _POIName, int _playerId, FastTags<TagGroup.Global> _questTags, int _questCode, NetPackageQuestNamedPOIGotoRebirth.QuestGotoTypes _gotoType, byte _difficulty, int posX = 0, int posZ = -1, float sizeX = 0f, float sizeY = 0f, float sizeZ = 0f, float offset = -1f, BiomeFilterTypes _biomeFilterType = BiomeFilterTypes.AnyBiome, string _biomeFilter = "")
|
||||
{
|
||||
////Log.Out("NetPackageQuestNamedPOIGotoRebirth-Setup");
|
||||
this.playerId = _playerId;
|
||||
this.questCode = _questCode;
|
||||
this.GotoType = _gotoType;
|
||||
this.questTags = _questTags;
|
||||
this.position = new Vector2((float)posX, (float)posZ);
|
||||
this.size = new Vector3(sizeX, sizeY, sizeZ);
|
||||
this.difficulty = _difficulty;
|
||||
this.biomeFilterType = _biomeFilterType;
|
||||
this.biomeFilter = _biomeFilter;
|
||||
this.POIName = _POIName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
////Log.Out("NetPackageQuestNamedPOIGotoRebirth-read");
|
||||
this.playerId = _br.ReadInt32();
|
||||
this.questCode = _br.ReadInt32();
|
||||
this.GotoType = (NetPackageQuestNamedPOIGotoRebirth.QuestGotoTypes)_br.ReadByte();
|
||||
this.questTags = FastTags<TagGroup.Global>.Parse(_br.ReadString());
|
||||
this.position = new Vector2((float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.size = StreamUtils.ReadVector3(_br);
|
||||
this.difficulty = _br.ReadByte();
|
||||
this.biomeFilterType = (BiomeFilterTypes)_br.ReadByte();
|
||||
this.biomeFilter = _br.ReadString();
|
||||
this.POIName = _br.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
////Log.Out("NetPackageQuestNamedPOIGotoRebirth-write");
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerId);
|
||||
_bw.Write(this.questCode);
|
||||
_bw.Write((byte)this.GotoType);
|
||||
_bw.Write(this.questTags.ToString());
|
||||
_bw.Write((int)this.position.x);
|
||||
_bw.Write((int)this.position.y);
|
||||
StreamUtils.Write(_bw, this.size);
|
||||
_bw.Write(this.difficulty);
|
||||
_bw.Write((byte)this.biomeFilterType);
|
||||
_bw.Write(this.biomeFilter);
|
||||
_bw.Write(this.POIName);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 2");
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage i: " + i);
|
||||
|
||||
EntityPlayer entityPlayer = GameManager.Instance.World.GetEntity(this.playerId) as EntityPlayer;
|
||||
|
||||
//Log.Out("ObjectiveGotoNamedPOIRebirth-GetPosition 3 prefab:" + this.POIName);
|
||||
List<PrefabInstance> prefabInstances = GameManager.Instance.World.ChunkClusters[0].ChunkProvider.GetDynamicPrefabDecorator().GetDynamicPrefabs().FindAll(instance => instance.name.Contains(this.POIName));
|
||||
|
||||
if (prefabInstances.Count == 0)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 4");
|
||||
return;
|
||||
}
|
||||
|
||||
PrefabInstance prefabInstance = RebirthUtilities.FindClosesPrefabs(entityPlayer.position, prefabInstances, null, biomeFilterType, biomeFilter);
|
||||
|
||||
if (prefabInstance != null)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 5");
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageQuestNamedPOIGotoRebirth>().Setup(this.POIName, this.playerId, this.questTags, this.questCode, this.GotoType, this.difficulty, prefabInstance.boundingBoxPosition.x, prefabInstance.boundingBoxPosition.z, (float)prefabInstance.boundingBoxSize.x, (float)prefabInstance.boundingBoxSize.y, (float)prefabInstance.boundingBoxSize.z, -1f, BiomeFilterTypes.AnyBiome, ""), false, this.playerId, -1, -1, null, 192);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 6");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 7");
|
||||
EntityPlayer primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
Quest quest = primaryPlayer.QuestJournal.FindActiveQuest(this.questCode);
|
||||
if (quest != null)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 8");
|
||||
for (int j = 0; j < quest.Objectives.Count; j++)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 9");
|
||||
if (quest.Objectives[j] is ObjectiveGotoNamedPOIRebirth)
|
||||
{
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage 10");
|
||||
((ObjectiveGotoNamedPOIRebirth)quest.Objectives[j]).FinalizePoint(new Vector3(this.position.x, primaryPlayer.position.y, this.position.y), this.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Log.Out("NetPackageQuestNamedPOIGotoRebirth-ProcessPackage END");
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 32 + (this.biomeFilter.Length * 2) + (this.POIName.Length * 2);
|
||||
}
|
||||
|
||||
private string POIName = "";
|
||||
private int playerId;
|
||||
private int questCode;
|
||||
private FastTags<TagGroup.Global> questTags;
|
||||
private Vector2 position;
|
||||
private Vector3 size;
|
||||
private byte difficulty;
|
||||
public NetPackageQuestNamedPOIGotoRebirth.QuestGotoTypes GotoType;
|
||||
private BiomeFilterTypes biomeFilterType;
|
||||
private string biomeFilter;
|
||||
public enum QuestGotoTypes
|
||||
{
|
||||
Trader,
|
||||
Closest,
|
||||
RandomPOI
|
||||
}
|
||||
}
|
||||
169
Scripts/Network/NetPackageQuestPointGotoSDX.cs
Normal file
169
Scripts/Network/NetPackageQuestPointGotoSDX.cs
Normal file
@@ -0,0 +1,169 @@
|
||||
public class NetPackageQuestPointGotoSDX : NetPackage
|
||||
{
|
||||
public NetPackageQuestPointGotoSDX Setup(int _playerId, FastTags<TagGroup.Global> _questTags, int _questCode, NetPackageQuestPointGotoSDX.QuestGotoTypes _gotoType, byte _difficulty, int posX = 0, int posZ = -1, float sizeX = 0f, float sizeY = 0f, float sizeZ = 0f, float offset = -1f, BiomeFilterTypes _biomeFilterType = BiomeFilterTypes.AnyBiome, string _biomeFilter = "")
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointGotoSDX-Setup");
|
||||
this.playerId = _playerId;
|
||||
this.questCode = _questCode;
|
||||
this.GotoType = _gotoType;
|
||||
this.questTags = _questTags;
|
||||
this.position = new Vector2((float)posX, (float)posZ);
|
||||
this.size = new Vector3(sizeX, sizeY, sizeZ);
|
||||
this.difficulty = _difficulty;
|
||||
this.biomeFilterType = _biomeFilterType;
|
||||
this.biomeFilter = _biomeFilter;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointGotoSDX-read");
|
||||
this.playerId = _br.ReadInt32();
|
||||
this.questCode = _br.ReadInt32();
|
||||
this.GotoType = (NetPackageQuestPointGotoSDX.QuestGotoTypes)_br.ReadByte();
|
||||
this.questTags = FastTags<TagGroup.Global>.Parse(_br.ReadString());
|
||||
this.position = new Vector2((float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.size = StreamUtils.ReadVector3(_br);
|
||||
this.difficulty = _br.ReadByte();
|
||||
this.biomeFilterType = (BiomeFilterTypes)_br.ReadByte();
|
||||
this.biomeFilter = _br.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointGotoSDX-write");
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerId);
|
||||
_bw.Write(this.questCode);
|
||||
_bw.Write((byte)this.GotoType);
|
||||
_bw.Write(this.questTags.ToString());
|
||||
_bw.Write((int)this.position.x);
|
||||
_bw.Write((int)this.position.y);
|
||||
StreamUtils.Write(_bw, this.size);
|
||||
_bw.Write(this.difficulty);
|
||||
_bw.Write((byte)this.biomeFilterType);
|
||||
_bw.Write(this.biomeFilter);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointGotoSDX-ProcessPackage");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointGotoSDX-ProcessPackage-Server");
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
EntityPlayer entityPlayer = GameManager.Instance.World.GetEntity(this.playerId) as EntityPlayer;
|
||||
PrefabInstance prefabInstance = null;
|
||||
prefabInstance = GameManager.Instance.World.ChunkClusters[0].ChunkProvider.GetDynamicPrefabDecorator().GetRandomPOINearWorldPos(new Vector2(entityPlayer.position.x, entityPlayer.position.z), 100, 4000000, this.questTags, this.difficulty, null, -1, BiomeFilterTypes.AnyBiome, "");
|
||||
|
||||
new Vector2((float)prefabInstance.boundingBoxPosition.x + (float)prefabInstance.boundingBoxSize.x / 2f, (float)prefabInstance.boundingBoxPosition.z + (float)prefabInstance.boundingBoxSize.z / 2f);
|
||||
|
||||
float numPlayerX = entityPlayer.position.x;
|
||||
float numPlayerZ = entityPlayer.position.z;
|
||||
|
||||
if (prefabInstance != null)
|
||||
{
|
||||
Vector2 vector3a = new Vector2((float)prefabInstance.boundingBoxPosition.x + (float)prefabInstance.boundingBoxSize.x / 2f, (float)prefabInstance.boundingBoxPosition.z + (float)prefabInstance.boundingBoxSize.z / 2f);
|
||||
|
||||
float numPreFabX = (float)vector3a.x;
|
||||
float numPreFabZ = (float)vector3a.y;
|
||||
|
||||
float numDiffXa = Math.Abs(numPreFabX - numPlayerX);
|
||||
float numDiffZa = Math.Abs(numPreFabZ - numPlayerZ);
|
||||
float numDiffa = Math.Abs(numDiffXa + numDiffZa);
|
||||
|
||||
//Log.Out("ObjectiveRandomGotoPOISDX-GetPosition-Prefab Name:" + prefabInstance.name);
|
||||
|
||||
//Log.Out("ObjectiveRandomGotoPOISDX-GetPosition-Original Prefab diffXa:" + numDiffXa + ", diffZa: " + numDiffZa);
|
||||
//Log.Out("ObjectiveRandomGotoPOISDX-GetPosition-Original Prefab diff:" + numDiffa);
|
||||
|
||||
int minDistance = 400;
|
||||
int maxDistance = 900;
|
||||
|
||||
//Log.Out("ObjectiveRandomGotoPOISDX-GetPosition-minDistance: " + minDistance + ", maxDistance: " + maxDistance);
|
||||
|
||||
for (int j = 0; j < 15; j++)
|
||||
{
|
||||
PrefabInstance prefabInstance2;
|
||||
prefabInstance2 = GameManager.Instance.World.ChunkClusters[0].ChunkProvider.GetDynamicPrefabDecorator().GetRandomPOINearWorldPos(new Vector2(entityPlayer.position.x, entityPlayer.position.z), 100, 4000000, this.questTags, this.difficulty, null, -1, BiomeFilterTypes.AnyBiome, "");
|
||||
|
||||
Vector2 vector3b = new Vector2((float)prefabInstance2.boundingBoxPosition.x + (float)prefabInstance2.boundingBoxSize.x / 2f, (float)prefabInstance2.boundingBoxPosition.z + (float)prefabInstance2.boundingBoxSize.z / 2f);
|
||||
|
||||
numPreFabX = (float)vector3b.x;
|
||||
numPreFabZ = (float)vector3b.y;
|
||||
|
||||
float numDiffXb = Math.Abs(numPreFabX - numPlayerX);
|
||||
float numDiffZb = Math.Abs(numPreFabZ - numPlayerZ);
|
||||
float numDiffb = Math.Abs(numDiffXb + numDiffZb);
|
||||
|
||||
if (numDiffb < numDiffa)
|
||||
{
|
||||
if ((numDiffb > minDistance) && (numDiffb < maxDistance))
|
||||
{
|
||||
prefabInstance = prefabInstance2;
|
||||
numDiffa = numDiffb;
|
||||
//Log.Out("ObjectiveRandomGotoPOISDX-GetPosition-Prefab Name:" + prefabInstance.name);
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("ObjectiveRandomGotoPOISDX-GetPosition-New Prefab diffXb:" + numDiffXb + ", diffZb: " + numDiffZb);
|
||||
//Log.Out("ObjectiveRandomGotoPOISDX-GetPosition-New Prefab diff:" + numDiffb);
|
||||
}
|
||||
}
|
||||
|
||||
if (prefabInstance != null)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageQuestPointGotoSDX>().Setup(this.playerId, this.questTags, this.questCode, this.GotoType, this.difficulty, prefabInstance.boundingBoxPosition.x, prefabInstance.boundingBoxPosition.z, (float)prefabInstance.boundingBoxSize.x, (float)prefabInstance.boundingBoxSize.y, (float)prefabInstance.boundingBoxSize.z, -1f, BiomeFilterTypes.AnyBiome, ""), false, this.playerId, -1, -1, null, 192);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
EntityPlayer primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
Quest quest = primaryPlayer.QuestJournal.FindActiveQuest(this.questCode);
|
||||
if (quest != null)
|
||||
{
|
||||
for (int j = 0; j < quest.Objectives.Count; j++)
|
||||
{
|
||||
if (quest.Objectives[j] is ObjectiveGoto && this.GotoType == NetPackageQuestPointGotoSDX.QuestGotoTypes.Trader)
|
||||
{
|
||||
((ObjectiveGoto)quest.Objectives[j]).FinalizePoint(new Vector3(this.position.x, primaryPlayer.position.y, this.position.y), this.size);
|
||||
}
|
||||
else if (quest.Objectives[j] is ObjectiveClosestPOIGoto && this.GotoType == NetPackageQuestPointGotoSDX.QuestGotoTypes.Closest)
|
||||
{
|
||||
((ObjectiveClosestPOIGoto)quest.Objectives[j]).FinalizePoint(new Vector3(this.position.x, primaryPlayer.position.y, this.position.y), this.size);
|
||||
}
|
||||
else if (quest.Objectives[j] is ObjectiveRandomGotoPOISDX && this.GotoType == NetPackageQuestPointGotoSDX.QuestGotoTypes.RandomPOI)
|
||||
{
|
||||
((ObjectiveRandomGotoPOISDX)quest.Objectives[j]).FinalizePoint(new Vector3(this.position.x, primaryPlayer.position.y, this.position.y), this.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 32 + (this.biomeFilter.Length * 2);
|
||||
}
|
||||
|
||||
private int playerId;
|
||||
private int questCode;
|
||||
private FastTags<TagGroup.Global> questTags;
|
||||
private Vector2 position;
|
||||
private Vector3 size;
|
||||
private byte difficulty;
|
||||
public NetPackageQuestPointGotoSDX.QuestGotoTypes GotoType;
|
||||
private BiomeFilterTypes biomeFilterType;
|
||||
private string biomeFilter;
|
||||
public enum QuestGotoTypes
|
||||
{
|
||||
Trader,
|
||||
Closest,
|
||||
RandomPOI
|
||||
}
|
||||
}
|
||||
208
Scripts/Network/NetPackageQuestPointTreasureSDX.cs
Normal file
208
Scripts/Network/NetPackageQuestPointTreasureSDX.cs
Normal file
@@ -0,0 +1,208 @@
|
||||
public class NetPackageQuestPointTreasureSDX : NetPackage
|
||||
{
|
||||
public NetPackageQuestPointTreasureSDX Setup(int _playerId, float _distance, int _offset, int _questCode, int posX = 0, int posY = -1, int posZ = 0, bool _useNearby = false)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-Setup A");
|
||||
this.playerId = _playerId;
|
||||
this.distance = _distance;
|
||||
this.offset = _offset;
|
||||
this.questCode = _questCode;
|
||||
this.position = new Vector3i(posX, posY, posZ);
|
||||
this.useNearby = _useNearby;
|
||||
this.treasureOffset = Vector3.zero;
|
||||
this.ActionType = QuestPointActions.GetGotoPoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NetPackageQuestPointTreasureSDX Setup(int _playerId, int _questCode, int _blocksPerReduction, Vector3i _position, Vector3 _treasureOffset)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-Setup B");
|
||||
this.playerId = _playerId;
|
||||
this.distance = 0f;
|
||||
this.offset = 0;
|
||||
this.questCode = _questCode;
|
||||
this.position = _position;
|
||||
this.treasureOffset = _treasureOffset;
|
||||
this.blocksPerReduction = _blocksPerReduction;
|
||||
this.ActionType = QuestPointActions.GetTreasurePoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NetPackageQuestPointTreasureSDX Setup(int _questCode, float _distance, int _offset, float _treasureRadius, Vector3 _startPosition, int _playerId, bool _useNearby, int _blocksPerReduction)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-Setup C");
|
||||
this.playerId = _playerId;
|
||||
this.distance = _distance;
|
||||
this.offset = _offset;
|
||||
this.questCode = _questCode;
|
||||
this.treasureRadius = _treasureRadius;
|
||||
this.position = new Vector3i(_startPosition);
|
||||
this.useNearby = _useNearby;
|
||||
this.treasureOffset = Vector3.zero;
|
||||
this.blocksPerReduction = _blocksPerReduction;
|
||||
this.ActionType = QuestPointActions.GetTreasurePoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NetPackageQuestPointTreasureSDX Setup(int _questCode, Vector3i _updatedPosition)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-Setup D");
|
||||
this.questCode = _questCode;
|
||||
this.position = _updatedPosition;
|
||||
this.ActionType = QuestPointActions.UpdateTreasurePoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NetPackageQuestPointTreasureSDX Setup(int _questCode, int _blocksPerReduction)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-Setup E");
|
||||
this.questCode = _questCode;
|
||||
this.blocksPerReduction = _blocksPerReduction;
|
||||
this.ActionType = QuestPointActions.UpdateBlocksPerReduction;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.ActionType = (QuestPointActions)_br.ReadByte();
|
||||
if (this.ActionType == QuestPointActions.UpdateTreasurePoint)
|
||||
{
|
||||
this.questCode = _br.ReadInt32();
|
||||
this.position = StreamUtils.ReadVector3i(_br);
|
||||
return;
|
||||
}
|
||||
this.playerId = _br.ReadInt32();
|
||||
this.distance = _br.ReadSingle();
|
||||
this.offset = _br.ReadInt32();
|
||||
this.treasureRadius = _br.ReadSingle();
|
||||
this.blocksPerReduction = _br.ReadInt32();
|
||||
this.questCode = _br.ReadInt32();
|
||||
this.position = StreamUtils.ReadVector3i(_br);
|
||||
this.treasureOffset = StreamUtils.ReadVector3(_br);
|
||||
this.useNearby = _br.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
_bw.Write((byte)this.PackageId);
|
||||
_bw.Write((byte)this.ActionType);
|
||||
if (this.ActionType == QuestPointActions.UpdateTreasurePoint)
|
||||
{
|
||||
_bw.Write(this.questCode);
|
||||
StreamUtils.Write(_bw, this.position);
|
||||
return;
|
||||
}
|
||||
_bw.Write(this.playerId);
|
||||
_bw.Write(this.distance);
|
||||
_bw.Write(this.offset);
|
||||
_bw.Write(this.treasureRadius);
|
||||
_bw.Write(this.blocksPerReduction);
|
||||
_bw.Write(this.questCode);
|
||||
StreamUtils.Write(_bw, this.position);
|
||||
StreamUtils.Write(_bw, this.treasureOffset);
|
||||
_bw.Write(this.useNearby);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
if (_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage 2");
|
||||
Quest quest = GameManager.Instance.World.GetPrimaryPlayer().QuestJournal.FindActiveQuest(this.questCode);
|
||||
if (quest != null)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage 3");
|
||||
for (int i = 0; i < quest.Objectives.Count; i++)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage i: " + i);
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage ID: " + quest.Objectives[i].ID);
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage Value: " + quest.Objectives[i].Value);
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage Value: " + quest.Objectives[i].ObjectiveValueType);
|
||||
|
||||
if (quest.CurrentPhase == quest.Objectives[i].Phase)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage 4");
|
||||
if (quest.Objectives[i] is ObjectiveTreasureChest)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage 5");
|
||||
if (this.ActionType == QuestPointActions.GetTreasurePoint)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage 6");
|
||||
((ObjectiveTreasureChest)quest.Objectives[i]).FinalizePointFromServer(this.blocksPerReduction, this.position, this.treasureOffset);
|
||||
}
|
||||
else if (this.ActionType == QuestPointActions.UpdateBlocksPerReduction)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage 7");
|
||||
((ObjectiveTreasureChest)quest.Objectives[i]).CurrentBlocksPerReduction = this.blocksPerReduction;
|
||||
}
|
||||
}
|
||||
else if (quest.Objectives[i] is ObjectiveGotoRandomSDX)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage 8");
|
||||
((ObjectiveGotoRandomSDX)quest.Objectives[i]).FinalizePoint(this.position.x, this.position.y, this.position.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.ActionType == QuestPointActions.UpdateTreasurePoint)
|
||||
{
|
||||
QuestEventManager.Current.SetTreasureContainerPosition(this.questCode, this.position);
|
||||
return;
|
||||
}
|
||||
if (this.ActionType == QuestPointActions.UpdateBlocksPerReduction)
|
||||
{
|
||||
QuestEventManager.Current.UpdateTreasureBlocksPerReduction(this.questCode, this.blocksPerReduction);
|
||||
return;
|
||||
}
|
||||
for (int j = 0; j < 15; j++)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage j: " + j);
|
||||
Vector3i vector3i = ObjectiveGotoRandomSDX.CalculateRandomPoint(this.playerId, this.distance, "");
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage vector3i: " + vector3i);
|
||||
Vector3i vector3iCompare = new Vector3i(0, -99999, 0);
|
||||
//if (QuestEventManager.Current.GetTreasureContainerPosition(this.questCode, this.distance, this.offset, this.treasureRadius, this.position.ToVector3(), this.playerId, this.useNearby, this.blocksPerReduction, out this.blocksPerReduction, out vector3i, out this.treasureOffset))
|
||||
if (vector3i != vector3iCompare)
|
||||
{
|
||||
//Log.Out("NetPackageQuestPointTreasureSDX-ProcessPackage SEND TO CLIENT: " + this.playerId);
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageQuestPointTreasureSDX>().Setup(this.playerId, this.questCode, this.blocksPerReduction, vector3i, this.treasureOffset), false, this.playerId, -1, -1, null, 192);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
////Log.Out("NetPackageQuestPointTreasureSDX-GetLength-Start");
|
||||
if (this.ActionType == QuestPointActions.UpdateTreasurePoint)
|
||||
{
|
||||
return 65;
|
||||
}
|
||||
else return 49;
|
||||
}
|
||||
|
||||
private int playerId;
|
||||
private float distance;
|
||||
private int offset;
|
||||
private float treasureRadius;
|
||||
private int questCode;
|
||||
private Vector3i position;
|
||||
private bool useNearby;
|
||||
private Vector3 treasureOffset = Vector3.zero;
|
||||
private int blocksPerReduction;
|
||||
private QuestPointActions ActionType;
|
||||
private enum QuestPointActions
|
||||
{
|
||||
GetGotoPoint,
|
||||
GetTreasurePoint,
|
||||
UpdateTreasurePoint,
|
||||
UpdateBlocksPerReduction
|
||||
}
|
||||
}
|
||||
68
Scripts/Network/NetPackageQuickStack.cs
Normal file
68
Scripts/Network/NetPackageQuickStack.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using static EntityDrone;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class NetPackageQuickStack : NetPackage
|
||||
{
|
||||
private int playerID;
|
||||
private bool mine;
|
||||
public List<Vector3i> tileList;
|
||||
|
||||
|
||||
public NetPackageQuickStack Setup(int playerID,
|
||||
bool mine
|
||||
)
|
||||
{
|
||||
this.playerID = playerID;
|
||||
this.mine = mine;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.playerID = _br.ReadInt32();
|
||||
this.mine = _br.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerID);
|
||||
_bw.Write(this.mine);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageQuickStack-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageQuickStack-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameManager.Instance.World.GetEntity(this.playerID) is EntityPlayer player)
|
||||
{
|
||||
//Log.Out("NetPackageQuickStack-ProcessPackage 1");
|
||||
List<TileEntity> tileEntities = RebirthUtilities.GetTileEntities(player, RebirthVariables.quickStackDistance, true);
|
||||
|
||||
tileList = new List<Vector3i>();
|
||||
|
||||
foreach (var tileEntity in tileEntities)
|
||||
{
|
||||
if (GameManager.Instance.lockedTileEntities.ContainsKey((ITileEntity)tileEntity))
|
||||
{
|
||||
//Log.Out("RebirthUtilities-QuickStackOnClick IS LOCKED: " + tileEntity.ToWorldPos());
|
||||
tileList.Add(tileEntity.ToWorldPos());
|
||||
}
|
||||
}
|
||||
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage((NetPackage)NetPackageManager.GetPackage<NetPackageQuickstackLockedTiles>().Setup(this.playerID, this.mine, this.tileList), _attachedToEntityId: this.playerID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
72
Scripts/Network/NetPackageQuickstackLockedTiles.cs
Normal file
72
Scripts/Network/NetPackageQuickstackLockedTiles.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using static EntityDrone;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
public class NetPackageQuickstackLockedTiles : NetPackage
|
||||
{
|
||||
private int playerID;
|
||||
private bool mine;
|
||||
public List<Vector3i> tileList;
|
||||
|
||||
|
||||
public NetPackageQuickstackLockedTiles Setup(int playerID,
|
||||
bool mine,
|
||||
List<Vector3i> tileList
|
||||
)
|
||||
{
|
||||
this.playerID = playerID;
|
||||
this.mine = mine;
|
||||
this.tileList = tileList;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.playerID = _br.ReadInt32();
|
||||
this.mine = _br.ReadBoolean();
|
||||
this.tileList = new List<Vector3i>();
|
||||
int num = _br.ReadInt32();
|
||||
for (int index = 0; index < num; ++index)
|
||||
this.tileList.Add(StreamUtils.ReadVector3i((BinaryReader)_br));
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.playerID);
|
||||
_bw.Write(this.mine);
|
||||
if (this.tileList == null)
|
||||
{
|
||||
_bw.Write(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_bw.Write(this.tileList.Count);
|
||||
for (int index = 0; index < this.tileList.Count; ++index)
|
||||
StreamUtils.Write((BinaryWriter)_bw, this.tileList[index]);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageQuickstackLockedTiles-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageQuickstackLockedTiles-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameManager.Instance.World.GetEntity(this.playerID) is EntityPlayer player)
|
||||
{
|
||||
//Log.Out("NetPackageQuickstackLockedTiles-ProcessPackage 2");
|
||||
RebirthUtilities.QuickStackOnClick(player, mine, tileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
73
Scripts/Network/NetPackageRebirthUtilitiesReborn.cs
Normal file
73
Scripts/Network/NetPackageRebirthUtilitiesReborn.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
public class NetPackageRebirthUtilitiesReborn : NetPackage
|
||||
{
|
||||
public NetPackageRebirthUtilitiesReborn Setup(int _entityID,
|
||||
int _classID,
|
||||
int numReborn,
|
||||
int _eventSpawn,
|
||||
float _numStartScale
|
||||
)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesReborn-Setup START");
|
||||
this.entityID = _entityID;
|
||||
this.classID = _classID;
|
||||
this.numReborn = numReborn;
|
||||
this.eventSpawn = _eventSpawn;
|
||||
this.numStartScale = _numStartScale;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesReborn-read START");
|
||||
this.entityID = _reader.ReadInt32();
|
||||
this.classID = _reader.ReadInt32();
|
||||
this.numReborn = _reader.ReadInt32();
|
||||
this.eventSpawn = _reader.ReadInt32();
|
||||
this.numStartScale = _reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesReborn-write START");
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityID);
|
||||
_writer.Write(this.classID);
|
||||
_writer.Write(this.numReborn);
|
||||
_writer.Write(this.eventSpawn);
|
||||
_writer.Write(this.numStartScale);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesReborn-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesReborn-ProcessPackage WORLD == null");
|
||||
return;
|
||||
}
|
||||
|
||||
Entity entity = GameManager.Instance.World.GetEntity(this.entityID);
|
||||
|
||||
if (entity is EntityAlive entityAlive)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesReborn-ProcessPackage numReborn: " + numReborn);
|
||||
|
||||
entityAlive.MarkToUnload();
|
||||
entityAlive.KillLootContainer();
|
||||
|
||||
RebirthUtilities.SpawnRebornZombie(entityAlive, classID, entityAlive.position, entityAlive.rotation, numReborn, eventSpawn, numStartScale);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
private int entityID;
|
||||
private int classID;
|
||||
private int numReborn;
|
||||
private int eventSpawn;
|
||||
private float numStartScale;
|
||||
}
|
||||
226
Scripts/Network/NetPackageRebirthUtilitiesSpawnEntity.cs
Normal file
226
Scripts/Network/NetPackageRebirthUtilitiesSpawnEntity.cs
Normal file
@@ -0,0 +1,226 @@
|
||||
public class NetPackageRebirthUtilitiesSpawnEntity : NetPackage
|
||||
{
|
||||
public NetPackageRebirthUtilitiesSpawnEntity Setup(int _entityID, int _spawnID, int _classID)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntity-Setup START");
|
||||
this.entityID = _entityID;
|
||||
this.spawnID = _spawnID;
|
||||
this.classID = _classID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntity-read START");
|
||||
this.entityID = _reader.ReadInt32();
|
||||
this.spawnID = _reader.ReadInt32();
|
||||
this.classID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntity-write START");
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityID);
|
||||
_writer.Write(this.spawnID);
|
||||
_writer.Write(this.classID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntity-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EntityAlive entity = _world.GetEntity(this.entityID) as EntityAlive;
|
||||
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntity-ProcessPackage 1");
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntity-ProcessPackage this.entityID: " + this.entityID);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
switch (this.classID)
|
||||
{
|
||||
case 5: // Technogeek
|
||||
{
|
||||
switch (this.spawnID)
|
||||
{
|
||||
// SLEDGE TURRETS
|
||||
case 2: // Test
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1);
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 45, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 90, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 135, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 180, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 225, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 270, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 315, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 35, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 325, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 35, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 325, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 180, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 35, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 325, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 145, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 215, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 70, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 290, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 145, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 215, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 60, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 120, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 180, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 240, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 300, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 52, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 103, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 154, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 206, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 257, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 309, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 45, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 90, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 135, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 180, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 225, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 270, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretSledgeGun", 1, "", "", "2", "dynamic", "1", "", 1, 315, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
// JUNK TURRETS
|
||||
case 12: // test
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 13:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 14:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 180, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 15:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 120, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 240, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunRegular", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 90, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 180, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 270, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 17:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 72, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 144, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 216, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 288, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 18:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 60, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 120, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 180, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 240, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 300, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 19:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 52, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 103, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 154, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 206, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 257, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 309, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
case 20:
|
||||
{
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 0, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 45, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 90, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShell", 1, "", "", "0", "dynamic", "1", "", 1, 135, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 180, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 225, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunAP", 1, "", "", "0", "dynamic", "1", "", 1, 270, false, true, false, entity.entityId, 1); ;
|
||||
RebirthUtilities.SpawnEntity(entity.entityId, "FuriousRamsayJunkTurretGunShock", 1, "", "", "0", "dynamic", "1", "", 1, 315, false, true, false, entity.entityId, 1); ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntity-ProcessPackage Entity does not exist");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
private int spawnID = -1; // 4
|
||||
private int entityID = -1; // 4
|
||||
private int classID = -1; // 4
|
||||
}
|
||||
217
Scripts/Network/NetPackageRebirthUtilitiesSpawnEntityAdvanced.cs
Normal file
217
Scripts/Network/NetPackageRebirthUtilitiesSpawnEntityAdvanced.cs
Normal file
@@ -0,0 +1,217 @@
|
||||
public class NetPackageRebirthUtilitiesSpawnEntityAdvanced : NetPackage
|
||||
{
|
||||
public NetPackageRebirthUtilitiesSpawnEntityAdvanced Setup(int entityID,
|
||||
string strEntity,
|
||||
int numEntities = 1,
|
||||
string entityPos = "",
|
||||
string entityRot = "",
|
||||
string strDistance = "",
|
||||
string strSpawner = "dynamic",
|
||||
string strHeight = "",
|
||||
string strDirection = "",
|
||||
float numStartScale = 1f,
|
||||
int numRotation = -1,
|
||||
bool randomRotation = false,
|
||||
bool atPlayerLevel = false,
|
||||
bool attackPlayer = true,
|
||||
int entityPlayerID = -1,
|
||||
int minion = -1,
|
||||
string strSound = "",
|
||||
int maxEntities = 20,
|
||||
int checkMaxEntities = 0,
|
||||
int minMax = 40,
|
||||
int repeat = 1,
|
||||
int allNames = 1,
|
||||
int isBoss = -1,
|
||||
int handParticle = -1,
|
||||
string lootListName = "",
|
||||
string lootDropClass = "",
|
||||
int lootDropChance = 1,
|
||||
string navIcon = "",
|
||||
string buffList = "",
|
||||
Boolean setRespawn = false
|
||||
)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntityAdvanced-Setup START");
|
||||
this.entityID = entityID;
|
||||
this.strEntity = strEntity;
|
||||
this.numEntities = numEntities;
|
||||
this.entityPos = entityPos;
|
||||
this.entityRot = entityRot;
|
||||
this.strDistance = strDistance;
|
||||
this.strSpawner = strSpawner;
|
||||
this.strHeight = strHeight;
|
||||
this.strDirection = strDirection;
|
||||
this.numStartScale = numStartScale;
|
||||
this.numRotation = numRotation;
|
||||
this.randomRotation = randomRotation;
|
||||
this.atPlayerLevel = atPlayerLevel;
|
||||
this.attackPlayer = attackPlayer;
|
||||
this.entityPlayerID = entityPlayerID;
|
||||
this.minion = minion;
|
||||
this.strSound = strSound;
|
||||
this.maxEntities = maxEntities;
|
||||
this.checkMaxEntities = checkMaxEntities;
|
||||
this.minMax = minMax;
|
||||
this.repeat = repeat;
|
||||
this.allNames = allNames;
|
||||
this.isBoss = isBoss;
|
||||
this.handParticle = handParticle;
|
||||
this.lootListName = lootListName;
|
||||
this.lootDropClass = lootDropClass;
|
||||
this.lootDropChance = lootDropChance;
|
||||
this.navIcon = navIcon;
|
||||
this.buffList = buffList;
|
||||
this.setRespawn = setRespawn;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntityAdvanced-read START");
|
||||
this.entityID = _reader.ReadInt32();
|
||||
this.strEntity = _reader.ReadString();
|
||||
this.numEntities = _reader.ReadInt32();
|
||||
this.entityPos = _reader.ReadString();
|
||||
this.entityRot = _reader.ReadString();
|
||||
this.strDistance = _reader.ReadString();
|
||||
this.strSpawner = _reader.ReadString();
|
||||
this.strHeight = _reader.ReadString();
|
||||
this.strDirection = _reader.ReadString();
|
||||
this.numStartScale = _reader.ReadSingle();
|
||||
this.numRotation = _reader.ReadInt32();
|
||||
this.randomRotation = _reader.ReadBoolean();
|
||||
this.atPlayerLevel = _reader.ReadBoolean();
|
||||
this.attackPlayer = _reader.ReadBoolean();
|
||||
this.entityPlayerID = _reader.ReadInt32();
|
||||
this.minion = _reader.ReadInt32();
|
||||
this.strSound = _reader.ReadString();
|
||||
this.maxEntities = _reader.ReadInt32();
|
||||
this.checkMaxEntities = _reader.ReadInt32();
|
||||
this.minMax = _reader.ReadInt32();
|
||||
this.repeat = _reader.ReadInt32();
|
||||
this.allNames = _reader.ReadInt32();
|
||||
this.isBoss = _reader.ReadInt32();
|
||||
this.handParticle = _reader.ReadInt32();
|
||||
this.lootListName = _reader.ReadString();
|
||||
this.lootDropClass = _reader.ReadString();
|
||||
this.lootDropChance = _reader.ReadInt32();
|
||||
this.navIcon = _reader.ReadString();
|
||||
this.buffList = _reader.ReadString();
|
||||
this.setRespawn = _reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntityAdvanced-write START");
|
||||
base.write(_writer);
|
||||
_writer.Write(this.entityID);
|
||||
_writer.Write(this.strEntity);
|
||||
_writer.Write(this.numEntities);
|
||||
_writer.Write(this.entityPos);
|
||||
_writer.Write(this.entityRot);
|
||||
_writer.Write(this.strDistance);
|
||||
_writer.Write(this.strSpawner);
|
||||
_writer.Write(this.strHeight);
|
||||
_writer.Write(this.strDirection);
|
||||
_writer.Write(this.numStartScale);
|
||||
_writer.Write(this.numRotation);
|
||||
_writer.Write(this.randomRotation);
|
||||
_writer.Write(this.atPlayerLevel);
|
||||
_writer.Write(this.attackPlayer);
|
||||
_writer.Write(this.entityPlayerID);
|
||||
_writer.Write(this.minion);
|
||||
_writer.Write(this.strSound);
|
||||
_writer.Write(this.maxEntities);
|
||||
_writer.Write(this.checkMaxEntities);
|
||||
_writer.Write(this.minMax);
|
||||
_writer.Write(this.repeat);
|
||||
_writer.Write(this.allNames);
|
||||
_writer.Write(this.isBoss);
|
||||
_writer.Write(this.handParticle);
|
||||
_writer.Write(this.lootListName);
|
||||
_writer.Write(this.lootDropClass);
|
||||
_writer.Write(this.lootDropChance);
|
||||
_writer.Write(this.navIcon);
|
||||
_writer.Write(this.buffList);
|
||||
_writer.Write(this.setRespawn);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageRebirthUtilitiesSpawnEntityAdvanced-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RebirthUtilities.SpawnEntity(this.entityID,
|
||||
strEntity,
|
||||
numEntities,
|
||||
entityPos,
|
||||
entityRot,
|
||||
strDistance,
|
||||
strSpawner,
|
||||
strHeight,
|
||||
strDirection,
|
||||
numStartScale,
|
||||
numRotation,
|
||||
randomRotation,
|
||||
atPlayerLevel,
|
||||
attackPlayer,
|
||||
entityPlayerID,
|
||||
minion,
|
||||
strSound,
|
||||
maxEntities,
|
||||
checkMaxEntities,
|
||||
minMax,
|
||||
repeat,
|
||||
allNames,
|
||||
isBoss,
|
||||
handParticle,
|
||||
lootListName,
|
||||
lootDropClass,
|
||||
lootDropChance,
|
||||
navIcon,
|
||||
buffList,
|
||||
setRespawn
|
||||
);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 30;
|
||||
}
|
||||
|
||||
private int entityID;
|
||||
private string strEntity;
|
||||
private int numEntities = 1;
|
||||
private string strDistance = "";
|
||||
private string entityPos = "";
|
||||
private string entityRot = "";
|
||||
private string strSpawner = "dynamic";
|
||||
private string strHeight = "";
|
||||
private string strDirection = "";
|
||||
private float numStartScale = 1f;
|
||||
private int numRotation = -1;
|
||||
private bool randomRotation = true;
|
||||
private bool atPlayerLevel = false;
|
||||
private bool attackPlayer = true;
|
||||
private int entityPlayerID = -1;
|
||||
private int minion = -1;
|
||||
private string strSound = "";
|
||||
private int maxEntities = 20;
|
||||
private int checkMaxEntities = 0;
|
||||
private int minMax = 40;
|
||||
private int repeat = 1;
|
||||
private int allNames = 1;
|
||||
private int isBoss = -1;
|
||||
private int handParticle = -1;
|
||||
private string lootListName = "";
|
||||
private string lootDropClass = "";
|
||||
private int lootDropChance = 1;
|
||||
private string navIcon = "";
|
||||
private string buffList = "";
|
||||
private Boolean setRespawn = false;
|
||||
}
|
||||
85
Scripts/Network/NetPackageRegisterPrefabNavIcon.cs
Normal file
85
Scripts/Network/NetPackageRegisterPrefabNavIcon.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using Audio;
|
||||
|
||||
public class NetPackageRegisterPrefabNavIcon : NetPackage
|
||||
{
|
||||
public NetPackageRegisterPrefabNavIcon Setup(string _navObjectClassName, float _posX, float _posY, float _posZ, string _report, string _sound)
|
||||
{
|
||||
//Log.Out("NetPackageRegisterPrefabNavIcon-Setup");
|
||||
this.navObjectClassName = _navObjectClassName;
|
||||
this.posX = _posX;
|
||||
this.posY = _posY;
|
||||
this.posZ = _posZ;
|
||||
this.report = _report;
|
||||
this.sound = _sound;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
//Log.Out("NetPackageRegisterPrefabNavIcon-read");
|
||||
this.navObjectClassName = _br.ReadString();
|
||||
this.posX = _br.ReadSingle();
|
||||
this.posY = _br.ReadSingle();
|
||||
this.posZ = _br.ReadSingle();
|
||||
this.report = _br.ReadString();
|
||||
this.sound = _br.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
//Log.Out("NetPackageRegisterPrefabNavIcon-write");
|
||||
base.write(_bw);
|
||||
_bw.Write(this.navObjectClassName);
|
||||
_bw.Write(this.posX);
|
||||
_bw.Write(this.posY);
|
||||
_bw.Write(this.posZ);
|
||||
_bw.Write(this.report);
|
||||
_bw.Write(this.sound);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageRegisterPrefabNavIcon-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 location = new Vector3();
|
||||
location.x = this.posX;
|
||||
location.y = this.posY;
|
||||
location.z = this.posZ;
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageRegisterPrefabNavIcon>().Setup(this.navObjectClassName, this.posX, this.posY, this.posZ, report, sound));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageRegisterPrefabNavIcon-ProcessPackage ADD NAV OBJECT at: " + location);
|
||||
NavObjectManager.Instance.RegisterNavObject(this.navObjectClassName, location, this.navObjectClassName);
|
||||
|
||||
if (report != "")
|
||||
{
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
Manager.PlayInsidePlayerHead(sound);
|
||||
GameManager.ShowTooltip(primaryPlayer, report, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
private string navObjectClassName = "";
|
||||
private float posX = 0;
|
||||
private float posY = 0;
|
||||
private float posZ = 0;
|
||||
private string report = "";
|
||||
private string sound = "";
|
||||
}
|
||||
34
Scripts/Network/NetPackageResetHNStats.cs
Normal file
34
Scripts/Network/NetPackageResetHNStats.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
public class NetPackageResetHNStats : NetPackage
|
||||
{
|
||||
public NetPackageResetHNStats Setup()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageResetHNStats-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageResetHNStats-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
RebirthVariables.localConstants["$varFuriousRamsayHNKills_Cst"] = 0;
|
||||
RebirthVariables.localConstants["$varFuriousRamsayHNHeadShots_Cst"] = 0;
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
88
Scripts/Network/NetPackageScenarioAddDiscoveredPrefab.cs
Normal file
88
Scripts/Network/NetPackageScenarioAddDiscoveredPrefab.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using Audio;
|
||||
|
||||
public class NetPackageScenarioAddDiscoveredPrefab : NetPackage
|
||||
{
|
||||
public NetPackageScenarioAddDiscoveredPrefab Setup(string _navObjectClassName, float _posX, float _posY, float _posZ, string _report, string _sound)
|
||||
{
|
||||
//Log.Out("NetPackageScenarioAddDiscoveredPrefab-Setup");
|
||||
this.navObjectClassName = _navObjectClassName;
|
||||
this.posX = _posX;
|
||||
this.posY = _posY;
|
||||
this.posZ = _posZ;
|
||||
this.report = _report;
|
||||
this.sound = _sound;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
//Log.Out("NetPackageScenarioAddDiscoveredPrefab-read");
|
||||
this.navObjectClassName = _br.ReadString();
|
||||
this.posX = _br.ReadSingle();
|
||||
this.posY = _br.ReadSingle();
|
||||
this.posZ = _br.ReadSingle();
|
||||
this.report = _br.ReadString();
|
||||
this.sound = _br.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
//Log.Out("NetPackageScenarioAddDiscoveredPrefab-write");
|
||||
base.write(_bw);
|
||||
_bw.Write(this.navObjectClassName);
|
||||
_bw.Write(this.posX);
|
||||
_bw.Write(this.posY);
|
||||
_bw.Write(this.posZ);
|
||||
_bw.Write(this.report);
|
||||
_bw.Write(this.sound);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageScenarioAddDiscoveredPrefab-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 location = new Vector3();
|
||||
location.x = this.posX;
|
||||
location.y = this.posY;
|
||||
location.z = this.posZ;
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer && !SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
|
||||
{
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageScenarioAddDiscoveredPrefab>().Setup(this.navObjectClassName, this.posX, this.posY, this.posZ, report, sound));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageScenarioAddDiscoveredPrefab-ProcessPackage ADD NAV OBJECT at: " + location);
|
||||
NavObjectManager.Instance.RegisterNavObject(this.navObjectClassName, location, this.navObjectClassName);
|
||||
|
||||
//Log.Out("NetPackageScenarioAddDiscoveredPrefab-ProcessPackage report: " + report);
|
||||
//Log.Out("NetPackageScenarioAddDiscoveredPrefab-ProcessPackage sound: " + sound);
|
||||
|
||||
if (report != "")
|
||||
{
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
Manager.PlayInsidePlayerHead(sound);
|
||||
GameManager.ShowTooltip(primaryPlayer, report, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
private string navObjectClassName = "";
|
||||
private float posX = 0;
|
||||
private float posY = 0;
|
||||
private float posZ = 0;
|
||||
private string report = "";
|
||||
private string sound = "";
|
||||
}
|
||||
80
Scripts/Network/NetPackageSetAuraChance.cs
Normal file
80
Scripts/Network/NetPackageSetAuraChance.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageSetAuraChance : NetPackage
|
||||
{
|
||||
public NetPackageSetAuraChance Setup(string _itemClassName, int _entitySourceID, int _classID, int _entityTargetID, int _npcEntityID, bool _fromOther, bool _isMelee)
|
||||
{
|
||||
this.itemClassName = _itemClassName;
|
||||
this.entitySourceID = _entitySourceID;
|
||||
this.classID = _classID;
|
||||
this.entityTargetID = _entityTargetID;
|
||||
this.npcEntityID = _npcEntityID;
|
||||
this.fromOther = _fromOther;
|
||||
this.isMelee = _isMelee;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.itemClassName = _reader.ReadString();
|
||||
this.entitySourceID = _reader.ReadInt32();
|
||||
this.classID = _reader.ReadInt32();
|
||||
this.entityTargetID = _reader.ReadInt32();
|
||||
this.npcEntityID = _reader.ReadInt32();
|
||||
this.fromOther = _reader.ReadBoolean();
|
||||
this.isMelee = _reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.itemClassName);
|
||||
_writer.Write(this.entitySourceID);
|
||||
_writer.Write(this.classID);
|
||||
_writer.Write(this.entityTargetID);
|
||||
_writer.Write(this.npcEntityID);
|
||||
_writer.Write(this.fromOther);
|
||||
_writer.Write(this.isMelee);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSetAuraChance-ProcessPackage 1 this.itemClassName: " + this.itemClassName);
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageSetAuraChance-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityNPCRebirth npc = _world.GetEntity(this.npcEntityID) as EntityNPCRebirth;
|
||||
|
||||
if (npc != null || this.itemClassName.ToLower().StartsWith("gunbot") || this.itemClassName.ToLower().StartsWith("furiousramsayjunkturret"))
|
||||
{
|
||||
//Log.Out("NetPackageSetAuraChance-ProcessPackage 3");
|
||||
RebirthUtilities.SetAuraChance(ItemClass.GetItem(this.itemClassName, false), this.itemClassName, this.entitySourceID, this.classID, this.entityTargetID, true, this.isMelee, this.npcEntityID, this.fromOther);
|
||||
if (npc != null)
|
||||
{
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.delayNPCShotgunTrigger(1.0f, npc));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageSetAuraChance-ProcessPackage 3");
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
private string itemClassName;
|
||||
private int entitySourceID;
|
||||
private int classID;
|
||||
private int entityTargetID;
|
||||
private int npcEntityID;
|
||||
private bool fromOther;
|
||||
private bool isMelee;
|
||||
}
|
||||
67
Scripts/Network/NetPackageSetGuardPositionRebirth.cs
Normal file
67
Scripts/Network/NetPackageSetGuardPositionRebirth.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
public class NetPackageSetGuardPositionRebirth : NetPackage
|
||||
{
|
||||
private int entityToUpdate;
|
||||
private int positionEntityID;
|
||||
|
||||
public NetPackageSetGuardPositionRebirth Setup(int _entityToUpdate, int _positionEntityID)
|
||||
{
|
||||
this.entityToUpdate = _entityToUpdate;
|
||||
this.positionEntityID = _positionEntityID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.entityToUpdate = _br.ReadInt32();
|
||||
this.positionEntityID = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityToUpdate);
|
||||
_bw.Write(this.positionEntityID);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSetGuardPositionRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageSetGuardPositionRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
/*if (!_world.IsRemote())
|
||||
{
|
||||
Log.Out("NetPackageSetGuardPositionRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}*/
|
||||
|
||||
EntityAliveV2 myEntity = (EntityAliveV2)_world.GetEntity(this.entityToUpdate);
|
||||
if (myEntity != null)
|
||||
{
|
||||
EntityAlive positionEntity = (EntityAlive)_world.GetEntity(this.positionEntityID);
|
||||
if (positionEntity != null)
|
||||
{
|
||||
if (entityToUpdate == positionEntityID)
|
||||
{
|
||||
myEntity.guardPosition = positionEntity.position;
|
||||
}
|
||||
else
|
||||
{
|
||||
myEntity.guardPosition = EntityUtilities.CenterPosition(positionEntity.position);
|
||||
}
|
||||
myEntity.guardPosition = EntityUtilities.CenterPosition(positionEntity.position);
|
||||
myEntity.bWillRespawn = true;
|
||||
myEntity.guardLookPosition = positionEntity.position + positionEntity.GetLookVector();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
53
Scripts/Network/NetPackageSetHordeNightActive.cs
Normal file
53
Scripts/Network/NetPackageSetHordeNightActive.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
public class NetPackageSetHordeNightActive : NetPackage
|
||||
{
|
||||
private bool isHordeNight;
|
||||
|
||||
public NetPackageSetHordeNightActive Setup(bool _isHordeNight)
|
||||
{
|
||||
//Log.Out("NetPackageSetHordeNightActive-Setup START");
|
||||
this.isHordeNight = _isHordeNight;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
//Log.Out("NetPackageSetHordeNightActive-read START");
|
||||
this.isHordeNight = _br.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
//Log.Out("NetPackageSetHordeNightActive-write START");
|
||||
base.write(_bw);
|
||||
_bw.Write(this.isHordeNight);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSetHordeNightActive-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageSetHordeNightActive-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageSetHordeNightActive-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
RebirthVariables.isHordeNight = this.isHordeNight;
|
||||
if (this.isHordeNight)
|
||||
{
|
||||
RebirthVariables.wasHordeNight = true;
|
||||
}
|
||||
//Log.Out("NetPackageSetHordeNightActive-ProcessPackage RebirthVariables.isHordeNight: " + RebirthVariables.isHordeNight);
|
||||
}
|
||||
}
|
||||
|
||||
57
Scripts/Network/NetPackageSetInstigatorRebirth.cs
Normal file
57
Scripts/Network/NetPackageSetInstigatorRebirth.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
public class NetPackageSetInstigatorRebirth : NetPackage
|
||||
{
|
||||
private int entityToUpdate;
|
||||
private int entityPlayerID;
|
||||
|
||||
public NetPackageSetInstigatorRebirth Setup(int _entityToUpdate, int _entityPlayerID)
|
||||
{
|
||||
//Log.Out("NetPackageSetInstigatorRebirth-Setup START");
|
||||
this.entityToUpdate = _entityToUpdate;
|
||||
this.entityPlayerID = _entityPlayerID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
//Log.Out("NetPackageSetInstigatorRebirth-read START");
|
||||
this.entityToUpdate = _br.ReadInt32();
|
||||
this.entityPlayerID = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
//Log.Out("NetPackageSetInstigatorRebirth-write START");
|
||||
base.write(_bw);
|
||||
_bw.Write(this.entityToUpdate);
|
||||
_bw.Write(this.entityPlayerID);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSetInstigatorRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageSetInstigatorRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageSetInstigatorRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityZombieSDX entity = GameManager.Instance.World.GetEntity((int)entityToUpdate) as EntityZombieSDX;
|
||||
if (entity)
|
||||
{
|
||||
//Log.Out("NetPackageSetInstigatorRebirth-ProcessPackage 4");
|
||||
entity.entityThatKilledMeID = entityPlayerID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
47
Scripts/Network/NetPackageSetNavObjectRebirth.cs
Normal file
47
Scripts/Network/NetPackageSetNavObjectRebirth.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageSetNavObjectRebirth : NetPackage
|
||||
{
|
||||
public NetPackageSetNavObjectRebirth Setup(int targetId, string iconName)
|
||||
{
|
||||
this.m_targetId = targetId;
|
||||
this.iconName = iconName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.m_targetId = _reader.ReadInt32();
|
||||
this.iconName = _reader.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.m_targetId);
|
||||
_writer.Write(this.iconName);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
return;
|
||||
}
|
||||
EntityAlive entityAlive = _world.GetEntity(this.m_targetId) as EntityAlive;
|
||||
if (entityAlive == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
entityAlive.AddNavObject(this.iconName, "", "");
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
private int m_targetId;
|
||||
private string iconName;
|
||||
}
|
||||
44
Scripts/Network/NetPackageSetPurgeProgress.cs
Normal file
44
Scripts/Network/NetPackageSetPurgeProgress.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
public class NetPackageSetPurgeProgress : NetPackage
|
||||
{
|
||||
private float purgeDisplayPercentage;
|
||||
private string purgeLabel;
|
||||
|
||||
public NetPackageSetPurgeProgress Setup(float _purgeDisplayPercentage, string _purgeLabel)
|
||||
{
|
||||
this.purgeDisplayPercentage = _purgeDisplayPercentage;
|
||||
this.purgeLabel = _purgeLabel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.purgeDisplayPercentage = _br.ReadSingle();
|
||||
this.purgeLabel = _br.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.purgeDisplayPercentage);
|
||||
_bw.Write(this.purgeLabel);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSetPurgeProgress-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageSetPurgeProgress-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
RebirthVariables.purgeDisplayPercentage = purgeDisplayPercentage;
|
||||
RebirthVariables.purgeLabel = purgeLabel;
|
||||
}
|
||||
}
|
||||
|
||||
58
Scripts/Network/NetPackageSetScaleRebirth.cs
Normal file
58
Scripts/Network/NetPackageSetScaleRebirth.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageSetScaleRebirth : NetPackage
|
||||
{
|
||||
public NetPackageSetScaleRebirth Setup(int targetId, float _sizeScale)
|
||||
{
|
||||
this.m_targetId = targetId;
|
||||
this.sizeScale = _sizeScale;
|
||||
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-Setup this.m_targetId: " + this.m_targetId);
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-Setup this.sizeScale: " + this.sizeScale);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.m_targetId = _reader.ReadInt32();
|
||||
this.sizeScale = _reader.ReadSingle();
|
||||
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-read this.sizeScale: " + this.sizeScale);
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.m_targetId);
|
||||
_writer.Write(this.sizeScale);
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-write this.sizeScale: " + this.sizeScale);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
EntityAlive entityAlive = _world.GetEntity(this.m_targetId) as EntityAlive;
|
||||
if (entityAlive == null)
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 3");
|
||||
return;
|
||||
}
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage this.sizeScale: " + this.sizeScale);
|
||||
entityAlive.OverrideSize = this.sizeScale;
|
||||
entityAlive.SetScale(this.sizeScale);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
private int m_targetId;
|
||||
private float sizeScale = 1f;
|
||||
}
|
||||
48
Scripts/Network/NetPackageSetScenarioDisplay.cs
Normal file
48
Scripts/Network/NetPackageSetScenarioDisplay.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
public class NetPackageSetScenarioDisplay : NetPackage
|
||||
{
|
||||
private int displayToUpdate;
|
||||
private bool value;
|
||||
|
||||
public NetPackageSetScenarioDisplay Setup(int _displayToUpdate, bool _value)
|
||||
{
|
||||
this.displayToUpdate = _displayToUpdate;
|
||||
this.value = _value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.displayToUpdate = _br.ReadInt32();
|
||||
this.value = _br.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.displayToUpdate);
|
||||
_bw.Write(this.value);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSetScenarioDisplay-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageSetScenarioDisplay-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (displayToUpdate == 1) // Purge
|
||||
{
|
||||
RebirthVariables.purgeDisplay = this.value;
|
||||
RebirthVariables.purgePrefabName = "";
|
||||
RebirthVariables.purgePrefabPosition = Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
55
Scripts/Network/NetPackageShowToolbetlMessage.cs
Normal file
55
Scripts/Network/NetPackageShowToolbetlMessage.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Audio;
|
||||
|
||||
public class NetPackageShowToolbetlMessage : NetPackage
|
||||
{
|
||||
private string message;
|
||||
private string soundName;
|
||||
private int playerID;
|
||||
|
||||
public NetPackageShowToolbetlMessage Setup(string message, int _playerID, string _soundName)
|
||||
{
|
||||
this.message = message;
|
||||
this.playerID = _playerID;
|
||||
this.soundName = _soundName;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.message = _reader.ReadString();
|
||||
this.playerID = _reader.ReadInt32();
|
||||
this.soundName = _reader.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.message);
|
||||
_writer.Write(this.playerID);
|
||||
_writer.Write(this.soundName);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageShowToolbetlMessage-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageShowToolbetlMessage-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayerLocal playerLocal = _world.GetEntity(this.playerID) as EntityPlayerLocal;
|
||||
|
||||
if (playerLocal != null)
|
||||
{
|
||||
Manager.PlayInsidePlayerHead(this.soundName);
|
||||
GameManager.ShowTooltip(playerLocal, this.message, string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
74
Scripts/Network/NetPackageSpawnVehicleFromItemRebirth.cs
Normal file
74
Scripts/Network/NetPackageSpawnVehicleFromItemRebirth.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
public class NetPackageSpawnVehicleFromItemRebirth : NetPackage
|
||||
{
|
||||
public NetPackageSpawnVehicleFromItemRebirth Setup(string _className,
|
||||
Vector3 _pos,
|
||||
Vector3 _rot,
|
||||
ItemValue _itemValue,
|
||||
int _entityThatPlaced,
|
||||
bool _isLocal)
|
||||
{
|
||||
//Log.Out("NetPackageSpawnVehicleFromItemRebirth-Setup START");
|
||||
this.className = _className;
|
||||
this.pos = _pos;
|
||||
this.rot = _rot;
|
||||
this.itemValue = _itemValue;
|
||||
this.entityThatPlaced = _entityThatPlaced;
|
||||
this.isLocal = _isLocal;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
//Log.Out("NetPackageSpawnVehicleFromItemRebirth-read START");
|
||||
this.className = _reader.ReadString();
|
||||
this.pos = StreamUtils.ReadVector3(_reader);
|
||||
this.rot = StreamUtils.ReadVector3(_reader);
|
||||
this.itemValue = new ItemValue();
|
||||
this.itemValue.Read(_reader);
|
||||
this.entityThatPlaced = _reader.ReadInt32();
|
||||
this.isLocal = _reader.ReadBoolean();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
//Log.Out("NetPackageSpawnVehicleFromItemRebirth-write START");
|
||||
base.write(_writer);
|
||||
_writer.Write(this.className);
|
||||
StreamUtils.Write(_writer, this.pos);
|
||||
StreamUtils.Write(_writer, this.rot);
|
||||
this.itemValue.Write(_writer);
|
||||
_writer.Write(this.entityThatPlaced);
|
||||
_writer.Write(this.isLocal);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSpawnVehicleFromItemRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ItemValue[] itemValues = { ItemValue.None };
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.SpawnVehicleFromItemCoroutine(
|
||||
this.className,
|
||||
this.pos,
|
||||
this.rot,
|
||||
this.itemValue.Clone(),
|
||||
this.entityThatPlaced,
|
||||
this.isLocal
|
||||
));
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 14;
|
||||
}
|
||||
|
||||
public string className;
|
||||
public Vector3 pos;
|
||||
public Vector3 rot;
|
||||
public ItemValue itemValue;
|
||||
public int entityThatPlaced;
|
||||
public bool isLocal;
|
||||
}
|
||||
90
Scripts/Network/NetPackageSpawnVehicleRebirth.cs
Normal file
90
Scripts/Network/NetPackageSpawnVehicleRebirth.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
public class NetPackageSpawnVehicleRebirth : NetPackage
|
||||
{
|
||||
public NetPackageSpawnVehicleRebirth Setup(string _className,
|
||||
ItemValue[] _itemValues,
|
||||
int _blockPosX,
|
||||
int _blockPosY,
|
||||
int _blockPosZ,
|
||||
float _durability,
|
||||
int _ownerID)
|
||||
{
|
||||
//Log.Out("NetPackageSpawnVehicleRebirth-Setup START");
|
||||
this.className = _className;
|
||||
this.itemValues = _itemValues;
|
||||
this.blockPosX = _blockPosX;
|
||||
this.blockPosY = _blockPosY;
|
||||
this.blockPosZ = _blockPosZ;
|
||||
this.durability = _durability;
|
||||
this.ownerID = _ownerID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
//Log.Out("NetPackageSpawnVehicleRebirth-read START");
|
||||
this.className = _reader.ReadString();
|
||||
this.itemValues = GameUtils.ReadItemValueArray((BinaryReader)_reader);
|
||||
this.blockPosX = _reader.ReadInt32();
|
||||
this.blockPosY = _reader.ReadInt32();
|
||||
this.blockPosZ = _reader.ReadInt32();
|
||||
this.durability = _reader.ReadSingle();
|
||||
this.ownerID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
//Log.Out("NetPackageSpawnVehicleRebirth-write START");
|
||||
base.write(_writer);
|
||||
_writer.Write(this.className);
|
||||
GameUtils.WriteItemValueArray((BinaryWriter)_writer, this.itemValues);
|
||||
_writer.Write(this.blockPosX);
|
||||
_writer.Write(this.blockPosY);
|
||||
_writer.Write(this.blockPosZ);
|
||||
_writer.Write(this.durability);
|
||||
_writer.Write(this.ownerID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSpawnVehicleRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3i vector3i = new Vector3i(this.blockPosX, this.blockPosY, this.blockPosZ);
|
||||
|
||||
Chunk chunk = (Chunk)GameManager.Instance.World.GetChunkFromWorldPos(vector3i);
|
||||
TileEntityDriveableLootContainer vehicleTE = _world.GetTileEntity(chunk.ClrIdx, vector3i) as TileEntityDriveableLootContainer;
|
||||
|
||||
if (vehicleTE != null)
|
||||
{
|
||||
GameManager.Instance.StartCoroutine(RebirthUtilities.SpawnVehicleCoroutine(
|
||||
vector3i,
|
||||
this.itemValues, //vehicleTE.itemValues,
|
||||
vehicleTE.vehicleHealth,
|
||||
vehicleTE.GasPerc,
|
||||
vehicleTE.OilPerc,
|
||||
vehicleTE.vehicleHealth,
|
||||
vehicleTE.vehicleHealth,
|
||||
RebirthUtilities.GetBlockAngle(vehicleTE.blockValue.rotation),
|
||||
this.className,
|
||||
this.ownerID
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 26;
|
||||
}
|
||||
|
||||
public string className;
|
||||
public ItemValue[] itemValues;
|
||||
public int blockPosX;
|
||||
public int blockPosY;
|
||||
public int blockPosZ;
|
||||
public float durability;
|
||||
public int ownerID;
|
||||
}
|
||||
66
Scripts/Network/NetPackageSynchZombieInfoRebirth.cs
Normal file
66
Scripts/Network/NetPackageSynchZombieInfoRebirth.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageSynchZombieInfoRebirth : NetPackage
|
||||
{
|
||||
public NetPackageSynchZombieInfoRebirth Setup(int targetId, string _otherTags, string _entityName, string _lootListOnDeath = "")
|
||||
{
|
||||
this.m_targetId = targetId;
|
||||
this.otherTags = _otherTags;
|
||||
this.entityName = _entityName;
|
||||
this.lootListOnDeath = _lootListOnDeath;
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-Setup this.m_targetId: " + this.m_targetId);
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-Setup this.otherTags: " + this.otherTags);
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.m_targetId = _reader.ReadInt32();
|
||||
this.otherTags = _reader.ReadString();
|
||||
this.entityName = _reader.ReadString();
|
||||
this.lootListOnDeath = _reader.ReadString();
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-read this.otherTags: " + this.otherTags);
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.m_targetId);
|
||||
_writer.Write(this.otherTags);
|
||||
_writer.Write(this.entityName);
|
||||
_writer.Write(this.lootListOnDeath);
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-write this.otherTags: " + this.otherTags);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
EntityZombieSDX entityAlive = _world.GetEntity(this.m_targetId) as EntityZombieSDX;
|
||||
if (entityAlive == null)
|
||||
{
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage 3");
|
||||
return;
|
||||
}
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage entityAlive.otherTags: " + entityAlive.otherTags);
|
||||
entityAlive.otherTags = this.otherTags;
|
||||
entityAlive.SetEntityName(entityName);
|
||||
entityAlive.lootListOnDeath = this.lootListOnDeath;
|
||||
//Log.Out("NetPackageSynchOtherTagsRebirth-ProcessPackage this.otherTags: " + this.otherTags);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
private int m_targetId;
|
||||
private string otherTags;
|
||||
private string entityName;
|
||||
private string lootListOnDeath;
|
||||
}
|
||||
48
Scripts/Network/NetPackageUnhideNPC.cs
Normal file
48
Scripts/Network/NetPackageUnhideNPC.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
public class NetPackageUnhideNPC : NetPackage
|
||||
{
|
||||
string parameter = "";
|
||||
Vector3 position;
|
||||
|
||||
public NetPackageUnhideNPC Setup(string _parameter, Vector3 _position)
|
||||
{
|
||||
//Log.Out("NetPackageUnhideNPC-Setup START");
|
||||
this.parameter = _parameter;
|
||||
this.position = _position;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.parameter = _br.ReadString();
|
||||
this.position = new Vector3((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.parameter);
|
||||
_bw.Write((int)this.position.x);
|
||||
_bw.Write((int)this.position.y);
|
||||
_bw.Write((int)this.position.z);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUnhideNPC-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUnhideNPC-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("NetPackageUnhideNPC-ProcessPackage 2");
|
||||
RebirthUtilities.UnhideNPC(this.parameter, this.position);
|
||||
}
|
||||
}
|
||||
|
||||
61
Scripts/Network/NetPackageUnregisterNavObject.cs
Normal file
61
Scripts/Network/NetPackageUnregisterNavObject.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
public class NetPackageUnregisterNavObject : NetPackage
|
||||
{
|
||||
private string navIconName;
|
||||
private float posX;
|
||||
private float posY;
|
||||
private float posZ;
|
||||
|
||||
public NetPackageUnregisterNavObject Setup(string navIconName, float _posX, float _posY, float _posZ)
|
||||
{
|
||||
this.navIconName = navIconName;
|
||||
this.posX = _posX;
|
||||
this.posY = _posY;
|
||||
this.posZ = _posZ;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.navIconName = _reader.ReadString();
|
||||
this.posX = _reader.ReadSingle();
|
||||
this.posY = _reader.ReadSingle();
|
||||
this.posZ = _reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.navIconName);
|
||||
_writer.Write(this.posX);
|
||||
_writer.Write(this.posY);
|
||||
_writer.Write(this.posZ);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUnregisterNavObject-ProcessPackage 1");
|
||||
if (_world == null || !_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageUnregisterNavObject-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
Vector3 location = new Vector3(this.posX, this.posY, this.posZ);
|
||||
|
||||
//Log.Out("NetPackageUnregisterNavObject-ProcessPackage location: " + location);
|
||||
//Log.Out("NetPackageUnregisterNavObject-ProcessPackage this.navIconName: " + this.navIconName);
|
||||
|
||||
NavObjectManager.Instance.UnRegisterNavObjectByPosition(location, this.navIconName);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
61
Scripts/Network/NetPackageUpdateChickenHomeRebirth.cs
Normal file
61
Scripts/Network/NetPackageUpdateChickenHomeRebirth.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
public class NetPackageUpdateChickenHomeRebirth : NetPackage
|
||||
{
|
||||
private Vector3i position;
|
||||
private int entityToUpdate;
|
||||
|
||||
public NetPackageUpdateChickenHomeRebirth Setup(Vector3i _position, int _entityToUpdate)
|
||||
{
|
||||
this.position = _position;
|
||||
this.entityToUpdate = _entityToUpdate;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.position = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.entityToUpdate = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write((int)this.position.x);
|
||||
_bw.Write((int)this.position.y);
|
||||
_bw.Write((int)this.position.z);
|
||||
_bw.Write(this.entityToUpdate);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateChickenHomeRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateChickenHomeRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageUpdateChickenHomeRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
Entity myEntity = _world.GetEntity(this.entityToUpdate);
|
||||
if (myEntity != null)
|
||||
{
|
||||
EntityAnimalChickenRebirth chicken = (EntityAnimalChickenRebirth)myEntity;
|
||||
chicken.homePos = this.position;
|
||||
//Log.Out("NetPackageUpdateChickenHomeRebirth-ProcessPackage FOUND THE ENTITY");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateChickenHomeRebirth-ProcessPackage CAN'T FIND THE ENTITY");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
64
Scripts/Network/NetPackageUpdateCoopRebirth.cs
Normal file
64
Scripts/Network/NetPackageUpdateCoopRebirth.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
public class NetPackageUpdateCoopRebirth : NetPackage
|
||||
{
|
||||
int clrIdx;
|
||||
Vector3i blockPos;
|
||||
int blockID;
|
||||
ulong accumulatedTicks;
|
||||
|
||||
public NetPackageUpdateCoopRebirth Setup(int _clrIdx, Vector3i _blockPos, int _blockID, ulong _accumulatedTicks)
|
||||
{
|
||||
this.clrIdx = _clrIdx;
|
||||
this.blockPos = _blockPos;
|
||||
this.blockID = _blockID;
|
||||
this.accumulatedTicks = _accumulatedTicks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.blockPos = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.clrIdx = _br.ReadInt32();
|
||||
this.accumulatedTicks = _br.ReadUInt64();
|
||||
this.blockID = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write((int)this.blockPos.x);
|
||||
_bw.Write((int)this.blockPos.y);
|
||||
_bw.Write((int)this.blockPos.z);
|
||||
_bw.Write(this.clrIdx);
|
||||
_bw.Write(this.accumulatedTicks);
|
||||
_bw.Write(this.blockID);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 28;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateCoopRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateCoopRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageUpdateCoopRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntityChickenCoopRebirth tileEntityCoop = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityChickenCoopRebirth;
|
||||
if (tileEntityCoop != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateCoopRebirth-ProcessPackage this.accumulatedTicks: " + this.accumulatedTicks);
|
||||
tileEntityCoop.AccumulatedTicks = this.accumulatedTicks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
78
Scripts/Network/NetPackageUpdateFarmPlotRebirth.cs
Normal file
78
Scripts/Network/NetPackageUpdateFarmPlotRebirth.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
public class NetPackageUpdateFarmPlotRebirth : NetPackage
|
||||
{
|
||||
int clrIdx = 0;
|
||||
int contentCount = 0;
|
||||
Vector3i blockPos;
|
||||
|
||||
public NetPackageUpdateFarmPlotRebirth Setup(int _clrIdx, Vector3i _blockPos, int _contentCount)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-Setup START");
|
||||
this.clrIdx = _clrIdx;
|
||||
this.contentCount = _contentCount;
|
||||
this.blockPos = _blockPos;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.blockPos = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.clrIdx = _br.ReadInt32();
|
||||
this.contentCount = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write((int)this.blockPos.x);
|
||||
_bw.Write((int)this.blockPos.y);
|
||||
_bw.Write((int)this.blockPos.z);
|
||||
_bw.Write(this.clrIdx);
|
||||
_bw.Write(this.contentCount);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-ProcessPackage 2");
|
||||
TileEntityFarmPlotRebirth tileEntity = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityFarmPlotRebirth;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-ProcessPackage SERVER tileEntity.waterCount: " + tileEntity.waterCount);
|
||||
tileEntity.waterCount = this.contentCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-ProcessPackage 3");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-ProcessPackage 4");
|
||||
TileEntityFarmPlotRebirth tileEntity = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityFarmPlotRebirth;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-ProcessPackage CLIENT tileEntity.waterCount: " + tileEntity.waterCount);
|
||||
tileEntity.waterCount = this.contentCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateFarmPlotRebirth-ProcessPackage 5");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
78
Scripts/Network/NetPackageUpdateManualLightRebirth.cs
Normal file
78
Scripts/Network/NetPackageUpdateManualLightRebirth.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
public class NetPackageUpdateManualLightRebirth : NetPackage
|
||||
{
|
||||
int clrIdx = 0;
|
||||
int contentCount = 0;
|
||||
Vector3i blockPos;
|
||||
|
||||
public NetPackageUpdateManualLightRebirth Setup(int _clrIdx, Vector3i _blockPos, int _contentCount)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-Setup START");
|
||||
this.clrIdx = _clrIdx;
|
||||
this.contentCount = _contentCount;
|
||||
this.blockPos = _blockPos;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.blockPos = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.clrIdx = _br.ReadInt32();
|
||||
this.contentCount = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write((int)this.blockPos.x);
|
||||
_bw.Write((int)this.blockPos.y);
|
||||
_bw.Write((int)this.blockPos.z);
|
||||
_bw.Write(this.clrIdx);
|
||||
_bw.Write(this.contentCount);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 2");
|
||||
TileEntityManualLightRebirth tileEntity = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityManualLightRebirth;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage SERVER tileEntity.waterCount: " + tileEntity.waterCount);
|
||||
tileEntity.powerCount = this.contentCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 3");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 4");
|
||||
TileEntityManualLightRebirth tileEntity = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityManualLightRebirth;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage CLIENT tileEntity.waterCount: " + tileEntity.waterCount);
|
||||
tileEntity.powerCount = this.contentCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateManualLightRebirth-ProcessPackage 5");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
63
Scripts/Network/NetPackageUpdatePlantedCropRebirth.cs
Normal file
63
Scripts/Network/NetPackageUpdatePlantedCropRebirth.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
public class NetPackageUpdatePlantedCropRebirth : NetPackage
|
||||
{
|
||||
int clrIdx;
|
||||
Vector3i blockPos;
|
||||
int blockID;
|
||||
ulong accumulatedTicks;
|
||||
|
||||
public NetPackageUpdatePlantedCropRebirth Setup(int _clrIdx, Vector3i _blockPos, int _blockID, ulong _accumulatedTicks)
|
||||
{
|
||||
this.clrIdx = _clrIdx;
|
||||
this.blockPos = _blockPos;
|
||||
this.blockID = _blockID;
|
||||
this.accumulatedTicks = _accumulatedTicks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.blockPos = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.clrIdx = _br.ReadInt32();
|
||||
this.accumulatedTicks = _br.ReadUInt64();
|
||||
this.blockID = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write((int)this.blockPos.x);
|
||||
_bw.Write((int)this.blockPos.y);
|
||||
_bw.Write((int)this.blockPos.z);
|
||||
_bw.Write(this.clrIdx);
|
||||
_bw.Write(this.accumulatedTicks);
|
||||
_bw.Write(this.blockID);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 28;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdatePlantedCropRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdatePlantedCropRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_world.IsRemote())
|
||||
{
|
||||
//Log.Out("NetPackageUpdatePlantedCropRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntityPlantGrowingRebirth tileEntityPlantGrowing = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityPlantGrowingRebirth;
|
||||
if (tileEntityPlantGrowing != null)
|
||||
{
|
||||
tileEntityPlantGrowing.AccumulatedTicks = this.accumulatedTicks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
126
Scripts/Network/NetPackageUpdatePurgeDisplay.cs
Normal file
126
Scripts/Network/NetPackageUpdatePurgeDisplay.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
public class NetPackageUpdatePurgeDisplay : NetPackage
|
||||
{
|
||||
private string prefabName;
|
||||
private float posX;
|
||||
private float posY;
|
||||
private float posZ;
|
||||
private int currentSleeperEntityCount;
|
||||
private int currentSleeperVolumeCount;
|
||||
private int maxSleeperVolumeCount;
|
||||
private float currentSleeperVolumePerc;
|
||||
private int clearedSleeperVolumeCount;
|
||||
private int totalSleeperVolumeCount;
|
||||
private int currentPOITier;
|
||||
|
||||
public NetPackageUpdatePurgeDisplay Setup(string _prefabName, float _posX, float _posY, float _posZ, int _currentSleeperEntityCount, int _currentSleeperVolumeCount, int _maxSleeperVolumeCount, float _currentSleeperVolumePerc, int _clearedSleeperVolumeCount, int _totalSleeperVolumeCount, int _currentPOITier)
|
||||
{
|
||||
this.prefabName = _prefabName;
|
||||
this.posX = _posX;
|
||||
this.posY = _posY;
|
||||
this.posZ = _posZ;
|
||||
this.currentSleeperEntityCount = _currentSleeperEntityCount;
|
||||
this.currentSleeperVolumeCount = _currentSleeperVolumeCount;
|
||||
this.maxSleeperVolumeCount = _maxSleeperVolumeCount;
|
||||
this.currentSleeperVolumePerc = _currentSleeperVolumePerc;
|
||||
this.clearedSleeperVolumeCount = _clearedSleeperVolumeCount;
|
||||
this.totalSleeperVolumeCount = _totalSleeperVolumeCount;
|
||||
this.currentPOITier = _currentPOITier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.prefabName = _br.ReadString();
|
||||
this.posX = _br.ReadSingle();
|
||||
this.posY = _br.ReadSingle();
|
||||
this.posZ = _br.ReadSingle();
|
||||
this.currentSleeperEntityCount = _br.ReadInt32();
|
||||
this.currentSleeperVolumeCount = _br.ReadInt32();
|
||||
this.maxSleeperVolumeCount = _br.ReadInt32();
|
||||
this.currentSleeperVolumePerc = _br.ReadSingle();
|
||||
this.clearedSleeperVolumeCount = _br.ReadInt32();
|
||||
this.totalSleeperVolumeCount = _br.ReadInt32();
|
||||
this.currentPOITier = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.prefabName);
|
||||
_bw.Write(this.posX);
|
||||
_bw.Write(this.posY);
|
||||
_bw.Write(this.posZ);
|
||||
_bw.Write(this.currentSleeperEntityCount);
|
||||
_bw.Write(this.currentSleeperVolumeCount);
|
||||
_bw.Write(this.maxSleeperVolumeCount);
|
||||
_bw.Write(this.currentSleeperVolumePerc);
|
||||
_bw.Write(this.clearedSleeperVolumeCount);
|
||||
_bw.Write(this.totalSleeperVolumeCount);
|
||||
_bw.Write(this.currentPOITier);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 14;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.purgePrefabName: " + RebirthVariables.purgePrefabName);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.purgePrefabPosition: " + RebirthVariables.purgePrefabPosition);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.prefabName: " + this.prefabName);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage new Vector3(this.posX, this.posY, this.posZ): " + new Vector3(this.posX, this.posY, this.posZ));
|
||||
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.currentSleeperEntityCount: " + this.currentSleeperEntityCount);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.currentSleeperVolumeCount: " + this.currentSleeperVolumeCount);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.maxSleeperVolumeCount: " + this.maxSleeperVolumeCount);
|
||||
|
||||
EntityPlayerLocal primaryPlayer = GameManager.Instance.World.GetPrimaryPlayer();
|
||||
|
||||
if (primaryPlayer != null)
|
||||
{
|
||||
if (RebirthVariables.purgePrefabName == this.prefabName &&
|
||||
RebirthVariables.purgePrefabPosition == new Vector3(this.posX, this.posY, this.posZ))
|
||||
{
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage 2");
|
||||
RebirthVariables.currentSleeperEntityCount = this.currentSleeperEntityCount;
|
||||
RebirthVariables.currentSleeperVolumeCount = this.currentSleeperVolumeCount;
|
||||
RebirthVariables.maxSleeperVolumeCount = this.maxSleeperVolumeCount;
|
||||
RebirthVariables.currentSleeperVolumePerc = this.currentSleeperVolumePerc;
|
||||
RebirthVariables.clearedSleeperVolumeCount = this.clearedSleeperVolumeCount;
|
||||
RebirthVariables.totalSleeperVolumeCount = this.totalSleeperVolumeCount;
|
||||
RebirthVariables.currentPOITier = this.currentPOITier;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RebirthVariables.purgePrefabName == "")
|
||||
{
|
||||
RebirthVariables.currentSleeperEntityCount = this.currentSleeperEntityCount;
|
||||
RebirthVariables.currentSleeperVolumeCount = this.currentSleeperVolumeCount;
|
||||
RebirthVariables.maxSleeperVolumeCount = this.maxSleeperVolumeCount;
|
||||
RebirthVariables.currentSleeperVolumePerc = this.currentSleeperVolumePerc;
|
||||
RebirthVariables.clearedSleeperVolumeCount = this.clearedSleeperVolumeCount;
|
||||
RebirthVariables.totalSleeperVolumeCount = this.totalSleeperVolumeCount;
|
||||
RebirthVariables.purgeDisplay = false;
|
||||
RebirthVariables.currentPOITier = this.currentPOITier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage this.currentPOITier: " + this.currentPOITier);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.currentPOITier: " + RebirthVariables.currentPOITier);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.totalSleeperVolumeCount: " + RebirthVariables.totalSleeperVolumeCount);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.currentSleeperVolumeCount: " + RebirthVariables.currentSleeperVolumeCount);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.maxSleeperVolumeCount: " + RebirthVariables.maxSleeperVolumeCount);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.currentSleeperEntityCount: " + RebirthVariables.currentSleeperEntityCount);
|
||||
//Log.Out("NetPackageUpdatePurgeDisplay-ProcessPackage RebirthVariables.currentSleeperVolumePerc: " + RebirthVariables.currentSleeperVolumePerc);
|
||||
}
|
||||
}
|
||||
|
||||
49
Scripts/Network/NetPackageUpdateVehicleHealthRebirth.cs
Normal file
49
Scripts/Network/NetPackageUpdateVehicleHealthRebirth.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageUpdateVehicleHealthRebirth : NetPackage
|
||||
{
|
||||
public NetPackageUpdateVehicleHealthRebirth Setup(int _vehicleEntityID, int _health)
|
||||
{
|
||||
this.vehicleHealth = _health;
|
||||
this.vehicleEntityID = _vehicleEntityID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _reader)
|
||||
{
|
||||
this.vehicleHealth = _reader.ReadInt32();
|
||||
this.vehicleEntityID = _reader.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _writer)
|
||||
{
|
||||
base.write(_writer);
|
||||
_writer.Write(this.vehicleHealth);
|
||||
_writer.Write(this.vehicleEntityID);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateVehicleHealthRebirth-ProcessPackage this.vehicleEntityID: " + this.vehicleEntityID);
|
||||
|
||||
EntityAlive entityVehicle = _world.GetEntity(this.vehicleEntityID) as EntityAlive;
|
||||
if (entityVehicle == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateVehicleHealthRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
entityVehicle.Health = this.vehicleHealth;
|
||||
entityVehicle.Stats.Health.Value = this.vehicleHealth;
|
||||
|
||||
//Log.Out("NetPackageUpdateVehicleHealthRebirth-ProcessPackage entityVehicle.Health: " + entityVehicle.Health);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
private int vehicleHealth;
|
||||
private int vehicleEntityID;
|
||||
}
|
||||
90
Scripts/Network/NetPackageUpdateWaterTankRebirth.cs
Normal file
90
Scripts/Network/NetPackageUpdateWaterTankRebirth.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
public class NetPackageUpdateWaterTankRebirth : NetPackage
|
||||
{
|
||||
int clrIdx = 0;
|
||||
int contentCount = 0;
|
||||
Vector3i blockPos;
|
||||
|
||||
public NetPackageUpdateWaterTankRebirth Setup(int _clrIdx, Vector3i _blockPos, int _contentCount)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-Setup START");
|
||||
this.clrIdx = _clrIdx;
|
||||
this.contentCount = _contentCount;
|
||||
this.blockPos = _blockPos;
|
||||
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-Setup this.clrIdx: " + this.clrIdx);
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-Setup this.contentCount: " + this.contentCount);
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-Setup this.blockPos: " + this.blockPos);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.blockPos = new Vector3i((float)_br.ReadInt32(), (float)_br.ReadInt32(), (float)_br.ReadInt32());
|
||||
this.clrIdx = _br.ReadInt32();
|
||||
this.contentCount = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write((int)this.blockPos.x);
|
||||
_bw.Write((int)this.blockPos.y);
|
||||
_bw.Write((int)this.blockPos.z);
|
||||
_bw.Write(this.clrIdx);
|
||||
_bw.Write(this.contentCount);
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage 2");
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage CLIENT this.clrIdx: " + this.clrIdx);
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage CLIENT this.blockPos: " + this.blockPos);
|
||||
TileEntityWaterTankRebirth tileEntity = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityWaterTankRebirth;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage 3");
|
||||
tileEntity.waterCount = this.contentCount;
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage CLIENT tileEntity.waterCount: " + tileEntity.waterCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage 4");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage 5");
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage SERVER this.clrIdx: " + this.clrIdx);
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage SERVER this.blockPos: " + this.blockPos);
|
||||
TileEntityWaterTankRebirth tileEntity = _world.GetTileEntity(this.clrIdx, this.blockPos) as TileEntityWaterTankRebirth;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage 6");
|
||||
tileEntity.waterCount = this.contentCount;
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage((NetPackage)NetPackageManager.GetPackage<NetPackageUpdateWaterTankRebirth>().Setup(this.clrIdx, this.blockPos, this.contentCount));
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage SERVER tileEntity.waterCount: " + tileEntity.waterCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageUpdateWaterTankRebirth-ProcessPackage 7");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
75
Scripts/Network/NetPackageVehicleUpdateBag.cs
Normal file
75
Scripts/Network/NetPackageVehicleUpdateBag.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageVehicleUpdateBag : NetPackage
|
||||
{
|
||||
public NetPackageVehicleUpdateBag Setup(int entityID, ItemStack[] _items)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-Setup START");
|
||||
this.items = _items;
|
||||
this.lootEntityId = entityID;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-read START");
|
||||
this.items = GameUtils.ReadItemStack(_br);
|
||||
for (int i = 0; i < this.items.Length; i++)
|
||||
{
|
||||
if (!this.items[i].IsEmpty())
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-read this.items[" + i + "].GetItemName: " + this.items[i].itemValue.ItemClass.GetItemName());
|
||||
//Log.Out("NetPackageVehicleUpdateBag-read this.items[" + i + "].count: " + this.items[i].count);
|
||||
}
|
||||
}
|
||||
this.lootEntityId = _br.ReadInt32();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-write START");
|
||||
base.write(_bw);
|
||||
_bw.Write((ushort)this.items.Length);
|
||||
for (int i = 0; i < this.items.Length; i++)
|
||||
{
|
||||
this.items[i].Write(_bw);
|
||||
if (!this.items[i].IsEmpty())
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-write this.items[" + i + "].GetItemName: " + this.items[i].itemValue.ItemClass.GetItemName());
|
||||
//Log.Out("NetPackageVehicleUpdateBag-write this.items[" + i + "].count: " + this.items[i].count);
|
||||
}
|
||||
}
|
||||
_bw.Write(this.lootEntityId);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityVehicleRebirth entity = GameManager.Instance.World.GetEntity(this.lootEntityId) as EntityVehicleRebirth;
|
||||
if (entity != null)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-ProcessPackage FOUND VEHICLE");
|
||||
entity.bag.SetSlots(this.items);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateBag-ProcessPackage 2");
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
private int lootEntityId;
|
||||
private ItemStack[] items;
|
||||
}
|
||||
97
Scripts/Network/NetPackageVehicleUpdatePartRebirth.cs
Normal file
97
Scripts/Network/NetPackageVehicleUpdatePartRebirth.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageVehicleUpdatePartRebirth : NetPackage
|
||||
{
|
||||
public NetPackageVehicleUpdatePartRebirth Setup(int _senderId, int _currentVehicleID, int _slotNumber, float _currentItemUseTimes, int _itemQuality, string _currentItemName)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-Setup START");
|
||||
this.senderId = _senderId;
|
||||
this.currentVehicleID = _currentVehicleID;
|
||||
this.slotNumber = _slotNumber;
|
||||
this.currentItemUseTimes = _currentItemUseTimes;
|
||||
this.itemQuality = _itemQuality;
|
||||
this.currentItemName = _currentItemName;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.senderId = _br.ReadInt32();
|
||||
this.currentVehicleID = _br.ReadInt32();
|
||||
this.slotNumber = _br.ReadInt32();
|
||||
this.currentItemUseTimes = _br.ReadSingle();
|
||||
this.itemQuality = _br.ReadInt32();
|
||||
this.currentItemName = _br.ReadString();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.senderId);
|
||||
_bw.Write(this.currentVehicleID);
|
||||
_bw.Write(this.slotNumber);
|
||||
_bw.Write(this.currentItemUseTimes);
|
||||
_bw.Write(this.itemQuality);
|
||||
_bw.Write(this.currentItemName);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
EntityVehicleRebirth entityVehicle = GameManager.Instance.World.GetEntity(this.currentVehicleID) as EntityVehicleRebirth;
|
||||
if (entityVehicle == null)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentItemName.Trim().Length > 0)
|
||||
{
|
||||
ItemValue vehiclePart = ItemClass.GetItem(currentItemName, false);
|
||||
if (vehiclePart != null)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-ProcessPackage slotNumber: " + slotNumber);
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-ProcessPackage currentItemUseTimes: " + currentItemUseTimes);
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-ProcessPackage currentItemName: " + currentItemName);
|
||||
vehiclePart.UseTimes = currentItemUseTimes;
|
||||
vehiclePart.Quality = (ushort)this.itemQuality;
|
||||
entityVehicle.itemValues[this.slotNumber] = vehiclePart;
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-ProcessPackage 4");
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageVehicleUpdatePartRebirth>().Setup(this.senderId, this.currentVehicleID, this.slotNumber, this.currentItemUseTimes, this.itemQuality, this.currentItemName), false, -1, this.senderId, -1, null, 192);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
entityVehicle.itemValues[this.slotNumber] = ItemValue.None;
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdatePartRebirth-ProcessPackage 5");
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageVehicleUpdatePartRebirth>().Setup(this.senderId, this.currentVehicleID, this.slotNumber, this.currentItemUseTimes, this.itemQuality, this.currentItemName), false, -1, this.senderId, -1, null, 192);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
private int senderId;
|
||||
private int currentVehicleID;
|
||||
private int slotNumber;
|
||||
private float currentItemUseTimes;
|
||||
private int itemQuality;
|
||||
private string currentItemName;
|
||||
}
|
||||
63
Scripts/Network/NetPackageVehicleUpdateStatsRebirth.cs
Normal file
63
Scripts/Network/NetPackageVehicleUpdateStatsRebirth.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using UnityEngine.Scripting;
|
||||
|
||||
[Preserve]
|
||||
public class NetPackageVehicleUpdateStatsRebirth : NetPackage
|
||||
{
|
||||
public NetPackageVehicleUpdateStatsRebirth Setup(int _senderId, int _currentVehicleID, float _OilPerc)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateStatsRebirth-Setup START");
|
||||
this.senderId = _senderId;
|
||||
this.currentVehicleID = _currentVehicleID;
|
||||
this.OilPerc = _OilPerc;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void read(PooledBinaryReader _br)
|
||||
{
|
||||
this.senderId = _br.ReadInt32();
|
||||
this.currentVehicleID = _br.ReadInt32();
|
||||
this.OilPerc = _br.ReadSingle();
|
||||
}
|
||||
|
||||
public override void write(PooledBinaryWriter _bw)
|
||||
{
|
||||
base.write(_bw);
|
||||
_bw.Write(this.senderId);
|
||||
_bw.Write(this.currentVehicleID);
|
||||
_bw.Write(this.OilPerc);
|
||||
}
|
||||
|
||||
public override void ProcessPackage(World _world, GameManager _callbacks)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateStatsRebirth-ProcessPackage START");
|
||||
if (_world == null)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateStatsRebirth-ProcessPackage 1");
|
||||
return;
|
||||
}
|
||||
EntityVehicleRebirth entityVehicle = GameManager.Instance.World.GetEntity(this.currentVehicleID) as EntityVehicleRebirth;
|
||||
if (entityVehicle == null)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateStatsRebirth-ProcessPackage 2");
|
||||
return;
|
||||
}
|
||||
|
||||
entityVehicle.OilPerc = this.OilPerc;
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("NetPackageVehicleUpdateStatsRebirth-ProcessPackage 4");
|
||||
SingletonMonoBehaviour<ConnectionManager>.Instance.SendPackage(NetPackageManager.GetPackage<NetPackageVehicleUpdateStatsRebirth>().Setup(this.senderId, this.currentVehicleID, this.OilPerc), false, -1, this.senderId, -1, null, 192);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLength()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
private int senderId;
|
||||
private int currentVehicleID;
|
||||
private float OilPerc;
|
||||
}
|
||||
Reference in New Issue
Block a user