Ejemplo n.º 1
0
 protected void OnSubControlPacketSend(object sender, GameMessageEventArgs e)
 {
     if (PacketSend != null)
     {
         PacketSend(this, e);
     }
 }
        protected override void DoExecute()
        {
            GameMessageEventArgs p_eventArgs = new GameMessageEventArgs(m_messageKey, m_messageDelay);

            LegacyLogic.Instance.EventManager.InvokeEvent(null, EEventType.GAME_MESSAGE, p_eventArgs);
            FinishExecution();
        }
Ejemplo n.º 3
0
 private void gamePacketViewer_PacketSend(object sender, GameMessageEventArgs e)
 {
     if (PacketSend != null)
     {
         PacketSend(this, e);
     }
 }
Ejemplo n.º 4
0
        private void OnGameMessageRaised(object sender, GameMessageEventArgs e)
        {
            //Add a new block, which is a paragraph that contains a run (string of text)
            //with the message to the rich text box.
            GameMessages.Document.Blocks.Add(new Paragraph(new Run(e.Message)));

            //Scroll to end of rich text box as we want player to always see the last messages.
            GameMessages.ScrollToEnd();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Process new GameMessage from MessageController
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnMessageControllerNewMessageAvailable(object sender, GameMessageEventArgs e)
        {
            if (e.Message is LoginModeMessage)
            {
                HandleLoginModeMessage((LoginModeMessage)e.Message);
            }

            else if (e.Message is GameModeMessage)
            {
                HandleGameModeMessage((GameModeMessage)e.Message);
            }

            // Add the message to the received Message queue
            ReceiveQueue.Enqueue(e.Message);
        }
Ejemplo n.º 6
0
        public void DisplayMessage(object sender, GameMessageEventArgs gameMessageEventArgs)
        {
            if (gameMessageEventArgs.Color == null)
            {
                rtbMessages.AppendText(gameMessageEventArgs.Message + Environment.NewLine);
            }
            else
            {
                rtbMessages.AppendText(gameMessageEventArgs.Message, gameMessageEventArgs.Color, true);
            }

            if (gameMessageEventArgs.AddNewLine == true)
            {
                rtbMessages.AppendText(Environment.NewLine);
            }
        }
Ejemplo n.º 7
0
        private void OnExternalMessageCreation(Object p_sender, EventArgs p_args)
        {
            String p_message = null;
            Single p_delay   = 3f;

            if (p_args is GameMessageEventArgs)
            {
                GameMessageEventArgs gameMessageEventArgs = p_args as GameMessageEventArgs;
                if (gameMessageEventArgs == null)
                {
                    return;
                }
                if (gameMessageEventArgs.IsTerrainMessage)
                {
                    if (m_terrainMessageTimeOut >= 0f)
                    {
                        return;
                    }
                    m_terrainMessageTimeOut = 5f;
                }
                if (gameMessageEventArgs.isLocaKey)
                {
                    if (String.IsNullOrEmpty(gameMessageEventArgs.locaVar))
                    {
                        p_message = LocaManager.GetText(gameMessageEventArgs.text);
                    }
                    else
                    {
                        p_message = LocaManager.GetText(gameMessageEventArgs.text, LocaManager.GetText(gameMessageEventArgs.locaVar));
                    }
                }
                else
                {
                    p_message = gameMessageEventArgs.text;
                }
                p_delay = gameMessageEventArgs.time;
            }
            else if (p_args is MapAreaEventArgs)
            {
                MapAreaEventArgs mapAreaEventArgs = p_args as MapAreaEventArgs;
                String           id = "AREA_NAME_" + mapAreaEventArgs.CurrentArea.ToString();
                p_message = LocaManager.GetText(id);
            }
            GameMessage item = new GameMessage(p_message, p_delay);

            m_queuedMessages.Enqueue(item);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Process new GameMessage from MessageController
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnMessageControllerNewMessageAvailable(object sender, GameMessageEventArgs e)
        {
            // Internally process some of the messages  that are linked to the connection
            switch (messageController.Mode)
            {
            case ProtocolMode.Login:
                HandleLoginModeMessage(e.Message);
                break;

            case ProtocolMode.Game:
                HandleGameModeMessage(e.Message);
                break;
            }

            // Add the message to the received Message queue
            ReceiveQueue.Enqueue(e.Message);
        }
Ejemplo n.º 9
0
        private void OnGameMessageRaised(object sender, GameMessageEventArgs e)
        {
            Brush foreground = Brushes.White; // Normal default

            if (e.Level == Emote.HAPPY)
            {
                foreground = Brushes.ForestGreen;
            }
            else if (e.Level == Emote.DANGEROUS)
            {
                foreground = Brushes.IndianRed;
            }
            else if (e.Level == Emote.FATAL)
            {
                foreground = Brushes.Red;
            }
            else if (e.Level == Emote.MOCKING)
            {
                foreground = Brushes.Gray;
            }
            else if (e.Level == Emote.STOIC)
            {
                foreground = Brushes.Gray;
            }
            else if (e.Level == Emote.FANTASTIC)
            {
                foreground = Brushes.Gold;
            }
            else if (e.Level == Emote.REQUIRED)
            {
                foreground = Brushes.DarkSlateGray;
            }
            else if (e.Level == Emote.REWARD)
            {
                foreground = Brushes.Goldenrod;
            }

            var a = new Paragraph(new Run(e.Message)
            {
                Foreground = foreground
            });

            GameMessages.Document.Blocks.Add(a);
            GameMessages.ScrollToEnd();
        }
Ejemplo n.º 10
0
 public void AddLoreBook(Int32 p_staticID, Boolean p_fromSaveGame)
 {
     if (p_staticID != 0)
     {
         LoreBookStaticData staticData = StaticDataHandler.GetStaticData <LoreBookStaticData>(EDataType.LOREBOOK, p_staticID);
         if (!m_foundBooks.Contains(staticData))
         {
             m_foundBooks.Add(staticData);
             String text  = Localization.Instance.GetText(staticData.TitleKey);
             String text2 = Localization.Instance.GetText("GAME_MESSSAGE_LOREBOOK_ADDED", text);
             GameMessageEventArgs p_eventArgs = new GameMessageEventArgs(text2, 0f, false);
             if (!p_fromSaveGame)
             {
                 m_newEntries.Add(p_staticID);
                 LegacyLogic.Instance.EventManager.InvokeEvent(null, EEventType.GAME_MESSAGE, p_eventArgs);
                 LegacyLogic.Instance.EventManager.InvokeEvent(staticData, EEventType.ADD_LOREBOOK, EventArgs.Empty);
             }
         }
     }
 }
Ejemplo n.º 11
0
        private static IEnumerator PlayLateShakeFX(DelayedEventManagerWorker p_Worker)
        {
            yield return(new WaitForSeconds(ANIM_TIME - 0.9f));

            Vector3 vec = new Vector3(0f, 0.1f, 0f);

            AudioController.Play("LightningBoltImpact", p_Worker.transform.position, null);
            FXMainCamera.Instance.PlayShakeFX(0.3f, vec);
            yield return(new WaitForSeconds(2.2f));

            Single      jingleTime = -1f;
            AudioObject jingle     = AudioController.Play("BossDefeatedJingle", p_Worker.transform.position, null);

            if (jingle != null)
            {
                jingleTime = jingle.clipLength;
            }
            GameMessageEventArgs gameMessageArgs = new GameMessageEventArgs("GAME_MESSAGE_MAMUSHI_DEFEATED", jingleTime - 2.4f);

            DelayedEventManager.InvokeEvent(EDelayType.ON_FRAME_END, EEventType.GAME_MESSAGE, null, gameMessageArgs);
            DelayedEventManager.InvokeEvent(EDelayType.ON_FIXED_DELAY, EEventType.GAME_MESSAGE, null, gameMessageArgs);
            Destroy(p_Worker);
            yield break;
        }
Ejemplo n.º 12
0
 private void DebugForm_PacketSend(object sender, GameMessageEventArgs e)
 {
     // send the user created generic message
     ServerConnection.SendQueue.Enqueue(e.Message);
 }
Ejemplo n.º 13
0
 private void OnGameMessageRaised(object sender, GameMessageEventArgs e)
 {
     GameMessages.Document.Blocks.Add(new Paragraph(new Run(e.Message)));
     GameMessages.ScrollToEnd();
 }
Ejemplo n.º 14
0
 public void Interact()
 {
     if (State == EInteractiveObjectState.ON)
     {
         String text = String.Empty;
         State = EInteractiveObjectState.OFF;
         m_lastActivationTime = LegacyLogic.Instance.GameTime.Time;
         LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.OBJECT_STATE_CHANGED, EventArgs.Empty);
         if (m_partyBuff != EPartyBuffs.NONE)
         {
             LegacyLogic.Instance.WorldManager.Party.Buffs.AddBuff(m_partyBuff, 1f);
             text = Localization.Instance.GetText("GAMEMESSAGE_BLESSED");
             GameMessageEventArgs p_eventArgs = new GameMessageEventArgs(text, 0f, false);
             LegacyLogic.Instance.EventManager.InvokeEvent(null, EEventType.GAME_MESSAGE, p_eventArgs);
             MessageEventArgs p_args = new MessageEventArgs(text, true);
             LegacyLogic.Instance.ActionLog.PushEntry(p_args);
         }
         else if (m_special == ERechargerSpecial.RESTORE)
         {
             foreach (Character character in LegacyLogic.Instance.WorldManager.Party.GetCharactersAlive())
             {
                 if (!character.ConditionHandler.HasCondition(ECondition.DEAD) && (character.HealthPoints != character.MaximumHealthPoints || character.ManaPoints != character.MaximumManaPoints))
                 {
                     character.ChangeHP(character.MaximumHealthPoints + Math.Abs(character.HealthPoints));
                     character.ChangeMP(character.MaximumManaPoints + Math.Abs(character.ManaPoints));
                 }
             }
             LegacyLogic.Instance.EventManager.InvokeEvent(null, EEventType.PARTY_RESTORED, EventArgs.Empty);
             text = Localization.Instance.GetText("GAME_MESSAGE_PARTY_RESTORED");
             MessageEventArgs p_args2 = new MessageEventArgs(text, true);
             LegacyLogic.Instance.ActionLog.PushEntry(p_args2);
         }
         else if (m_special == ERechargerSpecial.CURE)
         {
             for (Int32 i = 0; i < 4; i++)
             {
                 Character member = LegacyLogic.Instance.WorldManager.Party.GetMember(i);
                 if (member.ConditionHandler.HasCondition(ECondition.DEAD))
                 {
                     member.ConditionHandler.RemoveCondition(ECondition.DEAD);
                     member.Resurrect();
                     LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.CHARACTER_REVIVED, EventArgs.Empty);
                 }
                 if (member.ConditionHandler.HasCondition(ECondition.UNCONSCIOUS))
                 {
                     member.ConditionHandler.RemoveCondition(ECondition.UNCONSCIOUS);
                     member.Resurrect();
                 }
                 member.ConditionHandler.RemoveCondition(ECondition.PARALYZED);
                 member.ConditionHandler.RemoveCondition(ECondition.STUNNED);
                 member.ConditionHandler.RemoveCondition(ECondition.SLEEPING);
                 member.ConditionHandler.RemoveCondition(ECondition.POISONED);
                 member.ConditionHandler.RemoveCondition(ECondition.CONFUSED);
                 member.ConditionHandler.RemoveCondition(ECondition.WEAK);
                 member.ConditionHandler.RemoveCondition(ECondition.CURSED);
             }
             LegacyLogic.Instance.WorldManager.Party.Buffs.RemoveAllBuffs();
             text = Localization.Instance.GetText("GAMEMESSAGE_BLESSED");
             GameMessageEventArgs p_eventArgs2 = new GameMessageEventArgs(text, 0f, false);
             LegacyLogic.Instance.EventManager.InvokeEvent(null, EEventType.GAME_MESSAGE, p_eventArgs2);
             MessageEventArgs p_args3 = new MessageEventArgs(text, true);
             LegacyLogic.Instance.ActionLog.PushEntry(p_args3);
         }
     }
     else
     {
         GameMessageEventArgs p_eventArgs3 = new GameMessageEventArgs("GAMEMESSAGE_NOTHING_HAPPENS", 0f, true);
         LegacyLogic.Instance.EventManager.InvokeEvent(null, EEventType.GAME_MESSAGE, p_eventArgs3);
     }
 }
