示例#1
0
 public RocketShootEvent(BaseLauncher baseLauncher, BaseEntity.RPCMessage msg, BaseEntity baseEntity)
 {
     _entity = new Entity(baseEntity);
     _player = Server.GetPlayer(msg.player);
     _msg    = msg;
     _launch = baseLauncher;
 }
示例#2
0
    public void GetSnapshotFromClient(BaseEntity.RPCMessage msg)
    {
        BasePlayer basePlayer = msg.player;

        if (basePlayer == null || basePlayer != base.GetDriver())
        {
            return;
        }
        if (this.GetSnapshotFromClientPerSecond.Calculate() > (long)30)
        {
            return;
        }
        this.GetSnapshotFromClientPerSecond.Increment();
        ArcadeGame arcadeGame = Facepunch.Pool.Get <ArcadeGame>();

        arcadeGame = ArcadeGame.Deserialize(msg.read);
        Connection connection = null;

        if (this.networkTrigger.entityContents != null)
        {
            foreach (BaseEntity entityContent in this.networkTrigger.entityContents)
            {
                base.ClientRPCPlayer <ArcadeGame>(connection, entityContent.GetComponent <BasePlayer>(), "GetSnapshotFromServer", arcadeGame);
            }
        }
    }
示例#3
0
    public void ServerSetFrequency(BaseEntity.RPCMessage msg)
    {
        if (msg.player == null || !msg.player.CanBuild())
        {
            return;
        }
        if (base.GetOwnerPlayer() != msg.player)
        {
            return;
        }
        if (UnityEngine.Time.time < this.nextChangeTime)
        {
            return;
        }
        this.nextChangeTime = UnityEngine.Time.time + 2f;
        int num = msg.read.Int32();

        if (RFManager.IsReserved(num))
        {
            RFManager.ReserveErrorPrint(msg.player);
            return;
        }
        RFManager.ChangeFrequency(this.frequency, num, this, false, base.IsOn());
        this.frequency = num;
        base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
        Item item = this.GetItem();

        if (item != null)
        {
            item.MarkDirty();
        }
    }
示例#4
0
 public ItemRepairEvent(RepairBench repairBench, BaseEntity.RPCMessage msg)
 {
     _repairBench = repairBench;
     _player = Server.GetPlayer(msg.player);
     _item = new InvItem(repairBench.inventory.GetSlot(0));
     _msg = msg;
 }
示例#5
0
    public void RPC_Pump(BaseEntity.RPCMessage msg)
    {
        BasePlayer basePlayer = msg.player;

        if (basePlayer == null || basePlayer.IsDead() || basePlayer.IsSleeping())
        {
            return;
        }
        if (basePlayer.metabolism.calories.@value < this.caloriesPerPump)
        {
            return;
        }
        if (base.HasFlag(BaseEntity.Flags.Reserved2))
        {
            return;
        }
        base.SetFlag(BaseEntity.Flags.Reserved2, true, false, true);
        basePlayer.metabolism.calories.@value -= this.caloriesPerPump;
        basePlayer.metabolism.SendChangesToClient();
        this.currentPressure = Mathf.Clamp01(this.currentPressure + this.pressurePerPump);
        base.Invoke(new Action(this.StopPump), 1.8f);
        if (this.currentPressure >= 0f)
        {
            base.CancelInvoke(new Action(this.Produce));
            base.Invoke(new Action(this.Produce), 1f);
        }
        base.SendNetworkUpdateImmediate(false);
    }
示例#6
0
    public void CL_ReceiveFilePng(BaseEntity.RPCMessage msg)
    {
        var textureID = msg.read.UInt32();
        var bytes     = msg.read.BytesWithSize();

        if (bytes == null)
        {
            return;
        }

        if (FileStorage.client.Store(bytes, FileStorage.Type.png, net.ID) != textureID)
        {
            Log("Client/Server FileStorage CRC differs");
        }

        List <UnityEngine.UI.MaskableGraphic> components;

        if (!requestingTextureImages.TryGetValue(textureID, out components))
        {
            return;
        }

        requestingTextureImages.Remove(textureID);

        foreach (var c in components)
        {
            LoadPngIntoGraphic(c, bytes);
        }
    }
