示例#1
0
 public override void OnPositionChanging(Point3D newPos)
 {
     if (IsMulti && this.Position != Point3D.Zero && newPos != Point3D.Zero && this.Position != newPos)
     {
         ClientCommunication.PostRemoveMulti(this);
         ClientCommunication.PostAddMulti(m_ItemID, newPos);
     }
     base.OnPositionChanging(newPos);
 }
示例#2
0
 public static void ResendTarget()
 {
     if (!m_ClientTarget || !m_HasTarget)
     {
         CancelClientTarget();
         m_ClientTarget = m_HasTarget = true;
         ClientCommunication.SendToClient(new Target(m_CurrentID, m_AllowGround, m_CurFlags));
     }
 }
示例#3
0
        private static void DoLogin(PlayerData player)
        {
            PlayerData.ExternalZ = false;

            ClientCommunication.ForceSendToClient(new LoginConfirm(player));
            ClientCommunication.ForceSendToClient(new MapChange(player.Map));
            ClientCommunication.ForceSendToClient(new MapPatches(player.MapPatches));
            ClientCommunication.ForceSendToClient(new SeasonChange(player.Season, true));
            ClientCommunication.ForceSendToClient(new SupportedFeatures(player.Features));
            ClientCommunication.ForceSendToClient(new MobileUpdate(player));
            ClientCommunication.ForceSendToClient(new MobileUpdate(player));

            ClientCommunication.ForceSendToClient(new GlobalLightLevel(player.GlobalLightLevel));
            ClientCommunication.ForceSendToClient(new PersonalLightLevel(player));

            ClientCommunication.ForceSendToClient(new MobileUpdate(player));
            ClientCommunication.ForceSendToClient(new MobileIncoming(player));
            ClientCommunication.ForceSendToClient(new MobileAttributes(player));
            ClientCommunication.ForceSendToClient(new SetWarMode(player.Warmode));

            foreach (Item i in World.Items.Values)
            {
                if (i.Container == null)
                {
                    ClientCommunication.ForceSendToClient(new WorldItem(i));
                    if (i.HouseRevision != 0)
                    {
                        ClientCommunication.ForceSendToClient(new DesignStateGeneral(i));
                    }
                }
            }

            foreach (Mobile m in World.Mobiles.Values)
            {
                ClientCommunication.ForceSendToClient(new MobileIncoming(m));
            }

            ClientCommunication.ForceSendToClient(new SupportedFeatures(player.Features));

            ClientCommunication.ForceSendToClient(new MobileUpdate(player));
            ClientCommunication.ForceSendToClient(new MobileIncoming(player));
            ClientCommunication.ForceSendToClient(new MobileAttributes(player));
            ClientCommunication.ForceSendToClient(new SetWarMode(player.Warmode));
            ClientCommunication.ForceSendToClient(new MobileIncoming(player));

            ClientCommunication.ForceSendToClient(new LoginComplete());
            ClientCommunication.ForceSendToClient(new CurrentTime());

            ClientCommunication.ForceSendToClient(new SeasonChange(player.Season, true));
            ClientCommunication.ForceSendToClient(new MapChange(player.Map));
            ClientCommunication.ForceSendToClient(new MobileUpdate(player));
            ClientCommunication.ForceSendToClient(new MobileIncoming(player));

            PacketHandlers.PlayCharTime = DateTime.UtcNow;

            ClientCommunication.BeginCalibratePosition();
        }
示例#4
0
 protected override void OnTick()
 {
     m_Count++;
     if (m_Count > 30)
     {
         Stop();
     }
     ClientCommunication.RequestTitlebarUpdate();
 }
示例#5
0
 private static void GetSerial(string[] param)
 {
     if (PacketPlayer.Playing)
     {
         ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3,
                                                                  Language.CliLocName, "System", "Target a player to get their serial number."));
         ClientCommunication.ForceSendToClient(new Target(Targeting.LocalTargID, false));
     }
 }
