Ejemplo n.º 1
0
        private static void OnInt64PropertyChange(Entity sender, Int64PropertyChangeEventArgs args)
        {
            if (args.NewValue == args.OldValue)
            {
                return;
            }

            if (args.PropertyName == "m_iIsControllableByPlayer64")
            {
                UpdateManager.BeginInvoke(() => EntityManager9.ChangeEntityControl(sender));
            }
        }
Ejemplo n.º 2
0
 // Token: 0x060003BB RID: 955 RVA: 0x0001D3F4 File Offset: 0x0001B5F4
 private void OnInt64PropertyChange(Entity sender, Int64PropertyChangeEventArgs args)
 {
     if (args.NewValue == args.OldValue)
     {
         return;
     }
     try
     {
         string propertyName = args.PropertyName;
         if (propertyName == "m_iIsControllableByPlayer64")
         {
             UpdateManager.BeginInvoke(delegate
             {
                 EntityManager9.ChangeEntityControl(sender);
             }, 0);
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
Ejemplo n.º 3
0
        private void OnNetworkPropertyChanged(Entity sender, NetworkPropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "m_bReincarnating":
            {
                var newValue = e.NewValue.GetBoolean();
                if (newValue == e.OldValue.GetBoolean())
                {
                    break;
                }

                UpdateManager.BeginInvoke(() =>
                    {
                        var unit = (Hero9)EntityManager9.GetUnitFast(sender.Handle);
                        if (unit == null)
                        {
                            return;
                        }

                        unit.IsReincarnating = newValue;
                    });
            }
            break;

            case "m_iIsControllableByPlayer64":
            {
                if (e.NewValue.GetInt64() == e.OldValue.GetInt64())
                {
                    break;
                }

                UpdateManager.BeginInvoke(() =>
                    {
                        EntityManager9.ChangeEntityControl(sender);
                    });
            }
            break;

            case "m_hKillCamUnit":
            {
                if (e.NewValue.GetUInt32() == e.OldValue.GetUInt32())
                {
                    break;
                }

                UpdateManager.BeginInvoke(() =>
                    {
                        if (sender.Team == this.allyTeam)
                        {
                            return;
                        }

                        var entity = e.NewValue.GetEntity();
                        if (entity == null || !entity.IsValid)
                        {
                            return;
                        }

                        var handle = ((Player)sender).Hero?.Handle;
                        var unit   = (Hero9)EntityManager9.GetUnitFast(handle);
                        if (unit == null)
                        {
                            return;
                        }

                        UpdateManager.BeginInvoke(500, () => RespawnUnit(unit));
                    });
            }
            break;

            case "m_iHealth":
            {
                var newValue = e.NewValue.GetInt32();
                if (newValue == e.OldValue.GetInt32())
                {
                    break;
                }

                UpdateManager.BeginInvoke(() =>
                    {
                        var unit = EntityManager9.GetUnitFast(sender.Handle);
                        if (unit == null)
                        {
                            return;
                        }

                        if (newValue > 0)
                        {
                            this.UnitHealthChange?.Invoke(unit, newValue);
                        }
                        else
                        {
                            unit.DeathTime = GameManager.RawGameTime;

                            this.AttackStopped(unit);
                            this.attackSleeper.Remove(unit.Handle);

                            this.UnitDied?.Invoke(unit);
                        }
                    });
            }
            break;

            case "m_NetworkActivity":
            {
                var newValue = e.NewValue.GetInt32();
                if (newValue == e.OldValue.GetInt32())
                {
                    break;
                }

                UpdateManager.BeginInvoke(() =>
                    {
                        var unit = EntityManager9.GetUnitFast(sender.Handle);
                        if (unit == null)
                        {
                            return;
                        }

                        if (this.attackActivities.Contains(newValue))
                        {
                            this.AttackStarted(unit);
                        }
                        else
                        {
                            this.AttackStopped(unit);
                        }
                    });
            }
            break;
            }
        }