private string trimWhitSpaceAndEmotes(string str) { StringBuilder stringBuilder = new StringBuilder(" "); bool flag = true; int length = str.Length; char[] array = str.ToLower().ToCharArray(); for (int i = 0; i < length; i++) { if (EmoteManager.IsEmoteCharacter(array[i])) { continue; } if (char.IsWhiteSpace(array[i])) { if (!flag) { stringBuilder.Append(" "); flag = true; } } else { stringBuilder.Append(array[i]); flag = false; } } if (!flag) { stringBuilder.Append(" "); } return(stringBuilder.ToString()); }
/// <summary> /// Performs the current attack on the target /// </summary> public void Attack() { if (DebugMove) { Console.WriteLine($"[{Timers.RunningTime}] - {Name} ({Guid}) - Attack"); } switch (CurrentAttack) { case CombatType.Melee: MeleeAttack(); break; case CombatType.Missile: RangeAttack(); break; case CombatType.Magic: MagicAttack(); break; } EmoteManager.OnAttack(AttackTarget); ResetAttack(); }
public void CheckClose() { if (LastPlayer == null) { return; } // handles player logging out at vendor if (LastPlayer.CurrentLandblock == null) { LastPlayer = null; return; } var dist = Vector3.Distance(Location.ToGlobal(), LastPlayer.Location.ToGlobal()); if (dist > UseRadius) { EmoteManager.DoVendorEmote(VendorType.Close, LastPlayer); LastPlayer = null; return; } var closeChain = new ActionChain(); closeChain.AddDelaySeconds(CloseInterval); closeChain.AddAction(this, CheckClose); closeChain.EnqueueChain(); }
private bool onSendChatMessage(ChatMessageSender.SendChatMessage evt) { bool flag = false; EmoteDefinition[] emoteDefinitionsFromMessage = EmoteManager.GetEmoteDefinitionsFromMessage(evt.Message); for (int i = 0; i < emoteDefinitionsFromMessage.Length; i++) { if (emoteDefinitionsList.Contains(emoteDefinitionsFromMessage[i])) { emoteDefinitionsList.Remove(emoteDefinitionsFromMessage[i]); } emoteDefinitionsList.Insert(0, emoteDefinitionsFromMessage[i]); flag = true; } while (emoteDefinitionsList.Count > RecentEmotesMaxCount) { emoteDefinitionsList.RemoveAt(emoteDefinitionsList.Count - 1); } List <string> value = DefinitionsToStrings(emoteDefinitionsList); DisplayNamePlayerPrefs.SetList("RecentEmotesServiceList", value); if (flag) { eventDispatcher.DispatchEvent(default(RecentEmotesUpdated)); } return(false); }
public void SetEmote(EmoteDefinition emoteDefinition) { if (emoteDefinition != null) { if (emoteDefinition.Id == "RecentEmoteKey") { EmoteIconText.text = null; GetComponent <Button>().interactable = false; RecentEmoteImage.enabled = true; return; } this.emoteDefinition = emoteDefinition; if (!string.IsNullOrEmpty(emoteDefinition.Sound)) { disableClickSound(); } emoteString = EmoteManager.GetEmoteString(emoteDefinition); EmoteIconText.text = emoteString; AccessibilitySettings component = GetComponent <AccessibilitySettings>(); component.CustomToken = emoteDefinition.Token; TutorialBreadcrumb.SetBreadcrumbId($"Emote_{emoteDefinition.name}"); GetComponent <Button>().interactable = true; RecentEmoteImage.enabled = false; } else { EmoteIconText.text = null; GetComponent <Button>().interactable = false; RecentEmoteImage.enabled = false; } }
public override void ActOnUse(WorldObject activator) { var player = activator as Player; if (player == null) { return; } #if DEBUG player.Session.Network.EnqueueSend(new GameMessageSystemChat("Portal sending player to destination", ChatMessageType.System)); #endif var portalDest = new Position(Destination); player.AdjustDungeon(portalDest); player.Teleport(portalDest); // If the portal just used is able to be recalled to, // save the destination coordinates to the LastPortal character position save table if (!NoRecall) { player.LastPortalDID = OriginalPortal == null ? WeenieClassId : OriginalPortal; // if walking through a summoned portal } EmoteManager.OnPortal(player); }
public void CheckClose() { if (LastPlayer == null) { return; } // handles player logging out at vendor if (LastPlayer.CurrentLandblock == null) { LastPlayer = null; return; } var dist = GetCylinderDistance(LastPlayer); if (dist > UseRadius) { if (LastPlayer.lastUsedContainerId == Guid) { LastPlayer.lastUsedContainerId = new ObjectGuid(0); } EmoteManager.DoVendorEmote(VendorType.Close, LastPlayer); LastPlayer = null; return; } var closeChain = new ActionChain(); closeChain.AddDelaySeconds(CloseInterval); closeChain.AddAction(this, CheckClose); closeChain.EnqueueChain(); }
private void StartQuest(ChatMessage message, Player player, Quest quest) { Double successChance = player.GetQuestSuccessChance(); Boolean successful = Random.TryPercentChance(successChance); var resultMessage = successful ? quest.OnSuccess(player, Random.NextElement(EmoteManager.Get(message.Channel, EmoteCategory.Positive))) : quest.FailureMessage + " " + Random.NextElement(EmoteManager.Get(message.Channel, EmoteCategory.Negative)); StringBuilder questPrompt = new(); questPrompt .Append($"[Quest {String.Format("{0:0.0}", successChance * 100)}% success] "); if (quest.IsRare) { var positiveEmotes = EmoteManager.Get(message.Channel, EmoteCategory.Positive); questPrompt .Append(Random.NextElement(positiveEmotes)) .Append(" RARE QUEST!!! ") .Append(Random.NextElement(positiveEmotes)) .Append(' '); } questPrompt .Append($"{GetPlayerWithWorkers(player)} travel to {quest.Location}. {resultMessage}"); Client.SpoolMessageAsMe(message.Channel, player, questPrompt.ToString()); }
/// <summary> /// This is raised by Player.HandleActionUseItem, and is wrapped in ActionChain.<para /> /// The actor of the ActionChain is the item being used.<para /> /// The item does not exist in the players possession.<para /> /// If the item was outside of range, the player will have been commanded to move using DoMoveTo before ActOnUse is called.<para /> /// When this is called, it should be assumed that the player is within range. /// /// This is the OnUse method. This is just an initial implemention. I have put in the turn to action at this point. /// If we are out of use radius, move to the object. Once in range, let's turn the creature toward us and get started. /// Note - we may need to make an NPC class vs monster as using a monster does not make them turn towrad you as I recall. Og II /// Also, once we are reading in the emotes table by weenie - this will automatically customize the behavior for creatures. /// </summary> public override void ActOnUse(Player player) { var actionChain = new ActionChain(); actionChain.AddDelaySeconds(player.Rotate(this)); if (Biota.BiotaPropertiesEmote.Count > 0) { var rng = Physics.Common.Random.RollDice(0.0f, 1.0f); var result = Biota.BiotaPropertiesEmote.Where(emote => emote.Category == 7 && rng >= emote.Probability); if (result.Count() < 1) { result = Biota.BiotaPropertiesEmote.Where(emote => emote.Category == 7); } if (result.Count() > 0) { var actions = Biota.BiotaPropertiesEmoteAction.Where(action => action.EmoteSetId == result.ElementAt(result.Count() - 1).EmoteSetId&& action.EmoteCategory == result.ElementAt(result.Count() - 1).Category); foreach (var action in actions) { EmoteManager.ExecuteEmote(result.ElementAt(result.Count() - 1), action, actionChain, this, player); } } actionChain.EnqueueChain(); //OnAutonomousMove(player.Location, this.Sequences, MovementTypes.TurnToObject, playerId); //GameEventUseDone sendUseDoneEvent = new GameEventUseDone(player.Session); //player.Session.Network.EnqueueSend(sendUseDoneEvent); player.SendUseDoneEvent(); } else { player.SendUseDoneEvent(); } }
/// <summary> /// Transitions a monster from idle to awake state /// </summary> public void WakeUp() { MonsterState = State.Awake; IsAwake = true; //DoAttackStance(); EmoteManager.OnAttack(AttackTarget as Creature); }
private void sendChatMessage() { string text = InputBarField.Text.Trim(); InputBarField.Clear(); if (MonoSingleton <NativeAccessibilityManager> .Instance.AccessibilityLevel == NativeAccessibilityLevel.VOICE) { string messageWithLocalizedEmotes = EmoteManager.GetMessageWithLocalizedEmotes(text); MonoSingleton <NativeAccessibilityManager> .Instance.Native.Speak(messageWithLocalizedEmotes); } Service.Get <EventDispatcher>().DispatchEvent(new ChatMessageSender.SendChatMessage(text, null)); int num = 0; int num2 = 0; bool flag = false; for (int i = 0; i < text.Length; i++) { if (EmoteManager.IsEmoteCharacter(text[i])) { num2++; } else if (!char.IsWhiteSpace(text[i]) && !flag) { flag = true; num++; } else if (char.IsWhiteSpace(text[i])) { flag = false; } } Service.Get <ICPSwrveService>().Action("game.chat", text.Length.ToString(), num.ToString(), num2.ToString()); smc.SendEvent(new ExternalEvent("Root", "chat_close")); }
protected override void OnInit() { Messages = new Queue <MessageResult>(MaxMessages); _messageManager = new MessageManager(AddMessage); _emoteManager = new EmoteManager(); _messageManager.Connect(UserName, Token, Channel); }
public void SetChatMessage(string playerName, string message, bool isChatActivity, bool isAwaitingModeration = false, bool isChatBlocked = false) { if (NameText != null) { NameText.text = playerName; } if (isChatActivity) { showActiveChat(); return; } hideActiveChat(); showBlockedTextPanel(isChatBlocked); MessageText.gameObject.SetActive(!isChatBlocked); if (isChatBlocked) { return; } bool flag = message.Length <= maxEmoteString; bool flag2 = true; if (flag) { foreach (char character in message) { if (!EmoteManager.IsEmoteCharacter(character)) { flag2 = false; break; } } } if (flag2 && flag) { PaddingLayoutGroup.padding = PaddingSingleEmote; MessageText.fontSize = FontSizeSingleEmote - (message.Length - 1) * emoteReduction; } else { PaddingLayoutGroup.padding = PaddingDefault; MessageText.fontSize = FontSizeDefault; } MessageText.material = FontMaterialDefault; if (isAwaitingModeration) { MessageText.material = FontMaterialWaiting; } MessageText.text = message; if (MessageText.transform.parent != null) { AccessibilitySettings component = MessageText.transform.parent.GetComponent <AccessibilitySettings>(); if (component != null) { component.DynamicText = EmoteManager.GetMessageWithLocalizedEmotes(MessageText.text); } } }
public AutomuteService( ILogger <Discostor> logger, ConfigRoot config, EmoteManager emoteManager) { _logger = logger; _config = config.Discord; _emoteManager = emoteManager; }
public override void ActOnUse(WorldObject activator) { if (!(activator is Creature creature)) { return; } EmoteManager.OnUse(creature); }
private void showChatMessage(bool isAwaitingModeration) { MessageText.gameObject.SetActive(value: true); ActiveTypingPanel.SetActive(value: false); BlockedTextPanel.SetActive(value: false); isMessageShowing = true; CoroutineRunner.StopAllForOwner(this); bool flag = message.Length <= maxEmoteString; int num = message.Length + previousEmoteMessage.Length; bool flag2 = true; string text = ""; MessageText.material = FontMaterialDefault; if (flag) { string text2 = message; foreach (char c in text2) { if (!EmoteManager.IsEmoteCharacter(c)) { flag2 = false; break; } playSoundForEmote(EmoteManager.GetEmoteFromCharacter(c)); } } if (flag2 && flag) { text = ((num > maxEmoteString) ? message : (previousEmoteMessage + message)); PaddingLayoutGroup.padding = PaddingSingleEmote; MessageText.fontSize = FontSizeSingleEmote - (text.Length - 1) * emoteReduction; MessageText.text = text; previousEmoteMessage = text; Service.Get <EventDispatcher>().DispatchEvent(new ChatEvents.ChatEmoteMessageShown(text, SessionId)); } else { PaddingLayoutGroup.padding = PaddingDefault; MessageText.fontSize = FontSizeDefault; previousEmoteMessage = ""; if (isAwaitingModeration) { MessageText.material = FontMaterialWaiting; } MessageText.text = message; } AccessibilitySettings component = MessageText.GetComponent <AccessibilitySettings>(); if (component != null) { component.DynamicText = EmoteManager.GetMessageWithLocalizedEmotes(MessageText.text); } adjustBubbleSize(); openBubble(); CoroutineRunner.Start(waitForDisplayTime(), this, "waitForDisplayTime"); }
/// <summary> /// Called every ~5 seconds for WorldObject base /// </summary> public virtual void HeartBeat() { Generator_HeartBeat(); EmoteManager.HeartBeat(); EnchantmentManager.HeartBeat(); SetProperty(PropertyFloat.HeartbeatTimestamp, Time.GetTimestamp()); }
/// <summary> /// Called every ~5 seconds for WorldObject base /// </summary> public virtual void HeartBeat(double currentUnixTime) { Generator_HeartBeat(); EmoteManager.HeartBeat(); EnchantmentManager.HeartBeat(); cachedHeartbeatTimestamp = currentUnixTime; SetProperty(PropertyFloat.HeartbeatTimestamp, currentUnixTime); }
/// <summary> /// Transitions a monster from idle to awake state /// </summary> public void WakeUp(bool alertNearby = true) { MonsterState = State.Awake; IsAwake = true; //DoAttackStance(); EmoteManager.OnAttack(AttackTarget as Creature); if (alertNearby) { AlertFriendly(); } }
protected UsingEmoteManager() { MockedContextFactory = new(); MockedContext = new(); MockedRandom = new(); Sut = new(MockedContextFactory.Object, MockedRandom.Object); MockedContextFactory .Setup(x => x.GetContext()) .Returns(MockedContext.Object); }
// ReSharper disable once UnusedParameter.Local private static void Main(String[] args) { Logger.Info("TwitchTallyWorker v" + Assembly.GetExecutingAssembly().GetName().Version + " started."); LineParser.SetAccuracies(Properties.Settings.Default.Accuracies); DataStore.Connect(Properties.Settings.Default.RedisConnectString); EmoteManager.ImportFromRedis(); EmoteManager.Download(); IncommingQueue incommingQueue = new IncommingQueue(); Logger.Info("Waiting for User Input before exiting."); Console.ReadLine(); }
public void DoVendorEmote(VendorType vendorType, WorldObject player) { switch (vendorType) { case VendorType.Open: EmoteManager.DoVendorEmote(vendorType, player); break; default: log.Warn($"Vendor.DoVendorEmote - Encountered Unhandled VendorType {vendorType} for {Name} ({WeenieClassId})"); break; } }
/// <summary> /// Called on monster death, before Die() /// </summary> public void OnDeath() { IsTurning = false; IsMoving = false; EmoteManager.OnDeath(DamageHistory); // handle summoning portals on creature death if (LinkedPortalOneDID != null) { SummonPortal(LinkedPortalOneDID.Value); } }
/// <summary> /// Transitions a monster from idle to awake state /// </summary> public void WakeUp(bool alertNearby = true) { MonsterState = State.Awake; IsAwake = true; //DoAttackStance(); EmoteManager.OnWakeUp(AttackTarget as Creature); EmoteManager.OnNewEnemy(AttackTarget as Creature); //SelectTargetingTactic(); if (alertNearby) { AlertFriendly(); } }
protected override IEnumerator runTest() { Service.Set(new Content(ContentManifestUtility.FromDefinitionFile("Configuration/embedded_content_manifest"))); GameData gameData = new GameData(); Service.Set(gameData); Service.Set((IGameData)gameData); gameData.Init(new Type[1] { typeof(EmoteDefinition) }); emoteList = EmoteManager.GetAllEmoteCharacters(); CreateChatBarText(); yield return(EmojiFontTest()); }
private String GetRankUpMessage(ChatMessage message, Player player, IApplicationContext context, out Priority priority) { priority = Priority.Low; if (RanksToPoints.TryGetValue(player.Rank, out Int32 pointsToRank)) { Rank nextRank = player.Rank.Next(); if (player.Points >= pointsToRank) { if (nextRank == Rank.None) { if (player.HasUnlockedAllRecipes()) { HeistManager.LeaveAllHeists(context, player); // Prestige instead of rank up player.ResetRank(); player.Prestige++; context.SaveChanges(); var positiveEmotes = EmoteManager.Get(message.Channel, EmoteCategory.Positive); priority = Priority.Medium; return($"{Random.NextElement(positiveEmotes)} You prestiged back to {Rank.Bronze} and have gained a permanent {(Int32)(PrestigeBonus * 100)}% cheese gain boost. {Random.NextElement(positiveEmotes)}"); } return($"You need to buy all cheese recipes in order to prestige back to {Rank.Bronze} rank. " + $"You will lose all your cheese and upgrades, but will gain a permanent {(Int32)(PrestigeBonus * 100)}% bonus on your cheese gains."); } player.Points -= pointsToRank; player.Rank = nextRank; context.SaveChanges(); priority = Priority.Medium; return($"You ranked up to {nextRank}. {Random.NextElement(EmoteManager.Get(message.Channel, EmoteCategory.Positive))} (-{pointsToRank} cheese)"); } var pointsNeededToRank = pointsToRank - player.Points; if (nextRank == Rank.None) { return($"You need {pointsNeededToRank} more cheese in order to prestige back to {Rank.Bronze} rank. " + $"You will lose all your cheese and upgrades, but will gain a permanent {(Int32)(PrestigeBonus * 100)}% bonus on your cheese gains."); } return($"You need {pointsNeededToRank} more cheese in order to rank up to {nextRank}."); } return($"Uh oh, you broke something. You have an invalid rank of {player.Rank}."); }
private bool onKeyPressed(KeyboardEvents.KeyPressed evt) { oldText = base.Text; setText(evt.Text); if (MonoSingleton <NativeAccessibilityManager> .Instance.AccessibilityLevel == NativeAccessibilityLevel.VOICE && oldText.Length > base.Text.Length) { string text = oldText.Substring(oldText.Length - 1, 1); if (EmoteManager.IsEmoteCharacter(char.Parse(text))) { string token = EmoteManager.GetToken(text); string tokenTranslation = Service.Get <Localizer>().GetTokenTranslation(token); MonoSingleton <NativeAccessibilityManager> .Instance.Native.Speak(tokenTranslation); } } return(false); }
/// <summary> /// Called every ~5 seconds for Creatures /// </summary> public override void Heartbeat(double currentUnixTime) { foreach (var wo in EquippedObjects.Values) { if (wo.NextHeartbeatTime <= currentUnixTime) { wo.Heartbeat(currentUnixTime); } } VitalHeartBeat(); EmoteManager.HeartBeat(); base.Heartbeat(currentUnixTime); }
private bool OnChatEmoteMessage(ChatEvents.ChatEmoteMessageShown evt) { if (!IsIncludingRemotePlayers && !isSessionIdLocalPlayer(evt.SessionId)) { return(false); } Dictionary <string, EmoteDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <string, EmoteDefinition> >(); EmoteDefinition value = null; int num = 0; for (int i = 0; i < evt.Message.Length; i++) { if (EmoteManager.IsEmoteCharacter(evt.Message[i])) { dictionary.TryGetValue(EmoteNames[num], out value); if (!(value != null)) { continue; } if (evt.Message[i] == EmoteManager.GetEmoteChar(value)) { num++; if (num >= EmoteNames.Length) { base.Fsm.Event(MatchEvent); break; } continue; } if (EmoteNames.Length == 1 && i == evt.Message.Length - 1) { base.Fsm.Event(FailedEvent); break; } if (num != 0) { num = 0; i--; } } else if (num != 0) { break; } } return(false); }
/// <summary> /// This is raised by Player.HandleActionUseItem, and is wrapped in ActionChain.<para /> /// The actor of the ActionChain is the item being used.<para /> /// The item does not exist in the players possession.<para /> /// If the item was outside of range, the player will have been commanded to move using DoMoveTo before ActOnUse is called.<para /> /// When this is called, it should be assumed that the player is within range. /// /// This is the OnUse method. This is just an initial implemention. I have put in the turn to action at this point. /// If we are out of use radius, move to the object. Once in range, let's turn the creature toward us and get started. /// Note - we may need to make an NPC class vs monster as using a monster does not make them turn towrad you as I recall. Og II /// Also, once we are reading in the emotes table by weenie - this will automatically customize the behavior for creatures. /// </summary> public override void ActOnUse(WorldObject worldObject) { if (worldObject is Player) { var player = worldObject as Player; var actionChain = new ActionChain(); actionChain.AddDelaySeconds(player.Rotate(this)); if (Biota.BiotaPropertiesEmote.Count > 0) { var emoteSets = Biota.BiotaPropertiesEmote.Where(x => x.Category == (int)EmoteCategory.Use).ToList(); if (emoteSets.Count > 0) { var selectedEmoteSet = emoteSets.FirstOrDefault(x => x.Probability == 1); if (selectedEmoteSet == null) { var rng = Physics.Common.Random.RollDice(0.0f, 1.0f); selectedEmoteSet = emoteSets.FirstOrDefault(x => x.Probability >= rng); } if (selectedEmoteSet == null) { player.SendUseDoneEvent(); return; } var emoteActions = Biota.BiotaPropertiesEmoteAction.Where(x => x.EmoteCategory == selectedEmoteSet.Category && x.EmoteSetId == selectedEmoteSet.EmoteSetId).OrderBy(x => x.Order).ToList(); foreach (var action in emoteActions) { EmoteManager.ExecuteEmote(selectedEmoteSet, action, actionChain, this, player); } actionChain.EnqueueChain(); } player.SendUseDoneEvent(); } else { player.SendUseDoneEvent(); } } }