示例#7
0
    private void DoEmpty(BaseEntity.RPCMessage msg)
    {
        if (!msg.player.CanInteract())
        {
            return;
        }
        Item item = this.GetItem();

        if (item == null)
        {
            return;
        }
        if (item.contents == null)
        {
            return;
        }
        if (!msg.player.metabolism.CanConsume())
        {
            return;
        }
        List <Item> .Enumerator enumerator = item.contents.itemList.GetEnumerator();
        try
        {
            if (enumerator.MoveNext())
            {
                enumerator.Current.UseItem(50);
            }
        }
        finally
        {
            ((IDisposable)enumerator).Dispose();
        }
    }
    public void DoResearch(BaseEntity.RPCMessage msg)
    {
        if (this.IsResearching())
        {
            return;
        }
        BasePlayer player     = msg.player;
        Item       targetItem = this.GetTargetItem();

        if (targetItem == null || Interface.CallHook("CanResearchItem", (object)player, (object)targetItem) != null || (targetItem.amount > 1 || !this.IsItemResearchable(targetItem)))
        {
            return;
        }
        Interface.CallHook("OnItemResearch", (object)this, (object)targetItem, (object)player);
        targetItem.CollectedForCrafting(player);
        this.researchFinishedTime = Time.get_realtimeSinceStartup() + this.researchDuration;
        this.Invoke(new Action(this.ResearchAttemptFinished), this.researchDuration);
        this.inventory.SetLocked(true);
        this.SetFlag(BaseEntity.Flags.On, true, false, true);
        this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
        player.inventory.loot.SendImmediate();
        if (this.researchStartEffect.isValid)
        {
            Effect.server.Run(this.researchStartEffect.resourcePath, (BaseEntity)this, 0U, Vector3.get_zero(), Vector3.get_zero(), (Connection)null, false);
        }
        msg.player.GiveAchievement("RESEARCH_ITEM");
    }
示例#9
0
    private void RPC_KnockDoor(BaseEntity.RPCMessage rpc)
    {
        if (!rpc.player.CanInteract())
        {
            return;
        }
        if (!this.knockEffect.isValid)
        {
            return;
        }
        if (UnityEngine.Time.realtimeSinceStartup < this.nextKnockTime)
        {
            return;
        }
        this.nextKnockTime = UnityEngine.Time.realtimeSinceStartup + 0.5f;
        BaseEntity slot = base.GetSlot(BaseEntity.Slot.LowerCenterDecoration);

        if (slot != null)
        {
            DoorKnocker component = slot.GetComponent <DoorKnocker>();
            if (component)
            {
                component.Knock(rpc.player);
                return;
            }
        }
        Effect.server.Run(this.knockEffect.resourcePath, this, 0, Vector3.zero, Vector3.zero, null, false);
        Interface.CallHook("OnDoorKnocked", this, rpc.player);
    }
示例#10
0
    public void ServerCardSwiped(BaseEntity.RPCMessage msg)
    {
        if (!this.IsPowered() || (double)Vector3Ex.Distance2D(((Component)msg.player).get_transform().get_position(), ((Component)this).get_transform().get_position()) > 1.0 || (this.IsInvoking(new Action(this.GrantCard)) || this.IsInvoking(new Action(this.FailCard))))
        {
            return;
        }
        uint    uid     = msg.read.UInt32();
        Keycard keycard = BaseNetworkable.serverEntities.Find(uid) as Keycard;

        Effect.server.Run(this.swipeEffect.resourcePath, this.audioPosition.get_position(), Vector3.get_up(), msg.player.net.get_connection(), false);
        if (!Object.op_Inequality((Object)keycard, (Object)null))
        {
            return;
        }
        Item obj = keycard.GetItem();

        if (obj != null && keycard.accessLevel == this.accessLevel && (double)obj.conditionNormalized > 0.0)
        {
            this.Invoke(new Action(this.GrantCard), 0.5f);
            obj.LoseCondition(1f);
        }
        else
        {
            this.Invoke(new Action(this.FailCard), 0.5f);
        }
    }
 private void SERVER_TurnOn(BaseEntity.RPCMessage rpc)
 {
     if (this.IsAuthed(rpc.player))
     {
         this.InitiateStartup();
     }
 }
