Example #1
0
        public static void repair(Transform structure, float damage, float times)
        {
            byte            b;
            byte            b2;
            ushort          num;
            StructureRegion structureRegion;

            if (StructureManager.tryGetInfo(structure, out b, out b2, out num, out structureRegion) && !structureRegion.structures[(int)num].structure.isDead && !structureRegion.structures[(int)num].structure.isRepaired)
            {
                ushort amount = (ushort)(damage * times);
                structureRegion.structures[(int)num].structure.askRepair(amount);
                for (int i = 0; i < Provider.clients.Count; i++)
                {
                    if (Provider.clients[i].player != null && OwnershipTool.checkToggle(Provider.clients[i].playerID.steamID, structureRegion.structures[(int)num].owner, Provider.clients[i].player.quests.groupID, structureRegion.structures[(int)num].group) && Regions.checkArea(b, b2, Provider.clients[i].player.movement.region_x, Provider.clients[i].player.movement.region_y, StructureManager.STRUCTURE_REGIONS))
                    {
                        StructureManager.manager.channel.send("tellStructureHealth", Provider.clients[i].playerID.steamID, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[]
                        {
                            b,
                            b2,
                            num,
                            (byte)Mathf.RoundToInt((float)structureRegion.structures[(int)num].structure.health / (float)structureRegion.structures[(int)num].structure.asset.health * 100f)
                        });
                    }
                }
            }
        }
Example #2
0
        public void askSalvageStructure(CSteamID steamID, byte x, byte y, ushort index)
        {
            StructureRegion structureRegion;

            if (Provider.isServer && StructureManager.tryGetRegion(x, y, out structureRegion))
            {
                Player player = PlayerTool.getPlayer(steamID);
                if (player == null)
                {
                    return;
                }
                if (player.life.isDead)
                {
                    return;
                }
                if ((int)index >= structureRegion.drops.Count)
                {
                    return;
                }
                if (!OwnershipTool.checkToggle(player.channel.owner.playerID.steamID, structureRegion.structures[(int)index].owner, player.quests.groupID, structureRegion.structures[(int)index].group))
                {
                    return;
                }
                ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, structureRegion.structures[(int)index].structure.id);
                if (itemStructureAsset != null)
                {
                    if (itemStructureAsset.isUnpickupable)
                    {
                        return;
                    }
                    if (structureRegion.structures[(int)index].structure.health == itemStructureAsset.health)
                    {
                        player.inventory.forceAddItem(new Item(structureRegion.structures[(int)index].structure.id, EItemOrigin.NATURE), true);
                    }
                    else if (itemStructureAsset.isSalvageable)
                    {
                        for (int i = 0; i < itemStructureAsset.blueprints.Count; i++)
                        {
                            Blueprint blueprint = itemStructureAsset.blueprints[i];
                            if (blueprint.outputs.Length == 1 && blueprint.outputs[0].id == itemStructureAsset.id)
                            {
                                ushort id = blueprint.supplies[Random.Range(0, blueprint.supplies.Length)].id;
                                player.inventory.forceAddItem(new Item(id, EItemOrigin.NATURE), true);
                                break;
                            }
                        }
                    }
                }
                structureRegion.structures.RemoveAt((int)index);
                StructureManager.manager.channel.send("tellTakeStructure", ESteamCall.ALL, x, y, StructureManager.STRUCTURE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
                {
                    x,
                    y,
                    index,
                    (structureRegion.drops[(int)index].model.position - player.transform.position).normalized * 100f
                });
            }
        }
Example #3
0
        private static void updateActivity(StructureRegion region, CSteamID owner, CSteamID group)
        {
            ushort num = 0;

            while ((int)num < region.structures.Count)
            {
                StructureData structureData = region.structures[(int)num];
                if (OwnershipTool.checkToggle(owner, structureData.owner, group, structureData.group))
                {
                    structureData.objActiveDate = Provider.time;
                }
                num += 1;
            }
        }
