Example #1
0
    public RepairEvent Heal(IDBase healer, float amount)
    {
        RepairEvent repairEvent;

        this.Heal(healer, amount, out repairEvent);
        return(repairEvent);
    }
Example #2
0
    // Token: 0x060003B3 RID: 947 RVA: 0x00011884 File Offset: 0x0000FA84
    public void ClientHealthChange(float amount, GameObject attacker)
    {
        float health = base.health;

        base.AdjustClientSideHealth(amount);
        float num            = Mathf.Abs(amount - health);
        bool  flag           = amount < health;
        float healthFraction = base.healthFraction;

        if (base.localControlled && num >= 1f)
        {
            base.GetComponent <global::LocalDamageDisplay>().SetNewHealthPercent(healthFraction, attacker);
        }
        if (attacker && flag && num >= 1f && (global::ClientVitalsSync.hudDamagePrefab || Facepunch.Bundling.Load <global::HUDDirectionalDamage>("content/hud/DirectionalDamage", out global::ClientVitalsSync.hudDamagePrefab)))
        {
            global::Character character;
            Vector3           worldDamageDirection;
            if (IDBase.GetMain <global::Character>(attacker, ref character))
            {
                worldDamageDirection = base.eyesOrigin - character.eyesOrigin;
            }
            else
            {
                worldDamageDirection = base.origin - attacker.transform.position;
            }
            global::HUDDirectionalDamage.CreateIndicator(worldDamageDirection, (double)amount, global::NetCull.time, 1.6000000238418579, global::ClientVitalsSync.hudDamagePrefab);
        }
        global::RPOS.HealthUpdate(amount);
    }
Example #3
0
    public RepairEvent Heal(IDBase healer, float amount)
    {
        RepairEvent event2;

        this.Heal(healer, amount, out event2);
        return(event2);
    }
Example #4
0
    protected void WriteHitInfo(BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit)
    {
        bool        flag;
        NetEntityID unassigned;

        if (didHit)
        {
            IDBase id = hit.id;
            if ((id != null) && (id.idMain != null))
            {
                unassigned = NetEntityID.Get((MonoBehaviour)id.idMain);
                flag       = !unassigned.isUnassigned;
            }
            else
            {
                flag       = false;
                unassigned = NetEntityID.unassigned;
            }
        }
        else
        {
            unassigned = NetEntityID.unassigned;
            flag       = false;
        }
        this.WriteHitInfo(sendStream, ref ray, didHit, ref hit, flag, unassigned);
    }
Example #5
0
    public virtual void Local_SecondaryFire(ViewModel vm, ItemRepresentation itemRep, IMeleeWeaponItem itemInstance, ref HumanController.InputSample sample)
    {
        RaycastHit raycastHit;
        Character  character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        if (Physics.SphereCast(character.eyesRay, 0.3f, out raycastHit, this.GetRange(), 406721553))
        {
            IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>();
            if (component)
            {
                NetEntityID netEntityID = NetEntityID.Get(component);
                if (component.GetLocal <RepairReceiver>() != null && netEntityID != NetEntityID.unassigned)
                {
                    if (vm)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <NetEntityID>(2, uLink.RPCMode.Server, netEntityID);
                }
            }
        }
    }
Example #6
0
    // Token: 0x06000B80 RID: 2944 RVA: 0x0002D2D4 File Offset: 0x0002B4D4
    public global::RepairEvent Heal(IDBase healer, float amount)
    {
        global::RepairEvent result;

        this.Heal(healer, amount, out result);
        return(result);
    }
Example #7
0
 public void UpdateHealthAmount(IDBase self, float newHealth, bool force = false)
 {
     if (!this.initialized)
     {
         this.initialized = true;
         this.Initialize(self);
     }
     if (this.takeDamage != null)
     {
         this.takeDamage.health = newHealth;
         if (!this.disabled && this.valid)
         {
             float num = this.takeDamage.health / this.takeDamage.maxHealth;
             if ((force || !this.percent.HasValue) || (this.percent.Value != num))
             {
                 Color color;
                 this.percent = new float?(num);
                 this.MakeColor(num, out color);
                 this.propBlock.Clear();
                 this.propBlock.AddColor(PropOnce._Color, color);
                 foreach (MeshRenderer renderer in this.renderers)
                 {
                     if (renderer != null)
                     {
                         renderer.SetPropertyBlock(this.propBlock);
                     }
                 }
             }
         }
     }
 }
