public static void SendFurnitureToHouse(int Houseindex) { ByteStream buffer = new ByteStream(4); buffer.WriteInt32(92); buffer.WriteInt32(Houseindex); buffer.WriteInt32(modTypes.Player[Houseindex].Character[(int)modTypes.TempPlayer[Houseindex].CurChar].House.FurnitureCount); checked { if (modTypes.Player[Houseindex].Character[(int)modTypes.TempPlayer[Houseindex].CurChar].House.FurnitureCount > 0) { int furnitureCount = modTypes.Player[Houseindex].Character[(int)modTypes.TempPlayer[Houseindex].CurChar].House.FurnitureCount; for (int i = 1; i <= furnitureCount; i++) { buffer.WriteInt32(modTypes.Player[Houseindex].Character[(int)modTypes.TempPlayer[Houseindex].CurChar].House.Furniture[i].ItemNum); buffer.WriteInt32(modTypes.Player[Houseindex].Character[(int)modTypes.TempPlayer[Houseindex].CurChar].House.Furniture[i].X); buffer.WriteInt32(modTypes.Player[Houseindex].Character[(int)modTypes.TempPlayer[Houseindex].CurChar].House.Furniture[i].Y); } } int playersOnline = S_GameLogic.GetPlayersOnline(); for (int i = 1; i <= playersOnline; i++) { if (S_NetworkConfig.IsPlaying(i)) { if (modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].InHouse == Houseindex) { S_NetworkConfig.Socket.SendDataTo(i, buffer.Data, buffer.Head); } } } buffer.Dispose(); } }
public static void Packet_SaveHouses(int index, ref byte[] data) { checked { if (!(S_Players.GetPlayerAccess(index) < 2)) { ByteStream buffer = new ByteStream(data); int Count = buffer.ReadInt32(); if (Count > 0) { int num = Count; for (int z = 1; z <= num; z++) { int i = buffer.ReadInt32(); S_Housing.HouseConfig[i].ConfigName = (buffer.ReadString().Trim()); S_Housing.HouseConfig[i].BaseMap = buffer.ReadInt32(); S_Housing.HouseConfig[i].X = buffer.ReadInt32(); S_Housing.HouseConfig[i].Y = buffer.ReadInt32(); S_Housing.HouseConfig[i].Price = buffer.ReadInt32(); S_Housing.HouseConfig[i].MaxFurniture = buffer.ReadInt32(); S_Housing.SaveHouse(i); int playersOnline = S_GameLogic.GetPlayersOnline(); for (int x = 1; x <= playersOnline; x++) { if (S_NetworkConfig.IsPlaying(x) && modTypes.Player[x].Character[(int)modTypes.TempPlayer[x].CurChar].InHouse == i) { S_Housing.SendFurnitureToHouse(i); } } } } buffer.Dispose(); } } }
public static void SendDataToMapBut(int index, int mapNum, ref byte[] data, int head) { var loopTo = S_GameLogic.GetPlayersOnline(); for (int i = 1; i <= loopTo; i++) { if (IsPlaying(i) && S_Players.GetPlayerMap(i) == mapNum && i != index) { Socket.SendDataTo(i, data, head); } } }
internal static void SendDataToAll(ref byte[] data, int head) { var loopTo = S_GameLogic.GetPlayersOnline(); for (int i = 1; i <= loopTo; i++) { if (IsPlaying(i)) { Socket.SendDataTo(i, data, head); } } }
public static void SendTimeToAll() { int I; var loopTo = S_GameLogic.GetPlayersOnline(); for (I = 1; I <= loopTo; I++) { if (S_NetworkConfig.IsPlaying(I)) { SendTimeTo(I); } } }
public static bool IsMultiAccounts(string Login) { var loopTo = S_GameLogic.GetPlayersOnline(); // Lol this was broke before ~ SpiceyWolf for (int i = 1; i <= loopTo; i++) { if (modTypes.Player[i].Login.Trim().ToLower() == Login.Trim().ToLower()) { return(true); } } return(false); }
// Token: 0x060001D8 RID: 472 RVA: 0x000398D4 File Offset: 0x00037AD4 public static void LoadHouses() { bool flag = !File.Exists(Path.Combine(Application.StartupPath, "data", "houseconfig.xml")); if (flag) { S_Housing.CreateHouses(); } XmlClass myXml = new XmlClass { Filename = Path.Combine(Application.StartupPath, "data", "houseconfig.xml"), Root = "Config" }; myXml.LoadXml(); int max_HOUSES = S_Housing.MAX_HOUSES; checked { for (int i = 1; i <= max_HOUSES; i++) { S_Housing.HouseConfig[i].BaseMap = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "BaseMap", ""))); S_Housing.HouseConfig[i].ConfigName = (myXml.ReadString("House" + Conversions.ToString(i), "Name", "").Trim()); S_Housing.HouseConfig[i].MaxFurniture = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "MaxFurniture", ""))); S_Housing.HouseConfig[i].Price = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "Price", ""))); S_Housing.HouseConfig[i].X = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "X", ""))); S_Housing.HouseConfig[i].Y = (int)Math.Round(Conversion.Val(myXml.ReadString("House" + Conversions.ToString(i), "Y", ""))); } myXml.CloseXml(false); int playersOnline = S_GameLogic.GetPlayersOnline(); for (int i = 1; i <= playersOnline; i++) { bool flag2 = S_NetworkConfig.IsPlaying(i); if (flag2) { S_Housing.SendHouseConfigs(i); } } } }
internal static void Party_ShareExp(int partyNum, int exp, int index, int mapNum) { int expShare = 0; int leftOver = 0; int i = 0; int tmpindex = 0; byte loseMemberCount = 0; // check if it's worth sharing if (!(exp >= Party[partyNum].MemberCount)) { // no party - keep exp for self S_Events.GivePlayerExp(index, exp); return; } // check members in others maps for (i = 1; i <= Constants.MAX_PARTY_MEMBERS; i++) { tmpindex = Party[partyNum].Member[i]; if (tmpindex > 0) { if (S_NetworkConfig.Socket.IsConnected(tmpindex) && S_NetworkConfig.IsPlaying(tmpindex)) { if (S_Players.GetPlayerMap(tmpindex) != mapNum) { loseMemberCount = (byte)(loseMemberCount + 1); } } } } // find out the equal share expShare = exp / (Party[partyNum].MemberCount - loseMemberCount); leftOver = exp % (Party[partyNum].MemberCount - loseMemberCount); // loop through and give everyone exp for (i = 1; i <= Constants.MAX_PARTY_MEMBERS; i++) { tmpindex = Party[partyNum].Member[i]; // existing member? if (tmpindex > 0) { // playing? if (S_NetworkConfig.Socket.IsConnected(tmpindex) && S_NetworkConfig.IsPlaying(tmpindex)) { if (S_Players.GetPlayerMap(tmpindex) == mapNum) { // give them their share S_Events.GivePlayerExp(tmpindex, expShare); } } } } // give the remainder to a random member if (!(leftOver == 0)) { tmpindex = Party[partyNum].Member[S_GameLogic.Random(1, Party[partyNum].MemberCount)]; // give the exp S_Events.GivePlayerExp(tmpindex, leftOver); } }
public static void UpdateCaption() { Console.Title = string.Format("{0} <IP {1}:{2}> ({3} Players Online) - Current Errors: {4} - Time: {5}", modTypes.Options.GameName, MyIPAddress, modTypes.Options.Port, S_GameLogic.GetPlayersOnline(), S_Globals.ErrorCount, Time.Instance.ToString()); }
public static void HandleClearProjectile(int index, ref byte[] data) { int ProjectileNum; int Targetindex; Enums.TargetType TargetType; int TargetZone; int mapNum; int Damage; int armor; int npcnum; ByteStream buffer = new ByteStream(data); ProjectileNum = buffer.ReadInt32(); Targetindex = buffer.ReadInt32(); TargetType = (Enums.TargetType)buffer.ReadInt32(); TargetZone = buffer.ReadInt32(); buffer.Dispose(); mapNum = S_Players.GetPlayerMap(index); switch (MapProjectiles[mapNum, ProjectileNum].OwnerType) { case (byte)Enums.TargetType.Player: { if (MapProjectiles[mapNum, ProjectileNum].Owner == index) { switch (TargetType) { case Enums.TargetType.Player: { if (S_NetworkConfig.IsPlaying(Targetindex)) { if (Targetindex != index) { if (S_Players.CanPlayerAttackPlayer(index, Targetindex, true) == true) { // Get the damage we can do Damage = S_Players.GetPlayerDamage(index) + Projectiles[MapProjectiles[mapNum, ProjectileNum].ProjectileNum].Damage; // if the npc blocks, take away the block amount armor = Convert.ToInt32(S_Players.CanPlayerBlockHit(Targetindex)); Damage = Damage - armor; // randomise for up to 10% lower than max hit Damage = S_GameLogic.Random(1, Damage); if (Damage < 1) { Damage = 1; } S_Players.AttackPlayer(index, Targetindex, Damage); } } } break; } case Enums.TargetType.Npc: { npcnum = modTypes.MapNpc[mapNum].Npc[Targetindex].Num; if (S_Players.CanPlayerAttackNpc(index, Targetindex, true) == true) { // Get the damage we can do Damage = S_Players.GetPlayerDamage(index) + Projectiles[MapProjectiles[mapNum, ProjectileNum].ProjectileNum].Damage; // if the npc blocks, take away the block amount armor = 0; Damage = Damage - armor; // randomise from 1 to max hit Damage = S_GameLogic.Random(1, Damage); if (Damage < 1) { Damage = 1; } S_Players.PlayerAttackNpc(index, Targetindex, Damage); } break; } } } break; } } ClearMapProjectile(mapNum, ProjectileNum); }
public static void Packet_PlaceFurniture(int index, ref byte[] data) { ByteStream buffer = new ByteStream(data); int x = buffer.ReadInt32(); int y = buffer.ReadInt32(); int invslot = buffer.ReadInt32(); buffer.Dispose(); int ItemNum = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].Inv[invslot].Num; checked { if (!(ItemNum < 1 || ItemNum > 500)) { if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse == index) { if (Types.Item[ItemNum].Type == 6) { int i = 1; for (; ;) { if (S_Players.GetPlayerRawStat(index, (Enums.StatType)i) < (int)Types.Item[ItemNum].Stat_Req[i]) { break; } i++; if (i > 6) { goto Block_6; } } S_NetworkSend.PlayerMsg(index, "You do not meet the stat requirements to use this item.", 12); return; Block_6: if (S_Players.GetPlayerLevel(index) < Types.Item[ItemNum].LevelReq) { S_NetworkSend.PlayerMsg(index, "You do not meet the level requirement to use this item.", 12); } else { if (Types.Item[ItemNum].ClassReq > 0) { if (S_Players.GetPlayerClass(index) != Types.Item[ItemNum].ClassReq) { S_NetworkSend.PlayerMsg(index, "You do not meet the class requirement to use this item.", 12); return; } } if (S_Players.GetPlayerAccess(index) < Types.Item[ItemNum].AccessReq) { S_NetworkSend.PlayerMsg(index, "You do not meet the access requirement to use this item.", 12); } else { if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse != index) { S_NetworkSend.PlayerMsg(index, "You must be inside your house to place furniture!", 14); } else { if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount >= S_Housing.HouseConfig[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Houseindex].MaxFurniture) { if (S_Housing.HouseConfig[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Houseindex].MaxFurniture > 0) { S_NetworkSend.PlayerMsg(index, "Your house cannot hold any more furniture!", 12); return; } } if (!(x < 0 || x > (int)modTypes.Map[S_Players.GetPlayerMap(index)].MaxX)) { if (!(y < 0 || y > (int)modTypes.Map[S_Players.GetPlayerMap(index)].MaxY)) { int x2; int widthoffset; if (Types.Item[ItemNum].FurnitureWidth > 2) { x2 = (int)Math.Round(unchecked ((double)x + (double)Types.Item[ItemNum].FurnitureWidth / 2.0)); widthoffset = x2 - x; x2 -= Types.Item[ItemNum].FurnitureWidth - widthoffset; } x2 = x; widthoffset = 0; int y2 = y; if (widthoffset > 0) { int num = x2; int num2 = x2 + widthoffset; for (x = num; x <= num2; x++) { int num3 = y2; int num4 = y2 - Types.Item[ItemNum].FurnitureHeight + 1; for (y = num3; y >= num4; y += -1) { if (modTypes.Map[S_Players.GetPlayerMap(index)].Tile[x, y].Type == 1) { return; } int playersOnline = S_GameLogic.GetPlayersOnline(); for (i = 1; i <= playersOnline; i++) { if (S_NetworkConfig.IsPlaying(i) && i != index && S_Players.GetPlayerMap(i) == S_Players.GetPlayerMap(index)) { if (modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].InHouse == modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse) { if ((int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].X == x && (int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].Y == y) { return; } } } } if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount > 0) { int furnitureCount = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount; for (i = 1; i <= furnitureCount; i++) { if (x >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X && x <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X + Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureWidth - 1) { if (y <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y && y >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y - Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureHeight + 1) { return; } } } } } } int num5 = x2; int num6 = x2 - (Types.Item[ItemNum].FurnitureWidth - widthoffset); for (x = num5; x >= num6; x += -1) { int num7 = y2; int num8 = y2 - Types.Item[ItemNum].FurnitureHeight + 1; for (y = num7; y >= num8; y += -1) { if (modTypes.Map[S_Players.GetPlayerMap(index)].Tile[x, y].Type == 1) { return; } int playersOnline2 = S_GameLogic.GetPlayersOnline(); for (i = 1; i <= playersOnline2; i++) { if (S_NetworkConfig.IsPlaying(i) && i != index && S_Players.GetPlayerMap(i) == S_Players.GetPlayerMap(index)) { if (modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].InHouse == modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse) { if ((int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].X == x && (int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].Y == y) { return; } } } } if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount > 0) { int furnitureCount2 = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount; for (i = 1; i <= furnitureCount2; i++) { if (x >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X && x <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X + Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureWidth - 1) { if (y <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y && y >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y - Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureHeight + 1) { return; } } } } } } } else { int num9 = x2; int num10 = x2 + Types.Item[ItemNum].FurnitureWidth - 1; for (x = num9; x <= num10; x++) { int num11 = y2; int num12 = y2 - Types.Item[ItemNum].FurnitureHeight + 1; for (y = num11; y >= num12; y += -1) { if (modTypes.Map[S_Players.GetPlayerMap(index)].Tile[x, y].Type == 1) { return; } int playersOnline3 = S_GameLogic.GetPlayersOnline(); for (i = 1; i <= playersOnline3; i++) { if (S_NetworkConfig.IsPlaying(i) && i != index && S_Players.GetPlayerMap(i) == S_Players.GetPlayerMap(index)) { if (modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].InHouse == modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse) { if ((int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].X == x && (int)modTypes.Player[i].Character[(int)modTypes.TempPlayer[i].CurChar].Y == y) { return; } } } } if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount > 0) { int furnitureCount3 = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount; for (i = 1; i <= furnitureCount3; i++) { if (x >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X && x <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].X + Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureWidth - 1) { if (y <= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y && y >= modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].Y - Types.Item[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[i].ItemNum].FurnitureHeight + 1) { return; } } } } } } } x = x2; y = y2; modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount = modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount + 1; modTypes.CharacterRec[] character = modTypes.Player[index].Character; byte curChar = modTypes.TempPlayer[index].CurChar; character[(int)curChar].House.Furniture = (S_Housing.FurnitureRec[])Utils.CopyArray(character[(int)curChar].House.Furniture, new S_Housing.FurnitureRec[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount + 1]); modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount].ItemNum = ItemNum; modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount].X = x; modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Furniture[modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.FurnitureCount].Y = y; S_Players.TakeInvItem(index, ItemNum, 0); S_Housing.SendFurnitureToHouse(modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse); modDatabase.SavePlayer(index); } } } } } } } else { S_NetworkSend.PlayerMsg(index, "You cannot place furniture unless you are in your own house!", 12); } } } }
public static void Packet_InviteToHouse(int index, ref byte[] data) { ByteStream buffer = new ByteStream(data); string Name = (buffer.ReadString().Trim()); int invitee = S_GameLogic.FindPlayer(Name); buffer.Dispose(); if (invitee == 0) { S_NetworkSend.PlayerMsg(index, "Player not found.", 12); } else { if (index == invitee) { S_NetworkSend.PlayerMsg(index, "You cannot invite yourself to you own house!", 12); } else { if (modTypes.TempPlayer[invitee].Invitationindex > 0) { if (modTypes.TempPlayer[invitee].InvitationTimer > S_General.GetTimeMs()) { S_NetworkSend.PlayerMsg(index, (S_Players.GetPlayerName(invitee).Trim()) + " is currently busy!", 14); return; } } if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].House.Houseindex > 0) { if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse > 0) { if (modTypes.Player[index].Character[(int)modTypes.TempPlayer[index].CurChar].InHouse == index) { if (modTypes.Player[invitee].Character[(int)modTypes.TempPlayer[invitee].CurChar].InHouse > 0) { if (modTypes.Player[invitee].Character[(int)modTypes.TempPlayer[invitee].CurChar].InHouse == index) { S_NetworkSend.PlayerMsg(index, (S_Players.GetPlayerName(invitee).Trim()) + " is already in your house!", 14); } else { S_NetworkSend.PlayerMsg(index, (S_Players.GetPlayerName(invitee).Trim()) + " is already visiting someone elses house!", 14); } } else { buffer = new ByteStream(4); buffer.WriteInt32(91); buffer.WriteInt32(index); S_NetworkConfig.Socket.SendDataTo(invitee, buffer.Data, buffer.Head); modTypes.TempPlayer[invitee].Invitationindex = index; modTypes.TempPlayer[invitee].InvitationTimer = checked (S_General.GetTimeMs() + 15000); buffer.Dispose(); } } else { S_NetworkSend.PlayerMsg(index, "Only the house owner can invite other players into their house.", 12); } } else { S_NetworkSend.PlayerMsg(index, "You must be inside your house before you can invite someone to visit!", 12); } } else { S_NetworkSend.PlayerMsg(index, "You do not have a house to invite anyone to!", 12); } } } }
private static void ConsoleThread() { string line; string[] parts; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Initializing Console Loop"); Console.ResetColor(); while ((true)) { line = Console.ReadLine(); parts = line.Split(' '); if ((parts.Length < 1)) { continue; } switch (parts[0].Trim().ToLower().Replace("/", "")) { case "help": { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("/help, Shows this message."); Console.WriteLine("/exit, Closes down the server."); Console.WriteLine("/shutdown, Closes down the server with a 30 second countdown."); Console.WriteLine("/setadmin, Sets player access level, usage '/setadmin playername powerlvl' powerlevel goes from 0 for player, to 4 to creator."); Console.WriteLine("/kick, Kicks user from server, usage '/kick playername'"); Console.WriteLine("/ban, Bans user from server, usage '/ban playername'"); Console.WriteLine("/maintenance, Toggles maintenance mode"); Console.WriteLine("/timespeed, Set Game Speed, usage '/timespeed speed'"); Console.WriteLine("/ip, View the ip of the server"); Console.WriteLine("/say, Send a global message for everyone to see, usage '/say message'"); Console.WriteLine("/setxpmultiplier, Set the Global XP multiplier, usage '/setxpmultiplier multiplayer'"); Console.WriteLine("/debugtext, Toggle Debug Text"); Console.WriteLine("/unlockcps, unlock CPS"); Console.WriteLine("/lockcps, lock CPS"); Console.ResetColor(); break; } case "exit": { S_General.DestroyServer(); break; } case "shutdown": { if (S_General.shutDownTimer == null) { S_General.shutDownTimer = new System.Diagnostics.Stopwatch(); S_General.shutDownTimer.Start(); Console.WriteLine("Server Shutdown in 30 Seconds!"); } else { S_General.shutDownTimer = null; Console.WriteLine("Server Shutdown has been cancelled!"); } break; } case "setadmin": { if (parts.Length > 3 || parts.Length < 3) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } string Name = parts[1]; int Pindex = S_GameLogic.FindPlayer(Name); int.TryParse(parts[2], out int Power); Console.ForegroundColor = ConsoleColor.Yellow; if (!(Pindex > 0)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Player name is empty or invalid. [Name not found]"); } else { switch (Power) { case 0: { S_Players.SetPlayerAccess(Pindex, Power); S_NetworkSend.SendPlayerData(Pindex); S_NetworkSend.PlayerMsg(Pindex, "Your PowerLevel has been set to Player Rank!", (int)Enums.ColorType.BrightCyan); Console.WriteLine("Successfully set the power level to " + Power + " for player " + Name); break; } case 1: { S_Players.SetPlayerAccess(Pindex, Power); S_NetworkSend.SendPlayerData(Pindex); S_NetworkSend.PlayerMsg(Pindex, "Your PowerLevel has been set to Monitor Rank!", (int)Enums.ColorType.BrightCyan); Console.WriteLine("Successfully set the power level to " + Power + " for player " + Name); break; } case 2: { S_Players.SetPlayerAccess(Pindex, Power); S_NetworkSend.SendPlayerData(Pindex); S_NetworkSend.PlayerMsg(Pindex, "Your PowerLevel has been set to Mapper Rank!", (int)Enums.ColorType.BrightCyan); Console.WriteLine("Successfully set the power level to " + Power + " for player " + Name); break; } case 3: { S_Players.SetPlayerAccess(Pindex, Power); S_NetworkSend.SendPlayerData(Pindex); S_NetworkSend.PlayerMsg(Pindex, "Your PowerLevel has been set to Developer Rank!", (int)Enums.ColorType.BrightCyan); Console.WriteLine("Successfully set the power level to " + Power + " for player " + Name); break; } case 4: { S_Players.SetPlayerAccess(Pindex, Power); S_NetworkSend.SendPlayerData(Pindex); S_NetworkSend.PlayerMsg(Pindex, "Your PowerLevel has been set to Creator Rank!", (int)Enums.ColorType.BrightCyan); Console.WriteLine("Successfully set the power level to " + Power + " for player " + Name); break; } default: { Console.WriteLine("Failed to set the power level to " + Power + " for player " + Name); break; } } } Console.ResetColor(); break; } case "kick": { if (parts.Length > 2 || parts.Length < 2) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } string Name = parts[1]; int Pindex = S_GameLogic.FindPlayer(Name); Console.ForegroundColor = ConsoleColor.Red; if (!(Pindex > 0)) { Console.WriteLine("Player name is empty or invalid. [Name not found]"); } else { S_NetworkSend.AlertMsg(Pindex, "You have been kicked by the server owner!"); S_Players.LeftGame(Pindex); } Console.ResetColor(); break; } case "ban": { if (parts.Length > 2 || parts.Length < 2) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } string Name = parts[1]; int Pindex = S_GameLogic.FindPlayer(Name); Console.ForegroundColor = ConsoleColor.Red; if (!(Pindex > 0)) { Console.WriteLine("Player name is empty or invalid. [Name not found]"); } else { modDatabase.ServerBanIndex(Pindex); } Console.ResetColor(); break; } case "maintenance": { S_General.isInMaintenance = !S_General.isInMaintenance; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Maintenance is now " + S_General.isInMaintenance); Console.ResetColor(); break; } case "timespeed": { if (parts.Length > 2 || parts.Length < 2) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } double.TryParse(parts[1], out double speed); Time.Instance.GameSpeed = speed; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Set GameSpeed to " + Time.Instance.GameSpeed + " secs per seconds"); Console.ResetColor(); break; } case "ip": { Console.WriteLine("Ip:" + S_General.MyIPAddress); break; } case "say": { if (parts.Length > 2) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } string message = ""; foreach (var item in parts.ToList().Skip(1)) { if (message == "") { message += item; } else { message += " " + item; } } S_NetworkSend.GlobalMsg(message); Console.WriteLine(message); break; } case "setxpmultiplier": { if (parts.Length > 2 || parts.Length < 2) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } float.TryParse(parts[1], out float xpMultiplayer); modTypes.Options.xpMultiplier = xpMultiplayer; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Global XP Multiplayer set to: " + xpMultiplayer); Console.ResetColor(); break; } case "unlockcps": { if (parts.Length > 1 || parts.Length < 1) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } modTypes.Options.unlockCPS = true; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("CPS: " + S_General.gameCPS + " CPS is Unlocked"); Console.ResetColor(); break; } case "lockcps": { if (parts.Length > 1 || parts.Length < 1) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } modTypes.Options.unlockCPS = false; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("CPS: " + S_General.gameCPS + " CPS is locked"); Console.ResetColor(); break; } case "debugtext": { if (parts.Length > 1) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Incorrect usage."); Console.ResetColor(); break; } S_Globals.DebugTxt = !S_Globals.DebugTxt; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Debug Text: " + S_Globals.DebugTxt); Console.ResetColor(); break; } case "": { continue; } default: { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Invalid Command. If you are unsure of the functions type 'help'."); Console.ResetColor(); break; } } } }