示例#12
0
    public void MakeConnection(BaseEntity.RPCMessage msg)
    {
        if (!WireTool.CanPlayerUseWires(msg.player))
        {
            return;
        }
        uint            uid1             = msg.read.UInt32();
        int             index1           = msg.read.Int32();
        uint            uid2             = msg.read.UInt32();
        int             index2           = msg.read.Int32();
        BaseNetworkable baseNetworkable1 = BaseNetworkable.serverEntities.Find(uid1);
        IOEntity        newIOEnt1        = Object.op_Equality((Object)baseNetworkable1, (Object)null) ? (IOEntity)null : (IOEntity)((Component)baseNetworkable1).GetComponent <IOEntity>();

        if (Object.op_Equality((Object)newIOEnt1, (Object)null))
        {
            return;
        }
        BaseNetworkable baseNetworkable2 = BaseNetworkable.serverEntities.Find(uid2);
        IOEntity        newIOEnt2        = Object.op_Equality((Object)baseNetworkable2, (Object)null) ? (IOEntity)null : (IOEntity)((Component)baseNetworkable2).GetComponent <IOEntity>();

        if (Object.op_Equality((Object)newIOEnt2, (Object)null) || (double)Vector3.Distance(((Component)baseNetworkable2).get_transform().get_position(), ((Component)baseNetworkable1).get_transform().get_position()) > (double)WireTool.maxWireLength || (index1 >= newIOEnt1.inputs.Length || index2 >= newIOEnt2.outputs.Length) || (Object.op_Inequality((Object)newIOEnt1.inputs[index1].connectedTo.Get(true), (Object)null) || Object.op_Inequality((Object)newIOEnt2.outputs[index2].connectedTo.Get(true), (Object)null) || newIOEnt1.inputs[index1].rootConnectionsOnly && !newIOEnt2.IsRootEntity()))
        {
            return;
        }
        newIOEnt1.inputs[index1].connectedTo.Set(newIOEnt2);
        newIOEnt1.inputs[index1].connectedToSlot = index2;
        newIOEnt1.inputs[index1].connectedTo.Init();
        newIOEnt2.outputs[index2].connectedTo.Set(newIOEnt1);
        newIOEnt2.outputs[index2].connectedToSlot = index1;
        newIOEnt2.outputs[index2].connectedTo.Init();
        newIOEnt2.MarkDirtyForceUpdateOutputs();
        newIOEnt2.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
        newIOEnt1.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
    }
示例#13
0
 public ItemPickupEvent(CollectibleEntity ce, BaseEntity.RPCMessage msg, Item i)
 {
     _entity = ce;
     _msg = msg;
     _player = Server.GetPlayer(msg.player);
     _item = new InvItem(i);
 }
    private void RPC_LootCorpse(BaseEntity.RPCMessage rpc)
    {
        BasePlayer basePlayer = rpc.player;

        if (!basePlayer || !basePlayer.CanInteract())
        {
            return;
        }
        if (!this.CanLoot())
        {
            return;
        }
        if (this.containers == null)
        {
            return;
        }
        if (Interface.CallHook("CanLootEntity", basePlayer, this) != null)
        {
            return;
        }
        if (basePlayer.inventory.loot.StartLootingEntity(this, true))
        {
            base.SetFlag(BaseEntity.Flags.Open, true, false, true);
            ItemContainer[] itemContainerArray = this.containers;
            for (int i = 0; i < (int)itemContainerArray.Length; i++)
            {
                ItemContainer itemContainer = itemContainerArray[i];
                basePlayer.inventory.loot.AddContainer(itemContainer);
            }
            basePlayer.inventory.loot.SendImmediate();
            base.ClientRPCPlayer(null, basePlayer, "RPC_ClientLootCorpse");
            base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
        }
    }