Example #8
0
        // Token: 0x0600063E RID: 1598 RVA: 0x00046938 File Offset: 0x00044B38
        public static GameObject GetLineObject(Vector3 start, Vector3 end, out Vector3 point, int layerMask = -1)
        {
            point = Vector3.zero;
            RaycastHit        raycastHit;
            bool              flag2;
            MeshBatchInstance meshBatchInstance;
            bool              flag = !Facepunch.MeshBatch.MeshBatchPhysics.Linecast(start, end, out raycastHit, layerMask, out flag2, out meshBatchInstance);
            GameObject        result;

            if (flag)
            {
                result = null;
            }
            else
            {
                IDMain idmain = flag2 ? meshBatchInstance.idMain : IDBase.GetMain(raycastHit.collider);
                point = raycastHit.point;
                bool flag3 = !(idmain != null);
                if (flag3)
                {
                    result = raycastHit.collider.gameObject;
                }
                else
                {
                    result = idmain.gameObject;
                }
            }
            return(result);
        }
Example #9
0
    // Token: 0x06000426 RID: 1062 RVA: 0x00014C84 File Offset: 0x00012E84
    private static bool GetCharacterStuff(ref global::ConsoleSystem.Arg args, out global::Character character, out global::CameraMount camera, out global::ItemRepresentation itemRep, out global::ArmorModelRenderer armor)
    {
        character = null;
        itemRep   = null;
        armor     = null;
        camera    = global::CameraMount.current;
        if (!camera)
        {
            args.ReplyWith("Theres no active camera mount.");
            return(false);
        }
        character = (IDBase.GetMain(camera) as global::Character);
        if (!character)
        {
            args.ReplyWith("theres no character for the current mounted camera");
            return(false);
        }
        armor = character.GetLocal <global::ArmorModelRenderer>();
        global::InventoryHolder local = character.GetLocal <global::InventoryHolder>();

        if (local)
        {
            itemRep = local.itemRepresentation;
        }
        return(true);
    }
Example #10
0
 public bool Open(string dbpath, ref string msg)
 {
     try
     {
         DBaseFactory  factory = new DBaseFactory();
         DBConnectInfo info    = new DBConnectInfo()
         {
             DataSource = dbpath
         };
         ODMDB = factory.CreateInitialDbClass(DBkind.Access2013, DbOptKind.Oledb, info);
         if (ODMDB.ConnectionState == ConnectionState.Closed)
         {
             ODMDB.DbConnection.Open();
         }
         DatabaseFilePath = dbpath;
         Name             = Path.GetFileNameWithoutExtension(dbpath);
         msg = "successful";
         return(true);
     }
     catch (Exception ex)
     {
         msg = ex.Message;
         return(false);
     }
 }
