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