Ejemplo n.º 1
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;
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 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;
        }