Example #11
0
 private bool SurfaceForCollider(Collider collider, ref ExplosionHelper.Surface surface)
 {
     if (!collider.enabled)
     {
         surface = new ExplosionHelper.Surface();
         return false;
     }
     surface.idBase = IDBase.Get(collider);
     if (surface.idBase == null)
     {
         surface = new ExplosionHelper.Surface();
         return false;
     }
     surface.idMain = surface.idBase.idMain;
     if ((surface.idMain == null) || (surface.idMain == this.skip))
     {
         surface = new ExplosionHelper.Surface();
         return false;
     }
     surface.bounds = collider.bounds;
     if (!this.BoundsWork(ref surface.bounds, ref surface.work))
     {
         return false;
     }
     if (this.raycastLayerMask != 0)
     {
         RaycastHit hit;
         surface.blocked = ((surface.work.rayTest && collider.Raycast(new Ray(this.point, surface.work.rayDir), out hit, surface.work.rayDistance)) && Physics.Raycast(this.point, surface.work.rayDir, out hit, hit.distance, this.raycastLayerMask)) && (hit.collider != collider);
     }
     return true;
 }
    // Token: 0x06002E81 RID: 11905 RVA: 0x000B2BF4 File Offset: 0x000B0DF4
    private void Initialize(IDBase self)
    {
        global::TakeDamage local;

        MeshRenderer[] componentsInChildren;
        Material       material;

        if (!self || !(local = self.GetLocal <global::TakeDamage>()) || !global::HealthDimmer.GetFirstMaterial <MeshRenderer>(componentsInChildren = self.GetComponentsInChildren <MeshRenderer>(true), out material))
        {
            this.renderers  = null;
            this.valid      = false;
            this.takeDamage = null;
        }
        else
        {
            this.renderers      = componentsInChildren;
            this.takeDamage     = local;
            this.valid          = true;
            this.structureStyle = (self.idMain is global::StructureComponent);
            Color color = material.GetColor(global::HealthDimmer.PropOnce._Color);
            this.averageRGB = (color.r + color.g + color.b) * 0.333333343f;
            this.propBlock  = new MaterialPropertyBlock();
            this.percent    = null;
        }
    }
Example #13
0
    private void Initialize(IDBase self)
    {
        Material material;

        MeshRenderer[] rendererArray;
        TakeDamage     damage;

        if (((self == null) || ((damage = self.GetLocal <TakeDamage>()) == null)) || !GetFirstMaterial <MeshRenderer>(rendererArray = self.GetComponentsInChildren <MeshRenderer>(true), out material))
        {
            this.renderers  = null;
            this.valid      = false;
            this.takeDamage = null;
        }
        else
        {
            this.renderers      = rendererArray;
            this.takeDamage     = damage;
            this.valid          = true;
            this.structureStyle = self.idMain is StructureComponent;
            Color color = material.GetColor(PropOnce._Color);
            this.averageRGB = ((color.r + color.g) + color.b) * 0.3333333f;
            this.propBlock  = new MaterialPropertyBlock();
            this.percent    = null;
        }
    }
    // Token: 0x06003536 RID: 13622 RVA: 0x000C3AF8 File Offset: 0x000C1CF8
    public virtual void Local_SecondaryFire(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::Character character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        Ray        eyesRay = character.eyesRay;
        RaycastHit raycastHit;
        bool       flag = Physics.SphereCast(eyesRay, 0.3f, ref raycastHit, this.GetRange(), 406721553);

        if (flag)
        {
            IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>();
            if (component)
            {
                global::NetEntityID    netEntityID = global::NetEntityID.Get(component);
                global::RepairReceiver local       = component.GetLocal <global::RepairReceiver>();
                if (local != null && netEntityID != global::NetEntityID.unassigned)
                {
                    if (vm)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <global::NetEntityID>(2, 0, netEntityID);
                }
            }
        }
    }
    protected void WriteHitInfo(uLink.BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit)
    {
        bool        flag;
        NetEntityID netEntityID;

        if (!didHit)
        {
            netEntityID = NetEntityID.unassigned;
            flag        = false;
        }
        else
        {
            IDBase dBase = hit.id;
            if (!dBase || !dBase.idMain)
            {
                flag        = false;
                netEntityID = NetEntityID.unassigned;
            }
            else
            {
                netEntityID = NetEntityID.Get(dBase.idMain);
                flag        = !netEntityID.isUnassigned;
            }
        }
        this.WriteHitInfo(sendStream, ref ray, didHit, ref hit, flag, netEntityID);
    }
Example #16
0
        private bool SurfaceForCollider(Collider collider, ref ExplosionHelper.Surface surface)
        {
            RaycastHit raycastHit;

            if (!collider.enabled)
            {
                surface = new ExplosionHelper.Surface();
                return(false);
            }
            surface.idBase = IDBase.Get(collider);
            if (!surface.idBase)
            {
                surface = new ExplosionHelper.Surface();
                return(false);
            }
            surface.idMain = surface.idBase.idMain;
            if (!surface.idMain || surface.idMain == this.skip)
            {
                surface = new ExplosionHelper.Surface();
                return(false);
            }
            surface.bounds = collider.bounds;
            if (!this.BoundsWork(ref surface.bounds, ref surface.work))
            {
                return(false);
            }
            if (this.raycastLayerMask != 0)
            {
                surface.blocked = (!surface.work.rayTest || !collider.Raycast(new Ray(this.point, surface.work.rayDir), out raycastHit, surface.work.rayDistance) || !Physics.Raycast(this.point, surface.work.rayDir, out raycastHit, raycastHit.distance, this.raycastLayerMask) ? false : raycastHit.collider != collider);
            }
            return(true);
        }
