public void AddMessage(SystemMessage message)
 {
     _messageQueue.Add(message);
     _msgState = MsgState.Received;
     OnStateChanged((int)_msgState);
     _receivedTime.Change(ReceivedMessageTime, ReceivedMessageTime);
 }
Beispiel #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
                m_MsgTime = reader.ReadDeltaTime();
                goto case 2;

            case 2:
                m_LastMsg = (MsgState)reader.ReadInt();
                goto case 1;

            case 1:
                m_Announce = reader.ReadBool();
                goto case 0;

            case 0:
                break;
            }

            // kick off the message timer if we're announcing
            if (version >= 3)
            {
                if (m_Announce == true)
                {
                    m_Timer = new MsgTimer(this, m_MsgTime);
                    m_Timer.Start();
                }
            }
        }
Beispiel #3
0
        //int nIters = 0;
        public void GetData()
        {
            //nIters++;
            //Console.WriteLine ("nIters: " + nIters);
            if (msgRdr == null)
            {
                msgRdr = ReadMessageReal2();
            }

            /*
             * {
             *      System.Net.Sockets.NetworkStream nns = ns as System.Net.Sockets.NetworkStream;
             *      SocketTransport st = this as SocketTransport;
             *      if (!nns.DataAvailable)
             *              return null;
             * }
             */

            SocketTransport st = this as SocketTransport;

            //int nread = ns.Read (mmbuf, mmpos, 16);

            int avail = st.socket.Available;

            if (mmneeded == 0)
            {
                throw new Exception();
            }
            //if (avail < mmneeded)
            //	System.Threading.Thread.Sleep (10);

            if (avail == 0)
            {
                return;
            }

            avail = Math.Min(avail, mmneeded);
            int nread = st.socket.Receive(mmbuf, mmpos, avail, System.Net.Sockets.SocketFlags.None);

            mmpos    += nread;
            mmneeded -= nread;
            if (!msgRdr.MoveNext())
            {
                throw new Exception();
            }

            MsgState state = msgRdr.Current;

            if (state != MsgState.Done)
            {
                return;
            }

            mmpos    = 0;
            mmneeded = 16;

            msgRdr = null;
        }
Beispiel #4
0
        private void HandleStateMessage(MsgState message)
        {
            var state = message.State;

            _processor.AddNewState(state);

            // we always ack everything we receive, even if it is late
            AckGameState(state.ToSequence);
        }
Beispiel #5
0
    public void onSyncState(MsgState msg)
    {
        int oldState = state;

        pos    = msg.pos;
        dir    = msg.dir;
        mState = msg.state;
        sendUnitEvent((int)UnitEvent.StateChanged, oldState);
    }
Beispiel #6
0
    public void syncState()
    {
        MsgState msg = new MsgState();

        msg.guid  = guid;
        msg.pos   = pos;
        msg.dir   = dir;
        msg.state = state;
        sendMsg((short)MyMsgId.State, msg);
    }
Beispiel #7
0
 public ChatMessage(string from, string body, DateTime?date = null, bool self = false, bool isEvent = false)
 {
     From          = from;
     Body          = body;
     IsHistory     = date != null;
     Date          = IsHistory ? date.Value : DateTime.Now;
     State         = IsHistory ? MsgState.Readed : MsgState.Received;
     IsSelfMessage = self;
     IsEvent       = isEvent;
 }
Beispiel #8
0
        //MsgKind
        public static MsgState ToMsgState(object objOpt)
        {
            MsgState msgState = MsgState.Close;

            try
            {
                msgState = (MsgState)System.Enum.Parse(typeof(MsgState), Convert.ToString(objOpt), true);
            }
            catch { }
            return(msgState);
        }
Beispiel #9
0
        void ichat_StateChanged(MsgState state)
        {
            if (_allStates == state)
            {
                return;
            }
            _allStates = state;
            var h = StateChanged;

            if (h != null)
            {
                h(state);
            }
        }
Beispiel #10
0
        public void HandleStateMessage(MsgState message)
        {
            var state = message.State;

            if (GameSequence < state.FromSequence)
            {
                Logger.ErrorS("net.state", "Got a game state that's too new to handle!");
            }
            if (GameSequence > state.ToSequence)
            {
                Logger.WarningS("net.state", "Got a game state that's too old to handle!");
                return;
            }
            AckGameState(state.ToSequence);

            state.GameTime = 0;//(float)timing.CurTime.TotalSeconds;
            ApplyGameState(state);
        }
