示例#1
0
        /*
         #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());
                        }
                    }
                }
            }
        }
示例#2
0
        public static int TExpPet(BaseCreature bc)
        {
            XMLPetLevelAtt petxml = (XMLPetLevelAtt)XmlAttach.FindAttachment(bc, typeof(XMLPetLevelAtt));


            return(petxml.kxp + LevelCore.GetExp(bc));
        }
        public static int Classic(Mobile from)
        {
            XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(from, typeof(XMLPlayerLevelAtt));
            PlayerMobile      pm        = from as PlayerMobile;

            int exp      = LevelCore.GetExp(pm);//LevelCore.Stats(pm) + LevelCore.Skills(pm);
            int ToLevell = (int)(xmlplayer.Levell * 100);
            int highest  = 100;

            if (Cl.Enabled)
            {
                if (exp >= ToLevell && xmlplayer.Levell != highest)
                {
                    xmlplayer.Levell  += 1;
                    xmlplayer.ToLevell = (int)(xmlplayer.Levell * 100);

                    if (exp >= ToLevell)
                    {
                        LevelHandler.Classic(pm);
                    }

                    return(exp);
                }
                return(exp);
            }
            return(0);
        }
示例#4
0
        public static int TExp(Mobile m)
        {
            XMLPlayerLevelAtt xmlplayer = (XMLPlayerLevelAtt)XmlAttach.FindAttachment(m, typeof(XMLPlayerLevelAtt));
            PlayerMobile      pm        = m as PlayerMobile;

            if (Cl.Enabled)
            {
                return(LevelHandler.Classic(pm));
            }
            else if (En.Enabled)
            {
                return(xmlplayer.kxp + LevelCore.GetExp(pm));
            }
            else
            {
                return(xmlplayer.kxp);
            }
        }
示例#5
0
        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());
                }
            }
        }
示例#6
0
        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());
                    }
                }
            }
        }