public Response SendMessage(string message, int lastMessageId) { CheckSiteSecurity(); var manager = new ChatManager(); return manager.SendMessage(message, lastMessageId); }
public GameClient(TcpClient selfClient, Guid onlineId, IClientKiller killer, ChatManager manager, GameLoop game) { _self = selfClient; _self.NoDelay = true; _self.Client.NoDelay = true; _reader = new BinaryReader(_self.GetStream()); _writer = new BinaryWriter(_self.GetStream()); _clientKiller = killer; _game = game; ChatManager chatManager = manager; chatManager.Join(this); _auth = AuthorisationManager.Resolve(); _packetReader = PacketReader.Resolve<ServerPacketReader>(); _packetReader.InitialiseMapping(); OnlineId = onlineId; _active = true; _subs = new List<PacketSubscriber> { this, _game, chatManager }; Task.Factory.StartNew(Receive); }
public Response CheckMessages(int lastMessage) { CheckSiteSecurity(); var manager = new ChatManager(); return manager.CheckMessages(lastMessage); }
/************************************************** * Event Handlers **************************************************/ protected override void Awake() { base.Awake(); ToggleEnabled = false; _chatManager = ChatManager.Instance; _inputField = GetComponent<InputField>(); _inputField.onEndEdit.AddListener(SendChatMessage); _inputField.onValueChange.AddListener(ValueChanged); }
public void TestMust_Get2ChatsForLastDays() { var db = new MockSQLite(); var languageManager = new LanguageManager(db); var chatHistoryManager = new ChatHistoryManager(db); var chatManager = new ChatManager(db, languageManager, chatHistoryManager); var list = chatManager.GetChatsForLastDays(5); Assert.IsTrue(list.Count == 2); }
public Server() { Version = Convert.ToDouble(Resources.VERSION); _serverListener = new TcpListener(IPAddress.Any, Port); _clientManager = new GameClientManager(); _chatManager = ChatManager.Resolve(); _game = new GameLoop(); PacketReader.Resolve<ServerPacketReader>().InitialiseMapping(); }
private bool mUserWasDisconnected; // User was disconnected due to server/network crash #endregion Fields #region Constructors public Network(UserManager prUserManager, QuestionManager prQuestionManager, AnswerManager prAnswerManager, IOProcessor prIOProcessor, ChatManager prChatManager) { mIOProcessor = prIOProcessor; mQuestionManager = prQuestionManager; mUserManager = prUserManager; mAnswerManager = prAnswerManager; mChatManager = prChatManager; mTutor = new User(); }
private void UnturnedPlayerEvents_OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { UnturnedPlayer murdererPlayer = player; string MurdererName = "Unapplicable"; try { murdererPlayer = UnturnedPlayer.FromCSteamID(murderer); MurdererName = murdererPlayer.DisplayName; } catch { } string key = cause.ToString(); string HeldGun = murdererPlayer.GetHeldGunName(MurdererName); ushort heldGunID = murdererPlayer.GetHeldGunID(MurdererName); float distance = 0; if (murdererPlayer != null) { try { distance = UnityEngine.Vector3.Distance(player.Position, murdererPlayer.Position); } catch { } } if (player.CSteamID == murderer && cause != EDeathCause.SUICIDE) { key += "_SUICIDE"; } if (Configuration.Instance.EnableUncreatedMainCampingOverride && cause == OverridedCauseForMainCamping && translations.ContainsKey(Configuration.Instance.MainCampingKey)) { key = Configuration.Instance.MainCampingKey; } if ((cause == EDeathCause.GUN || cause == EDeathCause.MELEE || cause == EDeathCause.MISSILE || cause == EDeathCause.SPLASH) && MurdererName != "Unapplicable") { if (translations.ContainsKey(heldGunID.ToString())) { string message = translations[heldGunID.ToString()]; try { ChatManager.say(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m"), Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m")); } catch { Logger.Log(message + " is too long, sending basic message instead."); if (heldGunID == 0) { key += "_UNKNOWN"; } if (translations.ContainsKey(key)) { message = translations[key]; try { ChatManager.say(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m"), Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m")); } catch { Logger.Log(message + " is too long, sending default message instead."); if (DefTranslations.ContainsKey(key)) { message = DefTranslations[key]; ChatManager.say(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m"), Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(string.Format(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m"))); } else { ChatManager.say(key + $" ({player.DisplayName}, {murderer.m_SteamID}, {limb}, {HeldGun}, {distance.ToString() + "m"})", Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(key + $" ({player.DisplayName}, {murderer.m_SteamID}, {limb}, {HeldGun}, {distance.ToString() + "m"})"); } } } } } else { if (heldGunID == 0 && key != Configuration.Instance.MainCampingKey) { key += "_UNKNOWN"; } if (translations.ContainsKey(key)) { string message = translations[key]; try { ChatManager.say(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m"), Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m")); } catch { Logger.Log(message + " is too long, sending default message instead."); if (DefTranslations.ContainsKey(key)) { message = DefTranslations[key]; ChatManager.say(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m"), Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(String.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m")); } else { ChatManager.say(key + $" ({player.DisplayName}, {murderer.m_SteamID}, {limb}, {HeldGun}, {distance.ToString() + "m"})", Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(key + $" ({player.DisplayName}, {murderer.m_SteamID}, {limb}, {HeldGun}, {distance.ToString() + "m"})"); } } } } } else { if (translations.ContainsKey(key)) { if (cause == EDeathCause.BLEEDING) { if (murderer == Provider.server) { key += "_SUICIDE"; } else if (!murderer.m_SteamID.ToString().StartsWith("765")) { MurdererName = "a zombie."; } } string message = translations[key]; try { ChatManager.say(string.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m"), Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(string.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m")); } catch { Logger.Log(message + " is too long, sending default message instead."); if (DefTranslations.ContainsKey(key)) { message = DefTranslations[key]; ChatManager.say(string.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m"), Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(string.Format(message, player.DisplayName, MurdererName, limb.GetLimbName(), HeldGun, Math.Round(distance).ToString() + "m")); } else { ChatManager.say(key + $" ({player.DisplayName}, {murderer.m_SteamID}, {limb}, {HeldGun}, {Math.Round(distance).ToString() + "m"})", Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(string.Format(key + $" ({player.DisplayName}, {murderer.m_SteamID}, {limb}, {HeldGun}, {Math.Round(distance).ToString() + "m"})", player.DisplayName, MurdererName, NiceLimbs[limb])); } } } else { if (DefTranslations.ContainsKey(key)) { string message = DefTranslations[key]; ChatManager.say(string.Format(message, player.DisplayName, MurdererName, NiceLimbs[limb], HeldGun, Math.Round(distance).ToString() + "m"), Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(string.Format(message, player.DisplayName, MurdererName, NiceLimbs[limb], HeldGun, Math.Round(distance).ToString() + "m")); } else { ChatManager.say(key + $" ({player.DisplayName}, {murderer.m_SteamID}, {limb}, {HeldGun}, {Math.Round(distance).ToString() + "m"})", Configuration.Instance.ColorOfTheTextToSendWhenTextIsSentAfterAPlayerDiesOrGetsShotToDeath.Hex()); LogDeath(string.Format(key + $" ({player.DisplayName}, {murderer.m_SteamID}, {limb}, {HeldGun}, {Math.Round(distance).ToString() + "m"})", player.DisplayName, MurdererName, NiceLimbs[limb])); } } } }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); // This will hide the crafting menu similar to the reforge menu. For best results this UI is placed before "Vanilla: Inventory" to prevent 1 frame of the craft menu showing. Main.HidePlayerCraftingMenu = true; // Here we have a lot of code. This code is mainly adapted from the vanilla code for the reforge option. // This code draws "Place an item here" when no item is in the slot and draws the reforge cost and a reforge button when an item is in the slot. // This code could possibly be better as different UIElements that are added and removed, but that's not the main point of this example. // If you are making a UI, add UIElements in OnInitialize that act on your ItemSlot or other inputs rather than the non-UIElement approach you see below. const int slotX = 50; const int slotY = 270; if (!_vanillaItemSlot.Item.IsAir) { int awesomePrice = Item.buyPrice(0, 1, 0, 0); string costText = Language.GetTextValue("LegacyInterface.46") + ": "; string coinsText = ""; int[] coins = Utils.CoinsSplit(awesomePrice); if (coins[3] > 0) { coinsText = coinsText + "[c/" + Colors.AlphaDarken(Colors.CoinPlatinum).Hex3() + ":" + coins[3] + " " + Language.GetTextValue("LegacyInterface.15") + "] "; } if (coins[2] > 0) { coinsText = coinsText + "[c/" + Colors.AlphaDarken(Colors.CoinGold).Hex3() + ":" + coins[2] + " " + Language.GetTextValue("LegacyInterface.16") + "] "; } if (coins[1] > 0) { coinsText = coinsText + "[c/" + Colors.AlphaDarken(Colors.CoinSilver).Hex3() + ":" + coins[1] + " " + Language.GetTextValue("LegacyInterface.17") + "] "; } if (coins[0] > 0) { coinsText = coinsText + "[c/" + Colors.AlphaDarken(Colors.CoinCopper).Hex3() + ":" + coins[0] + " " + Language.GetTextValue("LegacyInterface.18") + "] "; } ItemSlot.DrawSavings(Main.spriteBatch, slotX + 130, Main.instance.invBottom, true); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, costText, new Vector2(slotX + 50, slotY), new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor), 0f, Vector2.Zero, Vector2.One, -1f, 2f); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, coinsText, new Vector2(slotX + 50 + Main.fontMouseText.MeasureString(costText).X, (float)slotY), Color.White, 0f, Vector2.Zero, Vector2.One, -1f, 2f); int reforgeX = slotX + 70; int reforgeY = slotY + 40; bool hoveringOverReforgeButton = Main.mouseX > reforgeX - 15 && Main.mouseX <reforgeX + 15 && Main.mouseY> reforgeY - 15 && Main.mouseY < reforgeY + 15 && !PlayerInput.IgnoreMouseInterface; Texture2D reforgeTexture = Main.reforgeTexture[hoveringOverReforgeButton ? 1 : 0]; Main.spriteBatch.Draw(reforgeTexture, new Vector2(reforgeX, reforgeY), null, Color.White, 0f, reforgeTexture.Size() / 2f, 0.8f, SpriteEffects.None, 0f); if (hoveringOverReforgeButton) { Main.hoverItemName = Language.GetTextValue("LegacyInterface.19"); if (!tickPlayed) { Main.PlaySound(SoundID.MenuTick, -1, -1, 1, 1f, 0f); } tickPlayed = true; Main.LocalPlayer.mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft && Main.LocalPlayer.CanBuyItem(awesomePrice, -1) && ItemLoader.PreReforge(_vanillaItemSlot.Item)) { Main.LocalPlayer.BuyItem(awesomePrice, -1); bool favorited = _vanillaItemSlot.Item.favorited; int stack = _vanillaItemSlot.Item.stack; Item reforgeItem = new Item(); reforgeItem.netDefaults(_vanillaItemSlot.Item.netID); reforgeItem = reforgeItem.CloneWithModdedDataFrom(_vanillaItemSlot.Item); // This is the main effect of this slot. Giving the Awesome prefix 90% of the time and the ReallyAwesome prefix the other 10% of the time. All for a constant 1 gold. Useless, but informative. if (Main.rand.NextBool(10)) { reforgeItem.Prefix(GetInstance <ExampleMod>().PrefixType("ReallyAwesome")); } else { reforgeItem.Prefix(GetInstance <ExampleMod>().PrefixType("Awesome")); } _vanillaItemSlot.Item = reforgeItem.Clone(); _vanillaItemSlot.Item.position.X = Main.LocalPlayer.position.X + (float)(Main.LocalPlayer.width / 2) - (float)(_vanillaItemSlot.Item.width / 2); _vanillaItemSlot.Item.position.Y = Main.LocalPlayer.position.Y + (float)(Main.LocalPlayer.height / 2) - (float)(_vanillaItemSlot.Item.height / 2); _vanillaItemSlot.Item.favorited = favorited; _vanillaItemSlot.Item.stack = stack; ItemLoader.PostReforge(_vanillaItemSlot.Item); ItemText.NewText(_vanillaItemSlot.Item, _vanillaItemSlot.Item.stack, true, false); Main.PlaySound(SoundID.Item37, -1, -1); } } else { tickPlayed = false; } } else { string message = "Place an item here to Awesomeify"; ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, message, new Vector2(slotX + 50, slotY), new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor), 0f, Vector2.Zero, Vector2.One, -1f, 2f); } }
public override void Draw(SpriteBatch sb) { base.Draw(sb); // Lets draw names for cars! List <Vector3> pos = new List <Vector3>(); List <string> text = new List <string>(); lock (gameObjects) { for (int i = 0; i < objectsOwned.Count; i++) { int playerId = objectsOwned.Values[i]; int objectId = objectsOwned.Keys[i]; string alias; Gobject g; if (gameObjects.TryGetValue(objectId, out g) && players.TryGetValue(playerId, out alias)) { pos.Add(g.GetPositionAbove()); text.Add(alias); } } } if (BlankBackground == null) { BlankBackground = new Texture2D(sb.GraphicsDevice, 1, 1); BlankBackground.SetData(new Color[] { Color.White }); } Matrix v = cameraManager.currentCamera.GetViewMatrix(); Matrix p = cameraManager.ProjectionMatrix(); //Now that we're no longer blocking, lets draw for (int i = 0; i < pos.Count; i++) { // TODO - magic number if (Vector3.Distance(cameraManager.currentCamera.CurrentPosition, pos[i]) < 100) { Vector3 screen = sb.GraphicsDevice.Viewport.Project(pos[i], p, v, Matrix.Identity); int size = (int)chatFont.MeasureString(text[i]).X; sb.Draw(BlankBackground, new Microsoft.Xna.Framework.Rectangle((int)screen.X - size / 2, (int)screen.Y, size, chatFont.LineSpacing), Color.Gray * .5f); sb.DrawString(chatFont, text[i], new Vector2(screen.X - size / 2, screen.Y), Color.White); } } DrawBuildMode(v, p); ChatManager.Draw(sb); if (isClient) // only clients need sound { FrameworkDispatcher.Update(); // Sounds like this called early and often } if (myRover != null) { int nrg = (int)myRover.Energy; sb.Draw(energy, new Microsoft.Xna.Framework.Rectangle(5, 5, nrg, 5), Color.White); if (myRover.hasRadar) { try { if (isClient) { soundManager.Play(Sounds.RadarNoise.ToString()); } } catch (Exception x) { string tacos = x.Message; } // The radar map if (radar != null) { sb.Draw(radar, new Microsoft.Xna.Framework.Rectangle(10, 900, 100, 100), Color.White); } // The Icon if (radar_icon != null) { sb.Draw(radar_icon, new Microsoft.Xna.Framework.Rectangle(10, 10, 50, 50), Color.White); } } if (myRover.hasLaser) { // The Icon if (laser_icon != null) { sb.Draw(laser_icon, new Microsoft.Xna.Framework.Rectangle(70, 10, 50, 50), Color.White); } } } }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { //if (BossChecklistUI.visible) //{ // layers.RemoveAll(x => x.Name == "Vanilla: Resource Bars" || x.Name == "Vanilla: Map / Minimap"); //} int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndex != -1) { layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer( "BossChecklist: Boss Checklist", delegate { if (BossChecklistUI.visible) { if (lastSeenScreenWidth != Main.screenWidth || lastSeenScreenHeight != Main.screenHeight) { bossChecklistInterface.Recalculate(); lastSeenScreenWidth = Main.screenWidth; lastSeenScreenHeight = Main.screenHeight; } bossChecklistUI.Draw(Main.spriteBatch); if (BossChecklistUI.hoverText != "") { float x = Main.fontMouseText.MeasureString(BossChecklistUI.hoverText).X; Vector2 vector = new Vector2((float)Main.mouseX, (float)Main.mouseY) + new Vector2(16f, 16f); if (vector.Y > (float)(Main.screenHeight - 30)) { vector.Y = (float)(Main.screenHeight - 30); } if (vector.X > (float)(Main.screenWidth - x - 30)) { vector.X = (float)(Main.screenWidth - x - 30); } //Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, BossChecklistUI.hoverText, // vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f); // Utils.draw //ItemTagHandler.GenerateTag(item) int hoveredSnippet = -1; TextSnippet[] array = ChatManager.ParseMessage(BossChecklistUI.hoverText, Color.White).ToArray(); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, array, vector, 0f, Vector2.Zero, Vector2.One, out hoveredSnippet /*, -1f, 2f*/); if (hoveredSnippet > -1) { array[hoveredSnippet].OnHover(); //if (Main.mouseLeft && Main.mouseLeftRelease) //{ // array[hoveredSnippet].OnClick(); //} } } } return(true); }, InterfaceScaleType.UI) ); } }
public static void SendMessage(this UnturnedPlayer player, string message, Color?color = null) { ChatManager.serverSendMessage(message, color ?? Color.yellow, toPlayer: player.SteamPlayer(), useRichTextFormatting: true); }
public frmMain() { InitializeComponent(); mMessageLogger = new MessageLogger(); mChatManager = new ChatManager(); mUserManager = new UserManager(mMessageLogger); mQuestionManager = new QuestionManager(mUserManager); mAnswerManager = new AnswerManager(); mIOProcessor = new IOProcessor(mMessageLogger, mUserManager, mQuestionManager, mAnswerManager, mChatManager); //mIOProcessor = new IOProcessor(mMessageLogger, mUserManager); mNetwork = new Network(mMessageLogger, mUserManager, mQuestionManager, mAnswerManager, mIOProcessor); // Load the registered tutors if (!mUserManager.LoadTutors("tutors.xml")) { mMessageLogger.NewMessage("Can't load file \"tutors.xml\" or the contents in it. " + "Please use the admin tool to recreate it", mMessageLogger.MESSAGE_ERROR); } mUser = new User(); mRunning = true; mDictionarySerialiser = new DictionarySerialiserMethods(); // Attempt to load questions from the questions.xml file if (LoadQuestions("questions.xml") == false) { // Add some demo questions if none could be loaded from a file question iDemoQuestion = new question(); // Multi-choice iDemoQuestion.QuestionID = 0; iDemoQuestion.Question = "How many days in a week?"; iDemoQuestion.QuestionType = "MC"; iDemoQuestion.PossibleAnswers = new string[4] { "Ten", "Three", "Seven", "Nine" }; iDemoQuestion.Answer = "Seven"; mQuestionManager.AddNewQuestion(iDemoQuestion); // True/False iDemoQuestion = new question(); iDemoQuestion.QuestionID = 1; iDemoQuestion.Question = "Fire burns?"; iDemoQuestion.QuestionType = "TF"; iDemoQuestion.PossibleAnswers = new string[4] { "True", "False", "", "" }; iDemoQuestion.Answer = "True"; mQuestionManager.AddNewQuestion(iDemoQuestion); // Short Answer iDemoQuestion = new question(); iDemoQuestion.QuestionID = 2; iDemoQuestion.Question = "What is 5x5?"; iDemoQuestion.QuestionType = "SA"; iDemoQuestion.PossibleAnswers = new string[4] { "", "", "", "" }; iDemoQuestion.Answer = ""; mQuestionManager.AddNewQuestion(iDemoQuestion); } mTimer = new System.Timers.Timer(1000); mTimer.Elapsed += new ElapsedEventHandler(TimeElapsed); mTimer.Enabled = true; }
public void OnStart() { ChatManager.TouchInstance(); ESCFontManager.TouchInstance(); }
public RenameChatCmd(ChatManager chatManager) { _chatManager = chatManager; }
private void Start() { chatManager = FindObjectOfType <ChatManager>(); }
private void onTextCommited(Player p, string buttonName, string text) { UnturnedPlayer player = UnturnedPlayer.FromPlayer(p); try { text = text.Trim(); bool containsInt = text.Any(char.IsDigit); bool result1 = text.All(Char.IsLetter); switch (buttonName) { case "RPRegistration_Name": if (text.Length > 10) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("TOO_LONG", "Name", 10).Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); return; } if (result1 == false || containsInt == true || string.IsNullOrEmpty(text)) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("BAD_CHARACTERS").Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); return; } text = UppercaseFirst(text); ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("REGISTER_DATE_NAME", text).Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); registerin[player.CSteamID].Name = text; Console.Write(text); break; case "RPRegistration_Subname": if (text.Length > 10) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("TOO_LONG", "Lastname", 10).Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); return; } ; if (result1 == false || containsInt == true || string.IsNullOrEmpty(text)) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("BAD_CHARACTERS").Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); return; } text = UppercaseFirst(text); ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("REGISTER_DATE_LASTNAME", text).Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); registerin[player.CSteamID].Lastname = text; break; case "RPRegistration_Birthday": try { String[] textsplitted; String[] spearator = { "/" }; Int32 count = 3; textsplitted = text.Split(spearator, count, StringSplitOptions.RemoveEmptyEntries); if (text.Length > 10 || textsplitted.Length > 3) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("TOO_LONG", "Birth", 10).Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); return; } foreach (String s in textsplitted) { int i; bool result = int.TryParse(s, out i); if (result == false) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("BAD_DATE").Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); return; } } string[] formats = { "MM/dd/yyyy", "M/d/yyyy", "MM/dd/yyyy", "yyyy/MM/dd", "yyyy/dd/MM" }; DateTime dateValue; if (DateTime.TryParseExact(text, formats, new CultureInfo("en-US"), DateTimeStyles.None, out dateValue)) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("REGISTER_DATE_BIRTH", dateValue.ToString("MMMM dd, yyyy")).Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); registerin[player.CSteamID].Birth = dateValue; } else { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("BAD_DATE").Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); } } catch (Exception) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("BAD_DATE").Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); } break; } } catch (Exception) { ChatManager.serverSendMessage(string.Format($"{MessageName}{Instance.Translate("BAD_CHARACTERS").Replace('(', '<').Replace(')', '>')}"), Color.white, null, player.SteamPlayer(), EChatMode.WELCOME, ChatLogo, true); } }
public void WarnRestartAction(string minutes) { Log.Write(new LocString(string.Format("CitePerdue - Server will restart in " + minutes + " Minutes !!"))); ChatManager.ServerMessageToAll(new LocString(Text.Color(Color.Red, "Server will restart in " + minutes + " Minutes !!")), false, DefaultChatTags.Notifications); }
internal static ARequest Parse(PlayerHandle player, ChatManager server, Message ev) { ARequest request = null; switch (ev.name) { case "login": request = Requests.Login.Parse(ev); break; case "joinroom": request = Requests.LobbyJoin.Parse(ev); break; case "leaveroom": request = Requests.LobbyLeave.Parse(ev); break; case "openroom": request = Requests.RoomOpen.Parse(ev); break; case "closeroom": request = Requests.RoomClose.Parse(ev); break; case "joingroup": request = Requests.GroupJoin.Parse(ev); break; case "leavegroup": request = Requests.GroupLeave.Parse(ev); break; case "getUserRoomList": request = Requests.RoomList.Parse(ev); break; case "sendgroup": request = Requests.SendGroup.Parse(ev); break; case "sendroom": request = Requests.SendLocal.Parse(ev); break; case "sendworld": request = Requests.SendWorld.Parse(ev); break; case "private": request = Requests.SendPM.Parse(ev); break; case "friend": request = Requests.FriendRequest.Parse(ev); break; case "getonline": request = Requests.GetOnline.Parse(ev); break; case "order": request = Requests.Order.Parse(ev); break; default: break; } if (request != null) { request.originalMessage = ev; } return request; }
public AbandonMySettlementCmd(ChatManager chatManager) { _chatManager = chatManager; }
public static void hotwire_cmd(Client player) { if (player.IsInVehicle == false) { API.Shared.SendChatMessageToPlayer(player, "You are not in a vehicle."); return; } Character character = player.GetCharacter(); var veh = API.Shared.GetPlayerVehicle(player); GameVehicle vehicle = API.Shared.GetEntityData(veh, "Vehicle"); if (API.Shared.GetVehicleEngineStatus(veh) == true) { API.Shared.SendChatMessageToPlayer(player, "This vehicle is already started."); return; } if (API.Shared.GetVehicleClass(vehicle.VehModel) == 13) // Cycles { API.Shared.SendChatMessageToPlayer(player, "The vehicle has no engine."); return; } if (vehicle.Fuel < 1) { API.Shared.SendChatMessageToPlayer(player, "This vehicle has no fuel."); return; } if (API.Shared.GetVehicleLocked(veh)) { API.Shared.SendChatMessageToPlayer(player, "The vehicle is locked."); return; } if (character.NextHotWire > DateTime.Now) { API.Shared.SendChatMessageToPlayer(player, $"You have to wait {character.NextHotWire.Subtract(DateTime.Now).Seconds} more second(s) before attempting to hotwire."); return; } ChatManager.RoleplayMessage(character, "attempts to hotwire the vehicle.", ChatManager.RoleplayMe); Random ran = new Random(); var hotwireChance = ran.Next(100); if (hotwireChance < 40) { API.Shared.SetVehicleEngineStatus(veh, true); ChatManager.RoleplayMessage(character, "succeeded in hotwiring the vehicle.", ChatManager.RoleplayMe); } else { API.Shared.SetPlayerHealth(player, player.Health - 10); player.SendChatMessage("You attempted to hotwire the vehicle and got shocked!"); ChatManager.RoleplayMessage(character, "failed to hotwire the vehicle.", ChatManager.RoleplayMe); character.NextHotWire = DateTime.Now.Add(TimeSpan.FromSeconds(10)); } }
//int lastSeenScreenWidth; //int lastSeenScreenHeight; public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { //if (BossChecklistUI.visible) //{ // layers.RemoveAll(x => x.Name == "Vanilla: Resource Bars" || x.Name == "Vanilla: Map / Minimap"); //} int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); if (MouseTextIndex != -1) { layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer( "BossChecklist: Boss Checklist", delegate { if (BossChecklistUI.Visible) { bossChecklistInterface?.Draw(Main.spriteBatch, new GameTime()); if (BossChecklistUI.hoverText != "") { float x = Main.fontMouseText.MeasureString(BossChecklistUI.hoverText).X; Vector2 vector = new Vector2((float)Main.mouseX, (float)Main.mouseY) + new Vector2(16f, 16f); if (vector.Y > (float)(Main.screenHeight - 30)) { vector.Y = (float)(Main.screenHeight - 30); } if (vector.X > (float)(Main.screenWidth - x - 30)) { vector.X = (float)(Main.screenWidth - x - 30); } //Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, BossChecklistUI.hoverText, // vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f); // Utils.draw //ItemTagHandler.GenerateTag(item) int hoveredSnippet = -1; TextSnippet[] array = ChatManager.ParseMessage(BossChecklistUI.hoverText, Color.White).ToArray(); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, array, vector, 0f, Vector2.Zero, Vector2.One, out hoveredSnippet /*, -1f, 2f*/); if (hoveredSnippet > -1) { array[hoveredSnippet].OnHover(); //if (Main.mouseLeft && Main.mouseLeftRelease) //{ // array[hoveredSnippet].OnClick(); //} } } } return(true); }, InterfaceScaleType.UI) ); } // This doesn't work perfectly. //if (BossChecklistUI.Visible) { // layers.RemoveAll(x => LayersToHideWhenChecklistVisible.Contains(x.Name)); //} if (MouseTextIndex != -1) { layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer("BossChecklist: Boss Log", delegate { BossLogInterface.Draw(Main.spriteBatch, new GameTime()); return(true); }, InterfaceScaleType.UI) ); layers.Insert(++MouseTextIndex, new LegacyGameInterfaceLayer("BossChecklist: Boss Radar", delegate { BossRadarUIInterface.Draw(Main.spriteBatch, new GameTime()); return(true); }, InterfaceScaleType.UI) ); } if (ClientConfig.RespawnTimerEnabled) { int InventoryIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Death Text")); if (InventoryIndex != -1) { layers.Insert(InventoryIndex, new LegacyGameInterfaceLayer("BossChecklist: Respawn Timer", delegate { if (Main.LocalPlayer.dead && Main.LocalPlayer.difficulty != 2) { if (ClientConfig.TimerSounds) { if (Main.LocalPlayer.respawnTimer % 60 == 0 && Main.LocalPlayer.respawnTimer / 60 <= 3) { Main.PlaySound(25); } } string timer = (Main.LocalPlayer.respawnTimer / 60 + 1).ToString(); Vector2 screenPos = new Vector2(Main.screenWidth / 2, Main.screenHeight / 2 - 75); Color deathColor = Main.player[Main.myPlayer].GetDeathAlpha(Color.Transparent); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, timer, screenPos, deathColor); } return(true); }, InterfaceScaleType.UI) ); } } #region DEBUG int PlayerChatIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Player Chat")); if (PlayerChatIndex != -1) { layers.Insert(PlayerChatIndex, new LegacyGameInterfaceLayer("BossChecklist: Debug Timers and Counters", delegate { PlayerAssist playerAssist = Main.LocalPlayer.GetModPlayer <PlayerAssist>(); int ConfigIndex = NPCAssist.ListedBossNum(DebugConfig.ShowTimerOrCounter.Type, DebugConfig.ShowTimerOrCounter.mod); if (ConfigIndex != -1) { string textKingSlime = $"{bossTracker.SortedBosses[ConfigIndex].name} (#{ConfigIndex + 1})" + $"\nTime: {playerAssist.RecordTimers[ConfigIndex]}" + $"\nDodge Timer: {playerAssist.DodgeTimer[ConfigIndex]}" + $"\nTimes Hit: {playerAssist.AttackCounter[ConfigIndex]}" + $"\nLowest Health: {playerAssist.BrinkChecker[ConfigIndex]} / {playerAssist.MaxHealth[ConfigIndex]}" + $"\nDeaths: {playerAssist.DeathTracker[ConfigIndex]}"; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textKingSlime, new Vector2(20, Main.screenHeight - 175), new Color(1f, 0.388f, 0.278f), 0f, default(Vector2), 1, SpriteEffects.None, 0f); } return(true); }, InterfaceScaleType.UI) ); } #endregion }
internal virtual bool Validate(PlayerHandle sender, ChatManager server) { return sender.IsLoggedIn; }
public void ToggleSounds(bool isOn) { ChatManager.GetCM().playAudio = isOn; }
/// <summary> /// Broadcasts a chat message to all users /// </summary> /// <param name="message"></param> public void Broadcast(string message) => ChatManager.sendChat(EChatMode.GLOBAL, message);
protected override async UniTask OnExecuteAsync() { if (Context.Parameters.Length > 1) { throw new CommandWrongUsageException(Context); } bool vanished; PlayerLook look; PlayerMovement movement; if (Context.Parameters.Length == 0) { if (!(Context.Actor is UnturnedUser uPlayer)) { throw new CommandWrongUsageException(Context); } movement = uPlayer.Player.Player.movement; look = uPlayer.Player.Player.look; vanished = !movement.canAddSimulationResultsToUpdates; if (vanished) { await uPlayer.PrintMessageAsync(m_StringLocalizer["vanish:unvanished"]); movement.updates.Add(new PlayerStateUpdate(movement.real, look.angle, look.rot)); } else { await uPlayer.PrintMessageAsync(m_StringLocalizer["vanish:vanished"]); } uPlayer.Player.Player.movement.canAddSimulationResultsToUpdates = vanished; return; } string searchTerm = Context.Parameters[0]; if (!PlayerTool.tryGetSteamPlayer(searchTerm, out SteamPlayer target)) { throw new UserFriendlyException(m_StringLocalizer["general:invalid_player", new { Player = searchTerm }]); } await UniTask.SwitchToMainThread(); string targetName = target.playerID.characterName; movement = target.player.movement; look = target.player.look; vanished = !movement.canAddSimulationResultsToUpdates; if (vanished) { await Context.Actor.PrintMessageAsync(m_StringLocalizer["vanish:unvanished_other", new { Player = targetName }]); ChatManager.serverSendMessage(m_StringLocalizer["vanish:unvanished"], Color.white, toPlayer: target, useRichTextFormatting: true); movement.updates.Add(new PlayerStateUpdate(movement.real, look.angle, look.rot)); } else { await Context.Actor.PrintMessageAsync(m_StringLocalizer["vanish:vanished_other", new { Player = targetName }]); ChatManager.serverSendMessage(m_StringLocalizer["vanish:vanished"], Color.white, toPlayer: target, useRichTextFormatting: true); } target.player.movement.canAddSimulationResultsToUpdates = vanished; }
public static void Broadcast(string message, string icon = null, Color?color = null) { ChatManager.serverSendMessage(message, color ?? Color.yellow, iconURL: icon, useRichTextFormatting: true); }
public static void do_racetalk(CharacterInstance ch, string argument) { ChatManager.SendToChat(ch, argument, ChannelTypes.RaceTalk, "racetalk"); }
public void DrawChat(bool drawingPlayerChat) { int startChatLine = this._startChatLine; int index = 0; int snippetIndex1 = 0; while (startChatLine > 0 && index < this._messages.Count) { int num = Math.Min(startChatLine, this._messages[index].LineCount); startChatLine -= num; snippetIndex1 += num; if (snippetIndex1 == this._messages[index].LineCount) { snippetIndex1 = 0; ++index; } } int num1 = 0; int?nullable1 = new int?(); int snippetIndex2 = -1; int?nullable2 = new int?(); int hoveredSnippet = -1; while (num1 < this._showCount && index < this._messages.Count) { ChatMessageContainer message = this._messages[index]; if (message.Prepared && drawingPlayerChat | message.CanBeShownWhenChatIsClosed) { TextSnippet[] withInversedIndex = message.GetSnippetWithInversedIndex(snippetIndex1); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.get_Value(), withInversedIndex, new Vector2(88f, (float)(Main.screenHeight - 30 - 28 - num1 * 21)), 0.0f, Vector2.Zero, Vector2.One, out hoveredSnippet, -1f, 2f); if (hoveredSnippet >= 0) { nullable2 = new int?(hoveredSnippet); nullable1 = new int?(index); snippetIndex2 = snippetIndex1; } ++num1; ++snippetIndex1; if (snippetIndex1 >= message.LineCount) { snippetIndex1 = 0; ++index; } } else { break; } } if (!nullable1.HasValue || !nullable2.HasValue) { return; } TextSnippet[] withInversedIndex1 = this._messages[nullable1.Value].GetSnippetWithInversedIndex(snippetIndex2); withInversedIndex1[nullable2.Value].OnHover(); if (!Main.mouseLeft || !Main.mouseLeftRelease) { return; } withInversedIndex1[nullable2.Value].OnClick(); }
void Start() { instance = this; }
protected override void DrawSelf(SpriteBatch spriteBatch) { base.DrawSelf(spriteBatch); int num1 = this._large.ToInt() * 6; Vector2 vector2_1 = new Vector2((float)num1, 0.0f); this._locked = !this._achievement.IsCompleted; this.UpdateIconFrame(); CalculatedStyle innerDimensions = this.GetInnerDimensions(); CalculatedStyle dimensions = this._achievementIconBorders.GetDimensions(); Vector2 vector2_2 = new Vector2(dimensions.X + dimensions.Width + 7f, innerDimensions.Y); Tuple <Decimal, Decimal> trackerValues = this.GetTrackerValues(); bool flag = false; if ((!(trackerValues.Item1 == Decimal.Zero) || !(trackerValues.Item2 == Decimal.Zero)) && this._locked) { flag = true; } float num2 = (float)((double)innerDimensions.Width - (double)dimensions.Width + 1.0) - (float)(num1 * 2); Vector2 baseScale1 = new Vector2(0.85f); Vector2 baseScale2 = new Vector2(0.92f); string wrappedText = FontAssets.ItemStack.get_Value().CreateWrappedText(this._achievement.Description.Value, (float)(((double)num2 - 20.0) * (1.0 / (double)baseScale2.X)), Language.ActiveCulture.CultureInfo); Vector2 stringSize1 = ChatManager.GetStringSize(FontAssets.ItemStack.get_Value(), wrappedText, baseScale2, num2); if (!this._large) { stringSize1 = ChatManager.GetStringSize(FontAssets.ItemStack.get_Value(), this._achievement.Description.Value, baseScale2, num2); } float num3 = (float)(38.0 + (this._large ? 20.0 : 0.0)); if ((double)stringSize1.Y > (double)num3) { baseScale2.Y *= num3 / stringSize1.Y; } Color baseColor1 = Color.Lerp(this._locked ? Color.Silver : Color.Gold, Color.White, this.IsMouseHovering ? 0.5f : 0.0f); Color baseColor2 = Color.Lerp(this._locked ? Color.DarkGray : Color.Silver, Color.White, this.IsMouseHovering ? 1f : 0.0f); Color color1 = this.IsMouseHovering ? Color.White : Color.Gray; Vector2 position1 = vector2_2 - Vector2.UnitY * 2f + vector2_1; this.DrawPanelTop(spriteBatch, position1, num2, color1); AchievementCategory category = this._achievement.Category; position1.Y += 2f; position1.X += 4f; spriteBatch.Draw(this._categoryTexture.get_Value(), position1, new Rectangle?(this._categoryTexture.Frame(4, 2, (int)category, 0, 0, 0)), this.IsMouseHovering ? Color.White : Color.Silver, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f); position1.X += 4f; position1.X += 17f; ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.get_Value(), this._achievement.FriendlyName.Value, position1, baseColor1, 0.0f, Vector2.Zero, baseScale1, num2, 2f); position1.X -= 17f; Vector2 position2 = vector2_2 + Vector2.UnitY * 27f + vector2_1; this.DrawPanelBottom(spriteBatch, position2, num2, color1); position2.X += 8f; position2.Y += 4f; ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.get_Value(), wrappedText, position2, baseColor2, 0.0f, Vector2.Zero, baseScale2, -1f, 2f); if (!flag) { return; } Vector2 position3 = position1 + Vector2.UnitX * num2 + Vector2.UnitY; string text = ((int)trackerValues.Item1).ToString() + "/" + (object)(int)trackerValues.Item2; Vector2 baseScale3 = new Vector2(0.75f); Vector2 stringSize2 = ChatManager.GetStringSize(FontAssets.ItemStack.get_Value(), text, baseScale3, -1f); float progress = (float)(trackerValues.Item1 / trackerValues.Item2); float Width = 80f; Color color2 = new Color(100, (int)byte.MaxValue, 100); if (!this.IsMouseHovering) { color2 = Color.Lerp(color2, Color.Black, 0.25f); } Color BackColor = new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue); if (!this.IsMouseHovering) { BackColor = Color.Lerp(BackColor, Color.Black, 0.25f); } this.DrawProgressBar(spriteBatch, progress, position3 - Vector2.UnitX * Width * 0.7f, Width, BackColor, color2, color2.MultiplyRGBA(new Color(new Vector4(1f, 1f, 1f, 0.5f)))); position3.X -= Width * 1.4f + stringSize2.X; ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.get_Value(), text, position3, baseColor1, 0.0f, new Vector2(0.0f, 0.0f), baseScale3, 90f, 2f); }
public override Vector2 GetSize() => ChatManager.GetStringSize(Main.fontMouseText, Text, Vector2.One);
private async Task ChangeJob() { var gearSets = GearsetManager.GearSets.Where(i => i.InUse); ClassJobType newjob; var foundJob = Enum.TryParse(job.Trim(), true, out newjob); if (Core.Me.CurrentJob == newjob && !force) { _isDone = true; return; } Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Started"); Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Found job: {foundJob} Job:{newjob}"); if (foundJob && gearSets.Any(gs => gs.Class == newjob)) { Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Found GearSet"); gearSets.First(gs => gs.Class == newjob).Activate(); await Coroutine.Wait(3000, () => SelectYesno.IsOpen); if (SelectYesno.IsOpen) { SelectYesno.Yes(); await Coroutine.Sleep(3000); } // await Coroutine.Sleep(1000); } else if (foundJob) { job = job.Trim() + ("s_Primary_Tool"); ItemUiCategory category; var categoryFound = Enum.TryParse(job, true, out category); if (categoryFound) { Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Found Item Category: {categoryFound} Category:{category}"); var item = InventoryManager.FilledInventoryAndArmory.Where(i => i.Item.EquipmentCatagory == category).OrderByDescending(i => i.Item.ItemLevel).FirstOrDefault(); BagSlot EquipSlot = InventoryManager.GetBagByInventoryBagId(InventoryBagId.EquippedItems)[EquipmentSlot.MainHand]; Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Found Item {item}"); if (item != null) { item.Move(EquipSlot); } await Coroutine.Sleep(1000); ChatManager.SendChat("/gs save"); await Coroutine.Sleep(1000); } else { Logging.Write(Colors.Fuchsia, $"[ChangeJobTag] Couldn't find item category'"); } } _isDone = true; }
public override void Draw(SpriteBatch spriteBatch, float maxWidth) { ChatManager.DrawColorCodedStringWithShadow(spriteBatch, Main.fontMouseText, Text, Position, Color.White, 0f, Vector2.Zero, Vector2.One); }
public void OnVehicleMenuTrigger(Player player, params object[] arguments) { var vehicleHandle = (Entity)arguments[0]; var option = (string)arguments[1]; Character character = player.GetCharacter(); GameVehicle vehicle = API.Shared.GetEntityData(vehicleHandle, "Vehicle"); var playerSeat = API.Shared.GetPlayerVehicleSeat(player); //Check that player vehicle is the same as the menu vehicle... if (API.Shared.GetPlayerVehicle(player) != vehicleHandle) { DebugManager.DebugMessage("[VehicleMenu] " + character.CharacterName + "(" + player.SocialClubName + ", " + player + ") used VehicleMenu option in a different vehicle handle."); return; } var vehAccess = VehicleManager.DoesPlayerHaveVehicleAccess(player, vehicle); var parkAccess = VehicleManager.DoesPlayerHaveVehicleParkLockAccess(player, vehicle); if ((option.Equals("park") || option.Equals("lock")) && !parkAccess) { API.Shared.SendChatMessageToPlayer(player, "~r~ You do not have access to this vehicle."); return; } if ((option.Equals("engine") || option.Equals("park")) && playerSeat != -1) { API.Shared.SendChatMessageToPlayer(player, "~r~ You can only access these options in the driver seat."); return; } switch (option) { case "engine": if (vehAccess) { VehicleManager.engine_cmd(player); } else { VehicleManager.hotwire_cmd(player); } break; case "lock": var lockState = API.Shared.GetVehicleLocked(vehicleHandle); if (lockState) { API.Shared.SetVehicleLocked(vehicleHandle, false); ChatManager.RoleplayMessage(character, "unlocks the doors of the vehicle.", ChatManager.RoleplayMe); } else { API.Shared.SetVehicleLocked(vehicleHandle, true); ChatManager.RoleplayMessage(character, "locks the doors of the vehicle.", ChatManager.RoleplayMe); } break; case "park": var pos = NAPI.Entity.GetEntityPosition(vehicleHandle); var rot = NAPI.Entity.GetEntityRotation(vehicleHandle); var dimension = NAPI.Entity.GetEntityDimension(vehicleHandle); vehicle.SpawnPos = pos; vehicle.SpawnRot = rot; vehicle.SpawnDimension = (int)dimension; vehicle.Save(); API.Shared.SendChatMessageToPlayer(player, "Car spawn location saved to current location."); break; case "door": var doorIndex = (int)arguments[2]; var doorName = ""; switch (doorIndex) { case 0: doorName = "front left door"; break; case 1: doorName = "front right door"; break; case 2: doorName = "back left door"; break; case 3: doorName = "back right door"; break; case 4: doorName = "hood"; break; case 5: doorName = "trunk"; break; } var doorState = API.GetVehicleDoorState(vehicleHandle, doorIndex); if (doorState) { API.SetVehicleDoorState(vehicleHandle, doorIndex, false); ChatManager.RoleplayMessage(character, "closed the " + doorName + " of the vehicle.", ChatManager.RoleplayMe); } else { API.SetVehicleDoorState(vehicleHandle, doorIndex, true); ChatManager.RoleplayMessage(character, "opened the " + doorName + " of the vehicle.", ChatManager.RoleplayMe); } break; } }
public DiscordCmd(ChatManager chatManager) { _chatManager = chatManager; }
public HomeController(ChatManager chatManager) { _chatManager = chatManager; }
void Awake() { instance = this; }
public void FindPlayer() { chatManager = GetComponent<ChatManager>(); StartCoroutine(GetUserName()); StartCoroutine(GetID()); }
public static void Reset() { _instance = null; }
public static List<Emoticon> GetEmoticons(bool refresh = false) { var emoticons = new List<Emoticon>(); if (!File.Exists(emoticonsCacheFileName)) { File.Create(emoticonsCacheFileName); refresh = true; } if (refresh) { using (StreamWriter writer = File.CreateText(emoticonsCacheFileName)) { var chatManager = new ChatManager(); foreach (Emoticon emoticon in chatManager.GetEmoticons()) { writer.WriteLine(emoticon.Pattern + "," + emoticon.Url); } } } using (StreamReader reader = File.OpenText(emoticonsCacheFileName)) { string line; while ((line = reader.ReadLine()) != null) { string[] parts = line.Split(','); emoticons.Add(new Emoticon {Pattern = parts[0].Trim(), Url = parts[1].Trim()}); } } return emoticons; }
internal abstract IPromise<Nothing> Process(PlayerHandle sender, ChatManager server);
void OnDestroy() { instance = null; }
public Response CheckUsers() { CheckSiteSecurity(); var manager = new ChatManager(); return manager.CheckUsers(); }
void Start() { Instance = this; }
public int EnterRoom(int roomId) { CheckSiteSecurity(); var manager = new ChatManager(); return manager.EnterRoom(roomId); }