public void CreateBoostInfoListTest() { List <BoostInfo> boostInfoList = BoostInfo.CreateInfoList(); foreach (BoostInfo boostInfo in boostInfoList) { Assert.IsTrue(DownloadHelper.RemoteFileExists(boostInfo.DownloadURL)); } }
IEnumerator Coroutine_InvisibilityStart(BoostInfo boost, float target) { do { boost.CurrentPower = Math.Min(boost.CurrentPower + Time.deltaTime * 0.75f, target); Owner.UpdateEffectAmount(boost.CurrentPower); yield return(new WaitForEndOfFrame()); } while (target > boost.CurrentPower); }
void OnFire() { if (IsBoostActive(E_ItemBoosterBehaviour.Invisible)) { StopAllCoroutines(); BoostInfo boost = ActiveBoosts.Find(s => s.Settings.BoosterBehaviour == E_ItemBoosterBehaviour.Invisible); StartCoroutine(Coroutine_InvisibilityDump(boost)); } }
public float GetActiveBoostModifier(E_ItemBoosterBehaviour boost) { BoostInfo item = ActiveBoosts.Find(s => s.Settings.BoosterBehaviour == boost); if (item == null) { return(1); } return(item.Settings.BoostModifier); }
public override void EventEnter() { foreach (var x in Services.GenerationService.Generators.Generators.Values) { //Services.GenerationService.Generators.SetEfficiencyMult(x.GeneratorId, 1.0 - ProfitReduction); //Services.GenerationService.Generators.SetSpeedMult(x.GeneratorId, 1.0 + SpeedReduction); Generators.AddProfitBoost(x.GeneratorId, BoostInfo.CreateTemp(GetType().FullName, 1.0 - ProfitReduction)); Generators.AddTimeBoost(x.GeneratorId, BoostInfo.CreateTemp(GetType().FullName, 1.0f - Mathf.Clamp01(SpeedReduction))); } StartCoroutine(ShowImpl()); }
IEnumerator Coroutine_InvisibilityStop(BoostInfo boost) { do { boost.CurrentPower = Math.Max(boost.CurrentPower - Time.deltaTime * 0.75f, 0.0f); Owner.UpdateEffectAmount(boost.CurrentPower); yield return(new WaitForEndOfFrame()); } while (boost.CurrentPower > 0.0f); Owner.SetInvisibleOff(); SetBoostEffect(true); }
public void DownloadBoost() { try { eBoostVersion boostVersion = eBoostVersion.Boost1_52_0; string destinationFolder = GlobalVariables.destinationFolder + @"DownloadBoost\"; if (!Directory.Exists(destinationFolder)) { Directory.CreateDirectory(destinationFolder); } string boostDownloadURL = BoostInfo.GetDownloadURL(boostVersion); string boostZIPFilename = BoostInfo.GetBoostZipFileName(boostVersion); // Download boost // Check if URL is valid bool validUrl = DownloadHelper.RemoteFileExists(boostDownloadURL); Assert.True(validUrl); DownloadHelper.DownloadFileFromURL(boostDownloadURL, destinationFolder + boostZIPFilename); if (boostVersion == eBoostVersion.Boost1_51_0) { FileInfo fi = new FileInfo(destinationFolder + boostZIPFilename); long fileLength = fi.Length; Assert.True(fileLength == 91365553); } if (boostVersion == eBoostVersion.Boost1_52_0) { FileInfo fi = new FileInfo(destinationFolder + boostZIPFilename); long fileLength = fi.Length; Assert.True(fileLength == 95342510); } // Delete File System.IO.File.Delete(destinationFolder + boostZIPFilename); } catch (System.Exception ex) { Assert.True(false); } }
public override int GetHashCode() { unchecked { int hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (CreditsEarned?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (BoostInfo?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (CurrentCsr?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (KilledByOpponentDetails?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (KilledOpponentDetails?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ MeasurementMatchesLeft; hashCode = (hashCode * 397) ^ (MetaCommendationDeltas?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (PreviousCsr?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProgressiveCommendationDeltas?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (RewardSets?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (XpInfo?.GetHashCode() ?? 0); return(hashCode); } }
public override void Apply(AllManagers bman) { //Services.GenerationService.Generators.AddX2Time(Services.TimeService.Now.AddMinutes(10)); //Services.GenerationService.Generators.AddX2Profit(Services.TimeService.Now.AddMinutes(10)); if (Profit > 1) { Services.GenerationService.Generators.AddProfitBoost( BoostInfo.CreateTimed(BoostIds.RewardTempProfit(), Profit, Services.TimeService.UnixTimeInt + 10 * 60)); } if (Speed > 1) { Services.GenerationService.Generators.AddTimeBoost( BoostInfo.CreateTimed(BoostIds.RewardTempTime(), Speed, Services.TimeService.UnixTimeInt + 10 * 60)); } Player.LegacyPlayerData.Save(); StatsCollector.Instance[Stats.REWARDS_UNLOCKED]++; }
IEnumerator Coroutine_InvisibilityDump(BoostInfo boost) { float powerTarget = Math.Max(0.25f, boost.CurrentPower - 0.5f); do { boost.CurrentPower = Math.Max(boost.CurrentPower - Time.deltaTime * 2.0f, powerTarget); Owner.UpdateEffectAmount(boost.CurrentPower); yield return(new WaitForEndOfFrame()); } while (boost.CurrentPower > powerTarget); do { boost.CurrentPower = Math.Min(boost.CurrentPower + Time.deltaTime * 0.5f, INVISIBLE_BOOST_MODIFIER_DEFAULT); Owner.UpdateEffectAmount(boost.CurrentPower); yield return(new WaitForEndOfFrame()); } while (boost.CurrentPower < INVISIBLE_BOOST_MODIFIER_DEFAULT); }
public override int GetHashCode() { unchecked { int hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (CreditsEarned?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (BoostInfo?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (KilledByOpponentDetails?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (KilledOpponentDetails?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (MetaCommendationDeltas?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ProgressiveCommendationDeltas?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (PveTotalRoundAssistBonuses?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (PveTotalRoundKillBonuses?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (PveTotalRoundSpeedBonuses?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (PveTotalRoundSurvivalBonuses?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (RewardSets?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ TotalPiesEarned; hashCode = (hashCode * 397) ^ WarzoneLevel; hashCode = (hashCode * 397) ^ (XpInfo?.GetHashCode() ?? 0); return(hashCode); } }
protected void RcvBoost(E_ItemID gadget) { if (uLink.Network.isServer == true) { return; } Item item = Owner.GadgetsComponent.GetGadget(gadget); if (item == null) { return; } PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(Owner.NetworkView.owner); if (ppi == null) { return; } BoostInfo boost = new BoostInfo() { Settings = item.Settings, TimeToEnd = Time.timeSinceLevelLoad + item.Settings.BoostTimer, CurrentPower = 1 }; if (item.Settings.BoostSoundOn) { Owner.SoundPlay(item.Settings.BoostSoundOn); } if (item.Settings.BoostEffect) { boost.Effect = GameObject.Instantiate(item.Settings.BoostEffect) as ParticleSystem; Transform t = boost.Effect.transform; t.parent = Owner.HatTarget; t.localPosition = Vector3.zero; t.localRotation = Quaternion.identity; if (IsBoostActive(E_ItemBoosterBehaviour.Invisible) == false) { boost.Effect.Play(true); } } else { boost.Effect = null; } if (item.Settings.BoosterBehaviour == E_ItemBoosterBehaviour.Invisible) { //Owner.SetInvisibleOn(item.Settings.BoostModifier); boost.CurrentPower = 0.0f; Owner.SetInvisibleOn(boost.CurrentPower); StopAllCoroutines(); StartCoroutine(Coroutine_InvisibilityStart(boost, INVISIBLE_BOOST_MODIFIER_DEFAULT)); SetBoostEffect(false); } ActiveBoosts.Add(boost); ppi.ConsumableItemUsed(gadget); item.BoostUsed(); }
public void GiveRewards(Lootbox lb) { if (!lb.IsValid) { return; } var pdata = Player.LegacyPlayerData; foreach (var item in lb.Items) { switch (item.RewardType) { case LootboxRewardType.Generators: if (Services.TransportService.HasUnits(item.TargetGenerator)) { Services.TransportService.AddLiveUnits(item.TargetGenerator, (int)item.RewardValue); } else { var generator = Services.GenerationService.Generators.GetGeneratorInfo(item.TargetGenerator); Services.GenerationService.BuyGenerator(generator, true); //AllManagers.BalanceManager.BuyGenerator(generator, free: true); } break; case LootboxRewardType.ProfitUpgrade: if (item.TargetGenerator == -1) { Services.GenerationService.Generators.AddProfitBoost( boost: BoostInfo.CreateTimed( id: $"lootbox_{item.RewardType}_".GuidSuffix(5), value: item.RewardValue, endTime: Services.TimeService.UnixTimeInt + 600)); } else { if (Services.TransportService.HasUnits(item.TargetGenerator)) { Services.GenerationService.Generators.AddProfitBoost( generatorId: item.TargetGenerator, boost: BoostInfo.CreateTimed( id: $"lootbox_{item.RewardType}_".GuidSuffix(5), value: item.RewardValue, endTime: Services.TimeService.UnixTimeInt + 600)); } } break; case LootboxRewardType.SpeedUpgrade: if (item.TargetGenerator == -1) { Services.GenerationService.Generators.AddTimeBoost( boost: BoostInfo.CreateTimed( id: $"lootbox_{item.RewardType}_".GuidSuffix(5), value: item.RewardValue, endTime: Services.TimeService.UnixTimeInt + 600)); } else { if (Services.TransportService.HasUnits(item.TargetGenerator)) { Services.GenerationService.Generators.AddTimeBoost( generatorId: item.TargetGenerator, boost: BoostInfo.CreateTimed( id: $"lootbox_{item.RewardType}_".GuidSuffix(5), value: item.RewardValue, endTime: Services.TimeService.UnixTimeInt + 600)); } } break; case LootboxRewardType.Manager: // TODO : ?? Debug.Log("TODO: implement Lootbox manager reward"); break; case LootboxRewardType.Investors: //pdata.Investors += item.RewardValue; //pdata.LifeTimeInvestors += item.RewardValue; Services.PlayerService.AddSecurities(item.RewardValue.ToCurrencyNumber()); break; case LootboxRewardType.Balance: Player.AddGenerationCompanyCash(item.RewardValue); break; case LootboxRewardType.Coins: Player.AddCoins((int)item.RewardValue); break; case LootboxRewardType.CoinsAndBalance: Player.AddGenerationCompanyCash(item.RewardValue); Player.AddCoins((int)item.RewardValue2); break; case LootboxRewardType.PercentBalance: var q = Services.PlayerService.CompanyCash.Value * item.RewardValue; if (q < 20) { q = 20; } Player.AddGenerationCompanyCash(q); item.DescText = Currencies.DefaultCurrency.CreatePriceString(q, false, " "); break; default: break; } StatsCollector.Instance[Stats.REWARDS_UNLOCKED]++; } pdata.Save(); Analytics.CustomEvent(AnalyticsStrings.LOOTBOX_OPEN); }
public override void Update() { if (frameTime < 1.13f) { frameTime += Time.deltaTime; return; } frameTime = 0; foreach (var x in Achievements) { if (x.IsCompleted) { continue; } if (Services.TransportService.HasUnits(x.TargetGeneratorId)) { var tCount = Services.TransportService.GetUnitTotalCount(x.TargetGeneratorId); //_pdata.OwnedGenerators[x.TargetGeneratorId]; if (tCount >= x.TargetCount) { Services.GetService <IAchievmentServcie>().AddCompletedAchievment(x.Id.ToString()); Services.AchievmentService.AddAchievmentPoints(x.Points); Points += x.Points; x.IsCompleted = true; switch (x.RewardType) { case RewardType.SpeedUpgrade: //Services.GenerationService.Generators.ApplyTime(x.TargetGeneratorId, x.RewardValue); Services.GenerationService.Generators.AddTimeBoost(x.TargetGeneratorId, BoostInfo.CreateTemp(BosUtils.PrefixedId("speed_achiv_"), x.RewardValue)); break; case RewardType.ProfitUpgrade: Services.GenerationService.Generators.AddProfitBoost(x.TargetGeneratorId, BoostInfo.CreateTemp(BosUtils.PrefixedId("profit_achiv_"), x.RewardValue)); //Services.GenerationService.Generators.ApplyProfit(x.TargetGeneratorId, ProfitMultInfo.Create(x.RewardValue)); break; default: break; } //Proc.Invoke(x); GameEvents.OnAchievmentCompleted(new AchievmentInfo(x.Id, x.Name)); StatsCollector.Instance[Stats.REWARDS_UNLOCKED]++; ChangeGeneratorIcon(x); Player.LegacyPlayerData.Save(); } } } }