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; }
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); }
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); }
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); } } }
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; }