private void LaserTurbineController_OnStartServer(On.RoR2.LaserTurbineController.orig_OnStartServer orig, LaserTurbineController self)
        {
            _pseudoInitialSpin  = self.minSpin;
            _pseudoSnapshotTime = _runNow;

            orig(self);
        }
Ejemplo n.º 2
0
 private void FireEquipment()
 {
     if (this.master.GetBody().equipmentSlot.ExecuteIfReady())
     {
         lastEquipmentUse = Run.FixedTimeStamp.now;
     }
 }
        // Token: 0x060022C4 RID: 8900 RVA: 0x00096F90 File Offset: 0x00095190
        private EquipmentIcon.DisplayData GenerateDisplayData()
        {
            EquipmentIcon.DisplayData result         = default(EquipmentIcon.DisplayData);
            EquipmentIndex            equipmentIndex = EquipmentIndex.None;

            if (this.targetInventory)
            {
                EquipmentState equipmentState;
                if (this.displayAlternateEquipment)
                {
                    equipmentState           = this.targetInventory.alternateEquipmentState;
                    result.hideEntireDisplay = (this.targetInventory.GetEquipmentSlotCount() <= 1);
                }
                else
                {
                    equipmentState           = this.targetInventory.currentEquipmentState;
                    result.hideEntireDisplay = false;
                }
                Run.FixedTimeStamp now = Run.FixedTimeStamp.now;
                Run.FixedTimeStamp chargeFinishTime = equipmentState.chargeFinishTime;
                equipmentIndex       = equipmentState.equipmentIndex;
                result.cooldownValue = (chargeFinishTime.isInfinity ? 0 : Mathf.CeilToInt(chargeFinishTime.timeUntilClamped));
                result.stock         = (int)equipmentState.charges;
                result.maxStock      = (this.targetEquipmentSlot ? this.targetEquipmentSlot.maxStock : 1);
            }
            else if (this.displayAlternateEquipment)
            {
                result.hideEntireDisplay = true;
            }
            result.equipmentDef = EquipmentCatalog.GetEquipmentDef(equipmentIndex);
            return(result);
        }
        private void GenerateEntriesServer(Run.FixedTimeStamp startTime)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.RouletteChestController::GenerateEntriesServer(RoR2.Run/FixedTimeStamp)' called on client");
                return;
            }
            Array.Resize <RouletteChestController.Entry>(ref this.entries, this.maxEntries);
            for (int i = 0; i < this.entries.Length; i++)
            {
                RouletteChestController.Entry[] array = this.entries;
                int num = i;
                array[num].endTime = startTime + this.CalcEntryDuration(i);
                startTime          = array[num].endTime;
            }
            PickupIndex b = PickupIndex.none;

            for (int j = 0; j < this.entries.Length; j++)
            {
                RouletteChestController.Entry[] array2 = this.entries;
                int         num2        = j;
                PickupIndex pickupIndex = this.dropTable.GenerateDrop(this.rng);
                if (pickupIndex == b)
                {
                    pickupIndex = this.dropTable.GenerateDrop(this.rng);
                }
                array2[num2].pickupIndex = pickupIndex;
                b = pickupIndex;
            }
            base.SetDirtyBit(RouletteChestController.entriesDirtyBit);
        }
 // Token: 0x06000D88 RID: 3464 RVA: 0x0003CD18 File Offset: 0x0003AF18
 public EquipmentState(EquipmentIndex equipmentIndex, Run.FixedTimeStamp chargeFinishTime, byte charges)
 {
     this.equipmentIndex   = equipmentIndex;
     this.chargeFinishTime = chargeFinishTime;
     this.charges          = charges;
     this.dirty            = true;
     this.equipmentDef     = EquipmentCatalog.GetEquipmentDef(equipmentIndex);
 }
        // Token: 0x06000D8C RID: 3468 RVA: 0x0003CDD4 File Offset: 0x0003AFD4
        public static EquipmentState Deserialize(NetworkReader reader)
        {
            EquipmentIndex equipmentIndex = reader.ReadEquipmentIndex();

            Run.FixedTimeStamp fixedTimeStamp = reader.ReadFixedTimeStamp();
            byte b = reader.ReadByte();

            return(new EquipmentState(equipmentIndex, fixedTimeStamp, b));
        }
 // Token: 0x06002E6F RID: 11887 RVA: 0x000C55FB File Offset: 0x000C37FB
 public override void OnEnter()
 {
     base.OnEnter();
     if (base.isAuthority)
     {
         this.startTime = Run.FixedTimeStamp.now;
         this.readyTime = this.startTime + RechargeState.baseDuration;
     }
 }
        // Token: 0x06001186 RID: 4486 RVA: 0x0004CAE4 File Offset: 0x0004ACE4
        private PickupIndex GetPickupIndexForTime(Run.FixedTimeStamp time)
        {
            int entryIndexForTime = this.GetEntryIndexForTime(time);

            if (entryIndexForTime != -1)
            {
                return(this.entries[entryIndexForTime].pickupIndex);
            }
            return(PickupIndex.none);
        }
 // Token: 0x06000DD5 RID: 3541 RVA: 0x0003E13C File Offset: 0x0003C33C
 private void FixedUpdate()
 {
     Run.FixedTimeStamp now = Run.FixedTimeStamp.now;
     this.spin   = this.spinChargeState.CalcCurrentSpinValue(now, this.spinDecayRate, this.minSpin);
     this.charge = this.spinChargeState.CalcCurrentChargeValue(now, this.spinDecayRate, this.minSpin);
     if (this.turbineDisplayRoot)
     {
         this.turbineDisplayRoot.gameObject.SetActive(this.showTurbineDisplay);
     }
 }
            // Token: 0x06000DE4 RID: 3556 RVA: 0x0003E4CC File Offset: 0x0003C6CC
            public float CalcCurrentChargeValue(Run.FixedTimeStamp currentTime, float spinDecayRate, float minSpin)
            {
                float num  = currentTime - this.snapshotTime;
                float num2 = minSpin * num;
                float num3 = this.initialSpin - minSpin;
                float t    = Mathf.Min(Trajectory.CalculateFlightDuration(num3, -spinDecayRate) * 0.5f, num);
                float num4 = Trajectory.CalculatePositionYAtTime(0f, num3, t, -spinDecayRate);

                return(Mathf.Min(this.initialCharge + num2 + num4, 1f));
            }
        //well this was a failure. I am very glad we have a public reference to charge
        //at least the spin calculation wasn't a similarly colossal failure

        // god f****n dammit now i need this to work so I can calculate the overcharge
        private float pseudoCalculateCharge(Run.FixedTimeStamp now, LaserTurbineController self)
        {
            float num  = now - _pseudoSnapshotTime;
            float num2 = self.minSpin * num;
            float num3 = _pseudoInitialSpin - self.minSpin;
            float t    = Mathf.Min(Trajectory.CalculateFlightDuration(num3, -self.spinDecayRate) * 0.5f, num);
            float num4 = Trajectory.CalculatePositionYAtTime(0f, num3, t, -self.spinDecayRate);

            return(Mathf.Min(_pseudoInitialCharge + num2 + num4, 1f));
        }
        public void LoadEquipment(Inventory inventory, byte equipmentSlot)
        {
            var chargeTime = new Run.FixedTimeStamp(chargeFinishTime);
            var state      = new EquipmentState(
                (EquipmentIndex)index,
                chargeTime,
                charges
                );

            inventory.SetEquipment(state, equipmentSlot);
        }
        private void UpdateEquipment()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.Inventory::UpdateEquipment()' called on client");
                return;
            }
            Run.FixedTimeStamp now = Run.FixedTimeStamp.now;
            int  itemCount         = this.GetItemCount(ItemIndex.EquipmentMagazine);
            byte b   = (byte)Mathf.Min(1 + this.GetItemCount(ItemIndex.EquipmentMagazine), 255);
            uint num = 0U;

            while ((ulong)num < (ulong)((long)this.equipmentStateSlots.Length))
            {
                EquipmentState equipmentState = this.equipmentStateSlots[(int)num];
                if (equipmentState.equipmentIndex != EquipmentIndex.None)
                {
                    if (equipmentState.charges < b)
                    {
                        Run.FixedTimeStamp a = equipmentState.chargeFinishTime;
                        byte b2 = equipmentState.charges;
                        if (!a.isPositiveInfinity)
                        {
                            b2 += 1;
                        }
                        if (a.isInfinity)
                        {
                            a = now;
                        }
                        if (a.hasPassed)
                        {
                            int   itemCount2 = this.GetItemCount(ItemIndex.AutoCastEquipment);
                            float num2       = Mathf.Pow(0.85f, (float)itemCount);
                            if (itemCount2 > 0)
                            {
                                num2 *= 0.5f * Mathf.Pow(0.85f, (float)(itemCount2 - 1));
                            }
                            float b3 = equipmentState.equipmentDef.cooldown * num2;
                            this.SetEquipment(new EquipmentState(equipmentState.equipmentIndex, a + b3, b2), num);
                        }
                    }
                    if (equipmentState.charges >= b && !equipmentState.chargeFinishTime.isPositiveInfinity)
                    {
                        this.SetEquipment(new EquipmentState(equipmentState.equipmentIndex, Run.FixedTimeStamp.positiveInfinity, b), num);
                    }
                }
                num += 1U;
            }
        }
        private void LaserTurbineController_ExpendCharge(On.RoR2.LaserTurbineController.orig_ExpendCharge orig, LaserTurbineController self)
        {
            Run.FixedTimeStamp now = _runNow;
            float spin             = pseudoCalculateSpin(now, self);

            spin += self.spinPerKill;

            _pseudoInitialSpin  += spin;
            _pseudoInitialCharge = 0f;
            _pseudoSnapshotTime  = now;

            self.spinPerKill = _stackedSpinPerKill;

            orig(self);
        }
        // Token: 0x06000DDB RID: 3547 RVA: 0x0003E31C File Offset: 0x0003C51C
        private void OnOwnerKilledOtherServer()
        {
            Run.FixedTimeStamp now = Run.FixedTimeStamp.now;
            float num           = this.spinChargeState.CalcCurrentSpinValue(now, this.spinDecayRate, this.minSpin);
            float initialCharge = this.spinChargeState.CalcCurrentChargeValue(now, this.spinDecayRate, this.minSpin);

            num = Mathf.Min(num + this.spinPerKill, this.maxSpin);
            LaserTurbineController.SpinChargeState networkspinChargeState = new LaserTurbineController.SpinChargeState
            {
                initialSpin   = num,
                initialCharge = initialCharge,
                snapshotTime  = now
            };
            this.NetworkspinChargeState = networkspinChargeState;
        }
 // Token: 0x06001185 RID: 4485 RVA: 0x0004CA94 File Offset: 0x0004AC94
 private int GetEntryIndexForTime(Run.FixedTimeStamp time)
 {
     for (int i = 0; i < this.entries.Length; i++)
     {
         if (time < this.entries[i].endTime)
         {
             return(i);
         }
     }
     if (this.entries.Length != 0)
     {
         return(this.entries.Length - 1);
     }
     return(-1);
 }
        private void LaserTurbineController_OnOwnerKilledOtherServer(On.RoR2.LaserTurbineController.orig_OnOwnerKilledOtherServer orig, LaserTurbineController self)
        {
            Run.FixedTimeStamp now = _runNow;
            float spin             = pseudoCalculateSpin(now, self);
            float charge           = pseudoCalculateCharge(now, self);

            spin = Mathf.Min(spin + self.spinPerKill, self.maxSpin);

            _pseudoInitialSpin   = spin;
            _pseudoInitialCharge = charge;
            _pseudoSnapshotTime  = now;

            self.spinPerKill = _stackedSpinPerKill;

            orig(self);
        }
        public void ExpendCharge()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.LaserTurbineController::ExpendCharge()' called on client");
                return;
            }
            Run.FixedTimeStamp now = Run.FixedTimeStamp.now;
            float num = this.spinChargeState.CalcCurrentSpinValue(now, this.spinDecayRate, this.minSpin);

            num += this.spinPerKill;
            LaserTurbineController.SpinChargeState networkspinChargeState = new LaserTurbineController.SpinChargeState
            {
                initialSpin   = num,
                initialCharge = 0f,
                snapshotTime  = now
            };
            this.NetworkspinChargeState = networkspinChargeState;
        }