示例#15
0
    private void UseOther(BaseEntity.RPCMessage msg)
    {
        BasePlayer player1 = msg.player;

        if (!this.VerifyClientAttack(player1))
        {
            this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
        }
        else
        {
            if (!player1.CanInteract() || !this.HasItemAmount() || !this.canUseOnOther)
            {
                return;
            }
            BasePlayer player2 = BaseNetworkable.serverEntities.Find(msg.read.UInt32()) as BasePlayer;
            if (!Object.op_Inequality((Object)player2, (Object)null) || (double)Vector3.Distance(((Component)player2).get_transform().get_position(), ((Component)player1).get_transform().get_position()) >= 4.0)
            {
                return;
            }
            this.ClientRPCPlayer((Connection)null, player1, "Reset");
            this.GiveEffectsTo(player2);
            this.UseItemAmount(1);
            this.StartAttackCooldown(this.repeatDelay);
        }
    }
示例#16
0
    private void RPC_CreateKey(BaseEntity.RPCMessage rpc)
    {
        if (!rpc.player.CanInteract())
        {
            return;
        }
        if (base.IsLocked() && !this.HasLockPermission(rpc.player))
        {
            return;
        }
        ItemDefinition itemDefinition = ItemManager.FindItemDefinition(this.keyItemType.itemid);

        if (itemDefinition == null)
        {
            Debug.LogWarning(string.Concat("RPC_CreateKey: Itemdef is missing! ", this.keyItemType));
            return;
        }
        ItemBlueprint itemBlueprint = ItemManager.FindBlueprint(itemDefinition);

        if (!rpc.player.inventory.crafting.CanCraft(itemBlueprint, 1))
        {
            return;
        }
        ProtoBuf.Item.InstanceData instanceDatum = Facepunch.Pool.Get <ProtoBuf.Item.InstanceData>();
        instanceDatum.dataInt = this.keyCode;
        rpc.player.inventory.crafting.CraftItem(itemBlueprint, rpc.player, instanceDatum, 1, 0, null);
        if (!this.firstKeyCreated)
        {
            this.LockLock(rpc.player);
            base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
            this.firstKeyCreated = true;
        }
    }
    public void ServerSetFrequency(BaseEntity.RPCMessage msg)
    {
        if (msg.player == null || !msg.player.CanBuild())
        {
            return;
        }
        if (!this.playerUsable)
        {
            return;
        }
        if (UnityEngine.Time.time < this.nextChangeTime)
        {
            return;
        }
        this.nextChangeTime = UnityEngine.Time.time + 2f;
        int num = msg.read.Int32();

        if (RFManager.IsReserved(num))
        {
            RFManager.ReserveErrorPrint(msg.player);
            return;
        }
        RFManager.ChangeFrequency(this.frequency, num, this, false, this.IsPowered());
        this.frequency = num;
        this.MarkDirty();
        base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
    }
示例#18
0
    public void ServerCardSwiped(BaseEntity.RPCMessage msg)
    {
        if (!this.IsPowered())
        {
            return;
        }
        if (Vector3Ex.Distance2D(msg.player.transform.position, base.transform.position) > 1f)
        {
            return;
        }
        if (base.IsInvoking(new Action(this.GrantCard)) || base.IsInvoking(new Action(this.FailCard)))
        {
            return;
        }
        uint    num     = msg.read.UInt32();
        Keycard keycard = BaseNetworkable.serverEntities.Find(num) as Keycard;

        Effect.server.Run(this.swipeEffect.resourcePath, this.audioPosition.position, Vector3.up, msg.player.net.connection, false);
        if (keycard != null)
        {
            Item item = keycard.GetItem();
            if (item != null && keycard.accessLevel == this.accessLevel && item.conditionNormalized > 0f)
            {
                base.Invoke(new Action(this.GrantCard), 0.5f);
                item.LoseCondition(1f);
                return;
            }
            base.Invoke(new Action(this.FailCard), 0.5f);
        }
    }
