Esempio n. 1
0
		internal static void Record_ClientDoubleClick(Assistant.Serial ser)
		{
			if (ser.IsItem)
				AddLog("Items.UseItem(0x" + ser.Value.ToString("X8") + ")");
			else
				AddLog("Mobiles.UseMobile(0x" + ser.Value.ToString("X8") + ")");
		}
Esempio n. 2
0
 public Mobile( Serial serial )
     : base(serial)
 {
     m_Items = new ArrayList();
     m_Map = World.Player == null ? (byte)0 : World.Player.Map;
     m_Visible = true;
 }
Esempio n. 3
0
        public static List <Context> WaitForContext(int ser, int delay) // Delay in MS
        {
            List <Context> retList = new List <Context>();

            Assistant.Client.Instance.SendToServerWait(new ContextMenuRequest(ser));
            int subdelay = delay;

            while (World.Player.HasContext != true && World.Player.ContextID != ser && subdelay > 0)
            {
                Thread.Sleep(2);
                subdelay -= 2;
            }
            UOEntity ent = null;

            Assistant.Serial menuOwner = new Assistant.Serial((uint)ser);
            if (menuOwner.IsMobile)
            {
                ent = World.FindMobile(menuOwner);
            }
            else if (menuOwner.IsItem)
            {
                ent = World.FindItem(menuOwner);
            }
            if (ent != null)
            {
                foreach (var entry in ent.ContextMenu)
                {
                    Context temp = new Context();
                    temp.Response = entry.Key;
                    temp.Entry    = Language.GetString(entry.Value);
                    retList.Add(temp);
                }
            }
            return(retList);
        }
