Public Void

07/29/2010 19:52 Zkiller110#1
just a quick question here im working on a 5165 server and im making a public void for setting the lvl of a weapons prof i got it to work but im asking what is extra unneeded code in this all i basicly did was copied the AddProfExp

Code:
        public void ProfLvl(ushort Wep, byte Level)
        {
            if (Profs.Contains(Wep))
            {
                Prof P = (Prof)Profs[Wep];
                if (P.Lvl < 20)
                {
                    Profs.Remove(Wep);
                    P.Lvl = Level;
                    if (P.Exp >= Database.ProfExp[P.Lvl])
                    {
                        P.Lvl++;
                        P.Exp = 0;
                        MyClient.LocalMessage(2000, "Your proficiency level has increased.");
                    }
                    Profs.Add(Wep, P);
                    MyClient.AddSend(Packets.Prof(P));
                }
            }
            else
            {
                Prof P = new Prof();
                P.ID = Wep;
                P.Lvl = 0;
                P.Exp = 0;
                NewProf(P);
            }
        }
07/29/2010 20:44 CptSky#2
You don't need to check the Exp. Just set the level to the specified one and just set the exp to 0.
07/29/2010 21:14 Zkiller110#3
ok thanks