private void CanSeeStash(BasePlayer player, StashContainer stash) { if (stash.inventory.itemList.Count == 0 || player.userID == stash.OwnerID) { return; } if ((bool)Config[IGNORE_SAME_TEAM] && IsTeamMember(player, stash)) { if (player.IsAdmin) { SendReply(player, "sameteam: " + IsTeamMember(player, stash)); } return; } IPlayer iPlayerOwner = covalence.Players.FindPlayerById(stash.OwnerID.ToString()); AddWarning(player, iPlayerOwner); foreach (BasePlayer target in BasePlayer.activePlayerList.Where(x => x.IsAdmin)) { SendReply(target, message, player); } LogToFile(string.Empty, message, this); if (_discordEnabled) { DiscordMessages?.Call("API_SendTextMessage", _webhookUrl, message); } }
private void OnEntitySpawned(StashContainer stash) { if (stash != null) { _stashes.Add(stash); } }
void OnFrame() { StashContainer[] stashes = GameObject.FindObjectsOfType <StashContainer>(); BasePlayer[] players = GameObject.FindObjectsOfType <BasePlayer>(); int botCount = 0; foreach (BasePlayer player in players) { if (player.IsWounded() && player.HasFlag(BaseEntity.Flags.Reserved1)) { player.Kill(); player.SendNetworkUpdate(); headShots++; } if (player.HasFlag(BaseEntity.Flags.Reserved1)) { botCount++; } } if (botCount < botCounts) { StashContainer randomStash = stashes[UnityEngine.Random.Range(0, stashes.Length - 1)]; SpawnBot(randomStash.transform.position); } }
void CmdSpawn(ConsoleSystem.Arg arg) { StashContainer[] stashes = GameObject.FindObjectsOfType <StashContainer>(); StashContainer randomStash = stashes[UnityEngine.Random.Range(0, stashes.Length - 1)]; SpawnBot(randomStash.transform.position); }
void CanHideStash(BasePlayer player, StashContainer stash) { if (!permission.UserHasPermission(player.UserIDString, permUse)) { return; } MapMarkerGenericRadius marker = GetOrAddMarker(player, stash.transform.position); marker.SendUpdate(); }
private void OnEntityKill(StashContainer stash) { _stashes.Remove(stash); List <MapMarkerGenericRadius> playerMarkers = _mapMarker[stash.OwnerID]; MapMarkerGenericRadius marker = playerMarkers?.FirstOrDefault(m => m.transform.position == stash.transform.position); if (marker == null || marker.IsDestroyed) { return; } marker.Kill(); playerMarkers.Remove(marker); }
public static void ESPText(BasePlayer adminPly, StashContainer sc) { adminPly.SendConsoleCommand("ddraw.text", new object[] { Variables.ESPSlowTickRate + 0.05f, Color.white, sc.transform.position, string.Format("Stash - <color=#ffa500>{0} M</color> - {1}", new object[] { Math.Floor((double)Vector3.Distance(sc.transform.position, adminPly.transform.position)), sc.IsHidden() ? "HIDDEN" : "VISIBLE" }) }); }
private bool IsTeamMember(BasePlayer player, StashContainer stash) { if (!(bool)Config[IGNORE_SAME_TEAM]) { return(false); } RelationshipManager.PlayerTeam team = RelationshipManager.ServerInstance.FindPlayersTeam(stash.OwnerID); if (team == null) { return(false); } return(team.teamID == player.currentTeam); }
void CanSeeStash(BasePlayer player, StashContainer stash) { List <MapMarkerGenericRadius> playerMarkers; if (!_mapMarker.TryGetValue(player.userID, out playerMarkers)) { _mapMarker.Add(player.userID, playerMarkers = new List <MapMarkerGenericRadius>()); } MapMarkerGenericRadius marker = playerMarkers?.FirstOrDefault(m => m.transform.position == stash.transform.position); if (marker == null || marker.IsDestroyed) { return; } marker.Kill(); playerMarkers.Remove(marker); }
private void CanSeeStash(StashContainer stash, BasePlayer player) { if (!_data.Stashes.Contains(stash.net.ID) || HasPermission(player)) { return; } _data.Stashes.Remove(stash.net.ID); _data.SaveData(_data.Stashes, "Stashes"); var nearbyPlayers = FormatNearbyPlayers(player); var body = MessageJson .Replace("{player}", $"{player.displayName} ({player.UserIDString})") .Replace("{nearbyPlayers}", string.IsNullOrEmpty(nearbyPlayers) ? "None" : nearbyPlayers) .Replace("{position}", FormatCoordinates(stash.transform.position)) .Replace("{networkID}", stash.net.ID.ToString()); webrequest.Enqueue(_configuration.WebHookURL, body, (code, response) => { if (code != 204) { PrintWarning($"Warning, the Discord API responded with code {code}."); } }, this, RequestMethod.POST); if (string.IsNullOrEmpty(nearbyPlayers)) { LogToFile("Stashes", string.Format(lang.GetMessage("StashLogAlone", this), DateTime.Now.ToShortDateString(), $"{player.displayName} ({player.UserIDString})", FormatCoordinates(stash.transform.position)), this, false); foreach (var target in BasePlayer.activePlayerList.Where(x => HasPermission(x))) { MessagePlayer(target, "StashAlertAlone", $"{player.displayName} ({player.UserIDString})", FormatCoordinates(stash.transform.position), stash.net.ID); } return; } LogToFile("Stashes", string.Format(lang.GetMessage("StashLogTogether", this), DateTime.Now.ToShortDateString(), $"{player.displayName} ({player.UserIDString})", nearbyPlayers, FormatCoordinates(stash.transform.position)), this, false); foreach (var target in BasePlayer.activePlayerList.Where(x => HasPermission(x))) { MessagePlayer(target, "StashAlertTogether", $"{player.displayName} ({player.UserIDString})", nearbyPlayers, FormatCoordinates(stash.transform.position), stash.net.ID); } }
public void Load(string fileName) { this.Unload(); if (!string.IsNullOrWhiteSpace(fileName)) { // try to load the file this.CurrentlyOpenFileName = fileName; try { this.stashContainer = StashContainer.LoadFromFile(fileName, logger); } catch (Exception ex) { MessageBox.Show($"Could not load file \"{fileName}\": \r\n{ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else { this.stashContainer = new StashContainer(); this.CurrentlyOpenFileName = null; } }
void FixedUpdate() { if (!AimTrain.Moving) { return; } if (Vector3.Distance(transform.position, targetPosition) < 1.0f) { //targetPosition = startPosition + transform.right * UnityEngine.Random.Range(-15, 15); StashContainer[] stashes = GameObject.FindObjectsOfType <StashContainer>(); StashContainer randomStash = stashes[UnityEngine.Random.Range(0, stashes.Length - 1)]; targetPosition = randomStash.transform.position; } Vector3 newPos = Vector3.Lerp(transform.position, targetPosition, Time.fixedDeltaTime * moveSpeed); newPos = Vector3.MoveTowards(transform.position, targetPosition, moveSpeed); basePlayer.transform.position = newPos; basePlayer.Teleport(basePlayer); basePlayer.SendNetworkUpdate(); }
private object CanHideStash(BasePlayer player, StashContainer stash) { var @event = new RustPlayerHidingStashEvent(new RustPlayer(player), stash); return(EmitCancellableReturnsObject(@event)); }
/// <summary> /// Loads the stash container from a file /// </summary> /// <param name="fileName">Name of the file to load</param> public void Load(string fileName) { this.Container = StashContainer.LoadFromFile(fileName, this.logger); this.FileName = fileName; }
string GetContents(StashContainer stash) { var items = stash.inventory?.itemList?.Select(item => string.Format("{0} ({1})", item.info.displayName.translated, item.amount))?.ToArray() ?? new string[0]; return(items.Length > 0 ? string.Join(", ", items) : string.Empty); }
object CanSeeStash(BasePlayer player, StashContainer stash) { if (StashUsers.Contains(player.userID)) { return("Dont show"); } if (IsMemberOrAlly(stash.OwnerID.ToString(), player.UserIDString)) { return(null); } IPlayer iplayer = covalence.Players.FindPlayerById(stash.OwnerID.ToString()); Puts("Stash found " + stash.OwnerID); bool deleteContents = false; if (stash.OwnerID == player.userID && cfg.DiscordIgnoreOwnStash) { return(null); } if (stash.OwnerID.Equals(KingSteamID)) { if (cfg.ShowServerStashWarning) { SendReplyWithIcon(player, GetMsg("Stash Found Warning")); } deleteContents = true; } List <EmbedFieldList> content = new List <EmbedFieldList>(); content.Add( new EmbedFieldList() { name = "Location", value = stash.transform.position.ToString() + " Grid " + GridReference(stash.transform.position), inline = false } ); int cnt = 0; var contents = new StringBuilder(); while (cnt < stash.inventorySlots) { Item slot = stash.inventory.GetSlot(cnt); if (slot != null) { if (deleteContents) { slot.DoRemove(); } } cnt++; } content.Add( new EmbedFieldList() { name = "Owner of stash", value = iplayer != null ? iplayer?.Name : stash.OwnerID.ToString(), inline = false } ); Facepunch.RCon.Broadcast(RCon.LogType.Chat, new ConVar.Chat.ChatEntry { Message = "Stash Found, original owner is " + iplayer.Name + " [" + iplayer.Id + "], \n Location: " + stash.transform.position.ToString() + " Grid " + GridReference(stash.transform.position), UserId = player.UserIDString, Username = player.displayName, Time = Facepunch.Math.Epoch.Current }); DiscordSend(player, content); return(null); }
public RustPlayerRevealingStashEvent(RustPlayer player, StashContainer stash) : base(player) { Stash = stash; }
// Token: 0x060003DB RID: 987 RVA: 0x00004BBD File Offset: 0x00002DBD static bool smethod_4(StashContainer stashContainer_0) { return(stashContainer_0.IsHidden()); }