コード例 #1
0
ファイル: CityLoyaltySystem.cs プロジェクト: UODOC/MyShard
        public static bool ApplyCityTitle(PlayerMobile pm, ObjectPropertyList list, string prefix, int loc)
        {
            if (loc == 1154017)
            {
                CityLoyaltySystem city = GetCitizenship(pm);

                if (city != null)
                {
                    CityLoyaltyEntry entry = city.GetPlayerEntry <CityLoyaltyEntry>(pm, true);

                    if (entry != null && !String.IsNullOrEmpty(entry.CustomTitle))
                    {
                        prefix = String.Format("{0} {1} the {2}", prefix, pm.Name, entry.CustomTitle);
                        list.Add(1154017, String.Format("{0}\t{1}", prefix, city.Definition.Name)); // ~1_TITLE~ of ~2_CITY~
                        return(true);
                    }
                }
            }
            else
            {
                list.Add(1151487, "{0} \t{1} the \t#{2}", prefix, pm.Name, loc); // ~1NT_PREFIX~~2NT_NAME~~3NT_SUFFIX~
                return(true);
            }

            return(false);
        }
コード例 #2
0
ファイル: CityLoyaltySystem.cs プロジェクト: UODOC/MyShard
        public static void OnLogin(LoginEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            CityLoyaltySystem sys = GetCitizenship(pm);

            if (sys != null && sys.ActiveTradeDeal != TradeDeal.None)
            {
                CityLoyaltyEntry entry = sys.GetPlayerEntry <CityLoyaltyEntry>(pm, true);

                if (entry != null && entry.UtilizingTradeDeal)
                {
                    BuffInfo.AddBuff(pm, new BuffInfo(BuffIcon.CityTradeDeal, 1154168, 1154169, new TextDefinition((int)sys.ActiveTradeDeal), true));
                }
            }
        }
コード例 #3
0
        public static bool ApplyCityTitle(PlayerMobile pm, ref string prefix, ref string name, ref string suffix)
        {
            if (String.IsNullOrWhiteSpace(pm.OverheadTitle))
            {
                return(false);
            }

            var loc = Utility.ToInt32(pm.OverheadTitle);

            if (loc != 1154017)
            {
                return(false);
            }

            CityLoyaltySystem city = GetCitizenship(pm);

            if (city != null)
            {
                CityLoyaltyEntry entry = city.GetPlayerEntry <CityLoyaltyEntry>(pm, true);

                if (entry != null && !String.IsNullOrEmpty(entry.CustomTitle))
                {
                    if (!String.IsNullOrWhiteSpace(suffix) && !suffix.EndsWith(" "))
                    {
                        suffix += " ";
                    }

                    suffix += String.Format("the {0} of {1}", entry.CustomTitle, city.Definition.Name);

                    return(true);
                }
            }

            return(false);
        }
コード例 #4
0
ファイル: CityLoyaltySystem.cs プロジェクト: UODOC/MyShard
        public static bool HasTradeDeal(Mobile m, TradeDeal deal)
        {
            CityLoyaltySystem sys = GetCitizenship(m);

            if (sys != null)
            {
                CityLoyaltyEntry entry = sys.GetPlayerEntry <CityLoyaltyEntry>(m, true);

                return(sys.ActiveTradeDeal == deal && entry != null && entry.UtilizingTradeDeal);
            }

            return(false);
        }
コード例 #5
0
        public static void OnLogin(LoginEventArgs e)
        {
            if (!Enabled)
            {
                return;
            }

            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            CityLoyaltySystem sys = GetCitizenship(pm);

            if (sys != null)
            {
                if (sys.ActiveTradeDeal != TradeDeal.None)
                {
                    CityLoyaltyEntry entry = sys.GetPlayerEntry <CityLoyaltyEntry>(pm, true);

                    if (entry != null && entry.UtilizingTradeDeal)
                    {
                        BuffInfo.AddBuff(pm, new BuffInfo(BuffIcon.CityTradeDeal, 1154168, 1154169, new TextDefinition((int)sys.ActiveTradeDeal), true));
                    }
                }

                int message;

                if (pm.LastOnline + LoveAtrophyDuration > DateTime.UtcNow)
                {
                    message = 1152913; // The moons of Trammel and Felucca align to preserve your virtue status and city loyalty.
                }
                else
                {
                    message = 1152912; // The moons of Trammel and Felucca fail to preserve your virtue status and city loyalty.
                }

                Timer.DelayCall(TimeSpan.FromSeconds(.7), () =>
                {
                    pm.SendLocalizedMessage(message);
                });
            }
        }
コード例 #6
0
ファイル: CityLoyaltySystem.cs プロジェクト: UODOC/MyShard
        public static bool HasCustomTitle(PlayerMobile pm, out string str)
        {
            CityLoyaltySystem city = GetCitizenship(pm);

            str = null;

            if (city != null)
            {
                CityLoyaltyEntry entry = city.GetPlayerEntry <CityLoyaltyEntry>(pm, true);

                if (entry != null)
                {
                    str = String.Format("{0}\t{1}", entry.CustomTitle, city.Definition.Name);
                }
            }

            return(str != null);
        }