Example #17
0
        public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
        {
            string str = "";

            for (int i = 0; i < ChatArguments.Length; i++)
            {
                str = str + ChatArguments[i] + " ";
            }
            str = str.Trim();
            PlayerClient client = null;

            foreach (PlayerClient client2 in PlayerClient.All)
            {
                if (client2.netUser.displayName.ToLower() == str.ToLower())
                {
                    client = client2;
                }
            }
            if (client != null)
            {
                try
                {
                    Character character;
                    Character.FindByUser(client.userID, out character);
                    IDBase victim = character;
                    TakeDamage.Kill(Arguments.argUser.playerClient, victim, null);
                    Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You killed " + client.netUser.displayName);
                    Util.sayUser(client.netPlayer, Core.Name, Arguments.argUser.displayName + " killed you with his admin power.");
                }
                catch (Exception ex)
                {
                    Logger.LogException(ex);
                }
            }
        }
 // Token: 0x06002E65 RID: 11877 RVA: 0x000B2410 File Offset: 0x000B0610
 private bool SurfaceForCollider(Collider collider, ref global::ExplosionHelper.Surface surface)
 {
     if (!collider.enabled)
     {
         surface = default(global::ExplosionHelper.Surface);
         return(false);
     }
     surface.idBase = IDBase.Get(collider);
     if (!surface.idBase)
     {
         surface = default(global::ExplosionHelper.Surface);
         return(false);
     }
     surface.idMain = surface.idBase.idMain;
     if (!surface.idMain || surface.idMain == this.skip)
     {
         surface = default(global::ExplosionHelper.Surface);
         return(false);
     }
     surface.bounds = collider.bounds;
     if (this.BoundsWork(ref surface.bounds, ref surface.work))
     {
         if (this.raycastLayerMask != 0)
         {
             RaycastHit raycastHit;
             surface.blocked = (surface.work.rayTest && collider.Raycast(new Ray(this.point, surface.work.rayDir), ref raycastHit, surface.work.rayDistance) && Physics.Raycast(this.point, surface.work.rayDir, ref raycastHit, raycastHit.distance, this.raycastLayerMask) && raycastHit.collider != collider);
         }
         return(true);
     }
     return(false);
 }
Example #19
0
    // Token: 0x06003317 RID: 13079 RVA: 0x000C0B7C File Offset: 0x000BED7C
    protected void WriteHitInfo(BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit)
    {
        global::NetEntityID hitView;
        bool hitNetworkView;

        if (didHit)
        {
            IDBase id = hit.id;
            if (id && id.idMain)
            {
                hitView        = global::NetEntityID.Get(id.idMain);
                hitNetworkView = !hitView.isUnassigned;
            }
            else
            {
                hitNetworkView = false;
                hitView        = global::NetEntityID.unassigned;
            }
        }
        else
        {
            hitView        = global::NetEntityID.unassigned;
            hitNetworkView = false;
        }
        this.WriteHitInfo(sendStream, ref ray, didHit, ref hit, hitNetworkView, hitView);
    }
Example #20
0
 void DestroyEntity(IDBase idbase)
 {
     if (idbase != null)
     {
         TakeDamage.KillSelf(idbase);
     }
 }
Example #21
0
        public IDBase CreateInitialDbClass(DBkind dbkind, DbOptKind optkind, DBConnectInfo info)
        {
            switch (optkind)
            {
            case DbOptKind.Oledb:
                oledbOptDbase = new OleDBase(dbkind, info);
                break;

#if UseOracle
            case DbOptKind.OracleClient:
                oralclientOptDbase = new OracleDbase(info);
                break;
#endif
            default:
                break;
            }
            IDBase result = null;
            if (optkind == DbOptKind.Oledb)
            {
                result = oledbOptDbase;
            }
#if UseOracle
            else
            {
                result = oralclientOptDbase;
            }
#endif
            return(result);
        }