Beispiel #11
0
        // if this message is the same as the last message, and the timer is running
        //	ignore this redundant queue request.
        public bool RedundantTCEntry(MsgState message)
        {
            if (m_Timer == null)
            {
                return(false);                                  // if no timer, not redundant
            }
            if (message != LastMsg)
            {
                return(false);                                  // if different msg, not redundant
            }
            bool running = m_Timer.Running;                     // if running, redundant

            if (running)
            {
                DebugSay("Redundant message detected");
            }
            return(running);                                                            // if redundant, ignore it
        }
Beispiel #12
0
        public void GetData()
        {
            if (msgRdr == null)
            {
                msgRdr = ReadMessageReal2();
            }

            SocketTransport st = this as SocketTransport;

            int avail = st.socket.Available;

            if (mmneeded == 0)
            {
                throw new Exception();
            }

            if (avail == 0)
            {
                return;
            }

            avail = Math.Min(avail, mmneeded);
            int nread = st.socket.Receive(mmbuf, mmpos, avail, System.Net.Sockets.SocketFlags.None);

            mmpos    += nread;
            mmneeded -= nread;
            if (!msgRdr.MoveNext())
            {
                throw new Exception();
            }

            MsgState state = msgRdr.Current;

            if (state != MsgState.Done)
            {
                return;
            }

            mmpos    = 0;
            mmneeded = 16;

            msgRdr = null;
        }
Beispiel #13
0
        public void RefreshState()
        {
            var newState = MsgState.Readed;

            if (_messages.Value.Any(msg => msg.Value.Any(i => i.State == MsgState.Received)))
            {
                newState = MsgState.Received;
            }

            if (_state != newState)
            {
                _state = newState;
                var h = StateChanged;
                if (h != null)
                {
                    h(_state);
                }
            }
        }
Beispiel #14
0
        void _chatManager_StateChanged(MsgState state)
        {
            switch (state)
            {
            case MsgState.None:
                SysMsgState = 0;
                break;

            case MsgState.Received:
                SysMsgState = 1;
                break;

            case MsgState.NotReaded:
                SysMsgState = 2;
                break;

            case MsgState.Readed:
                SysMsgState = 3;
                break;
            }
        }
 private void CheckState(object obj)
 {
     _receivedTime.Change(-1, -1);
     if (_messageQueue.Count < 1)
     {
         _msgState = MsgState.None;
     }
     else
     {
         var notReaded = _messageQueue.FirstOrDefault(i => !i.Readed);
         if (notReaded != null)
         {
             _msgState = MsgState.NotReaded;
         }
         else
         {
             _msgState = MsgState.Readed;
         }
     }
     OnStateChanged((int)_msgState);
 }
Beispiel #16
0
        private void rbtn_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rbtn = sender as RadioButton;

            if (rbtn == null || !rbtn.Checked)
            {
                return;
            }
            CurRbtnName.Clear();
            switch (rbtn.Name.Replace("rbtn", ""))
            {
            case "None":
                CURMSGSTATE        = MsgState.text;
                this.tbMsg.Enabled = true;
                break;

            default:
                CURMSGSTATE = MsgState.Image;
                CurRbtnName.Append(rbtn.Name.Replace("rbtn", ""));
                this.tbMsg.Enabled = false;
                break;
            }
        }
