My problem is that the NPC is not doing what I want it to do. I don't notice any errors in the code. Control 6 is supposed to give me 3 "Points" for 10 Meteors. But instead it gives me 3 points but does not take away my Meteors. This is the case for most of the Controls. Can someone please look over this whole code and tell me if anything is wrong. I'm sure you can understand what the code is supposed to do just by reading it. But I've got something very wrong somewhere I just don't know what.
Code:
if (CurrentNPC == 4200)
{
if (Control == 1)
{
SendPacket(General.MyPackets.NPCSay("You wish to buy points? This is what I can give for your items."));
SendPacket(General.MyPackets.NPCLink("1 Point for 1,000,000 silvers.", 3));
SendPacket(General.MyPackets.NPCLink("14 Points for 140 CPs.", 4));
SendPacket(General.MyPackets.NPCLink("20 Points for 5000 VPs", 5));
SendPacket(General.MyPackets.NPCLink("3 Points for 10 Meteors", 6));
SendPacket(General.MyPackets.NPCLink("26 Points for a DragonBall", 7));
SendPacket(General.MyPackets.NPCLink("4 Points for 5 ExpBalls", 13));
SendPacket(General.MyPackets.NPCLink("100 Points for 1000 CPs", 14));
SendPacket(General.MyPackets.NPCLink("Nothing,thanks.", 255));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
if (Control == 2)
{
SendPacket(General.MyPackets.NPCSay("You wish to sell points? This is what I can give for your points."));
SendPacket(General.MyPackets.NPCLink("10000 VPs for 40 points", 8));
SendPacket(General.MyPackets.NPCLink("10 ExpBalls for 8 points.", 9));
SendPacket(General.MyPackets.NPCLink("DragonBall for 26 points", 10));
SendPacket(General.MyPackets.NPCLink("PrayingStone(M) for 28 Points", 11));
SendPacket(General.MyPackets.NPCLink("10,000,000 silvers for 10 Points", 12));
SendPacket(General.MyPackets.NPCLink("Nothing,thanks.", 255));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
if (Control == 3)
{
if (MyChar.Silvers >= 1000000)
{
MyChar.Points += 1;
MyChar.Silvers -= 1000000;
SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 4)
{
if (MyChar.CPs >= 140)
{
MyChar.Points += 14;
MyChar.CPs -= 140;
SendPacket(General.MyPackets.Vital(MyChar.UID, 30, MyChar.CPs));
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 5)
{
if (MyChar.VP >= 5000)
{
MyChar.Points += 20;
MyChar.VP -= 5000;
MyChar.MyClient.SendPacket(General.MyPackets.Vital(MyChar.UID, 26, MyChar.GetStat()));
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 6)
{
if (MyChar.InventoryContains(1088001, 10))
{
MyChar.Points += 3;
MyChar.RemoveItem(1088001);
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 7)
{
if (MyChar.InventoryContains(1088000, 1))
{
MyChar.Points += 26;
MyChar.RemoveItem(1088000);
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 8)
{
if (MyChar.Points >= 140)
{
MyChar.VP += 10000;
MyChar.Points -= 40;
MyChar.MyClient.SendPacket(General.MyPackets.Vital(MyChar.UID, 26, MyChar.GetStat()));
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 9)
{
if (MyChar.Points >= 8)
{
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.AddItem("723700-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.Points -= 8;
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 10)
{
if (MyChar.Points >= 26)
{
MyChar.AddItem("1088000-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.Points -= 26;
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 11)
{
if (MyChar.Points >= 28)
{
MyChar.AddItem("1200001-0-0-0-0-0", 0, (uint)General.Rand.Next(36457836));
MyChar.Points -= 28;
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 12)
{
if (MyChar.Points >= 10)
{
MyChar.Silvers += 10000000;
MyChar.Points -= 500;
SendPacket(General.MyPackets.Vital(MyChar.UID, 4, MyChar.Silvers));
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
}
if (Control == 13)
{
if (MyChar.InventoryContains(723700, 5))
MyChar.Points += 4;
MyChar.RemoveItem(723700);
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
if (Control == 14)
{
if (MyChar.CPs >= 1000)
MyChar.Points += 100;
MyChar.CPs -= 1000;
SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "You now have " + MyChar.Points + " Points left.", 2005));
}
MyChar.SavePoints();
}