Profiencies Bug:
I get this error:
here are the voids I get the errors in ( errors marked in red ):Quote:
System.NullReferenceException: Object not set to an instance of an object
Code:
public void AddProfExp(ushort Wep, uint Amount)
{
[COLOR="DarkRed"]if (Profs.Contains(Wep))[/COLOR]
{
Prof P = (Prof)Profs[Wep];
if (P.Lvl < 20)
{
Profs.Remove(Wep);
Amount *= World.Server.ProfExpRate;
P.Exp += Amount;
if (P.Exp >= Database.ProfExp[P.Lvl])
{
P.Lvl++;
P.Exp = 0;
MyClient.LocalMessage(2000, System.Drawing.Color.Yellow, "Your proficiency level has gone up!.");
Database.SaveProfs(P, this);
}
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);
}
}
Code:
Attacker.IncreaseExp(MaxHP / 10, false);
if (!IsSkill)
{
if (AT == AttackType.Ranged || AT == AttackType.Melee || AT == AttackType.FatalStrike)
{
if (Attacker.Equips.RightHand.ID != 0)
[COLOR="#8b0000"]Attacker.AddProfExp((ushort)Game.ItemIDManipulation.Part(Attacker.Equips.RightHand.ID, 0, 3), Benefit);
[/COLOR] if (Attacker.Equips.LeftHand.ID != 0)
Attacker.AddProfExp((ushort)Game.ItemIDManipulation.Part(Attacker.Equips.LeftHand.ID, 0, 3), Benefit / 3 * 2);
}
}
Code:
if (PossMob != null && PossMob.Alive && (MyMath.PointDistance(GC.MyChar.Loc.X, GC.MyChar.Loc.Y, PossMob.Loc.X, PossMob.Loc.Y) <= 3 || AttackType == 28 && MyMath.PointDistance(GC.MyChar.Loc.X, GC.MyChar.Loc.Y, PossMob.Loc.X, PossMob.Loc.Y) <= 15 || GC.MyChar.StatEff.Contains(Game.StatusEffectEn.FatalStrike)))
{
if (!GC.MyChar.WeaponSkill(PossMob.Loc.X, PossMob.Loc.Y, PossMob.EntityID))
[COLOR="#8b0000"]PossMob.TakeAttack(GC.MyChar, ref Damage, (Game.AttackType)AttackType, false);[/COLOR]
}






