public async Task LinksAsync() { var channel = Context.Channel; var user = Context.User; await Context.Message.DeleteAsync(); TimeSpan last = Cooldowns.GetLinksLast(); TimeSpan current = DateTime.Now.TimeOfDay; double difference = current.TotalSeconds - last.TotalSeconds; if (difference >= Cooldowns.GetCommandCooldown() || difference < 0) { var embed = new EmbedBuilder() { Color = Colours.generalCol }; embed.WithAuthor("GTA5Police Links", References.GetGta5policeLogo()); embed.Description = "Useful GTA5Police links for you.\n**Teamspeak IP: gta5police.com**"; embed.WithThumbnailUrl(References.GetGta5policeLogo()); embed.AddField(new EmbedFieldBuilder() { Name = "Website", Value = References.GetWebsiteURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Dashboard", Value = References.GetDashboardURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Forums", Value = References.GetForumsURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Support", Value = References.GetSupportURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Suggestions", Value = References.GetSuggestionsURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Donations", Value = References.GetDonateURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Vacbanned - For Steam Hex", Value = References.GetVacbannedURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Greggs", Value = "https://www.greggs.co.uk/" }); embed.WithFooter("Requested by " + Context.User); embed.WithCurrentTimestamp(); var message = await Context.Channel.SendMessageAsync("", false, embed); await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown()); await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Links command was used by " + user + ".")); Cooldowns.SetLinksLast(current); Statistics.AddOutgoingMessages(); } else { await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol); } }
public async Task ClearCachAsync() { var channel = Context.Channel; var user = Context.User; await Context.Message.DeleteAsync(); TimeSpan last = Cooldowns.GetClearcacheLast(); TimeSpan current = DateTime.Now.TimeOfDay; double difference = current.TotalSeconds - last.TotalSeconds; if (difference >= Cooldowns.GetCommandCooldown() || difference < 0) { var embed = new EmbedBuilder() { Color = Colours.generalCol }; embed.WithAuthor("How to clear your cache 101", References.GetGta5policeLogo()); embed.WithUrl(References.GetClearcacheURL()); embed.Title = "Click here to learn how!"; embed.Description = "Clearing your FiveM cache will help with many errors. This includes resources not loading, graphical issues and fps issues."; embed.WithThumbnailUrl(References.GetGta5policeLogo()); embed.WithFooter("Requested by " + Context.User); embed.WithCurrentTimestamp(); var message = await Context.Channel.SendMessageAsync("", false, embed); //await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown()); await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Clearcache command was used by " + user + ".")); Cooldowns.SetClearcacheLast(current); Statistics.AddOutgoingMessages(); } else { await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol); } }
public void DoTargetEntityAction(TargetEntityActionEventArgs args) { var disarmedActs = args.Target.GetAllComponents <IDisarmedAct>().ToArray(); if (!args.Performer.InRangeUnobstructed(args.Target)) { return; } if (disarmedActs.Length == 0) { if (args.Performer.TryGetComponent(out ActorComponent? actor)) { // Fall back to a normal interaction with the entity var player = actor.PlayerSession; var coordinates = args.Target.Transform.Coordinates; var target = args.Target.Uid; EntitySystem.Get <InteractionSystem>().HandleUseInteraction(player, coordinates, target); return; } return; } if (!args.Performer.TryGetComponent <SharedActionsComponent>(out var actions)) { return; } if (args.Target == args.Performer || !EntitySystem.Get <ActionBlockerSystem>().CanAttack(args.Performer)) { return; } var random = IoCManager.Resolve <IRobustRandom>(); var audio = EntitySystem.Get <AudioSystem>(); var system = EntitySystem.Get <MeleeWeaponSystem>(); var diff = args.Target.Transform.MapPosition.Position - args.Performer.Transform.MapPosition.Position; var angle = Angle.FromWorldVec(diff); actions.Cooldown(ActionType.Disarm, Cooldowns.SecondsFromNow(_cooldown)); if (random.Prob(_failProb)) { SoundSystem.Play(Filter.Pvs(args.Performer), PunchMissSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f)); args.Performer.PopupMessageOtherClients(Loc.GetString("disarm-action-popup-message-other-clients", ("performerName", args.Performer.Name), ("targetName", args.Target.Name))); args.Performer.PopupMessageCursor(Loc.GetString("disarm-action-popup-message-cursor", ("targetName", args.Target.Name))); system.SendLunge(angle, args.Performer); return; } system.SendAnimation("disarm", angle, args.Performer, args.Performer, new[] { args.Target }); var eventArgs = new DisarmedActEvent() { Target = args.Target, Source = args.Performer, PushProbability = _pushProb }; IoCManager.Resolve <IEntityManager>().EventBus.RaiseLocalEvent(args.Target.Uid, eventArgs); // Check if the event has been handled, and if so, do nothing else! if (eventArgs.Handled) { return; } // Sort by priority. Array.Sort(disarmedActs, (a, b) => a.Priority.CompareTo(b.Priority)); // TODO: Remove this shit. foreach (var disarmedAct in disarmedActs) { if (disarmedAct.Disarmed(eventArgs)) { return; } } SoundSystem.Play(Filter.Pvs(args.Performer), DisarmSuccessSound.GetSound(), args.Performer.Transform.Coordinates, AudioHelpers.WithVariation(0.025f)); }
public static async Task <bool> Combat() { if (BotManager.Current.IsAutonomous) { if (Core.Me.HasTarget) { Movement.NavigateToUnitLos(Core.Me.CurrentTarget, 20 + Core.Me.CurrentTarget.CombatReach); } } if (await Casting.TrackSpellCast()) { return(true); } await Casting.CheckForSuccessfulCast(); BardRoutine.RefreshVars(); if (!Core.Me.HasTarget || !Core.Me.CurrentTarget.ThoroughCanAttack()) { return(false); } if (await CustomOpenerLogic.Opener()) { return(true); } if (BardRoutine.GlobalCooldown.CanWeave()) { // Utility if (await Utility.RepellingShot()) { return(true); } if (await Utility.WardensPaean()) { return(true); } if (await Utility.NaturesMinne()) { return(true); } if (await Utility.Troubadour()) { return(true); } if (await PhysicalDps.ArmsLength(BardSettings.Instance)) { return(true); } if (await PhysicalDps.SecondWind(BardSettings.Instance)) { return(true); } if (await PhysicalDps.Interrupt(BardSettings.Instance)) { return(true); } // Damage if (await SingleTarget.LastPossiblePitchPerfectDuringWM()) { return(true); } if (await Songs.LetMeSingYouTheSongOfMyPeople()) { return(true); } if (await Cooldowns.RagingStrikes()) { return(true); } if (await Cooldowns.BattleVoice()) { return(true); } if (await Cooldowns.RadiantFinale()) { return(true); } if (await Cooldowns.Barrage()) { return(true); } if (await SingleTarget.PitchPerfect()) { return(true); } if (await Aoe.RainOfDeathDuringMagesBallard()) { return(true); } if (await SingleTarget.BloodletterInMagesBallard()) { return(true); } if (await SingleTarget.EmpyrealArrow()) { return(true); } if (await SingleTarget.Sidewinder()) { return(true); } if (await Aoe.RainOfDeath()) { return(true); } if (await SingleTarget.Bloodletter()) { return(true); } } if (await DamageOverTime.IronJawsOnCurrentTarget()) { return(true); } if (await DamageOverTime.SnapShotIronJawsOnCurrentTarget()) { return(true); } if (await SingleTarget.StraightShotAfterBarrage()) { return(true); } if (await DamageOverTime.WindbiteOnCurrentTarget()) { return(true); } if (await DamageOverTime.VenomousBiteOnCurrentTarget()) { return(true); } if (await Aoe.BlastArrow()) { return(true); } if (await Aoe.ApexArrow()) { return(true); } if (await Aoe.ShadowBite()) { return(true); } if (await DamageOverTime.IronJawsOnOffTarget()) { return(true); } if (await DamageOverTime.WindbiteOnOffTarget()) { return(true); } if (await DamageOverTime.VenomousBiteOnOffTarget()) { return(true); } if (await Aoe.LadonsBite()) { return(true); } if (await SingleTarget.StraightShot()) { return(true); } return(await SingleTarget.HeavyShot()); }
public void CmdDisrobe(GameObject toDisrobe) { if (!Validations.CanApply(playerScript, toDisrobe, NetworkSide.Server)) { return; } //only allowed if this player is an observer of the player to disrobe var dynamicItemStorage = toDisrobe.GetComponent <DynamicItemStorage>(); if (dynamicItemStorage == null) { return; } //disrobe each slot, taking .2s per each occupied slot //calculate time var occupiedSlots = dynamicItemStorage.GetItemSlots() .Count(slot => slot.NamedSlot != NamedSlot.handcuffs && !slot.IsEmpty); if (occupiedSlots == 0) { return; } if (!Cooldowns.TryStartServer(playerScript, CommonCooldowns.Instance.Interaction)) { return; } var timeTaken = occupiedSlots * .4f; void ProgressComplete() { var victimsHealth = toDisrobe.GetComponent <PlayerHealthV2>(); foreach (var itemSlot in dynamicItemStorage.GetItemSlots()) { //are we an observer of the player to disrobe? if (itemSlot.ServerIsObservedBy(gameObject) == false) { continue; } //skip slots which have special uses if (itemSlot.NamedSlot == NamedSlot.handcuffs) { continue; } // cancels out of the loop if player gets up if (!victimsHealth.IsCrit) { break; } Inventory.ServerDrop(itemSlot); } } StandardProgressAction.Create(DisrobeProgressConfig, ProgressComplete) .ServerStartProgress(toDisrobe.RegisterTile(), timeTaken, gameObject); }
public void ClientPredictInteraction(PositionalHandApply interaction) { //start clientside melee cooldown so we don't try to spam melee //requests to server Cooldowns.TryStartClient(interaction, CommonCooldowns.Instance.Melee); }
private void Loaded() { cooldowns = Interface.Oxide.DataFileSystem.ReadObject <Cooldowns>(Name); cmd.AddChatCommand(_Config.Command, this, "chatCmd"); SaveConfig(); }
public void ServerPerformMeleeAttack(GameObject victim, Vector2 attackDirection, BodyPartType damageZone, LayerType layerType) { if (Cooldowns.IsOnServer(playerScript, CommonCooldowns.Instance.Melee)) { return; } var weapon = playerScript.playerNetworkActions.GetActiveHandItem(); var tiles = victim.GetComponent <InteractableTiles>(); if (tiles) { //validate based on position of target vector if (!Validations.CanApply(playerScript, victim, NetworkSide.Server, targetVector: attackDirection)) { return; } } else { //validate based on position of target object if (!Validations.CanApply(playerScript, victim, NetworkSide.Server)) { return; } } if (!playerMove.allowInput || playerScript.IsGhost || !victim || !playerScript.playerHealth.serverPlayerConscious ) { return; } var isWeapon = weapon != null; ItemAttributesV2 weaponAttr = isWeapon ? weapon.GetComponent <ItemAttributesV2>() : null; var damage = isWeapon ? weaponAttr.ServerHitDamage : fistDamage; var damageType = isWeapon ? weaponAttr.ServerDamageType : DamageType.Brute; var attackSoundName = isWeapon ? weaponAttr.ServerHitSound : "Punch#"; LayerTile attackedTile = null; bool didHit = false; // If Tilemap LayerType is not None then it is a tilemap being attacked if (layerType != LayerType.None) { var tileChangeManager = victim.GetComponent <TileChangeManager>(); if (tileChangeManager == null) { return; //Make sure its on a matrix that is destructable } //Tilemap stuff: var tileMapDamage = victim.GetComponentInChildren <MetaTileMap>().Layers[layerType].gameObject .GetComponent <TilemapDamage>(); if (tileMapDamage != null) { attackSoundName = ""; var worldPos = (Vector2)transform.position + attackDirection; attackedTile = tileChangeManager.InteractableTiles.LayerTileAt(worldPos, true); tileMapDamage.DoMeleeDamage(worldPos, gameObject, (int)damage); didHit = true; } } else { //a regular object being attacked LivingHealthBehaviour victimHealth = victim.GetComponent <LivingHealthBehaviour>(); var integrity = victim.GetComponent <Integrity>(); if (integrity != null) { //damaging an object integrity.ApplyDamage((int)damage, AttackType.Melee, damageType); didHit = true; } else { //damaging a living thing var rng = new System.Random(); // This is based off the alien/humanoid/attack_hand punch code of TGStation's codebase. // Punches have 90% chance to hit, otherwise it is a miss. if (isWeapon || 90 >= rng.Next(1, 100)) { // The attack hit. victimHealth.ApplyDamageToBodypart(gameObject, (int)damage, AttackType.Melee, damageType, damageZone); didHit = true; } else { // The punch missed. string victimName = victim.Player()?.Name; SoundManager.PlayNetworkedAtPos("PunchMiss", transform.position); Chat.AddCombatMsgToChat(gameObject, $"You attempted to punch {victimName} but missed!", $"{gameObject.Player()?.Name} has attempted to punch {victimName}!"); } } } //common logic to do if we hit something if (didHit) { if (!string.IsNullOrEmpty(attackSoundName)) { SoundManager.PlayNetworkedAtPos(attackSoundName, transform.position); } if (damage > 0) { Chat.AddAttackMsgToChat(gameObject, victim, damageZone, weapon, attackedTile: attackedTile); } if (victim != gameObject) { RpcMeleeAttackLerp(attackDirection, weapon); //playerMove.allowInput = false; } } Cooldowns.TryStartServer(playerScript, CommonCooldowns.Instance.Melee); }
public override void Execute() { Cooldowns.AddTask(Q, new CompanyTaskExploreCompany(SelectedCompany.company.Id), 8); }
public override void Execute() { Cooldowns.AddTask(Q, new CompanyTaskExploreMarket(SelectedNiche), 8); }
public void ServerPerformMeleeAttack(GameObject victim, Vector2 attackDirection, BodyPartType damageZone, LayerType layerType) { if (victim == null) { return; } if (Cooldowns.IsOnServer(playerScript, CommonCooldowns.Instance.Melee)) { return; } if (playerMove.allowInput == false) { return; } if (playerScript.IsGhost) { return; } if (playerScript.playerHealth.serverPlayerConscious == false) { return; } if (victim.TryGetComponent <InteractableTiles>(out var tiles)) { // validate based on position of target vector if (Validations.CanApply(playerScript, victim, NetworkSide.Server, targetVector: attackDirection) == false) { return; } } else { // validate based on position of target object if (Validations.CanApply(playerScript, victim, NetworkSide.Server) == false) { return; } } float damage = fistDamage; DamageType damageType = DamageType.Brute; AddressableAudioSource weaponSound = meleeSounds.PickRandom(); GameObject weapon = playerScript.playerNetworkActions.GetActiveHandItem(); ItemAttributesV2 weaponAttributes = weapon == null ? null : weapon.GetComponent <ItemAttributesV2>(); if (weaponAttributes != null) { damage = weaponAttributes.ServerHitDamage; damageType = weaponAttributes.ServerDamageType; weaponSound = weaponAttributes.hitSoundSettings == SoundItemSettings.OnlyObject ? null : weaponAttributes.ServerHitSound; slashChance = weaponAttributes.SlashChance; slashDamage = weaponAttributes.SlashDamage; pierceChance = weaponAttributes.PierceChance; pierceDamage = weaponAttributes.PierceDamage; burnDamage = weaponAttributes.BurnDamage; } LayerTile attackedTile = null; bool didHit = false; // If Tilemap LayerType is not None then it is a tilemap being attacked if (layerType != LayerType.None) { var tileChangeManager = victim.GetComponent <TileChangeManager>(); if (tileChangeManager == null) { return; // Make sure its on a matrix that is destructable } // Tilemap stuff: var tileMapDamage = victim.GetComponentInChildren <MetaTileMap>().Layers[layerType].gameObject.GetComponent <TilemapDamage>(); if (tileMapDamage == null) { return; } var worldPos = (Vector2)transform.position + attackDirection; attackedTile = tileChangeManager.InteractableTiles.LayerTileAt(worldPos, true); // Tile itself is responsible for playing victim damage sound tileMapDamage.ApplyDamage(damage, AttackType.Melee, worldPos); didHit = true; } // Damaging an object else if (victim.TryGetComponent <Integrity>(out var integrity) && victim.TryGetComponent <Meleeable>(out var meleeable) && meleeable.IsMeleeable) { if (weaponAttributes != null && weaponAttributes.hitSoundSettings != SoundItemSettings.OnlyItem) { AudioSourceParameters audioSourceParameters = new AudioSourceParameters(pitch: Random.Range(0.9f, 1.1f)); SoundManager.PlayNetworkedAtPos(integrity.soundOnHit, gameObject.WorldPosServer(), audioSourceParameters, sourceObj: gameObject); } integrity.ApplyDamage(damage, AttackType.Melee, damageType); didHit = true; }
public abstract Enums.AttackState ProcessPriorities(Cooldowns cooldowns, Weapon weapon);
public void DoTargetEntityAction(TargetEntityActionEventArgs args) { var disarmedActs = args.Target.GetAllComponents <IDisarmedAct>().ToArray(); if (!args.Performer.InRangeUnobstructed(args.Target)) { return; } if (disarmedActs.Length == 0) { if (args.Performer.TryGetComponent(out ActorComponent? actor)) { // Fall back to a normal interaction with the entity var player = actor.PlayerSession; var coordinates = args.Target.Transform.Coordinates; var target = args.Target.Uid; EntitySystem.Get <InteractionSystem>().HandleClientUseItemInHand(player, coordinates, target); return; } return; } if (!args.Performer.TryGetComponent <SharedActionsComponent>(out var actions)) { return; } if (args.Target == args.Performer || !args.Performer.CanAttack()) { return; } var random = IoCManager.Resolve <IRobustRandom>(); var audio = EntitySystem.Get <AudioSystem>(); var system = EntitySystem.Get <MeleeWeaponSystem>(); var diff = args.Target.Transform.MapPosition.Position - args.Performer.Transform.MapPosition.Position; var angle = Angle.FromWorldVec(diff); actions.Cooldown(ActionType.Disarm, Cooldowns.SecondsFromNow(_cooldown)); if (random.Prob(_failProb)) { SoundSystem.Play(Filter.Pvs(args.Performer), "/Audio/Weapons/punchmiss.ogg", args.Performer, AudioHelpers.WithVariation(0.025f)); args.Performer.PopupMessageOtherClients(Loc.GetString("{0} fails to disarm {1}!", args.Performer.Name, args.Target.Name)); args.Performer.PopupMessageCursor(Loc.GetString("You fail to disarm {0}!", args.Target.Name)); system.SendLunge(angle, args.Performer); return; } system.SendAnimation("disarm", angle, args.Performer, args.Performer, new [] { args.Target }); var eventArgs = new DisarmedActEventArgs() { Target = args.Target, Source = args.Performer, PushProbability = _pushProb }; // Sort by priority. Array.Sort(disarmedActs, (a, b) => a.Priority.CompareTo(b.Priority)); foreach (var disarmedAct in disarmedActs) { if (disarmedAct.Disarmed(eventArgs)) { return; } } SoundSystem.Play(Filter.Pvs(args.Performer), "/Audio/Effects/thudswoosh.ogg", args.Performer.Transform.Coordinates, AudioHelpers.WithVariation(0.025f)); }
public static async Task <bool> Combat() { if (BotManager.Current.IsAutonomous) { if (Core.Me.HasTarget) { Movement.NavigateToUnitLos(Core.Me.CurrentTarget, 23); } } if (!Core.Me.HasTarget || !Core.Me.CurrentTarget.ThoroughCanAttack()) { return(false); } if (await CustomOpenerLogic.Opener()) { return(true); } if (MachinistSettings.Instance.UseFlamethrower && Core.Me.HasAura(Auras.Flamethrower)) { // First check movement otherwise Flamethrower can be executed whereas you are moving if (MovementManager.IsMoving) { return(false); } if (!MachinistSettings.Instance.UseFlamethrower) { return(true); } if (Core.Me.EnemiesInCone(8) >= MachinistSettings.Instance.FlamethrowerEnemyCount) { return(true); } } //oGCDs //Utility if (await Utility.Tactician()) { return(true); } if (await PhysicalDps.ArmsLength(MachinistSettings.Instance)) { return(true); } if (await PhysicalDps.SecondWind(MachinistSettings.Instance)) { return(true); } if (await PhysicalDps.Interrupt(MachinistSettings.Instance)) { return(true); } if (Weaving.GetCurrentWeavingCounter() < 2) { //Pets if (await Pet.RookQueen()) { return(true); } if (await Pet.RookQueenOverdrive()) { return(true); } //Cooldowns if (await Cooldowns.Wildfire()) { return(true); } if (await Cooldowns.Hypercharge()) { return(true); } if (await Cooldowns.Reassemble()) { return(true); } if (await Cooldowns.BarrelStabilizer()) { return(true); } //oGCDs if (await SingleTarget.GaussRound()) { return(true); } if (await MultiTarget.Ricochet()) { return(true); } } //GCDs - Top Hypercharge Priority if (await MultiTarget.AutoCrossbow()) { return(true); } if (await SingleTarget.HeatBlast()) { return(true); } //Use On CD if (await MultiTarget.BioBlaster()) { return(true); } if (await SingleTarget.Drill()) { return(true); } if (await SingleTarget.HotAirAnchor()) { return(true); } if (await MultiTarget.Flamethrower()) { return(true); } if (await MultiTarget.SpreadShot()) { return(true); } //Default Combo if (Core.Me.ClassLevel >= 58) { if (!MachinistSettings.Instance.UseDrill || (MachinistSettings.Instance.UseDrill && Spells.Drill.Cooldown.TotalMilliseconds > 100)) { if (await SingleTarget.HeatedCleanShot()) { return(true); } if (await SingleTarget.HeatedSlugShot()) { return(true); } } } else { if (await SingleTarget.HeatedCleanShot()) { return(true); } if (await SingleTarget.HeatedSlugShot()) { return(true); } } return(await SingleTarget.HeatedSplitShot()); }
private void Service() { Cooldowns.Service(); }
public static async Task <bool> Execute() { Group.UpdateAllies(); if (Core.Me.IsCasting) { return(true); } if (await Casting.TrackSpellCast()) { return(true); } await Casting.CheckForSuccessfulCast(); Globals.InParty = PartyManager.IsInParty; Globals.PartyInCombat = Globals.InParty && Utilities.Combat.Enemies.Any(r => r.TaggerType == 2) || Core.Me.InCombat; Utilities.Routines.Bard.RefreshVars(); if (!Core.Me.HasTarget || !Core.Me.CurrentTarget.ThoroughCanAttack()) { return(false); } if (await CustomOpenerLogic.Opener()) { return(true); } if (BotManager.Current.IsAutonomous) { if (Core.Me.HasTarget) { Movement.NavigateToUnitLos(Core.Me.CurrentTarget, 20); } } if (Weaving.GetCurrentWeavingCounter() < 2 && Spells.HeavyShot.Cooldown.TotalMilliseconds > 650 + BaseSettings.Instance.UserLatencyOffset) { // Utility if (await Utility.RepellingShot()) { return(true); } if (await Utility.WardensPaean()) { return(true); } if (await Utility.NaturesMinne()) { return(true); } if (await Utility.Troubadour()) { return(true); } if (await PhysicalDps.ArmsLength(BardSettings.Instance)) { return(true); } if (await PhysicalDps.SecondWind(BardSettings.Instance)) { return(true); } if (await Utility.HeadGraze()) { return(true); } // Damage if (await SingleTarget.LastPossiblePitchPerfectDuringWM()) { return(true); } if (await Songs.LetMeSingYouTheSongOfMyPeople()) { return(true); } if (await Cooldowns.BattleVoice()) { return(true); } if (await Cooldowns.RagingStrikes()) { return(true); } if (await Cooldowns.Barrage()) { return(true); } if (await SingleTarget.PitchPerfect()) { return(true); } if (await Aoe.RainOfDeathDuringMagesBallard()) { return(true); } if (await SingleTarget.BloodletterInMagesBallard()) { return(true); } if (await SingleTarget.EmpyrealArrow()) { return(true); } if (await Aoe.ShadowBite()) { return(true); } if (await SingleTarget.Sidewinder()) { return(true); } if (await Aoe.RainOfDeath()) { return(true); } if (await SingleTarget.Bloodletter()) { return(true); } } if (await SingleTarget.StraightShotAfterBarrage()) { return(true); } if (await DamageOverTime.IronJawsOnCurrentTarget()) { return(true); } if (await DamageOverTime.SnapShotIronJawsOnCurrentTarget()) { return(true); } if (await DamageOverTime.WindbiteOnCurrentTarget()) { return(true); } if (await DamageOverTime.VenomousBiteOnCurrentTarget()) { return(true); } if (await Aoe.ApexArrow()) { return(true); } if (await DamageOverTime.IronJawsOnOffTarget()) { return(true); } if (await DamageOverTime.WindbiteOnOffTarget()) { return(true); } if (await DamageOverTime.VenomousBiteOnOffTarget()) { return(true); } if (await Aoe.QuickNock()) { return(true); } if (await SingleTarget.StraightShot()) { return(true); } return(await SingleTarget.HeavyShot()); }
private void Unload() { Cooldowns.Save(); }
public void ServerPerformInteraction(PositionalHandApply interaction) { //can only be applied to LHB if (!Validations.HasComponent <LivingHealthMasterBase>(interaction.TargetObject)) { return; } //The book can't save people who are dead. var LHB = interaction.TargetObject.GetComponent <LivingHealthMasterBase>(); if (LHB.IsDead) { return; } //Occurs only if applied on the head. if (interaction.TargetBodyPart != BodyPartType.Head) { return; } //Only the Chaplain can use the holy book. if (PlayerList.Instance.Get(interaction.Performer).Job != JobType.CHAPLAIN) { Chat.AddExamineMsgFromServer(interaction.Performer, "A force restrains you. Non-Clergymen can't use this!"); return; } //If using harm intent, book has 60% chance of causing brain trauma, and 40% of healing a bodypart. //If using any other intent, book has 60% chance of healing a bodypart, and 40% of causing brain trauma. int rand = rnd.Next(0, 10); bool willHarm = false; switch (interaction.Intent) { default: case Intent.Help: if (rand <= 5) { willHarm = true; } else { willHarm = false; } break; case Intent.Harm: if (rand <= 5) { willHarm = false; } else { willHarm = true; } break; } string performerName = interaction.Performer.ExpensiveName(); string victimName = interaction.TargetObject.ExpensiveName(); //Deal 10 brain trauma. [DUE TO NOT HAVING BRAIN DAMAGE YET, SUFFOCATION IS USED TO PREVENT SPAMMING.] //TODO: Rewrite this to deal 10 brain damage when organ damage is implemented. if (willHarm) { if (LHB.brain != null) { LHB.brain.RelatedPart.TakeDamage(this.gameObject, 10, AttackType.Magic, DamageType.Brute); Chat.AddActionMsgToChat(interaction.Performer, $"Your book slams into {victimName}'s head, and not much else.", $"{performerName}'s book slams into {victimName}'s head, and not much else."); SoundManager.PlayNetworkedAtPos(SingletonSOSounds.Instance.GenericHit, interaction.WorldPositionTarget, sourceObj: interaction.Performer); } } else //Heal a bodypart if possible. { //If there is no damage, do nothing. if (LHB.OverallHealth < LHB.MaxHealth) { //Break foreach loop once a single heal is applied. foreach (BodyPart bodyPart in LHB.ImplantList) { if (bodyPart.DamageContributesToOverallHealth == false) { continue; } //Heal brute first, then burns. if (bodyPart.Brute != 0) { bodyPart.HealDamage(this.gameObject, healthModifier, DamageType.Brute); break; } if (bodyPart.Burn != 0) { bodyPart.HealDamage(this.gameObject, healthModifier, DamageType.Burn); break; } } Chat.AddActionMsgToChat(interaction.Performer, $"A flash of light from your book thwacking {victimName} heals some of {victimName}'s wounds.", $"A flash of light from {performerName}'s book thwacking {victimName} heals some of {victimName}'s wounds."); SoundManager.PlayNetworkedAtPos(SingletonSOSounds.Instance.PunchMiss, interaction.WorldPositionTarget, sourceObj: interaction.Performer); } } //Play melee animation. interaction.Performer.GetComponent <WeaponNetworkActions>().RpcMeleeAttackLerp(interaction.TargetVector, gameObject); //Start server cooldown. Cooldowns.TryStartServer(interaction.Performer.GetComponent <PlayerScript>(), CommonCooldowns.Instance.Melee); }
private void Awake() { _cooldowns = GetComponent <Cooldowns>(); _combatSystem = GetComponentInChildren <CombatSystem>(); }
public void DoInstantAction(InstantActionEventArgs args) { args.Performer.PopupMessageEveryone(Message); args.PerformerActions?.Cooldown(args.ActionType, Cooldowns.SecondsFromNow(Cooldown)); }
private void ProcessInteraction <T>(T interaction, GameObject processorObj, Type ComponentType) where T : global::Interaction { //find the indicated component if one was indicated if (ComponentType != null) { if (processorObj == null) { Logger.LogWarning("processorObj is null, action will not be performed.", Category.Interaction); return; } var component = processorObj.GetComponent(ComponentType); if (component == null) { Logger.LogWarningFormat("No component found of requested type {0} on {1}," + " action will not be performed.", Category.Interaction, ComponentType.Name, processorObj.name); return; } if (!(component is IInteractable <T>)) { Logger.LogWarningFormat("Component of type {0} doesn't implement IInteractable" + " for interaction type {1} on {2}," + " action will not be performed.", Category.Interaction, ComponentType.Name, typeof(T).Name, processorObj.name); return; } var interactable = (component as IInteractable <T>); //server side interaction check and cooldown check, and start the cooldown if (interactable.ServerCheckInteract(interaction) && Cooldowns.TryStartServer(interaction, CommonCooldowns.Instance.Interaction)) { //perform interactable.ServerPerformInteraction(interaction); } else { //rollback if this component implements it if (component is IPredictedInteractable <T> predictedInteractable) { predictedInteractable.ServerRollbackClient(interaction); } } } else { // client wasn't sure which component of which object should be triggered, check them in the proper order // and trigger the first one that should happen, rolling back any that shouldn't happen. //always check used object first if (interaction.UsedObject) { var interactables = interaction.UsedObject.GetComponents <IInteractable <T> >() .Where(c => c != null && (c as MonoBehaviour).enabled); Logger.LogTraceFormat("Server checking which component to trigger for {0} on object {1}", Category.Interaction, typeof(T).Name, interaction.UsedObject.name); if (ServerCheckAndTrigger(interaction, interactables)) { return; } } //check the target object if there is one if (interaction is TargetedInteraction targetedInteraction) { if (targetedInteraction.TargetObject == null) { return; } var interactables = targetedInteraction.TargetObject.GetComponents <IInteractable <T> >() .Where(c => c != null && (c as MonoBehaviour)?.enabled == true); Logger.LogTraceFormat("Server checking which component to trigger for {0} on object {1}", Category.Interaction, typeof(T).Name, targetedInteraction.TargetObject.name); if (ServerCheckAndTrigger(interaction, interactables)) { return; } } } }
private static bool CheckInteractInternal <T>(this IBaseInteractable <T> interactable, T interaction, NetworkSide side, out bool wasClientInteractable) where T : Interaction { wasClientInteractable = false; //interactions targeting an object at hiddenpos are NEVER allowed (except for inventory actions, //since they can target an object in inventory which means its at hiddenpos) if (!(interaction is InventoryApply) && interaction is TargetedInteraction targetedInteraction) { if (targetedInteraction.TargetObject != null && targetedInteraction.TargetObject.IsAtHiddenPos()) { Logger.LogTraceFormat("Aborting {0} interaction on object {1} because the object is hidden.", Category.Interaction, typeof(T).Name, targetedInteraction.TargetObject.name); return(false); } } if (Cooldowns.IsOn(interaction, CooldownID.Asset(CommonCooldowns.Instance.Interaction, side))) { return(false); } var result = false; //check if client side interaction should be triggered if (side == NetworkSide.Client && interactable is IClientInteractable <T> clientInteractable) { result = clientInteractable.Interact(interaction); if (result) { Logger.LogTraceFormat("ClientInteractable triggered from {0} on {1} for object {2}", Category.Interaction, typeof(T).Name, clientInteractable.GetType().Name, (clientInteractable as Component).gameObject.name); Cooldowns.TryStartClient(interaction, CommonCooldowns.Instance.Interaction); wasClientInteractable = true; return(true); } } //check other kinds of interactions if (interactable is ICheckable <T> checkable) { result = checkable.WillInteract(interaction, side); if (result) { Logger.LogTraceFormat("WillInteract triggered from {0} on {1} for object {2}", Category.Interaction, typeof(T).Name, checkable.GetType().Name, (checkable as Component).gameObject.name); wasClientInteractable = false; return(true); } } else if (interactable is IInteractable <T> ) { //use default logic result = DefaultWillInteract.Default(interaction, side); if (result) { Logger.LogTraceFormat("WillInteract triggered from {0} on {1} for object {2}", Category.Interaction, typeof(T).Name, interactable.GetType().Name, (interactable as Component).gameObject.name); wasClientInteractable = false; return(true); } } Logger.LogTraceFormat("No interaction triggered from {0} on {1} for object {2}", Category.Interaction, typeof(T).Name, interactable.GetType().Name, (interactable as Component).gameObject.name); wasClientInteractable = false; return(false); }
public bool HasActiveTimer() { var t = GetCompanyTask(); return(Cooldowns.GetTask(Q, t) != null); }
public void CmdResist() { if (!Cooldowns.TryStartServer(playerScript, CommonCooldowns.Instance.Interaction)) { return; } // Handle the movement restricted actions first. if (playerScript.playerMove.IsBuckled) { // Make sure we don't unbuckle if we are currently cuffed. if (!playerScript.playerMove.IsCuffed) { playerScript.playerMove.Unbuckle(); } } else if (playerScript.playerHealth.FireStacks > 0) // Check if we are on fire. If we are perform a stop-drop-roll animation and reduce the fire stacks. { if (!playerScript.registerTile.IsLayingDown) { // Throw the player down to the floor for 15 seconds. playerScript.registerTile.ServerStun(15); SoundManager.PlayNetworkedAtPos("Bodyfall", transform.position, sourceObj: gameObject); } else { // Remove 5 stacks(?) per roll action. playerScript.playerHealth.ChangeFireStacks(-5.0f); // Find the next in the roll sequence. Also unlock the facing direction temporarily since ServerStun locks it. playerScript.playerDirectional.LockDirection = false; Orientation faceDir = playerScript.playerDirectional.CurrentDirection; OrientationEnum currentDir = faceDir.AsEnum(); switch (currentDir) { case OrientationEnum.Up: faceDir = Orientation.Right; break; case OrientationEnum.Right: faceDir = Orientation.Down; break; case OrientationEnum.Down: faceDir = Orientation.Left; break; case OrientationEnum.Left: faceDir = Orientation.Up; break; } playerScript.playerDirectional.FaceDirection(faceDir); playerScript.playerDirectional.LockDirection = true; } if (playerScript.playerHealth.FireStacks <= 0) { playerScript.playerHealth.Extinguish(); } } else if (playerScript.playerMove.IsCuffed) // Check if cuffed. { if (playerScript.playerSprites != null && playerScript.playerSprites.clothes.TryGetValue("handcuffs", out var cuffsClothingItem)) { if (cuffsClothingItem != null && cuffsClothingItem.TryGetComponent <RestraintOverlay>(out var restraintOverlay)) { restraintOverlay.ServerBeginUnCuffAttempt(); } } } }
public static async Task <bool> Combat() { if (BotManager.Current.IsAutonomous) { if (Core.Me.HasTarget) { Movement.NavigateToUnitLos(Core.Me.CurrentTarget, 20 + Core.Me.CurrentTarget.CombatReach); } } if (!Core.Me.HasTarget || !Core.Me.CurrentTarget.ThoroughCanAttack()) { return(false); } if (await CustomOpenerLogic.Opener()) { return(true); } if (MachinistSettings.Instance.UseFlamethrower && Core.Me.HasAura(Auras.Flamethrower)) { // First check movement otherwise Flamethrower can be executed whereas you are moving if (MovementManager.IsMoving) { return(false); } if (!MachinistSettings.Instance.UseFlamethrower) { return(true); } if (Core.Me.EnemiesInCone(8) >= MachinistSettings.Instance.FlamethrowerEnemyCount) { return(true); } } if (ActionResourceManager.Machinist.OverheatRemaining != TimeSpan.Zero) { if (MachinistRoutine.GlobalCooldown.CanWeave(1)) { //Utility if (await PhysicalDps.ArmsLength(MachinistSettings.Instance)) { return(true); } if (await PhysicalDps.Interrupt(MachinistSettings.Instance)) { return(true); } //Pets if (await Pet.RookQueen()) { return(true); } //Cooldowns if (await Cooldowns.BarrelStabilizer()) { return(true); } //oGCDs if (await SingleTarget.GaussRound()) { return(true); } if (await MultiTarget.Ricochet()) { return(true); } //Cooldowns if (await Cooldowns.Reassemble()) { return(true); } } } else { if (MachinistRoutine.GlobalCooldown.CanWeave()) { //Utility if (await Utility.Tactician()) { return(true); } if (await PhysicalDps.ArmsLength(MachinistSettings.Instance)) { return(true); } if (await PhysicalDps.SecondWind(MachinistSettings.Instance)) { return(true); } if (await PhysicalDps.Interrupt(MachinistSettings.Instance)) { return(true); } //Pets if (await Pet.RookQueen()) { return(true); } if (await Pet.RookQueenOverdrive()) { return(true); } //Cooldowns if (await Cooldowns.Wildfire()) { return(true); } if (await Cooldowns.Hypercharge()) { return(true); } if (await Cooldowns.Reassemble()) { return(true); } if (await Cooldowns.BarrelStabilizer()) { return(true); } //oGCDs if (await SingleTarget.GaussRound()) { return(true); } if (await MultiTarget.Ricochet()) { return(true); } } } //GCDs - Top Hypercharge Priority if (await MultiTarget.AutoCrossbow()) { return(true); } if (await SingleTarget.HeatBlast()) { return(true); } //Use On CD if (await MultiTarget.ChainSaw()) { return(true); } if (await MultiTarget.BioBlaster()) { return(true); } if (await SingleTarget.Drill()) { return(true); } if (await SingleTarget.HotAirAnchor()) { return(true); } if (await MultiTarget.Flamethrower()) { return(true); } if (await MultiTarget.Scattergun()) { return(true); } //Default Combo if (await SingleTarget.HeatedCleanShot()) { return(true); } if (await SingleTarget.HeatedSlugShot()) { return(true); } return(await SingleTarget.HeatedSplitShot()); }
public async Task RulesAsync() { var channel = Context.Channel; var user = Context.User; await Context.Message.DeleteAsync(); TimeSpan last = Cooldowns.GetRulesLast(); TimeSpan current = DateTime.Now.TimeOfDay; double difference = current.TotalSeconds - last.TotalSeconds; if (difference >= Cooldowns.GetCommandCooldown() || difference < 0) { var embed = new EmbedBuilder() { Color = Colours.generalCol }; embed.WithAuthor("GTA5Police Rules", References.GetGta5policeLogo()); embed.Title = "Click to view all GTA5Police rules."; embed.Description = "**Teamspeak IP: gta5police.com**"; embed.WithUrl(References.GetRulesURL()); embed.WithThumbnailUrl(References.GetGta5policeLogo()); embed.WithImageUrl(References.GetHowBanURL()); embed.WithFooter("Requested by " + Context.User); embed.WithCurrentTimestamp(); var message = await Context.Channel.SendMessageAsync("", false, embed); await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown()); await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Rules command was used by " + user + ".")); Cooldowns.SetRulesLast(current); Statistics.AddOutgoingMessages(); } else { await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol); } }
public static bool IsCanStartBrandingCampaign(GameEntity product, GameContext gameContext, CompanyTask task, long cost) { //Companies.IsEnoughResources(product, cost) && return(!Cooldowns.HasTask(gameContext, task)); }
public async Task ApplyAsync() { var channel = Context.Channel; var user = Context.User; await Context.Message.DeleteAsync(); TimeSpan last = Cooldowns.GetApplyLast(); TimeSpan current = DateTime.Now.TimeOfDay; double difference = current.TotalSeconds - last.TotalSeconds; if (difference >= Cooldowns.GetCommandCooldown() || difference < 0) { var embed = new EmbedBuilder() { Color = Colours.generalCol }; embed.WithAuthor("GTA5Police Applications", References.GetGta5policeLogo()); embed.WithUrl(References.GetApplicationsURL()); embed.Description = "Whitelist jobs and server applications.\n**Teamspeak IP: gta5police.com**"; embed.WithThumbnailUrl(References.GetGta5policeLogo()); embed.AddField(new EmbedFieldBuilder() { Name = "Whitelist Servers", Value = References.GetWhitelistURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Police", Value = References.GetPoliceURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "EMS", Value = References.GetEmsURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Mechanic", Value = References.GetMechanicURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Taxi", Value = References.GetTaxiURL() }); embed.AddField(new EmbedFieldBuilder() { Name = "Stream Verification", Value = References.GetStreamURL() }); embed.WithFooter("Requested by " + Context.User); embed.WithCurrentTimestamp(); var message = await Context.Channel.SendMessageAsync("", false, embed); await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown()); await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Apply command was used by " + user + ".")); Cooldowns.SetApplyLast(current); Statistics.AddOutgoingMessages(); } else { await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol); } }
public async Task GrantsAndRevokesItemActions() { var serverOptions = new ServerIntegrationOptions { ExtraPrototypes = Prototypes }; var clientOptions = new ClientIntegrationOptions { ExtraPrototypes = Prototypes }; var(client, server) = await StartConnectedServerClientPair(serverOptions : serverOptions, clientOptions : clientOptions); await server.WaitIdleAsync(); await client.WaitIdleAsync(); var serverPlayerManager = server.ResolveDependency <IPlayerManager>(); var serverEntManager = server.ResolveDependency <IEntityManager>(); var serverGameTiming = server.ResolveDependency <IGameTiming>(); var cooldown = Cooldowns.SecondsFromNow(30, serverGameTiming); ServerActionsComponent serverActionsComponent = null; ClientActionsComponent clientActionsComponent = null; IEntity serverPlayerEnt = null; IEntity serverFlashlight = null; await server.WaitAssertion(() => { serverPlayerEnt = serverPlayerManager.GetAllPlayers().Single().AttachedEntity; serverActionsComponent = serverPlayerEnt !.GetComponent <ServerActionsComponent>(); // spawn and give them an item that has actions serverFlashlight = serverEntManager.SpawnEntity("TestFlashlight", new EntityCoordinates(new EntityUid(1), (0, 0))); Assert.That(serverFlashlight.TryGetComponent <ItemActionsComponent>(out var itemActions)); // we expect this only to have a toggle light action initially var actionConfigs = itemActions.ActionConfigs.ToList(); Assert.That(actionConfigs.Count == 1); Assert.That(actionConfigs[0].ActionType == ItemActionType.ToggleLight); Assert.That(actionConfigs[0].Enabled); // grant an extra item action, before pickup, initially disabled itemActions.GrantOrUpdate(ItemActionType.DebugToggle, false); serverPlayerEnt.GetComponent <HandsComponent>().PutInHand(serverFlashlight.GetComponent <ItemComponent>(), false); // grant an extra item action, after pickup, with a cooldown itemActions.GrantOrUpdate(ItemActionType.DebugInstant, cooldown: cooldown); Assert.That(serverActionsComponent.TryGetItemActionStates(serverFlashlight.Uid, out var state)); // they should have been granted all 3 actions Assert.That(state.Count == 3); Assert.That(state.TryGetValue(ItemActionType.ToggleLight, out var toggleLightState)); Assert.That(toggleLightState.Equals(new ActionState(true))); Assert.That(state.TryGetValue(ItemActionType.DebugInstant, out var debugInstantState)); Assert.That(debugInstantState.Equals(new ActionState(true, cooldown: cooldown))); Assert.That(state.TryGetValue(ItemActionType.DebugToggle, out var debugToggleState)); Assert.That(debugToggleState.Equals(new ActionState(false))); }); await server.WaitRunTicks(5); await client.WaitRunTicks(5); // check that client has the actions, and toggle the light on via the action slot it was auto-assigned to var clientPlayerMgr = client.ResolveDependency <Robust.Client.Player.IPlayerManager>(); var clientUIMgr = client.ResolveDependency <IUserInterfaceManager>(); EntityUid clientFlashlight = default; await client.WaitAssertion(() => { var local = clientPlayerMgr.LocalPlayer; var controlled = local !.ControlledEntity; clientActionsComponent = controlled !.GetComponent <ClientActionsComponent>(); var lightEntry = clientActionsComponent.ItemActionStates() .Where(entry => entry.Value.ContainsKey(ItemActionType.ToggleLight)) .FirstOrNull(); clientFlashlight = lightEntry !.Value.Key; Assert.That(lightEntry, Is.Not.Null); Assert.That(lightEntry.Value.Value.TryGetValue(ItemActionType.ToggleLight, out var lightState)); Assert.That(lightState.Equals(new ActionState(true))); Assert.That(lightEntry.Value.Value.TryGetValue(ItemActionType.DebugInstant, out var debugInstantState)); Assert.That(debugInstantState.Equals(new ActionState(true, cooldown: cooldown))); Assert.That(lightEntry.Value.Value.TryGetValue(ItemActionType.DebugToggle, out var debugToggleState)); Assert.That(debugToggleState.Equals(new ActionState(false))); var actionsUI = clientUIMgr.StateRoot.Children.FirstOrDefault(c => c is ActionsUI) as ActionsUI; Assert.That(actionsUI, Is.Not.Null); var toggleLightSlot = actionsUI.Slots.FirstOrDefault(slot => slot.Action is ItemActionPrototype { ActionType: ItemActionType.ToggleLight }); Assert.That(toggleLightSlot, Is.Not.Null); clientActionsComponent.AttemptAction(toggleLightSlot); });
public async Task UptimeAsync() { var channel = Context.Channel; var user = Context.User; await Context.Message.DeleteAsync(); TimeSpan last = Cooldowns.GetUptimeLast(); TimeSpan current = DateTime.Now.TimeOfDay; double difference = current.TotalSeconds - last.TotalSeconds; TimeSpan uptimeTime = DateTime.Now.TimeOfDay - Cooldowns.GetStartupTime(); int startHours = uptimeTime.Hours; if (startHours < 0) { startHours = startHours + 24; } int startMinutes = uptimeTime.Minutes; int startSeconds = uptimeTime.Seconds; int startDays = DateTime.Now.Date.Day - Cooldowns.GetStartupDate().Day; if (startDays < 0) { startDays = ((startDays - startDays) - startDays); int startMonth = Cooldowns.GetStartupDate().Month; int startYear = Cooldowns.GetStartupDate().Year; int maxDaysInMonth = DateTime.DaysInMonth(startYear, startMonth); int extraDays = maxDaysInMonth - Cooldowns.GetStartupDate().Day; startDays = startDays + extraDays; } if (difference >= Cooldowns.GetCommandCooldown() || difference < 0) { var embed = new EmbedBuilder() { Color = Colours.generalCol }; var blankField = new EmbedFieldBuilder() { Name = "\u200b", Value = "\u200b" }; embed.WithAuthor("Bot Uptime and Statistics", References.GetGta5policeLogo()); embed.WithDescription("Here are all the statistics since last startup.\n**Teamspeak IP: gta5police.com**"); embed.WithThumbnailUrl(References.GetGta5policeLogo()); embed.WithUrl("http://www.blurrdev.com/gta5police.html"); //embed.AddField(new EmbedFieldBuilder() { Name = "Bot Uptime", Value = DateTime.Now.TimeOfDay - Cooldowns.GetStartupTime() }); embed.AddField(new EmbedFieldBuilder() { Name = "Bot Uptime", Value = "Days: " + startDays + " | Hours: " + startHours + " | Minutes: " + startMinutes + " | Seconds: " + startSeconds }); embed.AddField(new EmbedFieldBuilder() { Name = "Incoming Messages", Value = Statistics.GetIncomingMessages(), IsInline = true }); embed.AddField(new EmbedFieldBuilder() { Name = "Outgoing Messages", Value = Statistics.GetOutgoingMessages(), IsInline = true }); embed.AddField(new EmbedFieldBuilder() { Name = "Command Requests", Value = Statistics.GetCommandRequests(), IsInline = true }); embed.AddField(new EmbedFieldBuilder() { Name = "Admen Requests", Value = Statistics.GetAdmenRequests(), IsInline = true }); embed.AddField(new EmbedFieldBuilder() { Name = "Oofers", Value = Statistics.GetOofMessages(), IsInline = true }); embed.AddField(new EmbedFieldBuilder() { Name = "Meta Messages", Value = Statistics.GetMetaMessages(), IsInline = true }); embed.AddField(blankField); embed.AddField(new EmbedFieldBuilder() { Name = "Profanity Detected", Value = Statistics.GetProfanityDetected(), IsInline = true }); embed.AddField(new EmbedFieldBuilder() { Name = "Errors Detected", Value = Statistics.GetErrorsDetected(), IsInline = true }); embed.AddField(new EmbedFieldBuilder() { Name = "Timer Messages", Value = Statistics.GetTimerMessages(), IsInline = true }); embed.AddField(new EmbedFieldBuilder() { Name = "Status Changes", Value = Statistics.GetStatusChanges(), IsInline = true }); embed.WithFooter("Requested by " + Context.User); embed.WithCurrentTimestamp(); var message = await Context.Channel.SendMessageAsync("", false, embed); await Delete.DelayDeleteEmbedAsync(message, (int)Cooldowns.GetCommandCooldown()); await Program.Logger(new LogMessage(LogSeverity.Info, "GTA5Police Commands", "Uptime command was used by " + user + ".")); Cooldowns.SetUptimeLast(current); Statistics.AddOutgoingMessages(); } else { await errors.sendErrorTempAsync(channel, user + errorMessage + "\nCooldown " + difference + "/" + Cooldowns.GetCommandCooldown() + " seconds", Colours.errorCol); } }
// Use this for initialization void Start() { _coolDownScript = GameObject.FindWithTag(Tags.playerTag).GetComponent<Cooldowns>(); }