コード例 #1
0
ファイル: Portals.cs プロジェクト: greeduomacro/UO-Forever
        public static PlayerPortalProfile EnsureProfile(PlayerMobile pm)
        {
            PlayerPortalProfile p;

            if (!PlayerProfiles.TryGetValue(pm, out p))
            {
                PlayerProfiles.Add(pm, p = new PlayerPortalProfile(pm));
            }
            else if (p == null)
            {
                PlayerProfiles[pm] = p = new PlayerPortalProfile(pm);
            }

            return p;
        }
コード例 #2
0
        public static PlayerPortalProfile EnsureProfile(PlayerMobile pm)
        {
            PlayerPortalProfile p;

            if (!PlayerProfiles.TryGetValue(pm, out p))
            {
                PlayerProfiles.Add(pm, p = new PlayerPortalProfile(pm));
            }
            else if (p == null)
            {
                PlayerProfiles[pm] = p = new PlayerPortalProfile(pm);
            }

            return(p);
        }
コード例 #3
0
ファイル: Portals_Init.cs プロジェクト: zerodowned/UO-Forever
        private static bool DeserializePlayerProfiles(GenericReader reader)
        {
            reader.GetVersion();

            reader.ReadBlockDictionary(
                () =>
            {
                var e = reader.ReadMobile <PlayerMobile>();

                var p = new PlayerPortalProfile(reader);

                return(new KeyValuePair <PlayerMobile, PlayerPortalProfile>(e, p));
            },
                PlayerProfiles);

            return(true);
        }
コード例 #4
0
        public void AddScore(Mobile damager, int amount)
        {
            Mobile creditMob = null;

            if (damager is BaseCreature)
            {
                var bc = (BaseCreature)damager;

                if (bc.ControlMaster is PlayerMobile)
                {
                    creditMob = bc.ControlMaster;
                }
                else if (bc.SummonMaster is PlayerMobile)
                {
                    creditMob = bc.SummonMaster;
                }
                else if (bc.BardMaster is PlayerMobile)
                {
                    creditMob = bc.BardMaster;
                }
            }
            else if (damager is PlayerMobile)
            {
                creditMob = damager;
            }

            if (creditMob != null)
            {
                PlayerPortalProfile profile = Portals.EnsureProfile(creditMob as PlayerMobile);
                profile.AddScore(amount, this);
                if (ParticipantsScores.ContainsKey(creditMob as PlayerMobile))
                {
                    ParticipantsScores[creditMob as PlayerMobile] += amount;
                }
                else
                {
                    ParticipantsScores.Add(creditMob as PlayerMobile, amount);
                }
            }
        }
コード例 #5
0
        private static bool DeserializePlayerProfiles(GenericReader reader)
        {
            reader.GetVersion();

            reader.ReadBlockDictionary(
                () =>
                {
                    var e = reader.ReadMobile<PlayerMobile>();

                    var p = new PlayerPortalProfile(reader);

                    return new KeyValuePair<PlayerMobile, PlayerPortalProfile>(e, p);
                },
                PlayerProfiles);

            return true;
        }