예제 #1
0
        public static void AddPendingItem(Mobile m, Item item)
        {
            if (PendingItems == null)
            {
                PendingItems = new Dictionary <Mobile, List <Item> >();
            }

            if (!PendingItems.ContainsKey(m))
            {
                PendingItems[m] = new List <Item>();
            }

            PendingItems[m].Add(item);
            UltimaStoreContainer.DropItem(item);
        }
예제 #2
0
        public static void CheckPendingItem(Mobile m)
        {
            if (PendingItems == null)
            {
                return;
            }

            if (PendingItems.ContainsKey(m))
            {
                var list = new List <Item>(PendingItems[m]);

                foreach (Item item in list)
                {
                    if (item != null)
                    {
                        if (m.Backpack != null && m.Alive && m.Backpack.TryDropItem(m, item, false))
                        {
                            if (item is IPromotionalToken && ((IPromotionalToken)item).ItemName != null)
                            {
                                m.SendLocalizedMessage(1075248, ((IPromotionalToken)item).ItemName.ToString()); // A token has been placed in your backpack. Double-click it to redeem your ~1_PROMO~.
                            }
                            else if (item.LabelNumber > 0 || item.Name != null)
                            {
                                m.SendLocalizedMessage(1156844, item.LabelNumber > 0 ? String.Format("#{0}", item.LabelNumber.ToString()) : item.Name);
                                // Your purchase of ~1_ITEM~ has been placed in your backpack.
                            }
                            else
                            {
                                m.SendLocalizedMessage(1156843); // Your purchased item has been placed in your backpack.
                            }

                            PendingItems[m].Remove(item);
                        }
                    }
                }

                ColUtility.Free(list);

                if (PendingItems[m].Count == 0)
                {
                    PendingItems.Remove(m);
                }
            }
        }
예제 #3
0
 public static bool HasPendingItem(PlayerMobile pm)
 {
     return(PendingItems.ContainsKey(pm));
 }