Esempio n. 4
0
        // Check Poison
        private static bool CheckHealPoisonTarg(Assistant.Serial ser)
        {
            if (World.Player == null)
            {
                return(false);
            }

            if (!RazorEnhanced.Settings.General.ReadBool("BlockHealPoison"))
            {
                return(false);
            }

            if (ser.IsMobile && (World.Player.LastSpell == Spell.ToID(1, 4) || World.Player.LastSpell == Spell.ToID(4, 5) || World.Player.LastSpell == 202))
            {
                Assistant.Mobile m = World.FindMobile(ser);

                if (m != null && m.Poisoned)
                {
                    World.Player.SendMessage(MsgLevel.Warning, "Heal blocked, Target is poisoned!");
                    return(true);
                }
                else if (m != null && m.Blessed)
                {
                    World.Player.SendMessage(MsgLevel.Warning, "Heal blocked, Target is mortelled!");
                    return(true);
                }
                return(false);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
		internal static void Record_DropRequest(Assistant.Item i, Assistant.Serial dest)
		{
			if (dest != 0xFFFFFFFF)
				AddLog("Items.Move(0x" + i.Serial.Value.ToString("X8") + ", 0x" + dest.Value.ToString("X8") + ", " + i.Amount + ")");
			else
				AddLog("Items.DropItemGroundSelf(0x" + i.Serial.Value.ToString("X8") + ", " + i.Amount + ")");	
		}
Esempio n. 6
0
        public ObjectPropertyList( Serial ser, int hash, ArrayList props )
        {
            m_Serial = ser;
            m_ServerHash = hash;
            m_ServerProps = props;

            m_MyHash = 0;
            m_MyProps = null;
        }
Esempio n. 7
0
        public Mobile( Serial serial )
            : base(serial)
        {
            m_Items	= new ArrayList();
            m_Map =	World.Player ==	null ? (byte)0 : World.Player.Map;
            m_Visible =	true;

            Agent.InvokeMobileCreated( this );
        }
Esempio n. 8
0
        public AcceptParty( Serial leader )
            : base(0xBF)
        {
            EnsureCapacity( 1 + 2 + 2 + 1 + 4 );

            Write( (ushort)0x06 ); // party command
            Write( (byte)0x08 ); // accept
            Write( (uint)leader );
        }
Esempio n. 9
0
 private static bool? Event_ASCIIMessage(Serial serial, ItemID graphic, byte type, ushort hue, ushort font, string lang, string name, string msg)
 {
     if (msg == "Banish!" || msg == "Decimate!" || msg == "Pool of Poison!")
     {
         msg = string.Format("!!!{0}!!", msg);
         WorldEx.OverHeadMessage(msg, 0x0017);
         if (msg == "!!!Banish!!!")
             timer.Start();
     }
     return null;
 }
Esempio n. 10
0
        internal static void Record_ClientSingleClick(Assistant.Serial ser)
        {
            int serint = ser;

            if (ser.IsItem)
            {
                AddLog("Items.SingleClick(0x" + serint.ToString("X8") + ")");
            }
            else
            {
                AddLog("Mobiles.SingleClick(0x" + serint.ToString("X8") + ")");
            }
        }
Esempio n. 11
0
 private static void FriendPlayerTarget_Callback(bool loc, Assistant.Serial serial, Assistant.Point3D pt, ushort itemid)
 {
     Assistant.Mobile friendplayer = World.FindMobile(serial);
     if (friendplayer != null && friendplayer.Serial.IsMobile && friendplayer.Serial != World.Player.Serial)
     {
         Engine.MainWindow.SafeAction(s => { Friend.AddPlayerToList(friendplayer.Name, friendplayer.Serial); });
     }
     else
     {
         if (Engine.MainWindow.ShowAgentMessageCheckBox.Checked)
         {
             Misc.SendMessage("Invalid target", false);
         }
         Friend.AddLog("Invalid target");
     }
 }
Esempio n. 12
0
        internal static void Record_DropRequest(Assistant.Serial i, Assistant.Serial dest)
        {
            int iint    = i;
            int destint = dest;

            Assistant.Item item = Assistant.World.FindItem(i);
            if (item != null)
            {
                if (dest != 0xFFFFFFFF)
                {
                    AddLog("Items.Move(0x" + iint.ToString("X8") + ", 0x" + destint.ToString("X8") + ", " + item.Amount + ")");
                }
                else
                {
                    AddLog("Items.DropItemGroundSelf(0x" + iint.ToString("X8") + ", " + item.Amount + ")");
                }
            }
        }
Esempio n. 13
0
        static public void StoreBuyList(PacketReader p, PacketHandlerEventArgs args)
        {
            Assistant.Serial serial = p.ReadUInt32();
            ushort           gump   = p.ReadUInt16();

            Assistant.Mobile vendor = Assistant.World.FindMobile(serial);
            if (vendor == null)
            {
                return;
            }

            Assistant.Item pack = vendor.GetItemOnLayer(Layer.ShopBuy);
            if (pack == null || pack.Contains == null || pack.Contains.Count <= 0)
            {
                return;
            }
            Vendor.LastVendor  = vendor;
            Vendor.LastBuyList = pack.Contains;
        }
Esempio n. 14
0
 private void PromptGroundTargetExex_Callback(bool loc, Assistant.Serial serial, Assistant.Point3D pt, ushort itemid)
 {
     if (!loc)
     {
         Mobile target = Mobiles.FindBySerial(serial);
         if (target == null)
         {
             m_pgtarget = Point3D.MinusOne;
         }
         else
         {
             m_pgtarget = target.Position;
         }
     }
     else
     {
         m_pgtarget = new Point3D(pt.X, pt.Y, pt.Z);
     }
 }
Esempio n. 15
0
        public AsciiMessage( Serial serial, int graphic, MessageType type, int hue, int font, string name, string text )
            : base(0x1C)
        {
            if ( name == null ) name = "";
            if ( text == null ) text = "";

            if ( hue == 0 )
                hue = 0x3B2;

            this.EnsureCapacity( 45 + text.Length );

            Write( (uint) serial );
            Write( (short) graphic );
            Write( (byte) type );
            Write( (short) hue );
            Write( (short) font );
            WriteAsciiFixed( name, 30 );
            WriteAsciiNull( text );
        }
Esempio n. 16
0
        private static void ShopList(PacketReader p, PacketHandlerEventArgs args)
        {
            Assistant.Serial serial    = p.ReadUInt32();
            byte             itemcount = p.ReadByte();

            if (itemcount < 1)             // No item
            {
                return;
            }

            m_shoplist.Clear();
            for (int i = 0; i < itemcount; i++)
            {
                p.ReadUInt32();                                   // Price
                int    textlenght = p.ReadByte();                 // lenght name
                string itemname   = p.ReadStringSafe(textlenght); // real item name show
                m_shoplist.Add(itemname);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Return the List entry of a Context menu, of Mobile or Item objects.
        /// The function will ask the server for the List and wait for a maximum amount of time.
        /// </summary>
        /// <param name="serial">Serial of the entity.</param>
        /// <param name="delay">Maximum wait.</param>
        /// <param name="showContext">Show context menu in-game. (default: True)</param>
        /// <returns>A List of Context objects.</returns>
        public static List <Context> WaitForContext(int serial, int delay, bool showContext = false) // Delay in MS
        {
            if (!showContext)
            {
                var HideUntilMax = Math.Min(10000, Math.Max(1000, delay)); // at least 1 sec, but nmo more than 10 seconds
                Assistant.PacketHandlers.HideContextUntil = DateTime.Now.AddMilliseconds(HideUntilMax);
            }
            List <Context> retList = new List <Context>();

            Assistant.Client.Instance.SendToServerWait(new ContextMenuRequest(serial));
            int subdelay = delay;

            while (World.Player.HasContext != true && World.Player.ContextID != serial && subdelay > 0)
            {
                Thread.Sleep(2);
                subdelay -= 2;
            }
            UOEntity ent = null;

            Assistant.Serial menuOwner = new Assistant.Serial((uint)serial);
            if (menuOwner.IsMobile)
            {
                ent = World.FindMobile(menuOwner);
            }
            else if (menuOwner.IsItem)
            {
                ent = World.FindItem(menuOwner);
            }
            if (ent != null)
            {
                foreach (var entry in ent.ContextMenu)
                {
                    Context temp = new Context
                    {
                        Response = entry.Key,
                        Entry    = Language.GetString(entry.Value)
                    };
                    retList.Add(temp);
                }
            }
            return(retList);
        }
Esempio n. 18
0
 public static void DoubleClick( bool silent, Serial s )
 {
     if ( s != Serial.Zero )
     {
         if ( m_Last != s )
         {
             m_Queue.Enqueue( s );
             m_Last = s;
             m_Total++;
             if ( m_Queue.Count == 1 && !m_Timer.Running )
                 m_Timer.StartMe();
             else if ( !silent && m_Total > 1 )
                 World.Player.SendMessage( LocString.ActQueued, m_Queue.Count, TimeLeft );
         }
         else if ( !silent )
         {
             World.Player.SendMessage( LocString.QueueIgnore );
         }
     }
 }
Esempio n. 19
0
        private StatusBar(Serial serial)
        {
            this.serial = serial;
            table.Padding = new Padding(3);
            table.Controls.Add(barHP = new Bar(Color.Red));
            if (serial == Serial.MinusOne || PacketHandlers.Party.Contains(serial))
            {
                table.Controls.Add(barMana = new Bar(Color.Blue));
                table.Controls.Add(barStamina = new Bar(Color.DarkGoldenrod));
                if (PacketHandlers.Party.Contains(serial))
                    barMana.Text = barStamina.Text = "-";
            }

            if (serial == Serial.MinusOne)
            {
                if (ConfigEx.GetAttribute(false, "ex", "Status"))
                {
                    table.ColumnCount = 2;
                    table.Controls.Add(labelFoll = new LabelEx("-", margin: 0) { ForeColor = Color.White });
                    table.Controls.Add(labelWeight = new LabelEx("-", margin: 0) { ForeColor = Color.White });
                    table.Controls.Add(labelBands = new LabelEx("-", margin: 0) { ForeColor = Color.White });
                    table.Controls.SetChildIndex(labelFoll, 1);
                    table.Controls.SetChildIndex(labelWeight, 3);
                    table.Controls.SetChildIndex(labelBands, 5);
                    Bandages.Changed += Bandages_Changed;
                }
                ConfigEx.SetAttribute(true, "enabled", "Status");
                BackColor = Color.Purple;
                Location = new Point(ConfigEx.GetAttribute(Location.X, "locX", "Status"),
                                     ConfigEx.GetAttribute(Location.Y, "locY", "Status"));
                UpdateStats();
            }
            else
            {
                Mobile mobile = World.FindMobile(serial);
                if (mobile != null)
                    WorldEx.SendToServer(new StatusQuery(mobile));
            }
            Event.MobileUpdated += WorldEx_MobileUpdated;
        }
Esempio n. 20
0
        public static bool Enqueue( Serial ser, ushort body, MessageType type, ushort hue, ushort font, string lang, string name, string text )
        {
            MsgInfo m = m_Table[text] as MsgInfo;
            if ( m == null )
            {
                m_Table[text] = m = new MsgInfo( ser, body, type, hue, font, lang, name );

                m.Count = 0;

                m.Delay = TimeSpan.FromSeconds( (((int)(text.Length / 50))+1) * 3.5 );

                m.NextSend = DateTime.Now + m.Delay;

                return true;
            }
            else
            {
                m.Count++;

                return false;
            }
        }
Esempio n. 21
0
        public static bool EndHolding( Serial s )
        {
            //if ( m_Pending == s )
            //	return false;

            if ( m_Holding == s )
            {
                m_Holding = Serial.Zero;
                m_HoldingItem = null;
            }

            return true;
        }
Esempio n. 22
0
        public static bool Drop( Item i, Mobile to, Layer layer )
        {
            if ( m_Pending == i.Serial )
            {
                Log( "Equipping {0} to {1} (@{2})", i, to.Serial, layer );
                ClientCommunication.SendToServer( new EquipRequest( i.Serial, to, layer ) );
                m_Pending = Serial.Zero;
                m_Lifted = DateTime.MinValue;
                return true;
            }
            else
            {
                bool add = false;

                for(byte j=m_Front;j!=m_Back && !add;j++)
                {
                    if ( m_LiftReqs[j] != null && m_LiftReqs[j].Serial == i.Serial )
                    {
                        add = true;
                        break;
                    }
                }

                if ( add )
                {
                    Log( "Queuing Equip {0} to {1} (@{2})", i, to.Serial, layer );

                    Queue q = m_DropReqs[i.Serial] as Queue;
                    if ( q == null )
                        m_DropReqs[i.Serial] = q = new Queue();
                    q.Enqueue( new DropReq( to == null ? Serial.Zero : to.Serial, layer ) );
                    return true;
                }
                else
                {
                    Log( "Drop/Equip for {0} (to {1} (@{2})) not found, skipped", i, to == null ? Serial.Zero : to.Serial, layer );
                    return false;
                }
            }
        }
Esempio n. 23
0
        public static bool Drop( Item i, Serial dest, Point3D pt )
        {
            if ( m_Pending == i.Serial )
            {
                Log( "Dropping {0} to {1} (@{2})", i, dest, pt );

                ClientCommunication.SendToServer( new DropRequest( i.Serial, pt, dest ) );
                m_Pending = Serial.Zero;
                m_Lifted = DateTime.MinValue;
                return true;
            }
            else
            {
                bool add = false;

                for(byte j=m_Front;j!=m_Back && !add;j++)
                {
                    if ( m_LiftReqs[j] != null && m_LiftReqs[j].Serial == i.Serial )
                    {
                        add = true;
                        break;
                    }
                }

                if ( add )
                {
                    Log( "Queuing Drop {0} (to {1} (@{2}))", i, dest, pt );

                    Queue q = m_DropReqs[i.Serial] as Queue;
                    if ( q == null )
                        m_DropReqs[i.Serial] = q = new Queue();
                    q.Enqueue( new DropReq( dest, pt ) );
                    return true;
                }
                else
                {
                    Log( "Drop for {0} (to {1} (@{2})) not found, skipped", i, dest, pt );
                    return false;
                }
            }
        }
Esempio n. 24
0
 public DropReq( Serial s, Layer layer )
 {
     Serial = s; Layer = layer;
 }
Esempio n. 25
0
        public static void HandleSpeech( Packet p, PacketHandlerEventArgs args, Serial ser, ushort body, MessageType type, ushort hue, ushort font, string lang, string name, string text )
        {
            if ( World.Player == null )
                return;

            if ( !ser.IsValid || ser == World.Player.Serial || ser.IsItem )
            {
                SysMessages.Add( text.ToLower() );

                if ( SysMessages.Count >= 25 )
                    SysMessages.RemoveRange( 0, 10 );
            }

            if ( type == MessageType.Spell )
            {
                Spell s = Spell.Get( text.Trim() );
                bool replaced = false;
                if ( s != null )
                {
                    System.Text.StringBuilder sb = new System.Text.StringBuilder( Config.GetString( "SpellFormat" ) );
                    sb.Replace( @"{power}", s.WordsOfPower );
                    string spell = Language.GetString( s.Name );
                    sb.Replace( @"{spell}", spell );
                    sb.Replace( @"{name}", spell );

                    string newText = sb.ToString();

                    if ( newText != null && newText != "" && newText != text )
                    {
                        ClientCommunication.SendToClient( new AsciiMessage( ser, body, MessageType.Spell, s.GetHue( hue ), font, name, newText ) );
                        //ClientCommunication.SendToClient( new UnicodeMessage( ser, body, MessageType.Spell, s.GetHue( hue ), font, Language.CliLocName, name, newText ) );
                        replaced = true;
                        args.Block = true;
                    }
                }

                if ( !replaced && Config.GetBool( "ForceSpellHue" ) )
                {
                    p.Seek( 10, SeekOrigin.Begin );
                    if ( s != null )
                        p.Write( (ushort)s.GetHue( hue ) );
                    else
                        p.Write( (ushort)Config.GetInt( "NeutralSpellHue" ) );
                }
            }
            else if ( ser.IsMobile && type == MessageType.Label )
            {
                Mobile m = World.FindMobile( ser );
                if ( m != null /*&& ( m.Name == null || m.Name == "" || m.Name == "(Not Seen)" )*/&& m.Name.IndexOf( text ) != 5 && m != World.Player && !( text.StartsWith( "(" )  && text.EndsWith( ")" ) ) )
                    m.Name = text;
            }
            /*else if ( Spell.Get( text.Trim() ) != null )
            { // send fake spells to bottom left
                p.Seek( 3, SeekOrigin.Begin );
                p.Write( (uint)0xFFFFFFFF );
            }*/
            else
            {
                if ( ser == Serial.MinusOne && name == "System" )
                {
                    if ( Config.GetBool( "FilterSnoopMsg" ) && text.IndexOf( World.Player.Name ) == -1 && text.StartsWith( "You notice" ) && text.IndexOf( "attempting to peek into" ) != -1 && text.IndexOf( "belongings" ) != -1 )
                    {
                        args.Block = true;
                        return;
                    }
                    else if ( text.StartsWith( "You've committed a criminal act" ) || text.StartsWith( "You are now a criminal" ) )
                    {
                        World.Player.ResetCriminalTimer();
                    }
                }

                if ( ( type == MessageType.Emote || type == MessageType.Regular || type == MessageType.Whisper || type == MessageType.Yell ) && ser.IsMobile && ser != World.Player.Serial )
                {
                    if ( Config.GetBool( "ForceSpeechHue" ) )
                    {
                        p.Seek( 10, SeekOrigin.Begin );
                        p.Write( (ushort)Config.GetInt( "SpeechHue" ) );
                    }
                }

                if ( Config.GetBool( "FilterSpam" ) && ( ser == Serial.MinusOne || ser == Serial.Zero ) )
                {
                    if ( !MessageQueue.Enqueue( ser, body, type, hue, font, lang, name, text ) )
                    {
                        args.Block = true;
                        return;
                    }
                }
            }
        }
Esempio n. 26
0
        public static ProcStatus ProcessNext( int numPending )
        {
            if ( m_Pending != Serial.Zero )
            {
                if ( m_Lifted + TimeSpan.FromMinutes( 2 ) < DateTime.Now )
                {
                    Item i = World.FindItem( m_Pending );

                    Log( "Lift timeout, forced drop to pack for {0}", m_Pending );

                    if ( World.Player != null )
                    {
                        World.Player.SendMessage( MsgLevel.Force, LocString.ForceEndHolding );

                        if ( World.Player.Backpack != null )
                            ClientCommunication.SendToServer( new DropRequest( m_Pending, Point3D.MinusOne, World.Player.Backpack.Serial ) );
                        else
                            ClientCommunication.SendToServer( new DropRequest( m_Pending, World.Player.Position, Serial.Zero ) );
                    }

                    m_Holding = m_Pending = Serial.Zero;
                    m_HoldingItem = null;
                    m_Lifted = DateTime.MinValue;
                }
                else
                {
                    return ProcStatus.KeepWaiting;
                }
            }

            if ( m_Front == m_Back )
            {
                m_Front = m_Back = 0;
                return ProcStatus.Nothing;
            }

            LiftReq lr = m_LiftReqs[m_Front];

            if ( numPending > 0 && lr != null && lr.DoLast )
                return ProcStatus.ReQueue;

            m_LiftReqs[m_Front] = null;
            m_Front++;
            if ( lr != null )
            {
                Log( "Lifting {0}", lr );

                Item item = World.FindItem( lr.Serial );
                if ( item != null && item.Container == null )
                { // if the item is on the ground and out of range then dont grab it
                    if ( Utility.Distance( item.GetWorldPosition(), World.Player.Position ) > 3 )
                    {
                        Log( "Item is too far away... uncaching." );
                        ScavengerAgent.Instance.Uncache( item.Serial );
                        return ProcStatus.Nothing;
                    }
                }

                ClientCommunication.SendToServer( new LiftRequest( lr.Serial, lr.Amount ) );

                m_LastID = lr.Id;
                m_Holding = lr.Serial;
                m_HoldingItem = World.FindItem( lr.Serial );
                m_ClientLiftReq = lr.FromClient;

                DropReq dr = DequeueDropFor( lr.Serial );
                if ( dr != null )
                {
                    m_Pending = Serial.Zero;
                    m_Lifted = DateTime.MinValue;

                    Log( "Dropping {0} to {1}", lr, dr.Serial );

                    if ( dr.Serial.IsMobile && dr.Layer > Layer.Invalid && dr.Layer <= Layer.LastUserValid )
                        ClientCommunication.SendToServer( new EquipRequest( lr.Serial, dr.Serial, dr.Layer ) );
                    else
                        ClientCommunication.SendToServer( new DropRequest( lr.Serial, dr.Point, dr.Serial ) );
                }
                else
                {
                    m_Pending = lr.Serial;
                    m_Lifted = DateTime.Now;
                }

                return ProcStatus.Success;
            }
            else
            {
                Log( "No lift to be done?!" );
                return ProcStatus.Nothing;
            }
        }
Esempio n. 27
0
 private static DropReq DequeueDropFor( Serial s )
 {
     DropReq dr = null;
     Queue q = (Queue)m_DropReqs[s];
     if ( q != null )
     {
         if ( q.Count > 0 )
             dr = q.Dequeue() as DropReq;
         if ( q.Count <= 0 )
             m_DropReqs.Remove( s );
     }
     return dr;
 }
Esempio n. 28
0
 private static void OnCommand(bool location, Serial serial, Point3D p, ushort gfxid)
 {
     new StatusBar(serial == World.Player.Serial || !serial.IsValid || !serial.IsMobile ? Serial.MinusOne : serial).Show();
 }
Esempio n. 29
0
 private void WorldEx_MobileUpdated(Serial mobileSerial)
 {
     if (serial == mobileSerial || (serial == Serial.MinusOne && mobileSerial == World.Player.Serial))
         UpdateStats();
 }
Esempio n. 30
0
 public HuePicker( Serial serial, ItemID itemid )
     : base(0x95, 9)
 {
     Write( (uint)serial );
     Write( (ushort)0 );
     Write( (ushort)itemid );
 }
Esempio n. 31
0
 public ExtCastSpell( Serial book, ushort spell )
     : base(0xBF)
 {
     EnsureCapacity( 1 + 2 + 2 + 2 + 4 + 2 );
     Write( (short)0x1C );
     Write( (short)( book.IsItem ? 1 : 2 ) );
     if ( book.IsItem )
         Write( (uint)book );
     Write( (short)spell );
 }
Esempio n. 32
0
 private void PromptTargetExex_Callback(bool loc, Assistant.Serial serial, Assistant.Point3D pt, ushort itemid)
 {
     m_ptarget = serial;
 }
Esempio n. 33
0
 internal Serial(Assistant.Serial serial)
 {
     m_AssistantSerial = serial;
 }
Esempio n. 34
0
        private static void OnPartyMessage( PacketReader p, PacketHandlerEventArgs args )
        {
            switch ( p.ReadByte() )
            {
                case 0x01: // List
                {
                    m_Party.Clear();

                    int count = p.ReadByte();
                    for(int i=0;i<count;i++)
                    {
                        Serial s = p.ReadUInt32();
                        if ( World.Player == null || s != World.Player.Serial )
                            m_Party.Add( s );
                    }

                    break;
                }
                case 0x02: // Remove Member/Re-list
                {
                    m_Party.Clear();
                    int count = p.ReadByte();
                    Serial remSerial = p.ReadUInt32(); // the serial of who was removed

                    if ( World.Player != null )
                    {
                        Mobile rem = World.FindMobile( remSerial );
                        if ( rem != null && !Utility.InRange( World.Player.Position, rem.Position, World.Player.VisRange ) )
                            rem.Remove();
                    }

                    for(int i=0;i<count;i++)
                    {
                        Serial s = p.ReadUInt32();
                        if ( World.Player == null || s != World.Player.Serial )
                            m_Party.Add( s );
                    }

                    break;
                }
                case 0x03: // text message
                case 0x04: // 3 = private, 4 = public
                {
                    //Serial from = p.ReadUInt32();
                    //string text = p.ReadUnicodeStringSafe();
                    break;
                }
                case 0x07: // party invite
                {
                    //Serial leader = p.ReadUInt32();
                    PartyLeader = p.ReadUInt32();
                    if ( m_PartyDeclineTimer == null )
                        m_PartyDeclineTimer = Timer.DelayedCallback( TimeSpan.FromSeconds( 10.0 ), new TimerCallback( PartyAutoDecline ) );
                    m_PartyDeclineTimer.Start();
                    break;
                }
            }

            if (Engine.MainWindow.MapWindow != null)
                Engine.MainWindow.MapWindow.UpdateMap();
        }
Esempio n. 35
0
        public static bool HasDragFor( Serial s )
        {
            for(byte j=m_Front;j!=m_Back;j++)
            {
                if ( m_LiftReqs[j] != null && m_LiftReqs[j].Serial == s )
                    return true;
            }

            return false;
        }
Esempio n. 36
0
 public EquipRequest( Serial item, Serial to, Layer layer )
     : base(0x13, 10)
 {
     Write( item );
     Write( (byte)layer );
     Write( to );
 }
Esempio n. 37
0
        public static bool LiftReject()
        {
            Log( "Server rejected lift for item {0}", m_Holding );
            if ( m_Holding == Serial.Zero )
                return true;

            m_Holding = m_Pending = Serial.Zero;
            m_HoldingItem = null;
            m_Lifted = DateTime.MinValue;

            return m_ClientLiftReq;
        }
Esempio n. 38
0
        public static bool CancelDragFor( Serial s )
        {
            if ( Empty )
                return false;

            int skip = 0;
            for(byte j=m_Front;j!=m_Back;j++)
            {
                if ( skip == 0 && m_LiftReqs[j] != null && m_LiftReqs[j].Serial == s )
                {
                    m_LiftReqs[j] = null;
                    skip++;
                    if ( j == m_Front )
                    {
                        m_Front++;
                        break;
                    }
                    else
                    {
                        m_Back--;
                    }
                }

                if ( skip > 0 )
                    m_LiftReqs[j] = m_LiftReqs[(byte)(j+skip)];
            }

            if ( skip > 0 )
            {
                m_LiftReqs[m_Back] = null;
                return true;
            }
            else
            {
                return false;
            }
        }
Esempio n. 39
0
        private static void DisplayBuy(PacketReader p, PacketHandlerEventArgs args)
        {
            if (!Engine.MainWindow.BuyCheckBox.Checked)             // Filtro disabilitato
            {
                return;
            }

            Assistant.Serial serial = p.ReadUInt32();
            ushort           gump   = p.ReadUInt16();

            Assistant.Mobile vendor = Assistant.World.FindMobile(serial);
            if (vendor == null)
            {
                return;
            }

            Assistant.Item pack = vendor.GetItemOnLayer(Layer.ShopBuy);
            if (pack == null || pack.Contains == null || pack.Contains.Count <= 0)
            {
                return;
            }

            int total = 0;
            int cost  = 0;
            List <Assistant.VendorBuyItem> buyList = new List <Assistant.VendorBuyItem>();           // Lista definita altrove (non rimuovere se si fa pulizia in giro)

            for (int i = 0; i < pack.Contains.Count; i++)
            {
                if (pack.Contains[i] == null)
                {
                    continue;
                }

                List <BuyAgent.BuyAgentItem> items = Settings.BuyAgent.ItemsRead(m_listname);

                foreach (BuyAgentItem buyItem in items)                 // Scansione item presenti in lista agent item
                {
                    if (!buyItem.Selected)
                    {
                        continue;
                    }

                    if (buyItem.Graphics != pack.Contains[i].ItemID || !RazorEnhanced.BuyAgent.ColorCheck(buyItem.Color, pack.Contains[i].Hue))
                    {
                        continue;
                    }

                    if (pack.Contains[i].Amount >= buyItem.Amount)                     // Caso che il vendor abbia piu' item di quelli richiesti
                    {
                        AddLog("Item match: 0x" + buyItem.Graphics.ToString("X4") + " - Amount: " + pack.Contains[i].Amount + " - Buyed: " + buyItem.Amount);
                        buyList.Add(new VendorBuyItem(pack.Contains[i].Serial, buyItem.Amount, pack.Contains[i].Price));
                        total += buyItem.Amount;
                        cost  += pack.Contains[i].Price * buyItem.Amount;
                    }
                    else                     // Caso che il vendor ne abbia di meno (Li compro tutti)
                    {
                        AddLog("Item match: 0x" + buyItem.Graphics.ToString("X4") + " - Amount: " + pack.Contains[i].Amount + " - Buyed: " + pack.Contains[i].Amount);
                        buyList.Add(new VendorBuyItem(pack.Contains[i].Serial, pack.Contains[i].Amount, pack.Contains[i].Price));
                        total += pack.Contains[i].Amount;
                        cost  += pack.Contains[i].Price * pack.Contains[i].Amount;
                    }
                }
            }

            if (buyList.Count <= 0)
            {
                return;
            }

            args.Block = true;
            Assistant.Client.Instance.SendToServer(new VendorBuyResponse(serial, buyList));

            string message = "Enhanced Buy Agent: bought " + total.ToString() + " items for " + cost.ToString() + " gold coins";

            World.Player.Journal.Enqueue(new RazorEnhanced.Journal.JournalEntry(message, "System", 1, "Vendor", vendor.Serial));                      // Journal buffer
            World.Player.SendMessage(message);
            AddLog("Bought " + total.ToString() + " items for " + cost.ToString() + " gold coins");
        }
Esempio n. 40
0
        public static void Clear()
        {
            Log( "Clearing...." );

            m_DropReqs.Clear();
            for(int i=0;i<256;i++)
                m_LiftReqs[i] = null;
            m_Front = m_Back = 0;
            m_Holding = m_Pending = Serial.Zero;
            m_HoldingItem = null;
            m_Lifted = DateTime.MinValue;
        }
Esempio n. 41
0
 public DropReq( Serial s, Point3D pt )
 {
     Serial = s; Point = pt;
 }
Esempio n. 42
0
 public static void DragDrop( Item i, Serial to )
 {
     Drag( i, i.Amount );
     Drop( i, to, Point3D.MinusOne );
 }
Esempio n. 43
0
 public LiftReq( Serial s, int a, bool cli, bool last )
 {
     Serial = s;
     Amount = a;
     FromClient = cli;
     DoLast = last;
     Id = NextID++;
 }
Esempio n. 44
0
 private static void PartyAutoDecline()
 {
     PartyLeader = Serial.Zero;
 }