public static void AddExp(Mobile m, Mobile k, Party p, Configured c) { BaseCreature bc = (BaseCreature)m; XMLPetLevelAtt petxml = (XMLPetLevelAtt)XmlAttach.FindAttachment(bc, typeof(XMLPetLevelAtt)); ConfiguredPetXML cp = new ConfiguredPetXML(); PlayerMobile pm = null; LevelHandlerPet lh = new LevelHandlerPet(); Mobile cm = bc.ControlMaster; double orig = 0; //Monster Xp double fig = 0; //Party Xp double give = 0; //Xp To Give if (k != null) { orig = LevelCore.Base(k); } fig = orig; if (fig > 0) { give = LevelHandlerPet.ExpFilter(m, fig, p, false); } if (give > 0) { if (cp.NotifyOnPetExpGain == true) { cm.SendMessage("{0} gained " + give + " exp for the kill!", bc.Name); } petxml.kxp += (int)give; if (petxml.Expp >= petxml.ToLevell && petxml.Levell < petxml.MaxLevel) { DoLevel(bc, new Configured()); } } }
public static void AddExp(Mobile m, Mobile k, Party p, Configured c) { XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(m, typeof(XMLPlayerLevelAtt)); ExpPowerHour exppower = (ExpPowerHour)XmlAttach.FindAttachment(m, typeof(ExpPowerHour)); PlayerMobile pm = null; LevelHandler lh = new LevelHandler(); int range = c.PartyRange; double orig = 0; //Monster Xp double fig = 0; //Party Xp double give = 0; //Xp To Give if (k != null) { orig = LevelCore.Base(k); } if (p != null && c.PartyExpShare) { if (c.PartySplitExp) { foreach (PartyMemberInfo mi in p.Members) { pm = mi.Mobile as PlayerMobile; if (pm.InRange(k, range) && lh.MemberCount.Count < 6) { lh.MemberCount.Add(pm); } } if (lh.MemberCount.Count > 1) { fig = (orig / lh.MemberCount.Count); } } else { pm = m as PlayerMobile; fig = orig; } } else { pm = m as PlayerMobile; fig = orig; } if (fig > 0) { give = LevelHandler.ExpFilter(pm, fig, p, false); } if (give > 0) { #region PartyExpShare if (p != null && c.PartyExpShare) { foreach (PartyMemberInfo mi in p.Members) { pm = mi.Mobile as PlayerMobile; if (pm.Alive && pm.InRange(k, range)) { XMLPlayerLevelAtt xmlplayerparty = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(pm, typeof(XMLPlayerLevelAtt)); ExpPowerHour exppowerparty = (ExpPowerHour)XmlAttach.FindAttachment(pm, typeof(ExpPowerHour)); if (xmlplayerparty == null) { return; } else { if (exppowerparty != null) { pm.SendMessage("You gained " + (give + c.ExpPowerAmount) + " boosted exp for the party kill!"); xmlplayerparty.kxp += (int)give + c.ExpPowerAmount; if (pm.HasGump(typeof(ExpBar))) { pm.CloseGump(typeof(ExpBar)); pm.SendGump(new ExpBar(pm)); } if (xmlplayerparty.Expp >= xmlplayerparty.ToLevell && xmlplayerparty.Levell < xmlplayerparty.MaxLevel) { DoLevel(pm, new Configured()); } } else { pm.SendMessage("You gained " + give + " exp for the party kill!"); xmlplayerparty.kxp += (int)give; if (pm.HasGump(typeof(ExpBar))) { pm.CloseGump(typeof(ExpBar)); pm.SendGump(new ExpBar(pm)); } if (xmlplayerparty.Expp >= xmlplayerparty.ToLevell && xmlplayerparty.Levell < xmlplayerparty.MaxLevel) { DoLevel(pm, new Configured()); } } } } } } #endregion else { if (exppower != null) { pm.SendMessage("You gained " + (give + c.ExpPowerAmount) + " boosted exp for the kill!"); xmlplayer.kxp += (int)give + c.ExpPowerAmount; } else { pm.SendMessage("You gained " + give + " exp for the kill!"); xmlplayer.kxp += (int)give; } if (pm.HasGump(typeof(ExpBar))) { pm.CloseGump(typeof(ExpBar)); pm.SendGump(new ExpBar(pm)); } if (xmlplayer.Expp >= xmlplayer.ToLevell && xmlplayer.Levell < xmlplayer.MaxLevel) { DoLevel(pm, new Configured()); } } } }