示例#6
0
 private static void CancelClientTarget()
 {
     if (m_ClientTarget)
     {
         m_FilterCancel.Add((uint)m_CurrentID);
         ClientCommunication.SendToClient(new CancelTarget(m_CurrentID));
         m_ClientTarget = false;
     }
 }
示例#7
0
文件: Spells.cs 项目: DarkLotus/Klip
        public static void Interrupt()
        {
            Item item = FindUsedLayer();

            if (item != null)
            {
                ClientCommunication.SendToServer(new LiftRequest(item, 1));                                // unequip
                ClientCommunication.SendToServer(new EquipRequest(item.Serial, World.Player, item.Layer)); // Equip
            }
        }
示例#8
0
        private static void Echo(string[] param)
        {
            StringBuilder sb = new StringBuilder("Note To Self: ");

            for (int i = 0; i < param.Length; i++)
            {
                sb.Append(param[i]);
            }
            ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3, Language.CliLocName, "System", sb.ToString()));
        }
示例#9
0
        private static void GetRPVInfo(string[] param)
        {
            if (PacketPlayer.CurrentOpenedInfo == null || PacketPlayer.CurrentOpenedInfo == "")
            {
                return;
            }

            ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", "Current PacketVideo File Information:"));
            ClientCommunication.ForceSendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x25, 3, Language.CliLocName, "System", PacketPlayer.CurrentOpenedInfo));
        }
示例#10
0
        public static void Stop()
        {
            if (m_Recording)
            {
                byte[] hash;

                // the final timestamp
                m_GZOut.Compressed.Write((int)((DateTime.UtcNow - m_LastTime).TotalMilliseconds));
                m_GZOut.Compressed.Write((byte)0xFF);

                m_GZOut.ForceFlush();
                m_GZOut.BufferAll = true;

                m_GZOut.RawStream.Seek(1 + 16 + 8, SeekOrigin.Begin);
                m_GZOut.Raw.Write((int)((DateTime.UtcNow - m_StartTime).TotalMilliseconds));

                m_GZOut.RawStream.Seek(1 + 16, SeekOrigin.Begin);
                using (MD5 md5 = MD5.Create())
                    hash = md5.ComputeHash(m_GZOut.RawStream);

                m_GZOut.RawStream.Seek(1, SeekOrigin.Begin);
                m_GZOut.Raw.Write(hash);

                m_GZOut.RawStream.Flush();
                m_GZOut.Close();
                m_GZOut = null;

                m_Recording     = false;
                btnRec.Text     = "Record PacketVideo";
                btnPlay.Enabled = btnStop.Enabled = true;
            }
            else if (Playing)
            {
                //ClientCommunication.SetDeathMsg( Language.GetString( LocString.PacketPlayerStop + Utility.Random( 10 ) ) );
                ClientCommunication.ForceSendToClient(new DeathStatus(true));

                RemoveAll();

                if (m_PlayTimer != null && m_PlayTimer.Running)
                {
                    m_PlayTimer.Stop();
                }

                if (m_ScrollTimer != null)
                {
                    m_ScrollTimer.Stop();
                }

                m_PlayTimer = Timer.DelayedCallback(FadeDelay, m_EndPlay);
                m_PlayTimer.Start();

                btnPlay.Text     = "Play";
                btnClose.Enabled = tbPos.Enabled = btnPlay.Enabled = btnStop.Enabled = false;
            }
        }
