public void OnCommand(Fougerite.Player player, string cmd, string[] args) { if (cmd == "web") { player.SendConsoleMessage("messagesociallinks=" + Web + "=" + ClientMessage + "=" + MessageDuration); } else if (cmd == "discord") { player.SendConsoleMessage("messagesociallinks=" + Discord + "=" + ClientMessage + "=" + MessageDuration); } else if (cmd == "facebook") { player.SendConsoleMessage("messagesociallinks=" + Facebook + "=" + ClientMessage + "=" + MessageDuration); } else if (cmd == "instagram") { player.SendConsoleMessage("messagesociallinks=" + Instagram + "=" + ClientMessage + "=" + MessageDuration); } else if (cmd == "vk") { player.SendConsoleMessage("messagesociallinks=" + VKontakte + "=" + ClientMessage + "=" + MessageDuration); } else if (cmd == "sociallinks" && args[0] == "reload" && player.Admin) { ReloadConfig(); player.MessageFrom(Name, green + "Settings has been Reloaded :)"); } }
public void Spawn(Fougerite.Player pl, SpawnEvent se) { var dict = new Dictionary <string, object>(); dict["inshield"] = pl; onshield.Add(pl.UID); pl.MessageFrom("SpawnShield", ActiveMessage); ShieldTimer(ShieldTime * 1000, dict).Start(); if (RustBusterSupport) { pl.SendConsoleMessage("shieldgotalk"); } }
public void CallBack(TimedEvent e) { var dict = e.Args; e.Kill(); Fougerite.Player pl = (Fougerite.Player)dict["inshield"]; onshield.Remove(pl.UID); pl.MessageFrom("SpawnShield", DeactiveMessage); if (RustBusterSupport) { pl.SendConsoleMessage("shieldgotalk2"); } }
private void OnPlayerMove(HumanController hc, Vector3 origin, int encoded, ushort stateflags, uLink.NetworkMessageInfo info, Util.PlayerActions action) { foreach (var zone in _zones) { var distance = Vector3.Distance(origin, zone.Location); if (distance < zone.Radius) { Fougerite.Player player = new Fougerite.Player(hc.playerClient); player.SendConsoleMessage("worldedit_timedspawn|" + zone.SecondsToDestroy + "|" + Base64Encode(zone.Prefab)); } } }
private void OnCommand(Fougerite.Player player, string cmd, string[] args) { if (cmd == "authme") { if (args.Length == 0) { player.MessageFrom("仙域授权", yellow + "-- Passwords are stored using SHA1 hashes --"); player.MessageFrom("仙域授权", yellow + "-- Always use a different password than your emails, etc. --"); player.MessageFrom("仙域授权", orange + "/authme register username password"); player.MessageFrom("仙域授权", orange + "/authme login username password"); player.MessageFrom("仙域授权", orange + "/authme changepw username newpassword"); if (player.Admin || player.Moderator) { player.MessageFrom("仙域授权", orange + "/authme resetuser ingamename"); player.MessageFrom("仙域授权", orange + "/authme reload"); } } else if (args.Length == 1) { string subcmd = args[0]; switch (subcmd) { case "reload": if (player.Admin || player.Moderator) { ReloadConfig(); player.MessageFrom("仙域授权", green + "Config reloaded!"); } break; } } else if (args.Length == 2) { string subcmd = args[0]; switch (subcmd) { case "resetuser": if (player.Admin || player.Moderator) { Fougerite.Player plr = Fougerite.Server.GetServer().FindPlayer(args[1]); if (plr != null) { if (Auths.GetSetting("Login", plr.SteamID) != null) { Auths.DeleteSetting("Login", plr.SteamID); Auths.Save(); } if (Credentials.ContainsKey(plr.UID)) { Credentials.Remove(plr.UID); } player.MessageFrom("仙域授权", green + "User: "******" reset! He can now register a new account for that steamid."); plr.MessageFrom("AuthMe", green + CredsReset); AuthLogger.Log("[USER RESET] " + player.Name + " - " + player.SteamID + " - " + player.IP + " reset credetials for: " + plr.Name + " - " + plr.SteamID + " - " + plr.IP); } } break; } } else if (args.Length == 3) { string subcmd = args[0]; switch (subcmd) { case "register": if (Credentials.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", red + "This STEAMID is already protected using password authentication!"); return; } string username = args[1]; string password = args[2]; if (username.ToLower() == "username" || password.ToLower() == "password") { player.MessageFrom("仙域授权", orange + "Type /authme register username password"); return; } bool b = Regex.IsMatch(username, @"^[a-zA-Z0-9_&@%!+<>]+$"); bool b2 = Regex.IsMatch(password, @"^[a-zA-Z0-9_&@%!+<>]+$"); if (!b || !b2) { player.MessageFrom("仙域授权", orange + "Sorry, no special characters or space! Only: a-zA-Z0-9_&@%!+<>"); return; } if (username.Length > 25 || password.Length > 25) { player.MessageFrom("仙域授权", orange + "Sorry, username and password length must be below 25."); return; } string hash = SHA1Hash(password); Auths.AddSetting("Login", player.SteamID, username.ToLower() + "---##---" + hash); Auths.Save(); Credentials.Add(player.UID, new Credential(username.ToLower(), hash)); player.MessageFrom("仙域授权", orange + "You have registered with: " + username + " - " + password + " (Your console has this info now too.)"); player.SendConsoleMessage(orange + "You have registered with: " + username + " - " + password); WaitingUsers.Remove(player.UID); DataStore.GetInstance().Remove("AuthMeLogin", player.UID); uLink.NetworkView.Get(player.PlayerClient.networkView) .RPC("DestroyFreezeAuthMe", player.NetworkPlayer); foreach (var x in RestrictedCommands) { player.UnRestrictCommand(x); } AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " registered an account: " + username); break; case "login": if (!WaitingUsers.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", orange + "You are logged in already."); return; } string username2 = args[1]; string password2 = args[2]; if (username2.Length > 25 || password2.Length > 25) { player.MessageFrom("仙域授权", orange + "Sorry, username and password length must be below 25."); return; } if (!Credentials.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", orange + "This steamid is not registered yet!"); player.MessageFrom("仙域授权", orange + "Type /authme register username password"); return; } Credential cred = Credentials[player.UID]; if (cred.Username.ToLower() != username2.ToLower()) { player.MessageFrom("仙域授权", orange + "Invalid username!"); AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " tried to login using: " + username2); return; } if (cred.HashedPassword != SHA1Hash(password2)) { AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " tried to login using: " + username2); player.MessageFrom("仙域授权", orange + "Invalid password! Seek admin for help on their social site."); } else { PrivilegeStorage storage = WaitingUsers[player.UID]; if (storage.WasAdmin) { player.ForceAdminOff(false); player.PlayerClient.netUser.SetAdmin(true); } if (storage.WasModerator) { player.ForceModeratorOff(false); } WaitingUsers.Remove(player.UID); DataStore.GetInstance().Remove("AuthMeLogin", player.UID); uLink.NetworkView.Get(player.PlayerClient.networkView) .RPC("DestroyFreezeAuthMe", player.NetworkPlayer); foreach (var x in RestrictedCommands) { player.UnRestrictCommand(x); } AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " logged in using: " + username2); player.MessageFrom("仙域授权", green + "Successfully logged in!"); } break; case "changepw": if (WaitingUsers.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", orange + "Nice try. You need to be logged in to do that."); return; } string username3 = args[1]; string password3 = args[2]; if (!Credentials.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", orange + "This steamid is not registered yet!"); return; } Credential cred2 = Credentials[player.UID]; if (!string.Equals(cred2.Username, username3, StringComparison.CurrentCultureIgnoreCase)) { player.MessageFrom("仙域授权", orange + "Invalid username!"); return; } if (username3.Length > 25 || password3.Length > 25) { player.MessageFrom("仙域授权", orange + "Sorry, username and password length must be below 25."); return; } Credentials.Remove(player.UID); string hash3 = SHA1Hash(password3); Auths.SetSetting("Login", player.SteamID, username3.ToLower() + "---##---" + hash3); Auths.Save(); Credentials.Add(player.UID, new Credential(username3.ToLower(), hash3)); AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " changed password using: " + username3); player.MessageFrom("仙域授权", green + "Password successfully changed!"); break; default: player.MessageFrom("仙域授权", orange + "Invalid command. Type /authme for help."); break; } } } }
public void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc) { if (msgc.PluginSender == "JianxianC") { Fougerite.Player player = user.Player; string[] spl = msgc.MessageByClient.Split('-'); if (spl.Length != 3) { return; } string evt = spl[0]; string username = spl[1]; string password = spl[2]; if (evt == "AuthMeLogin") { if (!WaitingUsers.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", orange + "You are logged in already."); msgc.ReturnMessage = "DisApproved"; return; } if (!Credentials.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", orange + "This steamid is not registered yet!"); player.MessageFrom("仙域授权", orange + "Type /authme register username password"); msgc.ReturnMessage = "DisApproved"; return; } Credential cred = Credentials[player.UID]; if (!string.Equals(cred.Username, username, StringComparison.CurrentCultureIgnoreCase)) { player.MessageFrom("仙域授权", orange + "Invalid username!"); AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " tried to login using: " + username); msgc.ReturnMessage = "DisApproved"; return; } if (username.Length > 25 || password.Length > 25) { player.MessageFrom("仙域授权", orange + "Sorry, username and password length must be below 25."); msgc.ReturnMessage = "DisApproved"; return; } if (cred.HashedPassword != SHA1Hash(password)) { AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " tried to login using: " + username); player.MessageFrom("仙域授权", red + "Invalid password! Seek help here: " + yellow + " " + SocialSiteForHelp); msgc.ReturnMessage = "DisApproved"; } else { PrivilegeStorage storage = WaitingUsers[player.UID]; if (storage.WasAdmin) { player.ForceAdminOff(false); player.PlayerClient.netUser.SetAdmin(true); } if (storage.WasModerator) { player.ForceModeratorOff(false); } WaitingUsers.Remove(player.UID); DataStore.GetInstance().Remove("AuthMeLogin", player.UID); uLink.NetworkView.Get(player.PlayerClient.networkView) .RPC("DestroyFreezeAuthMe", player.NetworkPlayer); foreach (var x in RestrictedCommands) { player.UnRestrictCommand(x); } AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " logged in using: " + username); player.MessageFrom("仙域授权", green + "Successfully logged in!"); msgc.ReturnMessage = "Approved"; } } else if (evt == "AuthMeRegister") { if (Credentials.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", red + "This STEAMID is already protected using password authentication!"); msgc.ReturnMessage = "InvalidRegistration"; return; } if (username.ToLower() == "username" || password.ToLower() == "password") { player.MessageFrom("仙域授权", orange + "Type /authme register username password"); msgc.ReturnMessage = "InvalidRegistration"; return; } bool b = Regex.IsMatch(username, @"^[a-zA-Z0-9_&@%!+<>]+$"); bool b2 = Regex.IsMatch(password, @"^[a-zA-Z0-9_&@%!+<>]+$"); if (!b || !b2) { player.MessageFrom("仙域授权", orange + "Sorry, no special characters or space! Only: a-zA-Z0-9_&@%!+<>"); msgc.ReturnMessage = "InvalidRegistration"; return; } if (username.Length > 25 || password.Length > 25) { player.MessageFrom("仙域授权", orange + "Sorry, username and password length must be below 25."); msgc.ReturnMessage = "InvalidRegistration"; return; } string hash = SHA1Hash(password); Auths.AddSetting("Login", player.SteamID, username.ToLower() + "---##---" + hash); Auths.Save(); Credentials.Add(player.UID, new Credential(username.ToLower(), hash)); player.MessageFrom("仙域授权", orange + "You have registered with: " + username + " - " + password + " (Your console has this info now too.)"); player.SendConsoleMessage(orange + "You have registered with: " + username + " - " + password); WaitingUsers.Remove(player.UID); DataStore.GetInstance().Remove("AuthMeLogin", player.UID); uLink.NetworkView.Get(player.PlayerClient.networkView) .RPC("DestroyFreezeAuthMe", player.NetworkPlayer); foreach (var x in RestrictedCommands) { player.UnRestrictCommand(x); } AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " registered an account: " + username); msgc.ReturnMessage = "ValidRegistration"; } } }
public void OnEntityDeployed(Fougerite.Player pl, Fougerite.Entity e, Fougerite.Player actualplacer) { HasRustPP = true; if (HasRustPP == true) { foreach (Fougerite.Entity xx in Util.GetUtil().FindEntitiesAround(e.Location, 25f)) { if (e.Name == "WoodFoundation") { if (xx.Name == "WoodFoundation") { if (xx.OwnerID == actualplacer.SteamID) { } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } else if (e.Name.ToLower().Contains("bench")) { if (xx.OwnerID == actualplacer.SteamID) { break; } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { break; } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } else if (e.Name.ToLower().Contains("spike")) { if (xx.OwnerID == actualplacer.SteamID) { break; } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { break; } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } else if (e.Name.ToLower().Contains("sleepingbaga")) { if (!AllowSleepingBags) { if (xx.OwnerID == actualplacer.SteamID) { break; } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { break; } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } } else if (e.Name.ToLower().Contains("bed")) { if (!AllowBeds) { if (xx.OwnerID == actualplacer.SteamID) { break; } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { break; } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } } else if (e.Name.ToLower().Contains("barricade")) { if (!AllowBarricade) { if (xx.OwnerID == actualplacer.SteamID) { break; } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { break; } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } } else if (e.Name.ToLower().Contains("storage")) { if (!AllowBoxes) { if (xx.OwnerID == actualplacer.SteamID) { break; } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { break; } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } } else if (e.Name.ToLower().Contains("gate")) { if (xx.OwnerID == actualplacer.SteamID) { break; } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { break; } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } else if (e.Name.ToLower().Contains("ramp")) { if (!AllowRamps) { if (xx.OwnerID == actualplacer.SteamID) { break; } else { var friendc = Fougerite.Server.GetServer().GetRustPPAPI().GetFriendsCommand.GetFriendsLists(); if (friendc.ContainsKey(xx.UOwnerID)) { var fs = (RustPP.Social.FriendList)friendc[xx.UOwnerID]; bool isfriend = fs.Cast <FriendList.Friend>().Any(friend => friend.GetUserID() == actualplacer.UID); if (isfriend) { break; } else { e.Destroy(); { actualplacer.MessageFrom(Name, orange + "You are to close to someone else his structure cant build here"); actualplacer.Inventory.AddItem(e.Name, 1); actualplacer.SendConsoleMessage(aqua + "[ToolCubBoard]" + orange + "You are not allowed to build near this structure"); } } } } } } } } } }
public void OnPlayerConnected(Fougerite.Player player) { player.SendConsoleMessage("stacksizes.load"); }
public void OnPlayerConnected(Fougerite.Player player) { player.SendConsoleMessage("adminplus.load"); }