Пример #1
0
        public void ReceiveData(Mobile from, DeDOSDataCrystal targetCrystal)
        {
            if (this == null)
            {
                return;
            }
            if (Deleted)
            {
                return;
            }
            if (ParentEntity != null)
            {
                return;
            }

            if (targetCrystal == null)
            {
                return;
            }
            if (targetCrystal.Deleted)
            {
                return;
            }
            if (targetCrystal.ParentEntity != null)
            {
                return;
            }

            Effects.PlaySound(targetCrystal.Location, targetCrystal.Map, 0x2F4);
            targetCrystal.PublicOverheadMessage(MessageType.Regular, TextHue, false, "*sending response*");

            string targetName = "an unknown individual";

            if (targetCrystal.m_PlayerName != "")
            {
                targetName = targetCrystal.m_PlayerName;
            }

            Effects.PlaySound(Location, Map, 0x2F4);
            PublicOverheadMessage(MessageType.Regular, TextHue, false, "*receiving response from " + targetName + "*");

            for (int a = 0; a < 5; a++)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(1 + (a * 1)), delegate
                {
                    if (this == null)
                    {
                        return;
                    }
                    if (Deleted)
                    {
                        return;
                    }
                    if (ParentEntity != null)
                    {
                        return;
                    }

                    string message = "";

                    int messageLength = Utility.RandomMinMax(5, 15);

                    for (int b = 0; b < messageLength; b++)
                    {
                        switch (Utility.RandomMinMax(1, 2))
                        {
                        case 1: message += "0"; break;

                        case 2: message += "1"; break;
                        }
                    }

                    VisualEffect(false);

                    Effects.PlaySound(Location, Map, 0x2F4);
                    PublicOverheadMessage(MessageType.Regular, DataHue, false, message);
                });
            }
        }
Пример #2
0
        public void TransmitData(Mobile from)
        {
            m_NextUseAllowed = DateTime.UtcNow + UsageCooldown;

            List <DeDOSDataCrystal> m_ValidCrystals = new List <DeDOSDataCrystal>();

            foreach (DeDOSDataCrystal crystal in m_Instances)
            {
                if (crystal == null)
                {
                    continue;
                }
                if (crystal.Deleted)
                {
                    continue;
                }
                if (crystal == this)
                {
                    continue;
                }
                if (crystal.ParentEntity != null)
                {
                    continue;
                }

                m_ValidCrystals.Add(crystal);
            }

            if (m_ValidCrystals.Count == 0)
            {
                from.SendMessage("No data crystals appear to be currently attuned.");
                return;
            }

            Effects.PlaySound(Location, Map, 0x2F4);
            PublicOverheadMessage(MessageType.Regular, TextHue, false, "*transmitting data*");

            DeDOSDataCrystal targetCrystal = m_ValidCrystals[Utility.RandomMinMax(0, m_ValidCrystals.Count - 1)];

            Effects.PlaySound(targetCrystal.Location, targetCrystal.Map, 0x2F4);

            string fromText = from.Name;

            Effects.PlaySound(targetCrystal.Location, targetCrystal.Map, 0x2F4);
            targetCrystal.PublicOverheadMessage(MessageType.Regular, TextHue, false, "*incoming data from " + from.Name + "*");

            for (int a = 0; a < 5; a++)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(1 + (a * 1)), delegate
                {
                    if (targetCrystal == null)
                    {
                        return;
                    }
                    if (targetCrystal.Deleted)
                    {
                        return;
                    }
                    if (targetCrystal.ParentEntity != null)
                    {
                        return;
                    }

                    string message = "";

                    int messageLength = Utility.RandomMinMax(5, 15);

                    for (int b = 0; b < messageLength; b++)
                    {
                        switch (Utility.RandomMinMax(1, 2))
                        {
                        case 1: message += "0"; break;

                        case 2: message += "1"; break;
                        }
                    }

                    VisualEffect(true);

                    Effects.PlaySound(targetCrystal.Location, targetCrystal.Map, 0x2F4);
                    targetCrystal.PublicOverheadMessage(MessageType.Regular, DataHue, false, message);
                });
            }

            Timer.DelayCall(TimeSpan.FromSeconds(6), delegate
            {
                if (this == null)
                {
                    return;
                }
                if (Deleted)
                {
                    return;
                }
                if (ParentEntity != null)
                {
                    return;
                }

                ReceiveData(from, targetCrystal);
            });
        }