private static void EventSink_Login(LoginEventArgs args) { Mobile m = args.Mobile; if (args.Mobile.NetState == null) { return; } if (m is PlayerMobile) { PlayerMobile pm = (PlayerMobile)m; Configured c = new Configured(); XMLNewPlayer xmlnewplayers = (XMLNewPlayer)XmlAttach.FindAttachment(m, typeof(XMLNewPlayer)); if (xmlnewplayers != null) { if (c.LowLevelBonus == false) { XMLNewPlayer xmldel = (XMLNewPlayer)XmlAttach.FindAttachment(m, typeof(XMLNewPlayer)); xmldel.Delete(); } else { return; } } else { if (m is PlayerMobile && c.LowLevelBonus) { XmlAttach.AttachTo(m, new XMLNewPlayer()); } else { return; } } } }
public static void DoLevel(Mobile klr, Configured c) { XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(klr, typeof(XMLPlayerLevelAtt)); PlayerMobile pm = klr as PlayerMobile; LevelHandler lh = new LevelHandler(); ConfiguredSkills cs = new ConfiguredSkills(); if (xmlplayer.Expp >= xmlplayer.ToLevell) { xmlplayer.Expp = 0; xmlplayer.kxp = 0; xmlplayer.Levell += 1; int totalStats = pm.RawDex + pm.RawInt + pm.RawStr; if (xmlplayer.Levell <= 20) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L2to20Multipier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below20; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below20Stat; } } else if (xmlplayer.Levell <= 40) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L21to40Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below40; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below40Stat; } } else if (xmlplayer.Levell <= 60) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L41to60Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below60; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below60Stat; } } else if (xmlplayer.Levell <= 70) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L61to70Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below70; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below70Stat; } } else if (xmlplayer.Levell <= 80) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L71to80Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below80; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below80Stat; } } else if (xmlplayer.Levell <= 90) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L81to90Multipier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below90; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below90Stat; } } else if (xmlplayer.Levell <= 100) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L91to100Multipier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below100; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below100Stat; } } else if (xmlplayer.Levell <= 110) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L101to110Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below110; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below110Stat; } } else if (xmlplayer.Levell <= 120) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L111to120Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below120; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below120Stat; } } else if (xmlplayer.Levell <= 130) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L121to130Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below130; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below130Stat; } } else if (xmlplayer.Levell <= 140) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L131to140Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below140; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below140Stat; } } else if (xmlplayer.Levell <= 150) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L141to150Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below150; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below150Stat; } } else if (xmlplayer.Levell <= 160) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L151to160Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below160; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below160Stat; } } else if (xmlplayer.Levell <= 170) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L161to170Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below170; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below170Stat; } } else if (xmlplayer.Levell <= 180) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L171to180Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below180; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below180Stat; } } else if (xmlplayer.Levell <= 190) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L181to190Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below190; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below190Stat; } } else if (xmlplayer.Levell <= 200) { xmlplayer.ToLevell = (int)(xmlplayer.Levell * c.L191to200Multiplier); if (pm.SkillsTotal < cs.SkillsTotal) { xmlplayer.SKPoints += cs.Below200; } if (totalStats < cs.MaxStatPoints) { xmlplayer.StatPoints += cs.Below200Stat; } } if (xmlplayer.Levell >= c.WhatLevelToDelete) { XMLNewPlayer xmlnewplayer = (XMLNewPlayer)XmlAttach.FindAttachment(klr, typeof(XMLNewPlayer)); if (xmlnewplayer != null) { xmlnewplayer.Delete(); XmlAttach.AttachTo(klr, new XMLNewPlayer()); } } if (cs.GainFollowerSlotOnLevel == true) { if (xmlplayer.Levell == 20 && cs.GainOn20 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel20; } if (xmlplayer.Levell == 30 && cs.GainOn30 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel30; } if (xmlplayer.Levell == 40 && cs.GainOn40 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel40; } if (xmlplayer.Levell == 50 && cs.GainOn50 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel50; } if (xmlplayer.Levell == 60 && cs.GainOn60 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel60; } if (xmlplayer.Levell == 70 && cs.GainOn70 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel70; } if (xmlplayer.Levell == 80 && cs.GainOn80 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel80; } if (xmlplayer.Levell == 90 && cs.GainOn90 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel90; } if (xmlplayer.Levell == 100 && cs.GainOn100 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel100; } if (xmlplayer.Levell == 110 && cs.GainOn110 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel110; } if (xmlplayer.Levell == 120 && cs.GainOn120 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel120; } if (xmlplayer.Levell == 130 && cs.GainOn130 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel130; } if (xmlplayer.Levell == 140 && cs.GainOn140 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel140; } if (xmlplayer.Levell == 150 && cs.GainOn150 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel150; } if (xmlplayer.Levell == 160 && cs.GainOn160 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel160; } if (xmlplayer.Levell == 170 && cs.GainOn170 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel170; } if (xmlplayer.Levell == 180 && cs.GainOn180 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel180; } if (xmlplayer.Levell == 190 && cs.GainOn190 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel190; } if (xmlplayer.Levell == 200 && cs.GainOn200 == true) { klr.FollowersMax += cs.GainFollowerSlotOnLevel200; } } } if (c.RefreshOnLevel) { if (pm.Hits < pm.HitsMax) { pm.Hits = pm.HitsMax; } if (pm.Mana < pm.ManaMax) { pm.Mana = pm.ManaMax; } if (pm.Stam < pm.StamMax) { pm.Stam = pm.StamMax; } } pm.PlaySound(0x20F); pm.FixedParticles(0x376A, 1, 31, 9961, 1160, 0, EffectLayer.Waist); pm.FixedParticles(0x37C4, 1, 31, 9502, 43, 2, EffectLayer.Waist); pm.SendMessage("Your level has increased"); xmlplayer.Expp = 0; xmlplayer.kxp = 0; if (pm.HasGump(typeof(ExpBar))) { /* updates EXPBar */ pm.CloseGump(typeof(ExpBar)); pm.SendGump(new ExpBar(pm)); } }