示例#19
0
    public void ImageUpdate(BaseEntity.RPCMessage msg)
    {
        byte num  = msg.read.UInt8();
        byte num1 = msg.read.UInt8();
        uint num2 = msg.read.UInt32();

        if (num == 0 && this.fogImages[num1] == num2)
        {
            return;
        }
        if (num == 1 && this.paintImages[num1] == num2)
        {
            return;
        }
        uint num3 = (uint)(num * 1000 + num1);

        byte[] numArray = msg.read.BytesWithSize();
        if (numArray == null)
        {
            return;
        }
        FileStorage.server.RemoveEntityNum(this.net.ID, num3);
        uint num4 = FileStorage.server.Store(numArray, FileStorage.Type.png, this.net.ID, num3);

        if (num == 0)
        {
            this.fogImages[num1] = num4;
        }
        if (num == 1)
        {
            this.paintImages[num1] = num4;
        }
        base.InvalidateNetworkCache();
        Interface.CallHook("OnMapImageUpdated");
    }
    private void DoRotation(BaseEntity.RPCMessage msg)
    {
        if (!msg.player.CanInteract())
        {
            return;
        }
        if (!this.CanRotate(msg.player))
        {
            return;
        }
        if (!this.blockDefinition.canRotate)
        {
            return;
        }
        if (Interface.CallHook("OnStructureRotate", this, msg.player) != null)
        {
            return;
        }
        Transform transforms = base.transform;

        transforms.localRotation = transforms.localRotation * Quaternion.Euler(this.blockDefinition.rotationAmount);
        base.RefreshEntityLinks();
        base.UpdateSurroundingEntities();
        this.UpdateSkin(true);
        base.SendNetworkUpdateImmediate(false);
        base.ClientRPC(null, "RefreshSkin");
    }
示例#21
0
    private void RPC_CreateKey(BaseEntity.RPCMessage rpc)
    {
        if (!rpc.player.CanInteract() || this.IsLocked() && !this.HasLockPermission(rpc.player))
        {
            return;
        }
        ItemDefinition itemDefinition = ItemManager.FindItemDefinition(this.keyItemType.itemid);

        if (Object.op_Equality((Object)itemDefinition, (Object)null))
        {
            Debug.LogWarning((object)("RPC_CreateKey: Itemdef is missing! " + (object)this.keyItemType));
        }
        else
        {
            ItemBlueprint blueprint = ItemManager.FindBlueprint(itemDefinition);
            if (!rpc.player.inventory.crafting.CanCraft(blueprint, 1))
            {
                return;
            }
            Item.InstanceData instanceData = (Item.InstanceData)Pool.Get <Item.InstanceData>();
            instanceData.dataInt = (__Null)this.keyCode;
            rpc.player.inventory.crafting.CraftItem(blueprint, rpc.player, instanceData, 1, 0, (Item)null);
            if (this.firstKeyCreated)
            {
                return;
            }
            this.LockLock(rpc.player);
            this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
            this.firstKeyCreated = true;
        }
    }
示例#22
0
 public RocketShootEvent(BaseLauncher baseLauncher, BaseEntity.RPCMessage msg, BaseEntity baseEntity)
 {
     _entity = new Entity(baseEntity);
     _player = Server.GetPlayer(msg.player);
     _msg = msg;
     _launch = baseLauncher;
 }