示例#11
0
        public static void HealOrCureSelf()
        {
            Spell s = null;

            if (!ClientCommunication.AllowBit(FeatureBit.BlockHealPoisoned))
            {
                if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12)
                {
                    s = Get(4, 5);                       // greater heal
                }
                else
                {
                    s = Get(1, 4);                       // mini heal
                }
            }
            else
            {
                if (World.Player.Poisoned && ClientCommunication.AllowBit(FeatureBit.BlockHealPoisoned))
                {
                    s = Get(2, 3);                       // cure
                }
                else if (World.Player.Hits + 2 < World.Player.HitsMax)
                {
                    if (World.Player.Hits + 30 < World.Player.HitsMax && World.Player.Mana >= 12)
                    {
                        s = Get(4, 5);                           // greater heal
                    }
                    else
                    {
                        s = Get(1, 4);                           // mini heal
                    }
                }
                else
                {
                    if (World.Player.Mana >= 12)
                    {
                        s = Get(4, 5);                           // greater heal
                    }
                    else
                    {
                        s = Get(1, 4);                           // mini heal
                    }
                }
            }

            if (s != null)
            {
                if (World.Player.Poisoned || World.Player.Hits < World.Player.HitsMax)
                {
                    Targeting.TargetSelf(true);
                }
                ClientCommunication.SendToServer(new CastSpellFromMacro((ushort)s.GetID()));
                s.Cast();
            }
        }
示例#12
0
        public static void ClosestTarget(params int[] noto)
        {
            if (!ClientCommunication.AllowBit(FeatureBit.ClosestTargets))
            {
                return;
            }

            ArrayList list = new ArrayList();

            foreach (Mobile m in World.MobilesInRange(12))
            {
                if ((!FriendsAgent.IsFriend(m) || (noto.Length > 0 && noto[0] == 0)) &&
                    !m.Blessed && !m.IsGhost && m.Serial != World.Player.Serial &&
                    Utility.InRange(World.Player.Position, m.Position, Config.GetInt("LTRange")))
                {
                    for (int i = 0; i < noto.Length; i++)
                    {
                        if (noto[i] == m.Notoriety)
                        {
                            list.Add(m);
                            break;
                        }
                    }

                    if (noto.Length == 0)
                    {
                        list.Add(m);
                    }
                }
            }

            Mobile closest     = null;
            double closestDist = double.MaxValue;

            foreach (Mobile m in list)
            {
                double dist = Utility.DistanceSqrt(m.Position, World.Player.Position);

                if (dist < closestDist || closest == null)
                {
                    closestDist = dist;
                    closest     = m;
                }
            }

            if (closest != null)
            {
                SetLastTargetTo(closest);
            }
            else
            {
                World.Player.SendMessage(MsgLevel.Warning, LocString.TargNoOne);
            }
        }
示例#13
0
        internal static void CancelClientTarget()
        {
            if (!m_ClientTarget)
            {
                return;
            }

            m_FilterCancel.Add((uint)m_CurrentID);
            ClientCommunication.SendToClient(new CancelTarget(m_CurrentID));
            m_ClientTarget = false;
        }
示例#14
0
        private static void CancelTarget()
        {
            OnClearQueue();
            CancelClientTarget();

            if (m_HasTarget)
            {
                ClientCommunication.SendToServer(new TargetCancelResponse(m_CurrentID));
                m_HasTarget = false;
            }
        }
示例#15
0
        public static void Start()
        {
            m_Count = 0;

            if (m_Timer.Running)
            {
                m_Timer.Stop();
            }
            m_Timer.Start();
            ClientCommunication.RequestTitlebarUpdate();
        }
示例#16
0
 internal void OverheadMessageFrom(int hue, string from, string text)
 {
     if (Config.GetInt("OverheadStyle") == 0)
     {
         ClientCommunication.SendToClient(new AsciiMessage(Serial, m_Body, MessageType.Regular, hue, 3, Language.CliLocName, text));
     }
     else
     {
         ClientCommunication.SendToClient(new UnicodeMessage(Serial, m_Body, MessageType.Regular, hue, 3, Language.CliLocName, from, text));
     }
 }
示例#17
0
文件: HueEntry.cs 项目: mbnunes/razor
        private void inGame_Click(object sender, System.EventArgs e)
        {
            if (World.Player == null)
            {
                return;
            }

            Callback = new HueEntryCallback(HueResp);
            ClientCommunication.SendToClient(new HuePicker());
            World.Player.SendMessage(MsgLevel.Force, LocString.SelHue);
        }