Example #22
0
    public void ClientHealthChange(float amount, GameObject attacker)
    {
        float health = base.health;

        base.AdjustClientSideHealth(amount);
        float num2           = amount;
        float num3           = Mathf.Abs((float)(num2 - health));
        bool  flag           = amount < health;
        float healthFraction = base.healthFraction;

        if (base.localControlled && (num3 >= 1f))
        {
            base.GetComponent <LocalDamageDisplay>().SetNewHealthPercent(healthFraction, attacker);
        }
        if ((((attacker != null) && flag) && (num3 >= 1f)) && ((hudDamagePrefab != null) || Bundling.Load <HUDDirectionalDamage>("content/hud/DirectionalDamage", out hudDamagePrefab)))
        {
            Vector3   vector;
            Character character;
            if (IDBase.GetMain <Character>(attacker, out character))
            {
                vector = base.eyesOrigin - character.eyesOrigin;
            }
            else
            {
                vector = base.origin - attacker.transform.position;
            }
            HUDDirectionalDamage.CreateIndicator(vector, (double)amount, NetCull.time, 1.6000000238418579, hudDamagePrefab);
        }
        RPOS.HealthUpdate(amount);
    }
Example #23
0
    private void Initialize(IDBase self)
    {
        Material material;

        if (self)
        {
            TakeDamage local      = self.GetLocal <TakeDamage>();
            TakeDamage takeDamage = local;
            if (local)
            {
                MeshRenderer[] componentsInChildren = self.GetComponentsInChildren <MeshRenderer>(true);
                MeshRenderer[] meshRendererArray    = componentsInChildren;
                if (!HealthDimmer.GetFirstMaterial <MeshRenderer>(componentsInChildren, out material))
                {
                    this.renderers  = null;
                    this.valid      = false;
                    this.takeDamage = null;
                    return;
                }
                this.renderers      = meshRendererArray;
                this.takeDamage     = takeDamage;
                this.valid          = true;
                this.structureStyle = self.idMain is StructureComponent;
                Color color = material.GetColor(HealthDimmer.PropOnce._Color);
                this.averageRGB = (color.r + color.g + color.b) * 0.333333343f;
                this.propBlock  = new MaterialPropertyBlock();
                this.percent    = null;
                return;
            }
        }
        this.renderers  = null;
        this.valid      = false;
        this.takeDamage = null;
    }
Example #24
0
    public virtual void FireSingleBullet(uLink.BitStream sendStream, Ray ray, ItemRepresentation itemRep, out Component hitComponent, out bool allowBlood)
    {
        RaycastHit2 raycastHit2;
        Vector3     point;
        IDMain      dMain;
        Component   component;
        IDMain      dMain1;
        NetEntityID netEntityID = NetEntityID.unassigned;
        bool        flag        = false;
        bool        flag1       = Physics2.Raycast2(ray, out raycastHit2, this.GetBulletRange(itemRep), 406721553);

        if (!flag1)
        {
            dMain        = null;
            point        = ray.GetPoint(this.GetBulletRange(itemRep));
            hitComponent = null;
        }
        else
        {
            point = raycastHit2.point;
            IDBase dBase = raycastHit2.id;
            if (!raycastHit2.remoteBodyPart)
            {
                component = raycastHit2.collider;
            }
            else
            {
                component = raycastHit2.remoteBodyPart;
            }
            hitComponent = component;
            if (!dBase)
            {
                dMain1 = null;
            }
            else
            {
                dMain1 = dBase.idMain;
            }
            dMain = dMain1;
            if (dMain)
            {
                netEntityID = NetEntityID.Get(dMain);
                if (!netEntityID.isUnassigned)
                {
                    TakeDamage takeDamage = dMain.GetComponent <TakeDamage>();
                    if (takeDamage)
                    {
                        flag = true;
                        if (takeDamage.ShouldPlayHitNotification())
                        {
                            this.PlayHitNotification(point, null);
                        }
                    }
                }
            }
        }
        this.WriteHitInfo(sendStream, ref ray, flag1, ref raycastHit2, flag, netEntityID);
        allowBlood = (!flag1 ? false : flag);
    }