示例#23
0
    public void RPC_Open(BaseEntity.RPCMessage msg)
    {
        if (msg.player == null)
        {
            return;
        }
        bool flag = msg.read.Bit();

        if (flag == base.IsOpen())
        {
            return;
        }
        if (!flag)
        {
            base.CancelInvoke(new Action(this.CloseEgg));
        }
        else
        {
            base.ClientRPC <Vector3>(null, "FaceEggPosition", msg.player.eyes.position);
            base.Invoke(new Action(this.CloseEgg), 60f);
        }
        base.SetFlag(BaseEntity.Flags.Open, flag, false, false);
        if (this.IsSpinning() & flag)
        {
            base.SetFlag(BaseEntity.Flags.Reserved1, false, false, false);
        }
        base.SendNetworkUpdateImmediate(false);
    }
示例#24
0
    public void Rename(BaseEntity.RPCMessage msg)
    {
        if (!msg.player.CanInteract())
        {
            return;
        }
        string str1 = msg.read.String();

        if (Interface.CallHook("CanRenameBed", (object)msg.player, (object)this, (object)str1) != null)
        {
            return;
        }
        string str2 = WordFilter.Filter(str1);

        if (string.IsNullOrEmpty(str2))
        {
            str2 = "Unnamed Sleeping Bag";
        }
        if (str2.Length > 24)
        {
            str2 = str2.Substring(0, 22) + "..";
        }
        this.niceName = str2;
        this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
    }
示例#25
0
    private void DoDrink(BaseEntity.RPCMessage msg)
    {
        if (!msg.player.CanInteract())
        {
            return;
        }
        Item item = this.GetItem();

        if (item == null)
        {
            return;
        }
        if (item.contents == null)
        {
            return;
        }
        if (!msg.player.metabolism.CanConsume())
        {
            return;
        }
        foreach (Item content in item.contents.itemList)
        {
            ItemModConsume component = content.info.GetComponent <ItemModConsume>();
            if (component == null || !component.CanDoAction(content, msg.player))
            {
                continue;
            }
            component.DoAction(content, msg.player);
            return;
        }
    }
 private void SERVER_TurnOff(BaseEntity.RPCMessage rpc)
 {
     if (this.IsAuthed(rpc.player))
     {
         this.InitiateShutdown();
     }
 }
示例#27
0
 public ItemRepairEvent(RepairBench repairBench, BaseEntity.RPCMessage msg)
 {
     _repairBench = repairBench;
     _player      = Server.GetPlayer(msg.player);
     _item        = new InvItem(repairBench.inventory.GetSlot(0));
     _msg         = msg;
 }
示例#28
0
 private void TryLock(BaseEntity.RPCMessage rpc)
 {
     if (!rpc.player.CanInteract())
     {
         return;
     }
     if (base.IsLocked())
     {
         return;
     }
     if (this.code.Length != 4)
     {
         return;
     }
     if (Interface.CallHook("CanLock", rpc.player, this) != null)
     {
         return;
     }
     if (!this.whitelistPlayers.Contains(rpc.player.userID))
     {
         return;
     }
     this.DoEffect(this.effectLocked.resourcePath);
     base.SetFlag(BaseEntity.Flags.Locked, true, false, true);
     base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
 }
示例#29
0
    private void SVSwitch(BaseEntity.RPCMessage msg)
    {
        bool flag = msg.read.Bit();

        if (flag == base.IsOn())
        {
            return;
        }
        if (msg.player == null)
        {
            return;
        }
        if (Interface.CallHook("OnRecyclerToggle", this, msg.player) != null)
        {
            return;
        }
        if (flag && !this.HasRecyclable())
        {
            return;
        }
        if (!flag)
        {
            this.StopRecycling();
            return;
        }
        foreach (Item item in this.inventory.itemList)
        {
            item.CollectedForCrafting(msg.player);
        }
        this.StartRecycling();
    }
    private void UseOther(BaseEntity.RPCMessage msg)
    {
        BasePlayer basePlayer = msg.player;

        if (!this.VerifyClientAttack(basePlayer))
        {
            base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
            return;
        }
        if (!basePlayer.CanInteract())
        {
            return;
        }
        if (!base.HasItemAmount() || !this.canUseOnOther)
        {
            return;
        }
        BasePlayer basePlayer1 = BaseNetworkable.serverEntities.Find(msg.read.UInt32()) as BasePlayer;

        if (basePlayer1 != null && Vector3.Distance(basePlayer1.transform.position, basePlayer.transform.position) < 4f)
        {
            base.ClientRPCPlayer(null, basePlayer, "Reset");
            this.GiveEffectsTo(basePlayer1);
            base.UseItemAmount(1);
            base.StartAttackCooldown(this.repeatDelay);
        }
    }