Beispiel #17
0
        public override bool OverlandSystemMessage(MsgState state, Mobile mob)
        {
            //	ignore redundant queue requests
            if (Announce == true && RedundantTCEntry(state) == false)
            {
                try
                {
                    switch (state)
                    {
                    // initial/default message
                    case MsgState.InitialMsg:
                    {
                        string[] lines = new string[2];
                        lines[0] = String.Format(
                            "The {3} bandit {0} was last seen near {1}. {2} is not to be trusted.",
                            Name,
                            DescribeLocation(this),
                            Female == true ? "She" : "He",
                            RandomAdjective());

                        lines[1] = String.Format(
                            "Do what you will with {0}, but just see that {1} does not enter our fair city.",
                            Female == true ? "her" : "him",
                            Female == true ? "she" : "he");

                        AddTCEntry(lines, 5);
                        break;
                    }

                    // under attack
                    case MsgState.UnderAttackMsg:
                    {
                        string[] lines = new string[2];

                        switch (Utility.Random(2))
                        {
                        case 0:
                            lines[0] = String.Format(
                                "Hurrah! {1} has stepped in to beat down that {2} bandit {0}.",
                                Name,
                                (Hero(mob) == null) ? "Someone" : Hero(mob).Name,
                                RandomAdjective());

                            lines[1] = String.Format(
                                "{0} may need some asistance. {2} was last seen near {1}",
                                (Hero(mob) == null) ? "Someone" : Hero(mob).Name,
                                DescribeLocation(this),
                                (Hero(mob) == null) ? "It" :
                                Hero(mob).Female == true ? "She" : "He"
                                );

                            break;

                        case 1:
                            lines[0] = String.Format(
                                "The brave {0} is battling that {2} bandit {1}.",
                                (Hero(mob) == null) ? "Someone" : Hero(mob).Name,
                                Name,
                                RandomAdjective());

                            lines[1] = String.Format(
                                "Hurry now, and give your aid to {0}." + " " +
                                "We have heard they are still fighting near {1}.",
                                (Hero(mob) == null) ? "Someone" : Hero(mob).Name,
                                DescribeLocation(this));
                            break;
                        }

                        // 2 minute attack message
                        AddTCEntry(lines, 2);
                        break;
                    }

                    // OnDeath
                    case MsgState.OnDeathMsg:
                    {
                        string[] lines = new string[1];
                        switch (Utility.Random(2))
                        {
                        case 0:
                            lines[0] = String.Format("Huzzah! that {0} bandit {1} has been defeated!", RandomAdjective(), Name);
                            break;

                        case 1:
                            lines[0] = String.Format("The {0} bandit {1} has been killed! Rejoice!", RandomAdjective(), Name);
                            break;
                        }

                        // 2 minute death message
                        AddTCEntry(lines, 2);
                        break;
                    }
                    }
                }
                catch (Exception exc)
                {
                    LogHelper.LogException(exc);
                    System.Console.WriteLine("Caught Exception{0}", exc.Message);
                    System.Console.WriteLine(exc.StackTrace);
                }
            }

            // we must call the base to record the 'last message'
            return(base.OverlandSystemMessage(state, mob));
        }
Beispiel #18
0
		public bool OverlandSystemMessage(MsgState state)
		{
			return OverlandSystemMessage(state,  null);
		}
