Exemple #1
0
		public static void Add_ItemInfo(ItemInfo itm_inf)
		{
            Globals.ItemLock.EnterWriteLock();
            try
            {
                if (Globals.gamedata.nearby_items.ContainsKey(itm_inf.ID))
                {
                    //already in the array
                    Globals.gamedata.nearby_items[itm_inf.ID] = itm_inf;
                }
                else
                {
                    if (itm_inf.DroppedBy == Globals.gamedata.my_char.TargetID)
                    {

                        //do nothing

                        //itm_inf.IsMine = true;
                        //Globals.l2net_home.Add_Text("My target with objid: " + itm_inf.DroppedBy + " dropped an item. IsMine = true", Globals.Green, TextType.BOT);
                    }
                    else
                    {
                        //bool is_party_target = false;

                        Globals.PartyLock.EnterReadLock();
                        try
                        {
                            foreach (PartyMember pl in Globals.gamedata.PartyMembers.Values)
                            {
                                CharInfo ch;

                                Globals.PlayerLock.EnterReadLock();
                                try
                                {
                                    ch = Util.GetChar(pl.ID);
                                }
                                finally
                                {
                                    Globals.PlayerLock.ExitReadLock();
                                }

                                /*
                                if (itm_inf.DroppedBy == ch.TargetID)
                                {
                                    is_party_target = true;
                                    break;
                                }
                                 */
                            }
                        }
                        finally
                        {
                            Globals.PartyLock.ExitReadLock();
                        }

                        /*if (!is_party_target)
                        {
                            itm_inf.IsMine = false;
                        }
                        else
                        {
                            itm_inf.IsMine = true;
                        }
                        //Globals.l2net_home.Add_Text("My target with objid: " + itm_inf.DroppedBy + " dropped an item. IsMine = false", Globals.Green, TextType.BOT);
                        */
                    }
                    Globals.gamedata.nearby_items.Add(itm_inf.ID, itm_inf);
                }
            }
            catch
            {
                //oh well
            }
            finally
            {
                Globals.ItemLock.ExitWriteLock();
            }

            Globals.l2net_home.timer_items.Start();
		}
Exemple #2
0
 public static void AddItem(ByteBuffer buffe)
 {
     ItemInfo itm_info = new ItemInfo();
     itm_info.Load(buffe);
     AddInfo.Add_ItemInfo(itm_info);
 }
Exemple #3
0
        public static void Add_ItemInfo(ItemInfo itm_inf)
        {
            Globals.ItemLock.EnterWriteLock();
            try
            {
                if (Globals.gamedata.nearby_items.ContainsKey(itm_inf.ID))
                {
                    //already in the array
                    Globals.gamedata.nearby_items[itm_inf.ID] = itm_inf;
                }
                else
                {
                    if (itm_inf.DroppedBy == Globals.gamedata.my_char.TargetID)
                    {

                        //do nothing

                        //itm_inf.IsMine = true;
                        //Globals.l2net_home.Add_Text("My target with objid: " + itm_inf.DroppedBy + " dropped an item. IsMine = true", Globals.Green, TextType.BOT);
                    }
                    else
                    {
                        //bool is_party_target = false;

                        Globals.PartyLock.EnterReadLock();
                        try
                        {
                            foreach (PartyMember pl in Globals.gamedata.PartyMembers.Values)
                            {
                                CharInfo ch;

                                Globals.PlayerLock.EnterReadLock();
                                try
                                {
                                    ch = Util.GetChar(pl.ID);
                                }
                                finally
                                {
                                    Globals.PlayerLock.ExitReadLock();
                                }

                                /*
                                if (itm_inf.DroppedBy == ch.TargetID)
                                {
                                    is_party_target = true;
                                    break;
                                }
                                 */
                            }
                        }
                        finally
                        {
                            Globals.PartyLock.ExitReadLock();
                        }

                        /*if (!is_party_target)
                        {
                            itm_inf.IsMine = false;
                        }
                        else
                        {
                            itm_inf.IsMine = true;
                        }
                        //Globals.l2net_home.Add_Text("My target with objid: " + itm_inf.DroppedBy + " dropped an item. IsMine = false", Globals.Green, TextType.BOT);
                        */
                    }
                    Globals.gamedata.nearby_items.Add(itm_inf.ID, itm_inf);
                }
            }
            catch
            {
                //oh well
            }
            finally
            {
                Globals.ItemLock.ExitWriteLock();
            }

            Globals.l2net_home.timer_items.Start();
        }