Upload from upload_mods.ps1
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user