示例#18
0
        private static void ClearItems(string[] param)
        {
            ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3,
                                                                Language.CliLocName, "System", "Clearing all items from memory cache"));

            World.Items.Clear();
            Resync(param);

            ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3,
                                                                Language.CliLocName, "System", "All items in memory cache have been cleared"));
        }
示例#19
0
        public void ProcessMove(Direction dir)
        {
            int x;
            int y;
            int z;

            if (ClientCommunication.GetPosition(out x, out y, out z))
            {
                Position  = new Point3D(x, y, z);
                Direction = dir;
            }
        }
示例#20
0
        public static unsafe void Install(PluginHeader *header)
        {
            Console.WriteLine("Install Invoked CEasyUO");
            AppDomain.CurrentDomain.AssemblyResolve += (sender, e) =>
            {
                string[] fields  = e.Name.Split(',');
                string   name    = fields[0];
                string   culture = fields[2];

                if (name.EndsWith(".resources") && !culture.EndsWith("neutral"))
                {
                    return(null);
                }
                AssemblyName askedassembly = new AssemblyName(e.Name);

                bool isdll = File.Exists(Path.Combine(RootPath, askedassembly.Name + ".dll"));

                return(Assembly.LoadFile(Path.Combine(RootPath, askedassembly.Name + (isdll ? ".dll" : ".exe"))));
            };
            try
            {
                ClientVersion = (ClientVersions)header->ClientVersion;
                if (!ClientCommunication.InstallHooks(header))
                {
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    return;
                }
                UOFilePath = Marshal.GetDelegateForFunctionPointer <OnGetUOFilePath>(header->GetUOFilePath)();
                Ultima.Files.SetMulPath(UOFilePath);
                Ultima.Multis.PostHSFormat = UsePostHSChanges;
                // Thread t = new Thread( () =>
                // {
                //Thread.CurrentThread.Name = "EasyUO Main Thread";
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                m_MainForm = new CEasyUOMainForm();
                m_MainForm.Show();
                //  } );
                //   t.SetApartmentState( ApartmentState.STA );
                PacketHandlers.Initialize();
                // Targeting.Initialize();
                Spell.Initialize(); EUOVars.Initialize();
                // t.IsBackground = true;

                //  t.Start();
                IsInstalled = true;
            }
            catch (Exception e)
            {
                Debugger.Break();
                Console.WriteLine(e.Message);
            }
        }
示例#21
0
        private static void RemoveAll()
        {
            /*foreach ( Mobile m in World.Mobiles.Values )
             *      ClientCommunication.ForceSendToClient( new RemoveObject( m ) );
             * foreach ( Item i in World.Items.Values )
             *      ClientCommunication.ForceSendToClient( new RemoveObject( i ) );*/

            World.Mobiles.Clear();
            World.Items.Clear();

            ClientCommunication.OnLogout();
        }
示例#22
0
文件: Main.cs 项目: mbnunes/razor
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            if (e.IsTerminating)
            {
                ClientCommunication.Close();
                m_Running = false;

                new MessageDialog("Unhandled Exception", !e.IsTerminating, e.ExceptionObject.ToString()).ShowDialog(Engine.ActiveWindow);
            }

            LogCrash(e.ExceptionObject as Exception);
        }
示例#23
0
        public static int Drag(Item i, int amount, bool fromClient, bool doLast)
        {
            LiftReq lr   = new LiftReq(i.Serial, amount, fromClient, doLast);
            LiftReq prev = null;

            if (Full)
            {
                World.Player.SendMessage(MsgLevel.Error, LocString.DragDropQueueFull);
                if (fromClient)
                {
                    ClientCommunication.SendToClient(new LiftRej());
                }
                return(0);
            }

            Log("Queuing Drag request {0}", lr);

            if (m_Back >= m_LiftReqs.Length)
            {
                m_Back = 0;
            }

            if (m_Back <= 0)
            {
                prev = m_LiftReqs[m_LiftReqs.Length - 1];
            }
            else if (m_Back <= m_LiftReqs.Length)
            {
                prev = m_LiftReqs[m_Back - 1];
            }

            // if the current last req must stay last, then insert this one in its place
            if (prev != null && prev.DoLast)
            {
                Log("Back-Queuing {0}", prev);
                if (m_Back <= 0)
                {
                    m_LiftReqs[m_LiftReqs.Length - 1] = lr;
                }
                else if (m_Back <= m_LiftReqs.Length)
                {
                    m_LiftReqs[m_Back - 1] = lr;
                }

                // and then re-insert it at the end
                lr = prev;
            }

            m_LiftReqs[m_Back++] = lr;

            ActionQueue.SignalLift(!fromClient);
            return(lr.Id);
        }