Example #4
0
        public static void damage(Transform structure, Vector3 direction, float damage, float times, bool armor)
        {
            byte            b;
            byte            b2;
            ushort          num;
            StructureRegion structureRegion;

            if (StructureManager.tryGetInfo(structure, out b, out b2, out num, out structureRegion) && !structureRegion.structures[(int)num].structure.isDead)
            {
                if (armor)
                {
                    times *= Provider.modeConfigData.Structures.Armor_Multiplier;
                }
                ushort num2 = (ushort)(damage * times);
                structureRegion.structures[(int)num].structure.askDamage(num2);
                if (structureRegion.structures[(int)num].structure.isDead)
                {
                    ItemStructureAsset itemStructureAsset = (ItemStructureAsset)Assets.find(EAssetType.ITEM, structureRegion.structures[(int)num].structure.id);
                    if (itemStructureAsset != null && itemStructureAsset.explosion != 0)
                    {
                        EffectManager.sendEffect(itemStructureAsset.explosion, EffectManager.SMALL, structure.position + Vector3.down * StructureManager.HEIGHT);
                    }
                    structureRegion.structures.RemoveAt((int)num);
                    StructureManager.manager.channel.send("tellTakeStructure", ESteamCall.ALL, b, b2, StructureManager.STRUCTURE_REGIONS, ESteamPacket.UPDATE_RELIABLE_BUFFER, new object[]
                    {
                        b,
                        b2,
                        num,
                        direction * (float)num2
                    });
                }
                else
                {
                    for (int i = 0; i < Provider.clients.Count; i++)
                    {
                        if (Provider.clients[i].player != null && OwnershipTool.checkToggle(Provider.clients[i].playerID.steamID, structureRegion.structures[(int)num].owner, Provider.clients[i].player.quests.groupID, structureRegion.structures[(int)num].group) && Regions.checkArea(b, b2, Provider.clients[i].player.movement.region_x, Provider.clients[i].player.movement.region_y, StructureManager.STRUCTURE_REGIONS))
                        {
                            StructureManager.manager.channel.send("tellStructureHealth", Provider.clients[i].playerID.steamID, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[]
                            {
                                b,
                                b2,
                                num,
                                (byte)Mathf.RoundToInt((float)structureRegion.structures[(int)num].structure.health / (float)structureRegion.structures[(int)num].structure.asset.health * 100f)
                            });
                        }
                    }
                }
            }
        }
 // Token: 0x060027E0 RID: 10208 RVA: 0x000F1D6C File Offset: 0x000F016C
 public static bool checkCanBuild(Vector3 point, CSteamID owner, CSteamID group, bool isClaim)
 {
     for (int i = 0; i < ClaimManager.bubbles.Count; i++)
     {
         ClaimBubble claimBubble = ClaimManager.bubbles[i];
         if (((!isClaim) ? ((claimBubble.origin - point).sqrMagnitude < claimBubble.sqrRadius) : ((claimBubble.origin - point).sqrMagnitude < 4f * claimBubble.sqrRadius)) && ((!Dedicator.isDedicated) ? (!claimBubble.hasOwnership) : (!OwnershipTool.checkToggle(owner, claimBubble.owner, group, claimBubble.group))))
         {
             return(false);
         }
     }
     return(true);
 }
Example #6
0
 public override void startPrimary()
 {
     if (base.player.equipment.isBusy)
     {
         return;
     }
     if (this.isUseable)
     {
         if (base.channel.isOwner)
         {
             for (int i = 0; i < this.charges.Count; i++)
             {
                 InteractableCharge interactableCharge = this.charges[i];
                 if (!(interactableCharge == null))
                 {
                     RaycastInfo info = new RaycastInfo(interactableCharge.transform);
                     base.player.input.sendRaycast(info);
                 }
             }
             this.charges.Clear();
         }
         if (Provider.isServer)
         {
             this.charges.Clear();
             if (base.player.input.hasInputs())
             {
                 int inputCount = base.player.input.getInputCount();
                 for (int j = 0; j < inputCount; j++)
                 {
                     InputInfo input = base.player.input.getInput(false);
                     if (input != null)
                     {
                         if (input.type == ERaycastInfoType.BARRICADE)
                         {
                             if (!(input.transform == null) && input.transform.CompareTag("Barricade"))
                             {
                                 InteractableCharge component = input.transform.GetComponent <InteractableCharge>();
                                 if (!(component == null))
                                 {
                                     if (!((!Dedicator.isDedicated) ? (!component.hasOwnership) : (!OwnershipTool.checkToggle(base.channel.owner.playerID.steamID, component.owner, base.player.quests.groupID, component.group))))
                                     {
                                         this.charges.Add(component);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         base.player.equipment.isBusy = true;
         this.startedUse   = Time.realtimeSinceStartup;
         this.isUsing      = true;
         this.isDetonating = true;
         this.plunge();
         if (Provider.isServer)
         {
             base.player.life.markAggressive(false, true);
             base.channel.send("askPlunge", ESteamCall.NOT_OWNER, ESteamPacket.UPDATE_UNRELIABLE_BUFFER, new object[0]);
         }
     }
 }
 // Token: 0x0600344D RID: 13389 RVA: 0x001566F7 File Offset: 0x00154AF7
 public static bool checkToggle(ulong player, ulong group)
 {
     return(!Dedicator.isDedicated && OwnershipTool.checkToggle(Provider.client, player, Player.player.quests.groupID, group));
 }