Пример #1
0
        public static void CheckSpawn(Mobile killer, Mobile victim)
        {
            if (killer != null && victim != null)
            {
                PlayerState ps = PlayerState.Find(victim);

                if (ps != null)
                {
                    int chance = ps.Rank.Rank;

                    if (chance > Utility.Random(100))
                    {
                        int weight = 0;

                        foreach (WeightedItem item in _items)
                        {
                            weight += item.Weight;
                        }

                        weight = Utility.Random(weight);

                        foreach (WeightedItem item in _items)
                        {
                            if (weight < item.Weight)
                            {
                                Item obj = item.Construct();

                                if (obj != null)
                                {
                                    killer.AddToBackpack(obj);

                                    killer.SendSound(1470);
                                    killer.LocalOverheadMessage(
                                        Server.Network.MessageType.Regular, 2119, false,
                                        "You notice a strange item on the corpse, and decide to pick it up."
                                        );

                                    try
                                    {
                                        using (StreamWriter op = new StreamWriter("faction-power-items.log", true))
                                        {
                                            op.WriteLine("{0}\t{1}\t{2}\t{3}", DateTime.UtcNow, killer, victim, obj);
                                        }
                                    }
                                    catch
                                    {
                                    }
                                }

                                break;
                            }
                            else
                            {
                                weight -= item.Weight;
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        private static void EventSink_GuildGumpRequest(GuildGumpRequestArgs e)
        {
            Mobile beholder = e.Mobile;

            if (Core.SE)
            {
                Guild guild = beholder.Guild as Guild;

                if (beholder.Map == beholder.Map && beholder.InRange(beholder, 12))
                {
                    if (guild == null || guild.Disbanded)
                    {
                        beholder.CloseGump(typeof(JoinGuildGump));

                        beholder.SendGump(new JoinGuildGump(beholder, guild));
                    }
                    else if (guild.Accepted.Contains(beholder))
                    {
                        #region Factions
                        PlayerState guildState = PlayerState.Find(guild.Leader);

                        PlayerState targetState = PlayerState.Find(beholder);

                        Faction guildFaction = (guildState == null ? null : guildState.Faction);

                        Faction targetFaction = (targetState == null ? null : targetState.Faction);

                        if (guildFaction != targetFaction || (targetState != null && targetState.IsLeaving))
                        {
                            return;
                        }

                        if (guildState != null && targetState != null)
                        {
                            targetState.Leaving = guildState.Leaving;
                        }
                        #endregion

                        guild.Accepted.Remove(beholder);

                        guild.AddMember(beholder);

                        (beholder as PlayerMobile).GuildRank = 1;

                        beholder.CloseGump(typeof(SEGuildGump));

                        beholder.SendGump(new SEGuildGump(beholder, guild));
                    }
                    else
                    {
                        beholder.SendGump(new SEGuildGump(beholder, guild));
                    }
                }
            }
            else
            {
                beholder.SendLocalizedMessage(1063363);                   // * Requires the "Samurai Empire" expansion

                return;
            }
        }
Пример #3
0
        public PlayerDetailGump(PlayerMobile from, PlayerMobile mobile)
        {
            _from   = from;
            _mobile = mobile;

            Width = 320;

            int n = Notoriety.Compute(from, mobile);

            int notoColor = _notorietyColors[n];

            AddBorderedText(20, 18, Width - 40, 20, Center(mobile.Name ?? "Unknown"), notoColor, BlackColor32);

            AddSeperator(30, 40, Width - 60);

            const int LabelOffset = 20;
            const int LabelWidth  = 55;

            const int ValueOffset = 25 + LabelWidth;
            int       ValueWidth  = Width - (20 + ValueOffset);

            int y = 44;

            PlayerMobile pm = mobile as PlayerMobile;

            Guild guild = mobile.Guild as Guild;

            if (guild != null)
            {
                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Guild:"), LabelColor32, BlackColor32);

                AddBorderedText(ValueOffset, y, ValueWidth, 20, guild.Name ?? "Unknown", WhiteColor32, BlackColor32);
                y += 20;
            }

            if (mobile.PublicMyRunUO && mobile.Kills >= 5)
            {
                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Kills:"), LabelColor32, BlackColor32);
                AddBorderedText(ValueOffset, y, ValueWidth, 20, mobile.Kills.ToString("N0"), WhiteColor32, BlackColor32);

                y += 20;
            }

            Account acct = mobile.Account as Account;

            if (acct != null)
            {
                TimeSpan age = DateTime.UtcNow - acct.Created;

                int ageInDays = ( int )age.TotalDays;

                int ageInYears  = ((ageInDays + 162) / 365);
                int ageInMonths = ((ageInDays + 15) / 30);
                int ageInWeeks  = ((ageInDays + 3) / 7);

                string ageString;

                if (ageInYears > 0)
                {
                    ageString = String.Format("{0:N0} year{1}", ageInYears, ageInYears == 1?"":"s");
                }
                else if (ageInMonths > 1)
                {
                    ageString = String.Format("{0:N0} month{1}", ageInMonths, ageInMonths == 1?"":"s");
                }
                else if (ageInWeeks > 1)
                {
                    ageString = String.Format("{0:N0} week{1}", ageInWeeks, ageInWeeks == 1?"":"s");
                }
                else
                {
                    ageString = String.Format("Newbie", ageInDays, ageInDays == 1?"":"s");
                }



                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Age:"), LabelColor32, BlackColor32);
                AddBorderedText(ValueOffset, y, ValueWidth, 20, ageString, WhiteColor32, BlackColor32);

                y += 20;
            }

            PlayerState ps = PlayerState.Find(mobile);

            if (ps != null)
            {
                Faction fac = ps.Faction;

                //AddItem( Width - 51, 7, 5535, (fac.Definition.HueSecondary ^ 0x0000) - 1 );
                AddItem(7, 7, 5534, (fac.Definition.HuePrimary ^ 0x0000) - 1);

                y += 8;

                AddBorderedText(LabelOffset, y, LabelWidth + ValueWidth, 20, fac.Definition.FriendlyName, WhiteColor32, BlackColor32);

                y += 21;
                AddSeperator(30, y, Width - 60);
                y += 3;

                string rank = String.Format(
                    "Level {0} {1}",
                    ps.Rank.Rank,
                    ps.Rank.Title.String
                    );

                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Rank:"), LabelColor32, BlackColor32);
                AddBorderedText(ValueOffset, y, ValueWidth, 20, rank, WhiteColor32, BlackColor32);
                y += 20;

                AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Points:"), LabelColor32, BlackColor32);
                AddBorderedText(ValueOffset, y, ValueWidth, 20, String.Format("{0:N0}", ps.KillPoints), WhiteColor32, BlackColor32);
                y += 20;
            }

            Ladder instance = Ladder.Instance;

            if (instance != null)
            {
                LadderEntry entry = instance.Find(mobile);

                if (entry != null && (entry.Wins + entry.Losses) > 0)
                {
                    y += 8;

                    AddBorderedText(LabelOffset, y, LabelWidth + ValueWidth, 20, "Duelist", WhiteColor32, BlackColor32);

                    y += 21;
                    AddSeperator(30, y, Width - 60);
                    y += 3;

                    string rank = LadderGump.Rank(entry.Index + 1);

                    AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Rank:"), LabelColor32, BlackColor32);
                    AddBorderedText(ValueOffset, y, ValueWidth, 20, rank, WhiteColor32, BlackColor32);
                    y += 20;

                    AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Level:"), LabelColor32, BlackColor32);
                    AddBorderedText(ValueOffset, y, ValueWidth, 20, Ladder.GetLevel(entry.Experience).ToString("N0"), WhiteColor32, BlackColor32);
                    y += 20;

                    AddBorderedText(LabelOffset, y, LabelWidth, 20, Right("Matches:"), LabelColor32, BlackColor32);
                    AddBorderedText(ValueOffset, y, ValueWidth, 20, String.Format("{0:N0}", (entry.Wins + entry.Losses)), WhiteColor32, BlackColor32);
                    y += 20;
                }
            }

            Height = y + 12;

            Ethic ethic = Ethic.Find(mobile);

            if (ethic == Ethic.Hero)
            {
                AddItem(Width - 36, Height - 26, 7188);
            }
            else if (ethic == Ethic.Evil)
            {
                AddItem(Width - 35, Height - 36, 6232);
            }
        }