Example #25
0
        private static bool smethod_0(TruthDetector truthDetector_0, Vector3 vector3_0, ref Vector3 vector3_1)
        {
            RaycastHit        hit;
            bool              flag;
            MeshBatchInstance instance;
            Vector3           vector = vector3_1 - vector3_0;

            if (vector.magnitude == 0f)
            {
                return(false);
            }
            Ray ray = new Ray(vector3_0 + new Vector3(0f, 0.75f, 0f), vector.normalized);

            if (!Facepunch.MeshBatch.MeshBatchPhysics.SphereCast(ray, 0.1f, out hit, vector.magnitude, 0x20180403, out flag, out instance))
            {
                return(false);
            }
            IDMain             main      = flag ? instance.idMain : IDBase.GetMain(hit.collider);
            GameObject         obj2      = (main != null) ? main.gameObject : hit.collider.gameObject;
            string             newValue  = obj2.name.Trim();
            DeployableObject   obj3      = obj2.GetComponent <DeployableObject>();
            StructureComponent component = obj2.GetComponent <StructureComponent>();

            if (newValue == "")
            {
                newValue = "Mesh Texture";
            }
            else if (obj3 != null)
            {
                newValue = Helper.NiceName(obj3.name);
                if (truthDetector_0.netUser.userID == obj3.ownerID)
                {
                    return(false);
                }
                if (Users.SharedGet(obj3.ownerID, truthDetector_0.netUser.userID))
                {
                    return(false);
                }
            }
            else if (component != null)
            {
                newValue = Helper.NiceName(component.name);
                if (truthDetector_0.netUser.userID == component._master.ownerID)
                {
                    return(false);
                }
                if (Users.SharedGet(component._master.ownerID, truthDetector_0.netUser.userID))
                {
                    return(false);
                }
            }
            PunishDetails = Config.GetMessageTruth("Truth.Punish.Reason.WallHack", truthDetector_0.netUser, "", 0, new DateTime());
            PunishDetails = PunishDetails.Replace("%OBJECT.NAME%", newValue);
            PunishDetails = PunishDetails.Replace("%OBJECT.POS%", hit.point.AsString());
            HackDetected  = HackMethod.WallHack;
            vector3_1     = MoveBack(truthDetector_0, vector3_0, vector3_1);
            return(true);
        }
 // Token: 0x06000269 RID: 617 RVA: 0x0000CEF8 File Offset: 0x0000B0F8
 public void TryReportHit(GameObject hitGameObject)
 {
     if (this._myItemInstance != null && !this.reported)
     {
         this.reported = true;
         IDMain main = IDBase.GetMain(hitGameObject);
         this._myItemInstance.ArrowReportHit(main, this);
     }
 }
Example #27
0
    public Character GetFromCollider(Collider other)
    {
        IDBase base2 = IDBase.Get(other);

        if (base2 == null)
        {
            return(null);
        }
        return(base2.idMain as Character);
    }
Example #28
0
    // Token: 0x0600034B RID: 843 RVA: 0x00010354 File Offset: 0x0000E554
    public global::Character GetFromCollider(Collider other)
    {
        IDBase idbase = IDBase.Get(other);

        if (!idbase)
        {
            return(null);
        }
        return(idbase.idMain as global::Character);
    }