Ejemplo n.º 19
0
            public void SetEquipmentIndexUnsafe(Inventory inventory, EquipmentIndex newEquipmentIndex, byte equipmentSlot)
            {
                if (!NetworkServer.active)
                {
                    return;
                }

                EquipmentState equipment = inventory.GetEquipment(equipmentSlot);
                byte           charges   = equipment.charges;

                Run.FixedTimeStamp chargeFinishTime = equipment.chargeFinishTime;
                if (equipment.equipmentIndex == EquipmentIndex.None && chargeFinishTime.isNegativeInfinity)
                {
                    charges          = 1;
                    chargeFinishTime = Run.FixedTimeStamp.now;
                }
                EquipmentState equipmentState = new EquipmentState(newEquipmentIndex, chargeFinishTime, charges);

                inventory.SetEquipment(equipmentState, equipmentSlot);
            }
 public void SetEquipmentIndex(EquipmentIndex newEquipmentIndex)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.Inventory::SetEquipmentIndex(RoR2.EquipmentIndex)' called on client");
         return;
     }
     if (this.currentEquipmentIndex != newEquipmentIndex)
     {
         EquipmentState     equipment        = this.GetEquipment((uint)this.activeEquipmentSlot);
         byte               charges          = equipment.charges;
         Run.FixedTimeStamp chargeFinishTime = equipment.chargeFinishTime;
         if (equipment.equipmentIndex == EquipmentIndex.None && chargeFinishTime.isNegativeInfinity)
         {
             charges          = 1;
             chargeFinishTime = Run.FixedTimeStamp.now;
         }
         EquipmentState equipmentState = new EquipmentState(newEquipmentIndex, chargeFinishTime, charges);
         this.SetEquipment(equipmentState, (uint)this.activeEquipmentSlot);
     }
 }
        private void EndCycleServer([CanBeNull] Interactor activator)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.RouletteChestController::EndCycleServer(RoR2.Interactor)' called on client");
                return;
            }
            float       b = 0f;
            NetworkUser networkUser;

            if (activator && (networkUser = Util.LookUpBodyNetworkUser(activator.gameObject)) != null)
            {
                b = RttManager.GetConnectionRTT(networkUser.connectionToClient);
            }
            Run.FixedTimeStamp time = Run.FixedTimeStamp.now - b - RouletteChestController.rewindTime;
            PickupIndex        pickupIndexForTime = this.GetPickupIndexForTime(time);

            this.EjectPickupServer(pickupIndexForTime);
            this.activationTime = Run.FixedTimeStamp.positiveInfinity;
            this.onCycleCompletedServer.Invoke();
        }
 // Token: 0x060039AE RID: 14766 RVA: 0x000E2980 File Offset: 0x000E0B80
 public virtual void BeginMeleeAttackEffect()
 {
     if (this.meleeAttackStartTime != Run.FixedTimeStamp.positiveInfinity)
     {
         return;
     }
     this.meleeAttackStartTime = Run.FixedTimeStamp.now;
     Util.PlaySound(this.beginSwingSoundString, base.gameObject);
     if (this.swingEffectPrefab)
     {
         Transform transform = base.FindModelChild(this.swingEffectMuzzleString);
         if (transform)
         {
             this.swingEffectInstance = UnityEngine.Object.Instantiate <GameObject>(this.swingEffectPrefab, transform);
             ScaleParticleSystemDuration component = this.swingEffectInstance.GetComponent <ScaleParticleSystemDuration>();
             if (component)
             {
                 component.newDuration = component.initialDuration;
             }
         }
     }
 }
        // Token: 0x0600117B RID: 4475 RVA: 0x0004C6DC File Offset: 0x0004A8DC
        public override void OnDeserialize(NetworkReader reader, bool initialState)
        {
            uint num = reader.ReadPackedUInt32();

            if ((num & RouletteChestController.activationTimeDirtyBit) != 0U)
            {
                this.activationTime = reader.ReadFixedTimeStamp();
            }
            if ((num & RouletteChestController.entriesDirtyBit) != 0U)
            {
                Array.Resize <RouletteChestController.Entry>(ref this.entries, (int)reader.ReadPackedUInt32());
                Run.FixedTimeStamp endTime = this.activationTime;
                for (int i = 0; i < this.entries.Length; i++)
                {
                    RouletteChestController.Entry[] array = this.entries;
                    int num2 = i;
                    array[num2].pickupIndex = reader.ReadPickupIndex();
                    array[num2].endTime     = endTime + this.CalcEntryDuration(i);
                    endTime = array[num2].endTime;
                }
            }
        }
 // Token: 0x06001184 RID: 4484 RVA: 0x0004C9E0 File Offset: 0x0004ABE0
 private void FixedUpdate()
 {
     if (this.pickupDisplay)
     {
         this.pickupDisplay.SetPickupIndex(this.isCycling ? this.GetPickupIndexForTime(Run.FixedTimeStamp.now) : PickupIndex.none, false);
     }
     if (NetworkClient.active)
     {
         int entryIndexForTime = this.GetEntryIndexForTime(Run.FixedTimeStamp.now);
         if (entryIndexForTime != this.previousEntryIndexClient)
         {
             this.previousEntryIndexClient = entryIndexForTime;
             this.onChangedEntryClient.Invoke();
         }
     }
     if (NetworkServer.active && this.isCycling && this.entries.Length != 0)
     {
         Run.FixedTimeStamp endTime = this.entries[this.entries.Length - 1].endTime;
         if (endTime.hasPassed)
         {
             this.EndCycleServer(null);
         }
     }
 }
 // Token: 0x06000DE3 RID: 3555 RVA: 0x0003E4AD File Offset: 0x0003C6AD
 public float CalcCurrentSpinValue(Run.FixedTimeStamp currentTime, float spinDecayRate, float minSpin)
 {
     return(Mathf.Max(this.initialSpin - spinDecayRate * (currentTime - this.snapshotTime), minSpin));
 }
 private float pseudoCalculateSpin(Run.FixedTimeStamp now, LaserTurbineController self)
 {
     return(Mathf.Max(_pseudoInitialSpin - self.spinDecayRate * (_runNow - _pseudoSnapshotTime), self.minSpin));;
 }
Ejemplo n.º 27
0
 // Token: 0x060009A7 RID: 2471 RVA: 0x00030A57 File Offset: 0x0002EC57
 public static void Write(this NetworkWriter writer, Run.FixedTimeStamp timeStamp)
 {
     Run.FixedTimeStamp.Serialize(writer, timeStamp);
 }
Ejemplo n.º 28
0
 private void ResetBuyingDelay()
 {
     this.lastBuyCheck = Run.FixedTimeStamp.now;
     this.buyingDelay  = Random.Range(PlayerBotManager.MinBuyingDelay.Value, PlayerBotManager.MaxBuyingDelay.Value);
 }
Ejemplo n.º 29
0
 public void AddInstance(Run.FixedTimeStamp time, HitlagInstance instance)
 {
     instanceLists.Add(time, instance);
 }
Ejemplo n.º 30
0
 // Token: 0x060034E0 RID: 13536 RVA: 0x000E7BF6 File Offset: 0x000E5DF6
 public static void _WriteFixedTimeStamp_Run(NetworkWriter writer, Run.FixedTimeStamp value)
 {
     writer.Write(value.t);
 }