public void ClearUser(CSteamID id) { lock (this._pendingReadBuffers) { this._deletionQueue.Enqueue(id); } }
public byte GetWarnings(CSteamID id) { byte num = 0; try { MySqlConnection mySqlConnection = this.createConnection(); MySqlCommand mySqlCommand = mySqlConnection.CreateCommand(); mySqlCommand.CommandText = string.Concat(new string[] { "select `warninglevel` from `", Zaup_Warning.Instance.Configuration.Instance.TableName, "` where `steamId` = '", id.ToString(), "';" }); mySqlConnection.Open(); object obj = mySqlCommand.ExecuteScalar(); if (obj != null) { byte.TryParse(obj.ToString(), out num); } mySqlConnection.Close(); } catch (Exception exception) { Logger.LogException(exception); } return num; }
protected override void execute( CSteamID executorId, string parameter ) { try { var commandSource = executorId == CSteamID.Nil ? EssProvider.ConsoleSource : UPlayer.From( executorId ); if ( commandSource.IsConsole && Command.AllowedSource == AllowedSource.PLAYER ) { EssLang.CONSOLE_CANNOT_EXECUTE.SendTo( commandSource ); } else if ( !commandSource.IsConsole && Command.AllowedSource == AllowedSource.CONSOLE ) { EssLang.PLAYER_CANNOT_EXECUTE.SendTo( commandSource ); } else { Command.OnExecute( commandSource , new CommandArgs( parameter ) ); } } catch ( Exception e ) { UPlayer.TryGet( executorId, EssLang.COMMAND_ERROR_OCURRED.SendTo ); EssProvider.Logger.LogError( e.ToString() ); } }
public void AddUpdateVictimAccount(CSteamID id, decimal bounty, string lastDisplayName) { try { MySqlConnection connection = CreateConnection(); MySqlCommand command = connection.CreateCommand(); if (CheckExists(id)) { command.CommandText = "UPDATE `" + FeexHitman.Instance.Configuration.Instance.FeexHitmanDatabase.DatabaseTableName + "` SET `bounty` = bounty + (" + bounty + "), `lastDisplayName` = @lastDisplayName, `lastUpdated` = NOW() WHERE `steamId` = '" + id.ToString() + "';"; } else { command.CommandText = "INSERT IGNORE INTO `" + FeexHitman.Instance.Configuration.Instance.FeexHitmanDatabase.DatabaseTableName + "` (steamId,bounty,lastDisplayName,lastUpdated) VALUES('" + id.ToString() + "','" + bounty + "',@lastDisplayName,NOW());"; } command.Parameters.AddWithValue("@lastDisplayName", lastDisplayName); connection.Open(); IAsyncResult result = command.BeginExecuteNonQuery(); command.EndExecuteNonQuery(result); connection.Close(); } catch (Exception ex) { Logger.LogException(ex); } }
public static void ActivateGameOverlayToUser(string pchDialog, CSteamID steamID) { InteropHelp.TestIfAvailableClient(); using (InteropHelp.UTF8StringHandle uTF8StringHandle = new InteropHelp.UTF8StringHandle(pchDialog)) { NativeMethods.ISteamFriends_ActivateGameOverlayToUser(uTF8StringHandle, steamID); } }
//[SteamCall] public void tellToggleHud(CSteamID steamID, bool visible) { if (base.channel.checkServer(steamID)) { Debug.LogError("CALLED HUD"); this.visible = visible; } }
public void SetInvitedToGameId(ulong gameId) { CSteamID y = new CSteamID(gameId); if (y.IsValid() && (CoopLobby.Instance == null || CoopLobby.Instance.Info.LobbyId != y)) { base.StartCoroutine(this.DelayedInviteReceived(new CoopLobbyInfo(gameId))); } }
private void ClearInventory(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { if (!player.HasPermission ("keepinventory.keep")) { return; } var playerInventory = player.Inventory; List<Item> ids = new List<Item> (); List<Item> clothes = new List<Item> (); // "Remove "models" of items from player "body"" player.Player.channel.send ("tellSlot", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, ( byte ) 0, ( byte ) 0, new byte[0]); player.Player.channel.send ("tellSlot", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, ( byte ) 1, ( byte ) 0, new byte[0]); // Remove items for (byte page = 0; page < 8; page++) { var count = playerInventory.getItemCount (page); for (byte index = 0; index < count; index++) { ids.Add (playerInventory.getItem (page, 0).item); playerInventory.removeItem (page, 0); } } // Unequip & remove from inventory player.Player.clothing.askWearBackpack (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearGlasses (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearHat (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearPants (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearMask (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearShirt (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearVest (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); clothes.AddRange (ids); deadAdmins.Add (player); adminItems.Add (player, clothes); }
internal void OnPlayerDeath( UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer ) { if ( !player.HasPermission( "essentials.command.back" ) ) return; var displayName = player.DisplayName; if ( BackDict.ContainsKey( displayName ) ) BackDict.Remove( displayName ); BackDict.Add( displayName, player.Position ); }
public void ClearUser(CSteamID user) { lock (this._lock) { if (this._pendingSendData.ContainsKey(user)) { Queue<SteamP2PWriter.WriteInformation> item = this._pendingSendData[user]; while (item.Count > 0) { this._bufferPool.Enqueue(item.Dequeue().Data); } } } }
public Party(UnturnedPlayer leader) { //create the party's fake steam group var buffer = new byte[sizeof(ulong)]; random.NextBytes(buffer); ulong newID = BitConverter.ToUInt64(buffer, 0); steamGroup = new CSteamID(newID); claimedIDs.Add(newID); //set and add the leader this.leader = leader; leader.Player.SteamChannel.SteamPlayer.playerID.SteamGroupID = steamGroup; members.Add(leader); }
public bool IsDataAvailable(CSteamID id) { bool flag; lock (this._pendingReadBuffers) { if (this._pendingReadBuffers.ContainsKey(id)) { Queue<SteamP2PReader.ReadResult> item = this._pendingReadBuffers[id]; flag = (item.Count == 0 || item.Peek().Size == 0 ? false : true); } else { flag = false; } } return flag; }
protected override void execute(CSteamID executorID, string parameter) { CommandQueue queue = ExecScript.ToQueue(UnturnedFreneticMod.Instance.CommandSystem.System); MapTag map = new MapTag(); if (executorID == CSteamID.Nil) { map.Internal["is_server"] = new BooleanTag(true); } else { map.Internal["player"] = new PlayerTag(PlayerTool.getSteamPlayer(executorID)); map.Internal["is_server"] = new BooleanTag(false); } map.Internal["raw_arguments"] = new TextTag(parameter); queue.SetVariable("context", map); queue.CommandStack.Peek().Debug = DebugMode.MINIMAL; // Just in case queue.Execute(); }
private void CheckParameters() { ulong ulSteamID; if (Program.LaunchParameters.ContainsKey("+connect_lobby") && ulong.TryParse(Program.LaunchParameters["+connect_lobby"], out ulSteamID)) { CSteamID lobbySteamId = new CSteamID(ulSteamID); if (lobbySteamId.IsValid()) { Main.OpenPlayerSelect(delegate(PlayerFileData playerData) { Main.ServerSideCharacter = false; playerData.SetAsActive(); Main.menuMode = 882; Main.statusText = "Joining..."; this._lobby.Join(lobbySteamId, new CallResult<LobbyEnter_t>.APIDispatchDelegate(this.OnLobbyEntered)); }); } } }
public decimal GetBounty(CSteamID id) { decimal output = 0; try { MySqlConnection connection = CreateConnection(); MySqlCommand command = connection.CreateCommand(); command.CommandText = "SELECT `bounty` FROM `" + FeexHitman.Instance.Configuration.Instance.FeexHitmanDatabase.DatabaseTableName + "` WHERE `steamId` = '" + id.ToString() + "';"; connection.Open(); object result = command.ExecuteScalar(); if (result != null) Decimal.TryParse(result.ToString(), out output); connection.Close(); } catch (Exception ex) { Logger.LogException(ex); } return output; }
public void QueueSend(CSteamID user, byte[] data, int length) { lock (this._lock) { Queue<SteamP2PWriter.WriteInformation> queue; if (this._pendingSendData.ContainsKey(user)) { queue = this._pendingSendData[user]; } else { queue = (this._pendingSendData[user] = new Queue<SteamP2PWriter.WriteInformation>()); } int i = length; int num = 0; while (i > 0) { SteamP2PWriter.WriteInformation writeInformation; if (queue.Count == 0 || 1024 - queue.Peek().Size == 0) { if (this._bufferPool.Count > 0) { writeInformation = new SteamP2PWriter.WriteInformation(this._bufferPool.Dequeue()); } else { writeInformation = new SteamP2PWriter.WriteInformation(); } queue.Enqueue(writeInformation); } else { writeInformation = queue.Peek(); } int num2 = Math.Min(i, 1024 - writeInformation.Size); Array.Copy(data, num, writeInformation.Data, writeInformation.Size, num2); writeInformation.Size += num2; i -= num2; num += num2; } } }
public int Receive(CSteamID user, byte[] buffer, int bufferOffset, int bufferSize) { int num; uint num1 = 0; lock (this._pendingReadBuffers) { if (this._pendingReadBuffers.ContainsKey(user)) { Queue<SteamP2PReader.ReadResult> item = this._pendingReadBuffers[user]; while (item.Count > 0) { SteamP2PReader.ReadResult readResult = item.Peek(); uint num2 = (uint)Math.Min(bufferSize - num1, readResult.Size - readResult.Offset); if (num2 != 0) { Array.Copy(readResult.Data, (long)readResult.Offset, buffer, (long)((long)bufferOffset + (long)num1), (long)num2); if (num2 != readResult.Size - readResult.Offset) { SteamP2PReader.ReadResult offset = readResult; offset.Offset = offset.Offset + num2; } else { this._bufferPool.Enqueue(item.Dequeue().Data); } num1 = num1 + num2; } else { num = (int)num1; return num; } } return (int)num1; } else { num = 0; } } return num; }
internal static void TriggerReceive(SteamChannel instance, CSteamID d, byte[] a, int b,int size) { #if DEBUG /*ESteamPacket eSteamPacket = (ESteamPacket)a[0]; int num = a[1]; if (eSteamPacket != ESteamPacket.UPDATE_VOICE && eSteamPacket != ESteamPacket.UPDATE_UDP_CHUNK && eSteamPacket != ESteamPacket.UPDATE_TCP_CHUNK) { object[] objects = SteamPacker.getObjects(d, 2, a, instance.Methods[num].Types); string o = ""; foreach (object r in objects) { o += r.ToString() + ","; } Logger.Log("Receive+" + d.ToString() + ": " + o + " - " + b); }*/ #endif return; }
public bool CheckAccount(CSteamID id) { try { MySqlConnection connection = CreateConnection(); MySqlCommand command = connection.CreateCommand(); int exists = 0; connection.Open(); command.CommandText = "SELECT COUNT(1) FROM `" + FeexRanks.Instance.Configuration.Instance.FeexRanksDatabase.DatabaseTableName + "` WHERE `steamId` = '" + id.ToString() + "'"; object result = command.ExecuteScalar(); if (result != null) Int32.TryParse(result.ToString(), out exists); connection.Close(); if (exists == 0) { return false; } else { return true; } } catch (Exception ex) { Logger.LogException(ex); return false; } }
public void QueueSend(CSteamID user, byte[] data, int length) { Queue<SteamP2PWriter.WriteInformation> item; SteamP2PWriter.WriteInformation writeInformation; lock (this._lock) { if (!this._pendingSendData.ContainsKey(user)) { Dictionary<CSteamID, Queue<SteamP2PWriter.WriteInformation>> cSteamIDs = this._pendingSendData; Queue<SteamP2PWriter.WriteInformation> writeInformations = new Queue<SteamP2PWriter.WriteInformation>(); item = writeInformations; cSteamIDs[user] = writeInformations; } else { item = this._pendingSendData[user]; } int num = length; int num1 = 0; while (num > 0) { if (item.Count == 0 || 1024 - item.Peek().Size == 0) { writeInformation = (this._bufferPool.Count <= 0 ? new SteamP2PWriter.WriteInformation() : new SteamP2PWriter.WriteInformation(this._bufferPool.Dequeue())); item.Enqueue(writeInformation); } else { writeInformation = item.Peek(); } int num2 = Math.Min(num, 1024 - writeInformation.Size); Array.Copy(data, num1, writeInformation.Data, writeInformation.Size, num2); SteamP2PWriter.WriteInformation size = writeInformation; size.Size = size.Size + num2; num = num - num2; num1 = num1 + num2; } } }
public bool IsDataAvailable(CSteamID id) { bool result; lock (this._pendingReadBuffers) { if (!this._pendingReadBuffers.ContainsKey(id)) { result = false; } else { Queue<SteamP2PReader.ReadResult> queue = this._pendingReadBuffers[id]; if (queue.Count == 0 || queue.Peek().Size == 0u) { result = false; } else { result = true; } } } return result; }
private void BackPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { if (!player.HasPermission("essentials.command.back")) { return; } UPlayer.TryGet(player, p => { p.Metadata[CommandBack.META_KEY_DELAY] = DateTime.Now; p.Metadata[CommandBack.META_KEY_POS] = p.Position; }); }
private void OnPlayerDamaged(SDG.Unturned.Player uPlayer, ref EDeathCause cause, ref ELimb limb, ref CSteamID killerId, ref Vector3 direction, ref float damage, ref float times, ref bool canDamage) { var player = playerManager.GetOnlinePlayerById(uPlayer.channel.owner.playerID.steamID.m_SteamID.ToString()); playerManager.TryGetOnlinePlayerById(killerId.m_SteamID.ToString(), out var killer); UnturnedPlayerDamagedEvent @event = new UnturnedPlayerDamagedEvent(player, cause, limb, killer?.GetUser(), direction, damage, times) { IsCancelled = !canDamage }; eventManager.Emit(this, @event); cause = @event.DeathCause; limb = @event.Limb; killerId = @event.DamageDealer != null ? new CSteamID(ulong.Parse(@event.DamageDealer.Id)) : CSteamID.Nil; direction = @event.Direction; damage = (float)@event.Damage; times = @event.Times; canDamage = [email protected]; }
private void UnturnedPlayerEvents_OnPlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, CSteamID murderer) { if (Configuration.Instance.KickForAnyDeath) { StartCoroutine(DeathKick(player)); } if (Configuration.Instance.KickOnSucide) { if (cause.ToString() == "SUCIDE") { StartCoroutine(DeathKick(player)); } } }
private void ModListAPI_modlistRecievedFromClient(NetworkConnection connection, ModListAPI.ModList list, CSteamID steamID) { base.Logger.LogWarning("Modlist recieved from client with steamID: " + steamID.value); foreach (ModListAPI.ModInfo mod in list.mods) { base.Logger.LogWarning(mod.guid + " : " + mod.version); } if (!this.CheckList(list, this.GetModPrefs())) { GameNetworkManager.singleton.ServerKickClient(connection, GameNetworkManager.KickReason.BadVersion); } }
public void tellStat(CSteamID steamID, byte newStat) { if (this.channel.checkServer(steamID)) { if (newStat == 0) { return; } int num11; if (newStat == 2) { int num; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Kills_Players", out num)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Kills_Players", num + 1); } } else if (newStat == 1) { int num2; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Kills_Zombies_Normal", out num2)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Kills_Zombies_Normal", num2 + 1); } } else if (newStat == 6) { int num3; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Kills_Zombies_Mega", out num3)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Kills_Zombies_Mega", num3 + 1); } } else if (newStat == 3) { int num4; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Items", out num4)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Found_Items", num4 + 1); } } else if (newStat == 4) { int num5; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Resources", out num5)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Found_Resources", num5 + 1); } } else if (newStat == 8) { int num6; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Kills_Animals", out num6)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Kills_Animals", num6 + 1); } } else if (newStat == 9) { int num7; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Crafts", out num7)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Found_Crafts", num7 + 1); } } else if (newStat == 10) { int num8; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Fishes", out num8)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Found_Fishes", num8 + 1); } } else if (newStat == 11) { int num9; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Plants", out num9)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Found_Plants", num9 + 1); } } else if (newStat == 16) { int num10; if (Provider.provider.statisticsService.userStatisticsService.getStatistic("Arena_Wins", out num10)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Arena_Wins", num10 + 1); } } else if (newStat == 17 && Provider.provider.statisticsService.userStatisticsService.getStatistic("Found_Buildables", out num11)) { Provider.provider.statisticsService.userStatisticsService.setStatistic("Found_Buildables", num11 + 1); } } }
public void OnDamageStructure(CSteamID steamid, Transform structure, ref ushort num, ref bool barricadebool, EDamageOrigin damageorigin) { byte x; byte y; ushort index; StructureRegion structureRegion; string hq; hq = " "; StructureManager.tryGetInfo(structure, out x, out y, out index, out structureRegion); StructureData structuretargeted = structureRegion.structures[index]; // if (structuretargeted.structure.health < num) // { //if (((structuretargeted.point -axishq).sqrMagnitude <= 3600) || ((structuretargeted.point - allieshq).sqrMagnitude <= 3600)) Vector2 structurevector2; structurevector2.x = structuretargeted.point.x; structurevector2.y = structuretargeted.point.z; if (((structurevector2 - axishq).magnitude <= 600) || (structurevector2 - allieshq).magnitude <= 600) { if ((structurevector2 - axishq).magnitude <= 600) { hq = " Axis "; } else if ((structurevector2 - allieshq).magnitude <= 600) { hq = " Allies "; } Rocket.Core.Logging.Logger.Log("Structure destroyed in HQ"); var player = UnturnedPlayer.FromCSteamID(steamid); var steam64 = steamid; var itemid = structuretargeted.structure.id; ItemAsset itemAsset = (from i in new List <ItemAsset>(Assets.find(EAssetType.ITEM).Cast <ItemAsset>()) where i.itemName != null orderby i.itemName.Length where i.id == itemid select i).FirstOrDefault <ItemAsset>(); //stole this from rockets /i command var barricadename = itemAsset.itemName; var url = player.SteamProfile.AvatarFull.ToString(); var bx = structuretargeted.point.x; var by = structuretargeted.point.y; var bz = structuretargeted.point.z; //and then send to discord webhook var owner = structuretargeted.owner; Discord.SendWebhookPost(Configuration.Instance.raidalertchannel, Discord.BuildDiscordEmbed("A structure was damaged in" + hq + "HQ", "This structure was damaged at " + DateTime.Now, player.DisplayName, url, 65327, new object[] { Discord.BuildDiscordField("Destroyer steam64", steam64.ToString(), true), Discord.BuildDiscordField("Structure ID", itemid.ToString(), true), Discord.BuildDiscordField("Structure Name", barricadename, true), Discord.BuildDiscordField("Structure Position", "X: " + bx + " Y: " + by + " Z: " + bz, true), Discord.BuildDiscordField("Owner of this structure", owner.ToString(), true), })); } //} }
/// <summary> /// <para> changes who the lobby owner is</para> /// <para> you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby</para> /// <para> after completion, the local user will no longer be the owner</para> /// </summary> public static bool SetLobbyOwner(CSteamID steamIDLobby, CSteamID steamIDNewOwner) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamMatchmaking_SetLobbyOwner(steamIDLobby, steamIDNewOwner); }
public void OnDamageBarricade(CSteamID steamid, Transform barricade, ref ushort num2, ref bool barricadebool, EDamageOrigin damageorigin) { //Logdamage(steamid, barricade,num2); byte x; byte y; ushort num; ushort index; BarricadeRegion barricadeRegion; string hq; hq = " "; UnturnedPlayer player; CSteamID steam64; ushort itemid; float bx; float by; float bz; ulong owner; string url; string barricadename; //initialize variables in case exception happens which it will and data is missing. bx = 0; by = 0; bz = 0; url = ""; itemid = 0; owner = 0; player = null; steam64.m_SteamID = 0; barricadename = " Unknown"; try { BarricadeManager.tryGetInfo(barricade, out x, out y, out num, out index, out barricadeRegion); BarricadeData barricadetargeted = barricadeRegion.barricades[index]; //if (barricadetargeted.barricade.health < num2) //{ //Rocket.Core.Logging.Logger.Log("Sqr Distance to Axis HQ: " + (barricadetargeted.point - axishq).sqrMagnitude); //Rocket.Core.Logging.Logger.Log("Sqr Distance to Allies HQ: "+ (barricadetargeted.point - allieshq).sqrMagnitude); /*if (((barricadetargeted.point - axishq).sqrMagnitude <= 3600) || * ((barricadetargeted.point - allieshq).sqrMagnitude <= 3600)) */ Vector2 barricadevector2; barricadevector2.x = barricadetargeted.point.x; barricadevector2.y = barricadetargeted.point.z; if (((barricadevector2 - axishq).magnitude <= 500) || (barricadevector2 - allieshq).magnitude <= 500) { if ((barricadevector2 - axishq).magnitude <= 500) { hq = " Axis "; } else if ((barricadevector2 - allieshq).magnitude <= 500) { hq = " Allies "; } Rocket.Core.Logging.Logger.Log("Barricade damaged in HQ: " + hq); if (steamid.m_SteamID != 0) { player = UnturnedPlayer.FromCSteamID(steamid); } else { player = null; } // Rocket.Core.Logging.Logger.Log("destroying player found"); steam64 = steamid; // itemid = barricadetargeted.barricade.id; Rocket.Core.Logging.Logger.Log("Barricade ID found"); ItemAsset itemAsset = (from i in new List <ItemAsset>(Assets.find(EAssetType.ITEM).Cast <ItemAsset>()) where i.itemName != null orderby i.itemName.Length where i.id == itemid select i).FirstOrDefault <ItemAsset>(); //stole this from rockets /i command barricadename = itemAsset.itemName; // Rocket.Core.Logging.Logger.Log("barricade name found"); bx = barricadetargeted.point.x; by = barricadetargeted.point.y; bz = barricadetargeted.point.z; // Rocket.Core.Logging.Logger.Log("barricade location found"); //and then send to discord webhook owner = barricadetargeted.owner; // Rocket.Core.Logging.Logger.Log("barricade owner found"); if (player != null) { url = player.SteamProfile.AvatarFull.ToString(); //Rocket.Core.Logging.Logger.Log("steam profile avatar found"); } else { url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Question_mark_%28black%29.svg/200px-Question_mark_%28black%29.svg.png"; // Rocket.Core.Logging.Logger.Log("no player - url not done"); } Discord.SendWebhookPost(Configuration.Instance.raidalertchannel, Discord.BuildDiscordEmbed("A barricade was damaged in" + hq + "HQ", "This barricade was damagedat " + DateTime.Now, player.DisplayName, url, 16711680, new object[] { Discord.BuildDiscordField("Destroyer steam64", steam64.ToString(), true), Discord.BuildDiscordField("Barricade ID", itemid.ToString(), true), Discord.BuildDiscordField("Barricade Name", barricadename, true), Discord.BuildDiscordField("Barricade Position", "X: " + bx + " Y: " + by + " Z: " + bz, true), Discord.BuildDiscordField("Owner of this barricade", owner.ToString(), true), })); } } catch (Exception e) { //uh oh! a barriacde has requested to break but hasn't broken!! Likely due to advanced regions nodestroy flag!! var error = e; Rocket.Core.Logging.Logger.Log("Exception caught: " + e); bool found = false; foreach (var spawner in miscstuff.Instance.Configuration.Instance.listofignoredexploitbarricades) { if (itemid == spawner) { found = true; } } if (found == false) { Discord.SendWebhookPost("https://ptb.discord.com/api/webhooks/807221467204550666/yte_hGdNflFqCtW80uhnNR1O9a0uX8GNoz5xGdur9xfLjUvRhs2sIctPypJocXdSVHRU", Discord.BuildDiscordEmbed("Possible Exploit of infinite crops detected at" + hq + "HQ", "Possible exploit detected at: " + DateTime.Now, "Unknown Player", "https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Question_mark_%28black%29.svg/200px-Question_mark_%28black%29.svg.png", 16711680, new object[] { Discord.BuildDiscordField("Crop ID", itemid.ToString(), true), Discord.BuildDiscordField("Crop Name", barricadename, true), Discord.BuildDiscordField("Crop Position", "X: " + bx + " Y: " + by + " Z: " + bz, true), Discord.BuildDiscordField("Owner of this plant:", owner.ToString(), true), })); } } }
private void ReceivePacketMuteMsgCommand(byte[] data, uint dataLength, CSteamID sender) { if (dataLength < sizeof(bool)) return; Workflow.ProcessIsMutedMessage(ByteManipulator.ReadBoolean(data, 0), sender.m_SteamID); }
private void ReceivePacketAudioCommand(byte[] data, uint dataLength, CSteamID sender) { Workflow.ProcessReceivedPacket(data, 0, (int)dataLength, sender.m_SteamID); }
public void Execute(IRocketPlayer caller, string[] command) { if (command.Length < 2) { this.SendUsage(caller); return; } var regionName = command.GetStringParameter(1); Region region = RegionsPlugin.Instance.GetRegion(regionName); if (region == null) { UnturnedChat.Say(caller, "Region \"" + regionName + "\" not found!", Color.red); return; } if (!region.IsOwner(caller)) { UnturnedChat.Say(caller, "You do not have permission to manage this region!", Color.red); return; } switch (command.GetStringParameter(0).ToUpperInvariant()) // Turkey test f****t { case "ADD": { string name; CSteamID target = GetTarget(command.GetStringParameter(2), out name); if (target == CSteamID.Nil) { UnturnedChat.Say(caller, "Player not found", Color.red); return; } Add(region, target.m_SteamID); UnturnedChat.Say(caller, "Done", Color.green); break; } case "REMOVE": { string name; CSteamID target = GetTarget(command.GetStringParameter(2), out name); if (target == CSteamID.Nil) { UnturnedChat.Say(caller, "Player not found", Color.red); return; } Remove(region, target.m_SteamID); UnturnedChat.Say(caller, "Done", Color.green); break; } case "LIST": { var list = GetList(region); if (list.Count == 0) { UnturnedChat.Say(caller, "No players found", Color.red); return; } for (var i = 0; i < list.Count; i++) { ulong id = list[i]; UnturnedPlayer player = null; try { player = UnturnedPlayer.FromCSteamID(new CSteamID(id)); if (player?.Player == null) { player = null; } } catch (Exception) { } if (player != null) { UnturnedChat.Say(caller, "* " + player.DisplayName); continue; } UnturnedChat.Say(caller, "* " + id); } break; } default: this.SendUsage(caller); break; } RegionsPlugin.Instance.Configuration.Save(); }
private void LobbyUpdate() { MoveTextUp(); if (lobbyCursor.launchOrPause()) { int idx = offsetY + (8 - lobbyCursor.getY()); if (idx >= lobbyDisplay.Count) { idx = lobbyDisplay.Count - 1; } if (idx == 1) { FindFriendLobbies(); } else if (idx == 0) { initializedStatus = -3; } else { CSteamID lobby = lobbyDisplay[idx].Value; SetText("joining"); SteamAPICall_t try_joinLobby = SteamMatchmaking.JoinLobby(lobby); } return; } else if (lobbyCursor.back()) { initializedStatus = -3; return; } string res = ""; int actOffset = offsetY; if (offsetY > 0) { res = "...\r\n"; actOffset++; } int max = lobbyDisplay.Count; bool addEnd = false; if ((actOffset + 8) < max) { max = actOffset + 7; addEnd = true; } for (int i = actOffset; i < max; i++) { res += lobbyDisplay[i].Key + "\r\n"; } if (addEnd) { res += "..."; } ForceText(res); lobbyCursor.SetVisibility(true); lobbyCursor.DoUpdate(); int maxY = Mathf.Max(9 - lobbyDisplay.Count, 0); int curY = lobbyCursor.getY(); if (curY < maxY) { lobbyCursor.setY(maxY); } else if (curY == 0 && addEnd) { offsetY++; lobbyCursor.setY(1); } else if (curY == 8 && offsetY > 0) { offsetY--; lobbyCursor.setY(7); } }
private void FreezePlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { if (UEssentials.Config.UnfreezeOnDeath && player.GetComponent <FrozenPlayer>() != null) { UnityEngine.Object.Destroy(player.GetComponent <FrozenPlayer>()); } }
public PlayerSession(UnturnedPlayer player) { SteamID = player.CSteamID; }
/// <summary> /// <para> IN-GAME TRADING</para> /// <para> TradeItems() implements limited in-game trading of items, if you prefer not to use</para> /// <para> the overlay or an in-game web browser to perform Steam Trading through the website.</para> /// <para> You should implement a UI where both players can see and agree to a trade, and then</para> /// <para> each client should call TradeItems simultaneously (+/- 5 seconds) with matching</para> /// <para> (but reversed) parameters. The result is the same as if both players performed a</para> /// <para> Steam Trading transaction through the web. Each player will get an inventory result</para> /// <para> confirming the removal or quantity changes of the items given away, and the new</para> /// <para> item instance id numbers and quantities of the received items.</para> /// <para> (Note: new item instance IDs are generated whenever an item changes ownership.)</para> /// </summary> public static bool TradeItems(out SteamInventoryResult_t pResultHandle, CSteamID steamIDTradePartner, SteamItemInstanceID_t[] pArrayGive, uint[] pArrayGiveQuantity, uint nArrayGiveLength, SteamItemInstanceID_t[] pArrayGet, uint[] pArrayGetQuantity, uint nArrayGetLength) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServerInventory_TradeItems(out pResultHandle, steamIDTradePartner, pArrayGive, pArrayGiveQuantity, nArrayGiveLength, pArrayGet, pArrayGetQuantity, nArrayGetLength); }
public void ClearUser(CSteamID id) { lock (this._pendingReadBuffers) this._deletionQueue.Enqueue(id); }
public static bool GetUGCDetails(UGCHandle_t hContent, out AppId_t pnAppID, out string ppchName, out int pnFileSizeInBytes, out CSteamID pSteamIDOwner) { InteropHelp.TestIfAvailableClient(); IntPtr nativeUtf; bool flag = NativeMethods.ISteamRemoteStorage_GetUGCDetails(hContent, out pnAppID, out nativeUtf, out pnFileSizeInBytes, out pSteamIDOwner); ppchName = ((!flag) ? null : InteropHelp.PtrToStringUTF8(nativeUtf)); return flag; }
public void writeblacklist(CSteamID cSteamID, string word) { blackboard.text += ("\n" + SteamFriends.GetFriendPersonaName(cSteamID) + ":\n" + word); }
void OnP2PSessionRequest(P2PSessionRequest_t pCallback) { Debug.Log("[" + P2PSessionRequest_t.k_iCallback + " - P2PSessionRequest] - " + pCallback.m_steamIDRemote); bool ret = SteamNetworking.AcceptP2PSessionWithUser(pCallback.m_steamIDRemote); print("SteamNetworking.AcceptP2PSessionWithUser(" + pCallback.m_steamIDRemote + ") - " + ret); m_RemoteSteamId = pCallback.m_steamIDRemote; }
public void ListingCallback(CSteamID id) { LobbySelectionDelegate(id); }
public UnturnedBarricadeSalvagingEvent(UnturnedBuildable buildable, UnturnedPlayer instigator, CSteamID instigatorSteamId) : base(buildable, instigator, instigatorSteamId) { }
public SteamPlayerID(CSteamID steamID) { this.steamID = steamID; uuid = steamID.m_SteamID; }
private void DeathMessages(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID killer) { var message = EssLang.GetEntry($"DEATH_{cause}") as string; if (message == null) { return; } var hasKiller = killer != CSteamID.Nil; var arguments = new object[hasKiller ? 3 : 2]; var color = ColorUtil.GetColorFromString(ref message); arguments[0] = player.CharacterName; arguments[1] = EssLang.Translate($"LIMB_{limb}") ?? "?"; if (hasKiller) { arguments[2] = UPlayer.From(killer)?.CharacterName ?? "?"; } UServer.Broadcast(string.Format(message, arguments), color); }
// Token: 0x06002FC5 RID: 12229 RVA: 0x0013BBBF File Offset: 0x00139FBF public bool checkServer(CSteamID steamID) { return(steamID == Provider.server); }
protected UnturnedPlayer?GetUnturnedPlayer(CSteamID steamID) { return(GetUnturnedPlayer(PlayerTool.getPlayer(steamID))); }
private void GenericPlayerDeath(UnturnedPlayer rocketPlayer, EDeathCause cause, ELimb limb, CSteamID murderer) { const string METADATA_KEY = "KEEP_SKILL"; const string KEEP_SKILL_PERM = "essentials.keepskill."; var player = UPlayer.From(rocketPlayer); var allPercentage = -1; // essentials.keepskill.all.<percentage> // Save skills in metadata, it will be restored when player respawn. // Format: Skill -> NewValue // Get or instantiate new Dictionary Dictionary <USkill, byte> skillsToRestore; if (player.Metadata.Has(METADATA_KEY)) { skillsToRestore = player.Metadata.Get <Dictionary <USkill, byte> >(METADATA_KEY); } else { skillsToRestore = new Dictionary <USkill, byte>(); player.Metadata[METADATA_KEY] = skillsToRestore; } // Parse keepskill permissions // TODO: We should cache this. We need to find a way to detect when permissions change // and then re-compute this. foreach (var perm in player.Permissions.Where(perm => perm.StartsWith(KEEP_SKILL_PERM))) { var kind = perm.Substring(KEEP_SKILL_PERM.Length); var percentageToKeep = 100; if (string.IsNullOrEmpty(kind)) { continue; } // Parse percentage, if present. // e.g 'essentials.keepskill.cardio.25' -> keepPercentage = 25 if (kind.IndexOf('.') >= 0) { // Split 'skill.percentage' var parts = kind.Split('.'); if (!int.TryParse(parts[1], out percentageToKeep)) { continue; } // Percentage must be between 0-100 if (percentageToKeep < 0) { percentageToKeep = 0; } if (percentageToKeep > 100) { percentageToKeep = 100; } kind = parts[0]; // let only skill name } if (kind.EqualsIgnoreCase("all")) { allPercentage = percentageToKeep; continue; } // Parse skill from name if (!USkill.FromName(kind, out var skill)) { continue; } skillsToRestore[skill] = (byte)System.Math.Ceiling(player.GetSkillLevel(skill) * (percentageToKeep / 100.0)); } // All Skills if (allPercentage != -1) { foreach (var skill in USkill.Skills) { // We don't want change previously added (skillsToRestore) skills. // This will allow to set a separated percentage while using modifier 'all' (essentials.keepskill.all) // e.g // essentials.keepskill.all.50 // essentials.keepskill.cardio.100 // this will keep 50% of all skills and 100% of cardio skill if (skillsToRestore.ContainsKey(skill)) { continue; } skillsToRestore[skill] = (byte)System.Math.Ceiling(player.GetSkillLevel(skill) * (allPercentage / 100.0)); } } }
// Token: 0x06002FC6 RID: 12230 RVA: 0x0013BBCC File Offset: 0x00139FCC public bool checkOwner(CSteamID steamID) { return(this.owner != null && steamID == this.owner.playerID.steamID); }
public void OnGetLobbySelection(CSteamID selectedLobby) { lobby = selectedLobby; networkUIController.RequestPassword(OnGetPassword); }
public CachedSteamP2PClient(CSteamID endPoint) { steamEndPoint = endPoint; recBuffer.SetSize(65536); }
/// <summary> /// <para> returns the current lobby owner</para> /// <para> you must be a member of the lobby to access this</para> /// <para> there always one lobby owner - if the current owner leaves, another user will become the owner</para> /// <para> it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner</para> /// </summary> public static CSteamID GetLobbyOwner(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamMatchmaking_GetLobbyOwner(steamIDLobby); }
protected void Reset() { lobby = CSteamID.Nil; networkUIController.SetUIMode(UIMode.Welcome); }
/// <summary> /// <para> link two lobbies for the purposes of checking player compatibility</para> /// <para> you must be the lobby owner of both lobbies</para> /// </summary> public static bool SetLinkedLobby(CSteamID steamIDLobby, CSteamID steamIDLobbyDependent) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamMatchmaking_SetLinkedLobby(steamIDLobby, steamIDLobbyDependent); }
public void tellVoice(CSteamID steamID, byte[] data, int length) { if (this.bufferReceive == null || this.received == null) { return; } if (base.channel.checkOwner(steamID) && !Provider.isServer) { if (!OptionsSettings.chatVoiceIn || base.channel.owner.isMuted) { return; } if (base.player.life.isDead) { return; } if (length <= 5) { return; } this.usingWalkieTalkie = (data[4] == 1); if (this.usingWalkieTalkie) { if (!this.canHearRadio) { return; } if (Player.player != null && Player.player.quests.radioFrequency != base.player.quests.radioFrequency) { return; } } for (int i = 0; i < length; i++) { data[i] = data[i + 5]; } uint num; if (SteamUser.DecompressVoice(data, (uint)length, this.bufferReceive, (uint)this.bufferReceive.Length, ref num, PlayerVoice.FREQUENCY) == null) { float num2 = num / 2u / PlayerVoice.FREQUENCY; this.playback += num2; int num3 = 0; while ((long)num3 < (long)((ulong)num)) { this.received[this.write] = (float)BitConverter.ToInt16(this.bufferReceive, num3) / 32767f; this.received[this.write] *= OptionsSettings.voice; this.write++; if ((long)this.write >= (long)((ulong)PlayerVoice.SAMPLES)) { this.write = 0; } num3 += 2; } this.audioSource.clip.SetData(this.received, 0); if (!this.isPlaying) { this.needsPlay = true; if (this.delayPlay <= 0f) { this.delayPlay = 0.3f; } } } } }
/// <summary> /// <para> Returns true if the result belongs to the target steam ID, false if the</para> /// <para> result does not. This is important when using DeserializeResult, to verify</para> /// <para> that a remote player is not pretending to have a different user's inventory.</para> /// </summary> public static bool CheckResultSteamID(SteamInventoryResult_t resultHandle, CSteamID steamIDExpected) { InteropHelp.TestIfAvailableGameServer(); return NativeMethods.ISteamGameServerInventory_CheckResultSteamID(resultHandle, steamIDExpected); }
public override string ToString() { return(CSteamID.ToString()); }
public static SteamAPICall_t EnumerateUserSharedWorkshopFiles(CSteamID steamId, uint unStartIndex, IList<string> pRequiredTags, IList<string> pExcludedTags) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamRemoteStorage_EnumerateUserSharedWorkshopFiles(steamId, unStartIndex, new InteropHelp.SteamParamStringArray(pRequiredTags), new InteropHelp.SteamParamStringArray(pExcludedTags)); }
public void Ban(string reason, uint duration, CSteamID instigator) { Provider.requestBanPlayer(instigator, this.CSteamID, Parser.getUInt32FromIP(this.IP), reason, duration); }
public static void GetTicketSteamID(byte[] rgubTicketDecrypted, uint cubTicketDecrypted, out CSteamID psteamID) { InteropHelp.TestIfPlatformSupported(); NativeMethods.GetTicketSteamID(rgubTicketDecrypted, cubTicketDecrypted, out psteamID); }
public EPlayerKill Damage(byte amount, Vector3 direction, EDeathCause cause, ELimb limb, CSteamID damageDealer) { EPlayerKill playerKill; player.life.askDamage(amount, direction, cause, limb, damageDealer, out playerKill); return(playerKill); }