Ejemplo n.º 15
0
 private void OnBattleMessageRaised(object sender, GameMessageEventArgs e)
 {
     tbBattleLog.Document.Blocks.Add(new Paragraph(new Run(e.Message)));
     tbBattleLog.ScrollToEnd();
 }
Ejemplo n.º 16
0
        public void GiveBonus(Character p_targetCharacter)
        {
            if (State == EInteractiveObjectState.BARREL_EMPTY)
            {
                return;
            }
            String text = String.Empty;

            switch (m_targetAttribute)
            {
            case EPotionTarget.MIGHT:
            {
                Attributes baseAttributes = p_targetCharacter.BaseAttributes;
                baseAttributes.Might            += m_value;
                p_targetCharacter.BaseAttributes = baseAttributes;
                text = "BARREL_DARK_RED_LIQUID_EFFECT_TEXT";
                break;
            }

            case EPotionTarget.MAGIC:
            {
                Attributes baseAttributes = p_targetCharacter.BaseAttributes;
                baseAttributes.Magic            += m_value;
                p_targetCharacter.BaseAttributes = baseAttributes;
                text = "BARREL_DARK_BLUE_LIQUID_EFFECT_TEXT";
                break;
            }

            case EPotionTarget.PERCEPTION:
            {
                Attributes baseAttributes = p_targetCharacter.BaseAttributes;
                baseAttributes.Perception       += m_value;
                p_targetCharacter.BaseAttributes = baseAttributes;
                text = "BARREL_WHITE_LIQUID_EFFECT_TEXT";
                break;
            }

            case EPotionTarget.DESTINY:
            {
                Attributes baseAttributes = p_targetCharacter.BaseAttributes;
                baseAttributes.Destiny          += m_value;
                p_targetCharacter.BaseAttributes = baseAttributes;
                text = "BARREL_PURPLE_LIQUID_EFFECT_TEXT";
                break;
            }

            case EPotionTarget.FIRE_RESISTANCE:
                p_targetCharacter.BaseResistance.Add(EDamageType.FIRE, m_value);
                text = "BARREL_PULSING_RED_LIQUID_EFFECT_TEXT";
                break;

            case EPotionTarget.WATER_RESISTANCE:
                p_targetCharacter.BaseResistance.Add(EDamageType.WATER, m_value);
                text = "BARREL_PULSING_BLUE_LIQUID_EFFECT_TEXT";
                break;

            case EPotionTarget.AIR_RESISTANCE:
                p_targetCharacter.BaseResistance.Add(EDamageType.AIR, m_value);
                text = "BARREL_PULSING_YELLOW_LIQUID_EFFECT_TEXT";
                break;

            case EPotionTarget.EARTH_RESISTANCE:
                p_targetCharacter.BaseResistance.Add(EDamageType.EARTH, m_value);
                text = "BARREL_PULSING_GREEN_LIQUID_EFFECT_TEXT";
                break;

            case EPotionTarget.LIGHT_RESISTANCE:
                p_targetCharacter.BaseResistance.Add(EDamageType.LIGHT, m_value);
                text = "BARREL_PULSING_WHITE_LIQUID_EFFECT_TEXT";
                break;

            case EPotionTarget.DARK_RESISTANCE:
                p_targetCharacter.BaseResistance.Add(EDamageType.DARK, m_value);
                text = "BARREL_PULSING_BLACK_LIQUID_EFFECT_TEXT";
                break;

            case EPotionTarget.PRIME_RESISTANCE:
                p_targetCharacter.BaseResistance.Add(EDamageType.PRIMORDIAL, m_value);
                text = "BARREL_PULSING_PURPLE_LIQUID_EFFECT_TEXT";
                break;
            }
            p_targetCharacter.CalculateCurrentAttributes();
            State = EInteractiveObjectState.BARREL_EMPTY;
            BaseObjectEventArgs p_eventArgs = new BaseObjectEventArgs(this, Position);

            LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.BARREL_STATE_CHANGE, p_eventArgs);
            if (p_targetCharacter.Gender == EGender.MALE)
            {
                text += "_M";
            }
            else
            {
                text += "_F";
            }
            String text2 = Localization.Instance.GetText(text, "[00FF00]" + p_targetCharacter.Name + "[-]", m_value);
            GameMessageEventArgs p_eventArgs2 = new GameMessageEventArgs(text2, 0f, false);

            LegacyLogic.Instance.EventManager.InvokeEvent(null, EEventType.BARREL_BONUS, p_eventArgs2);
            MessageEventArgs p_args = new MessageEventArgs(text2, true);

            LegacyLogic.Instance.ActionLog.PushEntry(p_args);
        }
Ejemplo n.º 17
0
 private void RaiseBattleMessages(object sender, GameMessageEventArgs e)
 {
     FightStatus.Document.Blocks.Add(new Paragraph(new Run(e.Message)));
     FightStatus.ScrollToEnd();
 }