public void CallRpcThrowGrenade(GrenadeManager.GrenadeSpawnInfo g)
    {
        if (!NetworkServer.active)
        {
            Debug.LogError("RPC Function RpcThrowGrenade called on client.");
            return;
        }
        NetworkWriter networkWriter = new NetworkWriter();

        networkWriter.Write(0);
        networkWriter.Write((short)((ushort)2));
        networkWriter.WritePackedUInt32((uint)GrenadeManager.kRpcRpcThrowGrenade);
        networkWriter.Write(base.GetComponent <NetworkIdentity>().netId);
        GeneratedNetworkCode._WriteGrenadeSpawnInfo_GrenadeManager(networkWriter, g);
        this.SendRPCInternal(networkWriter, 2, "RpcThrowGrenade");
    }
    private void RpcThrowGrenade(GrenadeManager.GrenadeSpawnInfo g)
    {
        Rigidbody component = UnityEngine.Object.Instantiate <GameObject>(this.grenades[g.grenadeID].instance, g.spawnPosition, Quaternion.Euler(Vector3.up * 45f)).GetComponent <Rigidbody>();

        component.velocity        = g.velocity;
        component.angularVelocity = Vector3.one * 45f;
        component.name            = string.Concat(new object[]
        {
            "GRENADE#",
            g.grenadeID,
            "#",
            g.spawnPosition,
            "#",
            g.velocity,
            ":"
        });
        UnityEngine.Object.Destroy(component.gameObject, g.timeToExplode + 2f);
        base.StartCoroutine(this.CountDown(component.name, g.timeToExplode, g.throwerclass));
    }
    private void CmdThrowGrenade(int gId, int itemIndex)
    {
        CharacterClassManager component = base.GetComponent <CharacterClassManager>();

        if (component.IsHuman())
        {
            foreach (Inventory.SyncItemInfo syncItemInfo in this.inv.items)
            {
                if (syncItemInfo.id == this.grenades[gId].inventoryID)
                {
                    Vector3    spawnPos = this.plyCam.position + this.plyCam.forward * 0.2f + this.plyCam.right * 0.2f;
                    Quaternion rotation = this.plyCam.rotation;
                    this.plyCam.localRotation = Quaternion.Euler(Vector3.right * base.GetComponent <PlyMovementSync>().rotX);
                    GrenadeManager.GrenadeSpawnInfo g = new GrenadeManager.GrenadeSpawnInfo(gId, spawnPos, this.plyCam.forward * this.throwSpeed, this.grenades[gId].timeToExplode, component.curClass);
                    this.plyCam.rotation = rotation;
                    this.cooldown        = 1f;
                    this.CallRpcThrowGrenade(g);
                    if (this.inv.items[itemIndex].id == this.grenades[gId].inventoryID)
                    {
                        this.inv.items.RemoveAt(itemIndex);
                    }
                    else
                    {
                        int num = 0;
                        foreach (Inventory.SyncItemInfo syncItemInfo2 in this.inv.items)
                        {
                            if (syncItemInfo2.id == this.grenades[gId].inventoryID)
                            {
                                this.inv.items.RemoveAt(num);
                            }
                            num++;
                        }
                    }
                    break;
                }
            }
        }
    }
 public static void _WriteGrenadeSpawnInfo_GrenadeManager(NetworkWriter writer, GrenadeManager.GrenadeSpawnInfo value)
 {
     writer.WritePackedUInt32((uint)value.grenadeID);
     writer.Write(value.spawnPosition);
     writer.Write(value.velocity);
     writer.Write(value.timeToExplode);
     writer.WritePackedUInt32((uint)value.throwerclass);
 }