public static bool HandleCommand(Session Session, string Input) { Input = Input.Substring(1, Input.Length - 1); string[] input = Input.Split(new char[] { ' ' }); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId); SpaceActor actor = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; switch (input[0]) { case "alerta": if (referenceObject.Staff == 1) { string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false); return(true); } return(false); } return(false); }
public static bool HandleCommand(Session Session, string Input) { Input = Input.Substring(1, Input.Length - 1); string[] input = Input.Split(new char[] { ' ' }); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId); SpaceActor actor = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; switch (input[0]) { case "alerta": if (referenceObject.Staff == 1) { string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false); return(true); } return(false); case "effect": if (referenceObject.Vip == 1) { Input = Input.Replace("effect", ""); Input = Input.Replace(" ", ""); switch (int.Parse(Input)) { case 1: actor.ApplyEffect(1, true); actor.UpdateNeeded = true; break; case 2: actor.ApplyEffect(2, true); actor.UpdateNeeded = true; break; case 3: actor.ApplyEffect(3, true); actor.UpdateNeeded = true; break; case 4: actor.ApplyEffect(4, true); actor.UpdateNeeded = true; break; case 5: actor.ApplyEffect(5, true); actor.UpdateNeeded = true; break; case 6: actor.ApplyEffect(6, true); actor.UpdateNeeded = true; break; case 7: actor.ApplyEffect(7, true); actor.UpdateNeeded = true; break; case 8: actor.ApplyEffect(8, true); actor.UpdateNeeded = true; break; } return(true); } return(false); } return(false); }
public static bool HandleCommand(Session Session, string Input) { Input = Input.Substring(1, Input.Length - 1); string[] input = Input.Split(new char[] { ' ' }); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId); SpaceActor actor = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; switch (input[0]) { case "position": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session.SendData(SpaceChatComposer.Compose(0, string.Concat(new object[] { "Tu posici\x00f3n actual es - X: ", actor.Position.Int32_0, ", Y: ", actor.Position.Int32_1, ", Z: ", actor.Position.Int32_2 }), 3, ChatType.Say), false); return(true); } return(false); case "bm": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { if (!UpperBlock.Contains(actor.Name)) { string str = string.Format("{0}: Has activated Block User Upper.", actor.Name); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false); UpperBlock.Add(actor.Name); } return(true); } return(false); case "uub": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Input = Input.Replace("uub", ""); Input = Input.Replace(" ", ""); uint IDtoblock = CharacterResolverCache.GetUidFromName(Input); if (!UpperBlockUser.Contains(IDtoblock)) { string str = string.Format("{0}: Has activated Block User Upper For {1}", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false); UpperBlockUser.Add(IDtoblock); } return(true); } return(false); case "ub": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Input = Input.Replace("ub", ""); Input = Input.Replace(" ", ""); uint IDtoblock = CharacterResolverCache.GetUidFromName(Input); if (UpperBlockUser.Contains(IDtoblock)) { string str = string.Format("{0}: Has deactivated Block User Upper For {1}", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false); UpperBlockUser.Remove(IDtoblock); } return(true); } return(false); case "ubm": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { if (UpperBlock.Contains(actor.Name)) { string str = string.Format("{0}: Has deactivated Block User Upper.", actor.Name); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, str, 3, ChatType.Say), 0, false); UpperBlock.Remove(actor.Name); } return(true); } return(false); case "block_upper": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha bloqueado el punch.", 3, ChatType.Say), 0, false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Punch On.", 3, ChatType.Say), 0, false); block_upper = true; return(true); } return(false); case "unblock_upper": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha desbloqueado el punch.", 3, ChatType.Say), 0, false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Punch Off.", 3, ChatType.Say), 0, false); block_upper = false; return(true); } return(false); case "checkcredits": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { Input = Input.Replace("checkcredits", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(actor.Name); actor.Whisper(checkcredits(Input), ID, false); return(true); } return(false); case "block_coco": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Ha bloqueado el coco.", 3, ChatType.Say), 0, false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Coco On.", 3, ChatType.Say), 0, false); block_coco = true; return(true); } return(false); case "unblock_coco": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": ha desbloqueado el coco.", 3, ChatType.Say), 0, false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + ": Has turned Block Coco Off.", 3, ChatType.Say), 0, false); block_coco = false; return(true); } return(false); case "ban": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 && actor.Name != "DaLoe" || referenceObject.Staff == 6) { SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint UserID = CharacterResolverCache.GetUidFromName(username); Moderation.ModerationBanManager.BanHammer(mySqlClient, UserID, reason2, actor.Name); string ban = string.Format("{0}: Banned: {1}, For: {2}", actor.Name, username, reason2); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(username); if (SessionManager.ContainsCharacterId(ID)) { Session Session_ID = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = Session_ID.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); } else { } instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false); return(true); } return(false); case "unban": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 && actor.Name != "DaLoe" && actor.Name != "Fran" || referenceObject.Staff == 6) { SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); Input = Input.Replace("unban", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); Moderation.ModerationBanManager.Unban(mySqlClient, ID); string unban = string.Format("{0}: Unbanned User {1}", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, unban, 3, ChatType.Say), 0, false); return(true); } return(false); case "ipban": if (referenceObject.Staff == 2 && actor.Name != "DaLoE" && actor.Name != "Fran" || referenceObject.Staff == 6) { SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint UserID = CharacterResolverCache.GetUidFromName(username); Sessions.Session session_0; session_0 = SessionManager.GetSessionByCharacterId(UserID); string str = session_0.RemoteAddress.ToString(); Moderation.ModerationBanManager.BanHammer3(mySqlClient, UserID, reason2, actor.Name, str); string ban = string.Format("{0}: IP Banned: {1}, For: {2}", actor.Name, username, reason2); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(username); if (SessionManager.ContainsCharacterId(ID)) { Session Session_ID = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = Session_ID.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); } else { } instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false); return(true); } return(false); case "alert": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false); return(true); } return(false); case "la": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { if (actor.Name == "Brandon" || actor.Name == "Mike") { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Creator {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else if (actor.Name == "Kyle") { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Main Programmer {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else if (referenceObject.Staff == 1) { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Moderator {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else if (referenceObject.Staff == 2 && actor.Name != "Brandon" && actor.Name != "Mike") { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Administrator {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else if (referenceObject.Staff == 6 && actor.Name != "Kyle") { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Programmer {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } else { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { Input = Input.Replace("la", ""); string send = string.Format("{0} - From Burbian Moderator {1}", Input, actor.Name); pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, send, 2)); } } return(true); } return(false); case "effect": if (referenceObject.Vip == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { Input = Input.Replace("effect", ""); Input = Input.Replace(" ", ""); switch (int.Parse(Input)) { case 1: actor.ApplyEffect(1, true); actor.UpdateNeeded = true; break; case 2: actor.ApplyEffect(2, true); actor.UpdateNeeded = true; break; case 3: actor.ApplyEffect(3, true); actor.UpdateNeeded = true; break; case 4: actor.ApplyEffect(4, true); actor.UpdateNeeded = true; break; } return(true); } return(false); case "give": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session session_0; string userthatadded = actor.Name; SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); int credits = 0; string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); credits = int.Parse(reason2); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint ID = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(ID); //givecredits2(mySqlClient, credits, username); referenceObject.UpdateGoldCreditsBalance(mySqlClient, +credits); session_0.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(credits)), false); //Punch cost 200 string str = string.Format("{0}: Gave {1}, {2} Credits!", userthatadded, username, credits); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); return(true); } return(false); case "share": if (referenceObject.Staff == 0 || referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 3 || referenceObject.Staff == 4 || referenceObject.Staff == 5 || referenceObject.Staff == 6) { string BeforeComma = string.Empty; string AfterComma = string.Empty; SqlDatabaseClient client = SqlDatabaseManager.GetClient(); Session session_0; Session session_1; Input = Input.Replace("share", ""); Input = Input.Replace(" ", ""); BeforeComma = Input.Remove(Input.LastIndexOf(',')); AfterComma = Input.Substring(Input.IndexOf(',') + 1); string username = BeforeComma.Replace(" ", ""); string amountofcredits_0 = AfterComma.Replace(" ", ""); int amount = int.Parse(amountofcredits_0); uint actorID = CharacterResolverCache.GetUidFromName(actor.Name); uint actorID2 = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(actorID); session_1 = SessionManager.GetSessionByCharacterId(actorID2); SpaceInstance instanceBySpaceId2 = SpaceManager.GetInstanceBySpaceId(session_1.CurrentSpaceId); SpaceActor actor2 = (instanceBySpaceId2 == null) ? null : instanceBySpaceId2.GetActorByReferenceId(session_1.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject2 = (CharacterInfo)actor2.ReferenceObject; if (enoughcredits(session_0, amount)) { referenceObject.UpdateGoldCreditsBalance(client, -amount); session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(amount)), false); referenceObject2.UpdateGoldCreditsBalance(client, +amount); session_1.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(amount)), false); string str = string.Format("{0}: Shared {1} Credits To {2}!", actor.Name, amount, username); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } else { string str = string.Format("Could not send {0} the credits, did you have enough?", username); actor.Whisper(str, actorID, false); } return(true); } return(false); case "take": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session session_0; Session session_1; uint actoeid = CharacterResolverCache.GetUidFromName(actor.Name); string userthatadded = actor.Name; SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); int credits = 0; string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); credits = int.Parse(reason2); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint ID = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(ID); //givecredits2(mySqlClient, credits, username); session_1 = SessionManager.GetSessionByCharacterId(ID); int gold = session_1.CharacterInfo.GoldCoins; int minusgold = gold - credits; if (minusgold < 0) { actor.Whisper("Error, the amount you tried to give was below 0", actoeid, false); } else { referenceObject.UpdateGoldCreditsBalance(mySqlClient, -credits); session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(credits)), false); string str = string.Format("{0}: Took Away {1} Credits From {2}!", userthatadded, credits, username); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } return(true); } return(false); case "kick": if (referenceObject.Staff == 1 || referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session session_0; Input = Input.Replace("kick", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); if (SessionManager.ContainsCharacterId(ID)) { session_0 = SessionManager.GetSessionByCharacterId(ID); SpaceManager.RemoveUserFromSpace(session_0); string str = string.Format("{0}: Has Kicked {1} From Island.", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } else { } //SpaceManager.GetInstanceBySpaceId //SpaceUserRemovedComposer.BroadcastCompose( return(true); } return(false); case "kickoffline": if (referenceObject.Staff == 2 || referenceObject.Staff == 6) { Session session_0; Input = Input.Replace("kickoffline", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); if (SessionManager.ContainsCharacterId(ID)) { session_0 = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = session_0.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); string str = string.Format("{0}: Has kicked {1} Offline!", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } else { } //SpaceManager.GetInstanceBySpaceId //SpaceUserRemovedComposer.BroadcastCompose( return(true); } return(false); case "mod": if (actor.Name == "Kyle" || actor.Name == "Brandon" || actor.Name == "Mike") { Session session_0; SqlDatabaseClient client; client = SqlDatabaseManager.GetClient(); Input = Input.Replace("mod", ""); Input = Input.Replace(" ", ""); string Input2 = Input; string level = Input2.Substring(Input2.IndexOf(",") + 1); uint mod = Convert.ToUInt32(level); if (Input.Contains(",")) { Input = Input.Substring(0, Input.LastIndexOf(",")); } givemod(client, Input, mod); string str = string.Format("{0}: Gave {1} Level {2} Mod Ability.", actor.Name, Input, mod); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); uint ID = CharacterResolverCache.GetUidFromName(Input); session_0 = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = session_0.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); return(true); } return(false); case "getmod": if (actor.Name == "Kyle" || actor.Name == "Brandon" || actor.Name == "Mike") { SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient(); Input = Input.Replace("getmod", ""); Input = Input.Replace(" ", ""); uint ID2 = CharacterResolverCache.GetUidFromName(actor.Name); uint ID = CharacterResolverCache.GetUidFromName(Input); Session session_1; session_1 = SessionManager.GetSessionByCharacterId(ID); uint modlevel = session_1.CharacterInfo.Staff; string str = string.Format("User {0} is mod level {1}", Input, modlevel); actor.Whisper(str, ID2, false); SessionManager.StopSession(session_1.AbsoluteSpaceId); return(true); } return(false); } return(false); }
public static bool HandleCommand(Session Session, string Input) { Input = Input.Substring(1, Input.Length - 1); string[] input = Input.Split(new char[] { ' ' }); SpaceInstance instanceBySpaceId = SpaceManager.GetInstanceBySpaceId(Session.CurrentSpaceId); SpaceActor actor = (instanceBySpaceId == null) ? null : instanceBySpaceId.GetActorByReferenceId(Session.CharacterId, SpaceActorType.UserCharacter); CharacterInfo referenceObject = (CharacterInfo)actor.ReferenceObject; switch (input[0]) { case "position": { Session.SendData(SpaceChatComposer.Compose(0, string.Concat(new object[] { "Tu posici\x00f3n actual es - X: ", actor.Position.Int32_0, ", Y: ", actor.Position.Int32_1, ", Z: ", actor.Position.Int32_2 }), 3, ChatType.Say), false); return(true); } case "block": if (referenceObject.Staff != 0) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha bloqueado el punch.", 3, ChatType.Say), 0, false); block = true; return(true); } return(false); case "unblock": if (referenceObject.Staff != 0) { instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, actor.Name + " ha desbloqueado el punch.", 3, ChatType.Say), 0, false); block = false; return(true); } return(false); case "ban": if (referenceObject.Staff == 2) { SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint UserID = CharacterResolverCache.GetUidFromName(username); Moderation.ModerationBanManager.BanHammer(mySqlClient, UserID, reason2, actor.Name); string ban = string.Format("{0} ha baneado a {1} por {2}", actor.Name, username, reason2); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(username); if (SessionManager.ContainsCharacterId(ID)) { Session Session_ID = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = Session_ID.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); } else { } instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(1, ban, 3, ChatType.Say), 0, false); return(true); } return(false); case "alert": if (referenceObject.Staff != 0) { string messageText = InputFilter.FilterString(InputFilter.MergeString(input, 1), false); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, messageText, 3, ChatType.Say), 0, false); return(true); } return(false); case "la": if (referenceObject.Staff != 0) { foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, Input.Replace("la", ""), 2)); } return(true); } return(false); case "give": if (referenceObject.Staff == 2) { Session session_0; string userthatadded = actor.Name; SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); int credits = 0; string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); credits = int.Parse(reason2); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint ID = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(ID); //givecredits2(mySqlClient, credits, username); referenceObject.UpdateGoldCreditsBalance(mySqlClient, +credits); session_0.SendData(CharacterCoinsComposer.AddGoldCompose(Convert.ToUInt32(credits)), false); //Punch cost 200 string str = string.Format("{0} le ha dado a {1} {2} Creditos!", userthatadded, username, credits); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); return(true); } return(false); case "take": if (referenceObject.Staff == 2) { Session session_0; string userthatadded = actor.Name; SqlDatabaseClient mySqlClient = SqlDatabaseManager.GetClient(); int credits = 0; string Input2 = Input; string reason2 = Input2.Substring(Input2.IndexOf(',') + 1); credits = int.Parse(reason2); Input = Input.Replace(",", ""); string[] split = Input.Split(' '); string username = (split[1]); string reason = string.Join(" ", Input, 2, Input.Length - 2); uint ID = CharacterResolverCache.GetUidFromName(username); session_0 = SessionManager.GetSessionByCharacterId(ID); referenceObject.UpdateGoldCreditsBalance(mySqlClient, -credits); session_0.SendData(CharacterCoinsComposer.RemoveGoldCompose(Convert.ToUInt32(credits)), false); //Punch cost 200 string str = string.Format("{0} le ha quitado {1} Creditos a {2}!", userthatadded, credits, username); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); return(true); } return(false); case "kick": if (referenceObject.Staff != 0) { Session session_0; Input = Input.Replace("kick", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); if (SessionManager.ContainsCharacterId(ID)) { session_0 = SessionManager.GetSessionByCharacterId(ID); SpaceManager.RemoveUserFromSpace(session_0); string str = string.Format("{0} echa a {1} de la isla", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } return(true); } return(false); case "kickoffline": if (referenceObject.Staff == 2) { Session session_0; Input = Input.Replace("kickoffline", ""); Input = Input.Replace(" ", ""); uint ID = CharacterResolverCache.GetUidFromName(Input); if (SessionManager.ContainsCharacterId(ID)) { session_0 = SessionManager.GetSessionByCharacterId(ID); uint session_id2 = session_0.CharacterInfo.SessionId; SessionManager.StopSession(session_id2); string str = string.Format("{0} desconectó a {1}", actor.Name, Input); instanceBySpaceId.BroadcastMessage(SpaceChatComposer.Compose(0, str, 3, ChatType.Say), 0, false); } //SpaceManager.GetInstanceBySpaceId //SpaceUserRemovedComposer.BroadcastCompose( return(true); } return(false); case "chest1": if (referenceObject.Staff == 2) { return(true); } return(false); } return(false); }
public static void ProcessInput(string[] Args) { string key = Args[0].ToLower(); if (key != null) { int num2 = 0; { Dictionary <string, int> dictionary1 = new Dictionary <string, int>(9); dictionary1.Add("delay", 0); dictionary1.Add("restart", 1); dictionary1.Add("crash", 2); dictionary1.Add("stop", 3); dictionary1.Add("cls", 4); dictionary1.Add("recache_news", 5); dictionary1.Add("laptop_alert", 6); dictionary1.Add("lock", 7); dictionary1.Add("disconnect", 8); switch (num2) { case 0: { int result = 0x1388; if (Args.Length > 1) { int.TryParse(Args[1], out result); } Thread.Sleep(result); return; } case 1: Process.Start(Environment.CurrentDirectory + @"\BoomBang.exe", "\"delay 1500\""); Program.Stop(); return; case 2: Environment.FailFast(string.Empty); return; case 3: Program.Stop(); return; case 4: Output.ClearStream(); return; case 5: NewsCacheManager.ReCacheNews(); return; case 6: foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, InputFilter.MergeString(Args, 1), 2), false); } return; case 7: SessionManager.RejectIncomingConnections = true; return; case 8: SessionManager.StopSession(Convert.ToUInt32(Args[1])); return; } } Output.WriteLine("'" + Args[0].ToLower() + "' is not recognized as a command or internal operation.", OutputLevel.Warning); } }
public static void ProcessInput(string[] Args) { string key = Args[0].ToLower(); if (key != null) { int num2 = 0; { Dictionary <string, int> dictionary1 = new Dictionary <string, int>(9); dictionary1.Add("delay", 0); dictionary1.Add("restart", 1); dictionary1.Add("crash", 2); dictionary1.Add("stop", 3); dictionary1.Add("cls", 4); dictionary1.Add("recache_news", 5); dictionary1.Add("laptop_alert", 6); dictionary1.Add("lock", 7); dictionary1.Add("disconnect", 8); dictionary1.Add("HELP", 9); dictionary1.Add("help", 9); switch (num2) { case 0: { int result = 0x1388; if (Args.Length > 1) { int.TryParse(Args[1], out result); } Thread.Sleep(result); return; } case 1: Process.Start(Environment.CurrentDirectory + @"\BoomBang.exe", "\"delay 1500\""); Program.Stop(); return; case 2: Environment.FailFast(string.Empty); return; case 3: Program.Stop(); return; case 4: Output.ClearStream(); return; case 5: NewsCacheManager.ReCacheNews(); return; case 6: foreach (KeyValuePair <uint, Session> pair in SessionManager.Sessions) { pair.Value.SendData(LaptopMessageComposer.Compose(pair.Value.CharacterId, InputFilter.MergeString(Args, 1), 2), false); } return; case 7: SessionManager.RejectIncomingConnections = true; return; case 8: SessionManager.StopSession(Convert.ToUInt32(Args[1])); return; case 9: Console.WriteLine("restart -> Reinicia el server"); Console.WriteLine("crash -> Apaga el server"); Console.WriteLine("stop -> Cierra el server"); Console.WriteLine("laptop_alert -> Enviar mensaje de BBTeam*"); Console.WriteLine("cls -> Borrar todas las las líneas del servidor"); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("*Para que haga efecto el laptop_alert debes escribir algo como a continuación:"); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("laptop_alert Mensaje a enviar"); return; } } Output.WriteLine("'" + Args[0].ToLower() + "' is not recognized as a command or internal operation.", OutputLevel.Warning); } }