/* #region Level System Taming * XMLPetLevelAtt xmlpet = (XMLPetLevelAtt)XmlAttach.FindAttachment(this, typeof(XMLPetLevelAtt)); * Configured c = new Configured(); * ConfiguredPetXML cp = new ConfiguredPetXML(); * if (c.TamingGivesExp == true) * LevelCore.Taming(tamer); #endregion */ public static void Harvest(Mobile m, Item i, HarvestDefinition def, Map map, Point3D loc, HarvestResource resource) { Configured c = new Configured(); //LevelCore.Harvest(tool , from, new Configured()); XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(m, typeof(XMLPlayerLevelAtt)); PlayerMobile pm = m as PlayerMobile; LevelHandler lh = new LevelHandler(); if (xmlplayer == null) { return; } else { if (xmlplayer.Expp < xmlplayer.ToLevell) { int xp = (int)Math.Round(2 + (LevelCore.HarvestExp(m, i, def, map, loc, resource))); int give = LevelHandler.ExpFilter(pm, xp, null, true); if (give > 0) { pm.SendMessage("You gained {0} experience for harvesting some Resources.", give); xmlplayer.kxp += (int)give; if (xmlplayer.Expp >= xmlplayer.ToLevell && xmlplayer.Levell < xmlplayer.MaxLevel) { LevelHandler.DoLevel(pm, new Configured()); } } } } }
public static void Craft(Item i, int q, double ch, double e, Mobile m, Configured c) { XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(m, typeof(XMLPlayerLevelAtt)); PlayerMobile pm = m as PlayerMobile; LevelHandler lh = new LevelHandler(); if (xmlplayer.Expp < xmlplayer.ToLevell) { int xp = (int)Math.Round(3.6 + (LevelCore.CraftExp(i, q, ch, e, pm))); int give = LevelHandler.ExpFilter(pm, xp, null, true); if (give > 0) { pm.SendMessage("You gained {0} experience for crafting an item.", give); xmlplayer.kxp += (int)give; if (xmlplayer.Expp >= xmlplayer.ToLevell && xmlplayer.Levell < xmlplayer.MaxLevel) { LevelHandler.DoLevel(pm, 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()); } } } }