Example #29
0
    public Character GetFromCollider(Collider other)
    {
        IDBase dBase = IDBase.Get(other);

        if (!dBase)
        {
            return(null);
        }
        return(dBase.idMain as Character);
    }
        public static EventTimer TimeEvent_TeleportTo(NetUser Sender, NetUser Target, string Command, double time)
        {
            Class38 class2 = new Class38 {
                netUser_0 = Sender,
                netUser_1 = Target,
                string_0  = Command
            };

            if (Core.CommandTeleportOutdoorsOnly)
            {
                foreach (Collider collider in Physics.OverlapSphere(class2.netUser_1.playerClient.controllable.character.transform.position, 1f, 0x10360401))
                {
                    IDMain main = IDBase.GetMain(collider);
                    if (main != null)
                    {
                        StructureMaster component = main.GetComponent <StructureMaster>();
                        if (((component != null) && (component.ownerID != class2.netUser_0.userID)) && (component.ownerID != class2.netUser_1.userID))
                        {
                            UserData bySteamID = Users.GetBySteamID(component.ownerID);
                            if ((bySteamID == null) || (!bySteamID.HasShared(class2.netUser_0.userID) && !bySteamID.HasShared(class2.netUser_1.userID)))
                            {
                                Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessage("Command.Teleport.NoTeleport", class2.netUser_0, class2.netUser_1.displayName), 5f);
                                Broadcast.Notice(class2.netUser_1, "☢", Config.GetMessage("Command.Teleport.NotHere", class2.netUser_1, class2.netUser_0.displayName), 5f);
                                return(null);
                            }
                        }
                    }
                }
            }
            Broadcast.Message(class2.netUser_0, Config.GetMessage("Command.Teleport.IsConfirm", class2.netUser_0, null).Replace("%USERNAME%", class2.netUser_1.displayName), null, 0f);
            Broadcast.Message(class2.netUser_1, Config.GetMessage("Command.Teleport.Confirmed", class2.netUser_1, null).Replace("%USERNAME%", class2.netUser_0.displayName), null, 0f);
            if (!Character.FindByUser(class2.netUser_1.userID, out class2.character_0))
            {
                return(null);
            }
            if (time <= 0.0)
            {
                Teleport_PlayerTo(null, class2.netUser_0, class2.netUser_1, class2.string_0, class2.character_0.transform.position);
                return(null);
            }
            EventTimer timer = new EventTimer {
                Interval  = time * 1000.0,
                AutoReset = false
            };

            timer.Elapsed += new ElapsedEventHandler(class2.method_0);
            timer.Sender   = class2.netUser_0;
            timer.Target   = class2.netUser_1;
            timer.Command  = class2.string_0;
            Broadcast.Notice(class2.netUser_0, "☢", Config.GetMessage("Command.Teleport.Timewait", class2.netUser_0, null).Replace("%TIME%", timer.TimeLeft.ToString()), 5f);
            Broadcast.Notice(class2.netUser_1, "☢", Config.GetMessage("Command.Teleport.Timewait", class2.netUser_1, null).Replace("%TIME%", timer.TimeLeft.ToString()), 5f);
            timer.Start();
            return(timer);
        }
Example #31
0
 public new bool AssignedControlOf(IDBase idBase)
 {
     return (!this.ch.vl || !idBase ? false : this.idMain == idBase.idMain);
 }
Example #32
0
 public new bool OverridingControlOf(IDBase idBase)
 {
     if (!this.ch.vl || this.ch.nm == 0 || !idBase)
     {
         return false;
     }
     return this.OverridingControlOf(idBase.idMain);
 }
Example #33
0
 public new bool ControlOverriddenBy(IDBase idBase)
 {
     if (!this.ch.vl || this.ch.ln == 0 || !idBase)
     {
         return false;
     }
     return this.ControlOverriddenBy(idBase.idMain);
 }
Example #34
0
 public static LifeStatus HurtSelf(IDBase victim, TakeDamage.Quantity damageQuantity, object extraData = null)
 {
     return TakeDamage.HurtShared(victim, victim, damageQuantity, extraData);
 }
Example #35
0
 public new RelativeControl RelativeControlTo(IDBase idBase)
 {
     if (!idBase)
     {
         return RelativeControl.Incompatible;
     }
     return this.RelativeControlTo(idBase.idMain as Character);
 }
Example #36
0
 public static bool GetIDBaseFromCollider(Collider collider, out IDBase id)
 {
     if (!collider)
     {
         id = null;
         return false;
     }
     id = IDBase.Get(collider);
     if (id)
     {
         return true;
     }
     Rigidbody rigidbody = collider.attachedRigidbody;
     if (!rigidbody)
     {
         return false;
     }
     id = rigidbody.GetComponent<IDBase>();
     return id;
 }