示例#31
0
    public void RPC_PickUp(BaseEntity.RPCMessage msg)
    {
        if (msg.player == null)
        {
            return;
        }
        float single = UnityEngine.Time.realtimeSinceStartup - this.lastPickupStartTime;

        if (!msg.player.GetHeldEntity() as EasterBasket)
        {
            if (single > 2f)
            {
                return;
            }
            if (single < 0.8f)
            {
                return;
            }
        }
        if (EggHuntEvent.serverEvent)
        {
            if (!EggHuntEvent.serverEvent.IsEventActive())
            {
                return;
            }
            EggHuntEvent.serverEvent.EggCollected(msg.player);
            int num = 1;
            msg.player.GiveItem(ItemManager.Create(this.itemToGive, num, (ulong)0), BaseEntity.GiveItemReason.Generic);
        }
        Effect.server.Run(this.pickupEffect.resourcePath, base.transform.position + (Vector3.up * 0.3f), Vector3.up, null, false);
        base.Kill(BaseNetworkable.DestroyMode.None);
    }
示例#32
0
    private void RPC_OpenLoot(BaseEntity.RPCMessage rpc)
    {
        if (this.inventory == null)
        {
            return;
        }
        BasePlayer basePlayer = rpc.player;

        if (!basePlayer || !basePlayer.CanInteract())
        {
            return;
        }
        if (Interface.CallHook("CanLootEntity", basePlayer, this) != null)
        {
            return;
        }
        if (basePlayer.inventory.loot.StartLootingEntity(this, true))
        {
            base.SetFlag(BaseEntity.Flags.Open, true, false, true);
            basePlayer.inventory.loot.AddContainer(this.inventory);
            basePlayer.inventory.loot.SendImmediate();
            basePlayer.ClientRPCPlayer <string>(null, basePlayer, "RPC_OpenLootPanel", this.lootPanelName);
            base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
        }
    }
示例#33
0
    public void TryClear(BaseEntity.RPCMessage msg)
    {
        IOEntity component;

        if (!WireTool.CanPlayerUseWires(msg.player))
        {
            return;
        }
        uint            num             = msg.read.UInt32();
        BaseNetworkable baseNetworkable = BaseNetworkable.serverEntities.Find(num);

        if (baseNetworkable == null)
        {
            component = null;
        }
        else
        {
            component = baseNetworkable.GetComponent <IOEntity>();
        }
        IOEntity oEntity = component;

        if (oEntity == null)
        {
            return;
        }
        oEntity.ClearConnections();
        oEntity.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
    }
示例#34
0
 public ItemPickupEvent(CollectibleEntity collectibleEntity, BaseEntity.RPCMessage msg, Item item)
 {
     Entity = collectibleEntity;
     RPCMessage = msg;
     Player = Server.GetPlayer(msg.player);
     Item = new InvItem(item);
 }
示例#35
0
 public WeaponThrowEvent(ThrownWeapon thrownWeapon, BaseEntity.RPCMessage msg)
 {
     _msg = msg;
     _thrownWeapon = thrownWeapon;
     _player = Server.GetPlayer(msg.player);
 }
示例#36
0
 public ShootEvent(BaseProjectile baseProjectile, BaseEntity.RPCMessage msg)
 {
     _player = Server.GetPlayer(msg.player);
     _rpcMessage = msg;
     _projectile = baseProjectile;
 }