public virtual void AddExp(Mobile killer, Mobile killed) { if (killer == null | killed == null) { return; } if (killer is PlayerMobile && killed is PlayerMobile) { return; } if (killed is BaseCreature && (((BaseCreature)killed).Summoned | ((BaseCreature)killed).IsAnimatedDead)) { return; } bool frompet = false; if (killer is BaseCreature && (((BaseCreature)killer).Controlled || ((BaseCreature)killer).BardProvoked || ((BaseCreature)killer).Summoned || ((BaseCreature)killer).IsAnimatedDead || ((BaseCreature)killer).IsNecroFamiliar)) { //Pet Exp frompet = true; if (((BaseCreature)killer).Controlled) { AddExp(killer, killed, GetExp(killer, killed)); killer = ((BaseCreature)killer).GetMaster(); } else if (((BaseCreature)killer).BardProvoked && ((BaseCreature)killer).BardMaster != null) { killer = ((BaseCreature)killer).BardMaster; } else if (((BaseCreature)killer).Summoned && ((BaseCreature)killer).SummonMaster != null) { killer = ((BaseCreature)killer).SummonMaster; } else if (((BaseCreature)killer).ControlMaster != null) { killer = ((BaseCreature)killer).ControlMaster; } else { return; } } if (killer != null) { if (!frompet) { AddExp(killer, killed, GetExp(killer, killed)); } else { CombatLevel level = (CombatLevel)LSGovernor.GetAttached(killer.Serial, typeof(CombatLevel)); level.AddExp(killer, killed); } } }
public static void Login_Event(LoginEventArgs e) { LSGovernor.AttachLevelables(e.Mobile.Serial); int totalexp = 0; CombatLevel combat = (CombatLevel)LSGovernor.GetAttached(e.Mobile.Serial, typeof(CombatLevel)); for (int i = 0; i < combat.Level; i++) { totalexp += combat.LevelsAt[i]; } if (combat.TotalExp < totalexp) { combat.TotalExp = totalexp; } }
public virtual void AddExp(Mobile killer, Mobile killed, int amount) { if (killer is BaseCreature) { if (!CreaturesLevel | !((BaseCreature)killer).Controlled) { return; } if (((BaseCreature)killer).BardProvoked || ((BaseCreature)killer).Summoned) { return; } } Party p = Party.Get(killer); if (p == null || p.Members.Count <= 1 || !m_PartyShareExp) { //Give Exp CombatLevel combat = (CombatLevel)LSGovernor.GetAttached(killer.Serial, typeof(CombatLevel)); combat.AddExp((int)Filter(killer, killed, amount)); } else { int killerLevel = 0, inRange = 0; { //Get Killer Level CombatLevel combat = (CombatLevel)LSGovernor.GetAttached(killer.Serial, typeof(CombatLevel)); killerLevel = combat.Level; //Get People In Range foreach (PartyMemberInfo mi in p.Members) { PlayerMobile pm = (PlayerMobile)mi.Mobile; if (pm.Alive && pm.InRange(killed, m_PartyShareRange)) { inRange++; } } } //Split Exp if (m_PartyShareEvenly && amount > 0) { amount = (int)((amount + (amount * (.3 * inRange))) / inRange); } //Give Each Exp foreach (PartyMemberInfo mi in p.Members) { PlayerMobile pm = (PlayerMobile)mi.Mobile; //Skip If Not Qualified if (pm.Class == Class.Crafter || !pm.Alive || !pm.InRange(killed, m_PartyShareRange)) { continue; } //Give Exp If Not 'Power Leveler' CombatLevel combat = (CombatLevel)LSGovernor.GetAttached(pm.Serial, typeof(CombatLevel)); if (combat.Level >= (killerLevel - m_PowerLevelRange)) { combat.AddExp((int)Filter(pm, killed, amount)); } } } }