示例#24
0
        public static void SetLastTargetTo(Mobile m, byte flagType)
        {
            TargetInfo targ = new TargetInfo();

            m_LastGroundTarg = m_LastTarget = targ;

            if ((m_HasTarget && m_CurFlags == 1) || flagType == 1)
            {
                m_LastHarmTarg = targ;
            }
            else if ((m_HasTarget && m_CurFlags == 2) || flagType == 2)
            {
                m_LastBeneTarg = targ;
            }
            else if (flagType == 0)
            {
                m_LastHarmTarg = m_LastBeneTarg = targ;
            }

            targ.Type = 0;
            if (m_HasTarget)
            {
                targ.Flags = m_CurFlags;
            }
            else
            {
                targ.Flags = flagType;
            }

            targ.Gfx    = m.Body;
            targ.Serial = m.Serial;
            targ.X      = m.Position.X;
            targ.Y      = m.Position.Y;
            targ.Z      = m.Position.Z;

            ClientCommunication.SendToClient(new ChangeCombatant(m));
            m_LastCombatant = m.Serial;
            World.Player.SendMessage(MsgLevel.Force, LocString.NewTargSet);

            bool wasSmart = Config.GetBool("SmartLastTarget");

            if (wasSmart)
            {
                Config.SetProperty("SmartLastTarget", false);
            }
            LastTarget();
            if (wasSmart)
            {
                Config.SetProperty("SmartLastTarget", true);
            }
            LastTargetChanged();
        }
示例#25
0
        public static string Decrypt(string source)
        {
            byte[] buff = null;

            if (source.Length > 2 && source[0] == '1' && source[1] == '+')
            {
                buff = new byte[(source.Length - 2) / 2];
                string key = ClientCommunication.GetWindowsUserName();
                if (key == String.Empty)
                {
                    return(String.Empty);
                }
                int kidx = 0;
                for (int i = 2; i < source.Length; i += 2)
                {
                    byte c;
                    try
                    {
                        c = Convert.ToByte(source.Substring(i, 2), 16);
                    }
                    catch
                    {
                        continue;
                    }
                    buff[(i - 2) / 2] = (byte)(c ^ ((byte)key[kidx++]));
                    if (kidx >= key.Length)
                    {
                        kidx = 0;
                    }
                }
            }
            else
            {
                byte key = (byte)(source.Length / 2);
                buff = new byte[key];

                for (int i = 0; i < source.Length; i += 2)
                {
                    byte c;
                    try
                    {
                        c = Convert.ToByte(source.Substring(i, 2), 16);
                    }
                    catch
                    {
                        continue;
                    }
                    buff[i / 2] = (byte)(c ^ key++);
                }
            }
            return(ASCIIEncoding.ASCII.GetString(buff));
        }
示例#26
0
 public void ResetCriminalTimer()
 {
     if (m_CriminalStart == DateTime.MinValue || DateTime.Now - m_CriminalStart >= TimeSpan.FromSeconds(1))
     {
         m_CriminalStart = DateTime.Now;
         if (m_CriminalTime == null)
         {
             m_CriminalTime = new CriminalTimer(this);
         }
         m_CriminalTime.Start();
         ClientCommunication.RequestTitlebarUpdate();
     }
 }
