Пример #1
0
        public bool TryTurnIn(Mobile from, TradeOrderCrate order, Mobile turninMobile)
        {
            if (order == null || from == null || turninMobile == null || order.Entry == null)
            {
                return(false);
            }

            TradeEntry    entry    = order.Entry;
            TradeMinister minister = turninMobile as TradeMinister;

            if (from.AccessLevel == AccessLevel.Player && minister != null && minister.City != entry.Destination)
            {
                turninMobile.SayTo(from, 1151738, string.Format("#{0}", CityLoyaltySystem.GetCityLocalization(entry.Destination))); // Begging thy pardon, but those goods are destined for the City of ~1_city~
            }
            else if (!order.Fulfilled)
            {
                turninMobile.SayTo(from, 1151732); // This trade order has not been fulfilled.  Fill the trade order with all necessary items and try again.
            }
            else
            {
                CityLoyaltySystem.OnTradeComplete(from, order.Entry);
                CityTradeEntry pentry = GetPlayerEntry <CityTradeEntry>(from as PlayerMobile);

                if (pentry != null)
                {
                    pentry.Points++;
                    pentry.DistanceTraveled += entry.Distance;
                    pentry.Completed++;
                    CheckTitle(pentry);
                }

                order.Delete();
                return(true);
            }

            return(false);
        }