Example #37
0
 public static LifeStatus Kill(IDBase attacker, IDBase victim, object extraData = null)
 {
     return TakeDamage.HurtShared(attacker, victim, TakeDamage.Quantity.AllHealth, extraData);
 }
Example #38
0
 public static LifeStatus KillSelf(IDBase victim, out DamageEvent damage, object extraData = null)
 {
     return TakeDamage.HurtShared(victim, victim, TakeDamage.Quantity.AllHealth, out damage, extraData);
 }
Example #39
0
 public RepairEvent Heal(IDBase healer, float amount)
 {
     RepairEvent repairEvent;
     this.Heal(healer, amount, out repairEvent);
     return repairEvent;
 }
Example #40
0
 private static LifeStatus HurtShared(IDBase attacker, IDBase victim, TakeDamage.Quantity damageQuantity, object extraData = null)
 {
     DamageEvent damageEvent;
     return TakeDamage.HurtShared(attacker, victim, damageQuantity, out damageEvent, extraData);
 }
Example #41
0
 private static LifeStatus HurtShared(IDBase attacker, IDBase victim, TakeDamage.Quantity damageQuantity, out DamageEvent damage, object extraData = null)
 {
     damage = new DamageEvent();
     TakeDamage takeDamage;
     if (victim)
     {
         IDMain dMain = victim.idMain;
         if (dMain)
         {
             takeDamage = (!(dMain is Character) ? dMain.GetLocal<TakeDamage>() : ((Character)dMain).takeDamage);
             if (takeDamage && !takeDamage.takenodamage)
             {
                 takeDamage.MarkDamageTime();
                 damage.victim.id = victim;
                 damage.attacker.id = attacker;
                 damage.amount = damageQuantity.@value;
                 damage.sender = takeDamage;
                 damage.status = (!takeDamage.dead ? LifeStatus.IsAlive : LifeStatus.IsDead);
                 damage.damageTypes = (DamageTypeFlags)0;
                 damage.extraData = extraData;
                 if ((int)damageQuantity.Unit == -1)
                 {
                     takeDamage.ApplyDamageTypeList(ref damage, damageQuantity.list);
                 }
                 takeDamage.Hurt(ref damage);
                 return damage.status;
             }
         }
     }
     damage.victim.id = null;
     damage.attacker.id = null;
     damage.amount = 0f;
     damage.sender = null;
     damage.damageTypes = (DamageTypeFlags)0;
     damage.status = LifeStatus.Failed;
     damage.extraData = extraData;
     return LifeStatus.Failed;
 }
Example #42
0
 public RepairStatus Heal(IDBase healer, float amount, out RepairEvent repair)
 {
     repair = new RepairEvent();
     repair.doner = healer;
     repair.receiver = this;
     repair.givenAmount = amount;
     if (amount <= 0f)
     {
         repair.status = RepairStatus.Failed;
         repair.usedAmount = 0f;
         return RepairStatus.Failed;
     }
     if (this.dead)
     {
         repair.status = RepairStatus.FailedUnreparable;
         repair.usedAmount = 0f;
     }
     else if (this._health == this._maxHealth)
     {
         repair.status = RepairStatus.FailedFull;
         repair.usedAmount = 0f;
     }
     else if (this._health <= this._maxHealth - amount)
     {
         TakeDamage takeDamage = this;
         takeDamage._health = takeDamage._health + amount;
         repair.usedAmount = repair.givenAmount;
         if (this._health != this._maxHealth)
         {
             repair.status = RepairStatus.Applied;
         }
         else
         {
             repair.status = RepairStatus.AppliedFull;
         }
     }
     else
     {
         this._health = this._maxHealth;
         repair.usedAmount = this._maxHealth - this._health;
         repair.status = RepairStatus.AppliedPartial;
     }
     if (this.sendMessageRepair)
     {
         base.SendMessage("OnRepair", repair, SendMessageOptions.DontRequireReceiver);
     }
     return repair.status;
 }