示例#27
0
        private static void OnGetItemHueTarget(bool ground, Serial serial, Point3D pt, ushort gfx)
        {
            Item item = World.FindItem(serial);

            if (item != null)
            {
                ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3,
                                                                    Language.CliLocName, "System", $"Item: '{item.Name}' '{item.ItemID.Value}'"));

                ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3,
                                                                    Language.CliLocName, "System", $"Hue: '{item.Hue}'"));
            }
        }
示例#28
0
        private static void OnGetMobileTarget(bool ground, Serial serial, Point3D pt, ushort gfx)
        {
            Mobile mobile = World.FindMobile(serial);

            if (mobile != null)
            {
                ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3,
                                                                    Language.CliLocName, "System", $"Name: '{mobile.Name}' Hits: '{mobile.Hits}/{mobile.HitsMax}' Mana: '{mobile.Mana}/{mobile.ManaMax}' Stam: '{mobile.Stam}/{mobile.StamMax}'"));

                ClientCommunication.SendToClient(new UnicodeMessage(0xFFFFFFFF, -1, MessageType.Regular, 0x3B2, 3,
                                                                    Language.CliLocName, "System", $"Serial: '{mobile.Serial}' Hue: '{mobile.Hue}' IsAnimal: '{mobile.IsAnimal}' IsGhost: '{mobile.IsGhost}' IsHuman: '{mobile.IsHuman}' IsMonster: '{mobile.IsMonster}' IsSeaMonster: '{mobile.IsSeaMonster}'"));
            }
        }
示例#29
0
        private static void LastTargetChanged()
        {
            if (m_LastTarget == null)
            {
                return;
            }

            bool lth = RazorEnhanced.Settings.General.ReadInt("LTHilight") != 0;

            if (m_OldLT.IsItem)
            {
                RemoveTextFlags(World.FindItem(m_OldLT));
            }
            else
            {
                Mobile m = World.FindMobile(m_OldLT);
                if (m != null)
                {
                    if (lth)
                    {
                        ClientCommunication.SendToClient(new MobileIncoming(m));
                    }

                    RemoveTextFlags(m);
                }
            }

            if (m_LastTarget.Serial.IsItem)
            {
                AddTextFlags(World.FindItem(m_LastTarget.Serial));
            }
            else
            {
                Mobile m = World.FindMobile(m_LastTarget.Serial);
                if (m != null)
                {
                    if (IsLastTarget(m) && lth)
                    {
                        ClientCommunication.SendToClient(new MobileIncoming(m));
                    }

                    CheckLastTargetRange(m);

                    AddTextFlags(m);
                }
            }

            m_OldLT = m_LastTarget.Serial;
        }
示例#30
0
            protected override void OnTick()
            {
                if (m_Table.Count <= 0)
                {
                    return;
                }

                List <string> toremove = new List <string>();

                foreach (KeyValuePair <string, MsgInfo> de in m_Table)
                {
                    string  txt = de.Key;
                    MsgInfo msg = de.Value;

                    if (msg.NextSend <= DateTime.UtcNow)
                    {
                        if (msg.Count > 0)
                        {
                            if (msg.Lang == "A")
                            {
                                ClientCommunication.SendToClient(new AsciiMessage(msg.Serial, msg.Body, msg.Type,
                                                                                  msg.Hue, msg.Font, msg.Name,
                                                                                  msg.Count > 1 ? String.Format("{0} [{1}]", txt, msg.Count) : txt));
                            }
                            else
                            {
                                ClientCommunication.SendToClient(new UnicodeMessage(msg.Serial, msg.Body, msg.Type,
                                                                                    msg.Hue, msg.Font, msg.Lang, msg.Name,
                                                                                    msg.Count > 1 ? String.Format("{0} [{1}]", txt, msg.Count) : txt));
                            }
                            msg.Count    = 0;
                            msg.NextSend = DateTime.UtcNow + msg.Delay;
                        }
                        else
                        {
                            if (txt != null)
                            {
                                toremove.Add(txt);
                            }
                        }
                    }
                }

                for (int i = toremove.Count - 1; i >= 0; --i)
                {
                    m_Table.Remove(toremove[i]);
                }
            }