Beispiel #19
0
    public virtual void onSync(NetworkMessage msg)
    {
        switch (msg.msgType)
        {
        case (short)MyMsgId.State:
        {
            MsgState m = msg.ReadMessage <MsgState> ();
            this.onSyncState(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Nav:
        {
            MsgNav m = msg.ReadMessage <MsgNav> ();
            move.onSync(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Anim:
        {
            MsgAnim m = msg.ReadMessage <MsgAnim> ();
            anim.onSync(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Skill:
        {
            MsgSkill m = msg.ReadMessage <MsgSkill> ();
            if (isServer)
            {
                skill.onSync(m);
            }
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Attr:
        {
            MsgAttr m = msg.ReadMessage <MsgAttr> ();
            attr.onSync(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Buff:
        {
            MsgBuff m = msg.ReadMessage <MsgBuff> ();
            buff.onSync(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Move:
        {
            MsgMove m = msg.ReadMessage <MsgMove> ();
            move.onSyncMove(m);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }

        case (short)MyMsgId.Event:
        {
            MsgEvent m = msg.ReadMessage <MsgEvent> ();
            sendUnitEvent(m.evt, m.param);
            if (isServer)
            {
                sendMsg(msg.msgType, m);
            }
            break;
        }
        }
    }
        public override bool OverlandSystemMessage(MsgState state, Mobile mob)
        {
            //	ignore redundant queue requests
            if (Announce == true && RedundantTCEntry(state) == false)
            {
                try
                {
                    switch (state)
                    {
                    // initial/default message
                    case MsgState.InitialMsg:
                    {
                        string[] lines = new string[2];
                        lines[0] = String.Format(
                            "The merchant {0} was last seen somewhere {1} and is said to be bringing us some of {2} finest wares.",
                            Name,
                            RelativeLocation(),
                            Female == true ? "her" : "his");

                        lines[1] = String.Format(
                            "{0} was last seen near {1}" + " " +
                            "Please see that {2} arrives safely.",
                            Name,
                            DescribeLocation(this),
                            Name);

                        AddTCEntry(lines, 5);
                        break;
                    }

                    // under attack
                    case MsgState.UnderAttackMsg:
                    {
                        string[] lines = new string[2];

                        switch (Utility.Random(2))
                        {
                        case 0:
                            lines[0] = String.Format(
                                "The merchant {0} is under attack by {1}!" + " " +
                                "Quickly now! There is no time to waste.",
                                Name,
                                (Villain(mob) == null) ? "Someone" : Villain(mob).Name);

                            lines[1] = String.Format(
                                "{0} was last seen near {1}",
                                Name,
                                DescribeLocation(this));
                            break;

                        case 1:
                            lines[0] = String.Format(
                                "Quickly, there is no time to waste!" + " " +
                                "Britain's merchant {0} is under attack by {1}!",
                                Name,
                                (Villain(mob) == null) ? "Someone" : Villain(mob).Name);

                            lines[1] = String.Format(
                                "{0} was last seen somewhere near {1}",
                                Name,
                                DescribeLocation(this));
                            break;
                        }

                        // 2 minute attack message
                        AddTCEntry(lines, 2);
                        break;
                    }

                    // OnDeath
                    case MsgState.OnDeathMsg:
                    {
                        string[] lines = new string[1];
                        switch (Utility.Random(2))
                        {
                        case 0:
                            lines[0] = String.Format("Great sadness befalls us. The merchant {0} has been killed.", Name);
                            break;

                        case 1:
                            lines[0] = String.Format("Alas, the fair merchant {0} has been killed. We shall avenge those responsible!", Name);
                            break;
                        }

                        // 2 minute death message
                        AddTCEntry(lines, 2);
                        break;
                    }
                    }
                }
                catch (Exception exc)
                {
                    LogHelper.LogException(exc);
                    System.Console.WriteLine("Caught Exception{0}", exc.Message);
                    System.Console.WriteLine(exc.StackTrace);
                }
            }

            // we must call the base to record the 'last message'
            return(base.OverlandSystemMessage(state, mob));
        }
Beispiel #21
0
 public bool OverlandSystemMessage(MsgState state)
 {
     return(OverlandSystemMessage(state, null));
 }
Beispiel #22
0
 public virtual bool OverlandSystemMessage(MsgState state, Mobile mob)
 {
     m_LastMsg = state;
     return(Announce);
 }
Beispiel #23
0
		// if this message is the same as the last message, and the timer is running
		//	ignore this redundant queue request.
		public bool RedundantTCEntry(MsgState message)
		{
			if ( m_Timer == null ) return false;	// if no timer, not redundant
			if ( message != LastMsg ) return false;	// if different msg, not redundant
			bool running = m_Timer.Running;			// if running, redundant
			if (running) DebugSay("Redundant message detected");
			return running;							// if redundant, ignore it
		}
		public override bool OverlandSystemMessage(MsgState state, Mobile mob)
		{
			//	ignore redundant queue requests
			if (Announce == true && RedundantTCEntry(state) == false) 
			{
				try
				{
					switch(state)
					{
							// initial/default message
						case MsgState.InitialMsg:
						{
							string[] lines = new string[2];
							lines[0] = String.Format(
								"The {3} bandit {0} was last seen near {1}. {2} is not to be trusted.",
								Name, 
								DescribeLocation(this),	
								Female == true ? "She" : "He",
								RandomAdjective());

							lines[1] = String.Format(
								"Do what you will with {0}, but just see that {1} does not enter our fair city.",
								Female == true ? "her" : "him",
								Female == true ? "she" : "he");
					
							AddTCEntry(lines,5);
							break;
						}
				
							// under attack
						case MsgState.UnderAttackMsg:
						{
							string[] lines = new string[2];
 					
							switch ( Utility.Random( 2 ) )
							{
								case 0:
									lines[0] = String.Format(
										"Hurrah! {1} has stepped in to beat down that {2} bandit {0}.",
										Name,
										(Hero(mob) == null) ? "Someone" : Hero(mob).Name,
										RandomAdjective());

									lines[1] = String.Format(
										"{0} may need some asistance. {2} was last seen near {1}",
										(Hero(mob) == null) ? "Someone" : Hero(mob).Name,
										DescribeLocation(this),
										(Hero(mob) == null) ? "It" :
										Hero(mob).Female == true ? "She" : "He"
										);

									break;

								case 1:
									lines[0] = String.Format(
										"The brave {0} is battling that {2} bandit {1}.",
										(Hero(mob) == null) ? "Someone" : Hero(mob).Name,
										Name,
										RandomAdjective());

									lines[1] = String.Format(
										"Hurry now, and give your aid to {0}." + " " +
										"We have heard they are still fighting near {1}.",
										(Hero(mob) == null) ? "Someone" : Hero(mob).Name,
										DescribeLocation(this)	);
									break;
							}
				
							// 2 minute attack message
							AddTCEntry(lines,2);
							break;
						}

							// OnDeath
						case MsgState.OnDeathMsg:
						{
							string[] lines = new string[1];
							switch ( Utility.Random( 2 ) )
							{
								case 0:
									lines[0] = String.Format("Huzzah! that {0} bandit {1} has been defeated!", RandomAdjective(), Name);
									break;

								case 1:
									lines[0] = String.Format("The {0} bandit {1} has been killed! Rejoice!", RandomAdjective(), Name);
									break;
							}
					
							// 2 minute death message
							AddTCEntry(lines,2);
							break;
						}
					}
				}
				catch(Exception exc)
				{
					LogHelper.LogException(exc);
					System.Console.WriteLine("Caught Exception{0}", exc.Message);
					System.Console.WriteLine(exc.StackTrace);
				}
			}
			
			// we must call the base to record the 'last message'
			return base.OverlandSystemMessage(state, mob);
		}
Beispiel #25
0
        public MsgState ProcessStates(out MessageEventArgs mea)
        {
            mea = processMea();

            switch (this._state)
            {
            case MsgState.Idle:
                if (this._msgs2Send.Count > 0)
                {
                    lock (this._msgs2Send)
                    {
                        this._msg2Go = this._msgs2Send.Dequeue();
                    }
                    if (!String.IsNullOrWhiteSpace(this._msg2Go))
                    {
                        this._msgProcessed = false;
                        this._attempt      = 0;
                        this._imSendingAck = false;
                        this._state        = MsgState.ReadyForRemote;
                    }
                }
                break;

            case MsgState.ReadyForRemote:
                this._startTime = DateTime.Now;

                if (this._attempt >= 3)
                {
                    this._state = MsgState.Idle;
                }
                else if (this._msgProcessed)
                {
                    this._state = MsgState.WaitingResponse;
                }
                break;

            case MsgState.WaitingResponse:
                // message was already sent out, check timeout
                DateTime endTime = DateTime.Now;
                if (endTime.Subtract(this._startTime).Milliseconds >= 799)
                {
                    Sock.debug(_name + ": timeout, repeating");
                    this._msgProcessed = false;
                    this._attempt++;
                    this._state = MsgState.ReadyForRemote;
                }
                break;

            case MsgState.ReadyForAck:
                this._msgProcessed = false;
                this._msg2Go       = this._lastAckMsg;
                this._state        = MsgState.SendAck;
                break;

            case MsgState.SendAck:
                if (this._msgProcessed)
                {
                    this._msgProcessed = false;
                    this._imSendingAck = false;
                    this._state        = MsgState.Done;
                }
                break;

            case MsgState.Done:
                this._state = MsgState.Idle;
                break;

            default: break;
            }
            return(this._state);
        }
Beispiel #26
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 3:
					m_MsgTime = reader.ReadDeltaTime();
					goto case 2;

				case 2:
					m_LastMsg = (MsgState)reader.ReadInt();
					goto case 1;

				case 1:
					m_Announce = reader.ReadBool();
					goto case 0;

				case 0:
					break;
			}

			// kick off the message timer if we're announcing
			if (version >= 3)
			{
				if (m_Announce == true)
				{
					m_Timer = new MsgTimer( this, m_MsgTime );
					m_Timer.Start();
				}
			}

		}
Beispiel #27
0
        private MessageEventArgs processMea()
        {
            string localMsg;
            int    myIndex;

            lock (_buildMsg)
            {
                localMsg = _buildMsg.ToString();
                myIndex  = localMsg.IndexOf("<EOF>");
                if (myIndex >= 0)
                {
                    localMsg = localMsg.Substring(0, myIndex + 1 + 4).Trim();
                    _buildMsg.Remove(0, myIndex + 1 + 4);
                }
            }

            if (myIndex >= 0)
            {
                MessageEventArgs mea = new MessageEventArgs(localMsg);

                if (mea.Valid)
                {
                    // for safety
                    _buddyIp = mea.FriendIP;

                    if (this._state == MsgState.WaitingResponse || this._state == MsgState.SendAck)
                    {
                        Sock.debug(_name + ":got ACK:" + this._state.ToString() + ":Id=" + mea.Id);
                        mea.IsAck = true;
                        if (this._state == MsgState.WaitingResponse)
                        {
                            this._state = MsgState.Done;
                        }
                        return(mea);
                    }

                    if (this._imSendingAck || mea.FriendIP == myip)
                    {
                        if (this._state == MsgState.WaitingResponse)
                        {
                            this._state = MsgState.Done;
                        }
                        return(null);
                    }
                    else if (this._state == MsgState.Idle || this._state == MsgState.ReadyForRemote)
                    {
                        this._imSendingAck = true;
                        _lastAckMsg        = generate(mea.Id, mea.FriendName, mea.FriendIP, Sock.Checksum(mea.TextFromFriend)); // no need to send entire msg payload
                        _lastAckIP         = mea.FriendIP;

                        Sock.debug(_name + ":Display(sendAck)" + this._state.ToString() + ":Id=" + mea.Id);
                        this._state = MsgState.ReadyForAck;
                    }
                    else
                    {
                        return(mea);
                    }
                }
                else
                {
                    Sock.debug(_name + ": oops, invalid message received");
                }

                return(mea);
            }
            else
            {
                return(null);
            }
        }
		public override bool OverlandSystemMessage(MsgState state, Mobile mob)
		{
			//	ignore redundant queue requests
			if (Announce == true && RedundantTCEntry(state) == false) 
			{
				try
				{
					switch(state)
					{
							// initial/default message
						case MsgState.InitialMsg:
						{
							string[] lines = new string[2];
							lines[0] = String.Format(
								"The merchant {0} was last seen somewhere {1} and is said to be bringing us some of {2} finest wares.",
								Name, 
								RelativeLocation(),
								Female == true ? "her" : "his");

							lines[1] = String.Format(
								"{0} was last seen near {1}" + " " +
								"Please see that {2} arrives safely.",
								Name,
								DescribeLocation(this),
								Name);
					
							AddTCEntry(lines,5);
							break;
						}
				
							// under attack
						case MsgState.UnderAttackMsg:
						{
							string[] lines = new string[2];
 					
							switch ( Utility.Random( 2 ) )
							{
								case 0:
									lines[0] = String.Format(
										"The merchant {0} is under attack by {1}!" + " " +
										"Quickly now! There is no time to waste.",
										Name,
										(Villain(mob) == null) ? "Someone" : Villain(mob).Name);

									lines[1] = String.Format(
										"{0} was last seen near {1}",
										Name,
										DescribeLocation(this));
									break;

								case 1:
									lines[0] = String.Format(
										"Quickly, there is no time to waste!" + " " +
										"Britain's merchant {0} is under attack by {1}!",
										Name,
										(Villain(mob) == null) ? "Someone" : Villain(mob).Name);

									lines[1] = String.Format(
										"{0} was last seen somewhere near {1}",
										Name,
										DescribeLocation(this));
									break;
							}
				
							// 2 minute attack message
							AddTCEntry(lines,2);
							break;
						}

							// OnDeath
						case MsgState.OnDeathMsg:
						{
							string[] lines = new string[1];
							switch ( Utility.Random( 2 ) )
							{
								case 0:
									lines[0] = String.Format("Great sadness befalls us. The merchant {0} has been killed.", Name);
									break;

								case 1:
									lines[0] = String.Format("Alas, the fair merchant {0} has been killed. We shall avenge those responsible!", Name);
									break;
							}
					
							// 2 minute death message
							AddTCEntry(lines,2);
							break;
						}
					}
				}
				catch(Exception exc)
				{
					LogHelper.LogException(exc);
					System.Console.WriteLine("Caught Exception{0}", exc.Message);
					System.Console.WriteLine(exc.StackTrace);
				}
			}

			// we must call the base to record the 'last message'
			return base.OverlandSystemMessage(state, mob);
		}
Beispiel #29
0
		public virtual bool OverlandSystemMessage(MsgState state, Mobile mob)
		{
			m_LastMsg = state;
			return Announce;
		}