PHP Code:
#region Met/Db Storage
case 47://input test npc (prize npc)
{
if (LinkBack == 0)
{
Text("I can help you store your excess mets and dbs!", Client);
Text("What would you like to do today?", Client);
Link("Mets", 1, Client);
Link("Dbs", 2, Client);
Link("Check balance", 11, Client);
Link("Nevermind...", 255, Client);
Face(91, Client);
End(Client);
}
if (LinkBack == 1)//Mets
{
Text("Are you wanting to put mets in or withdraw?", Client);
Text("Met balance - " + Client.Char.MetPoint, Client);
Link("Withdraw", 3, Client);
Link("Deposit", 4, Client);
Link("Nevermind...", 255, Client);
Face(91, Client);
End(Client);
}
if (LinkBack == 2)//Dbs
{
Text("Are you wanting to put dragonballs in or withdraw?", Client);
Text("DragonBall balance - " + Client.Char.DbPoint, Client);
Link("Withdraw", 5, Client);
Link("Deposit", 6, Client);
Link("Nevermind...", 255, Client);
Face(91, Client);
End(Client);
}
if (LinkBack == 11)
{
Text("Met balance - " + Client.Char.MetPoint, Client);
Text("DragonBall balance - " + Client.Char.DbPoint, Client);
Link("Main menu", 0, Client);
Link("Thanks", 255, Client);
Face(91, Client);
End(Client);
}
if (LinkBack == 3)
{
Text("How many mets are you withdrawing today?", Client);
Input(" ", 7, Client);
Link("Nevermind...", 255, Client);
Face(91, Client);
End(Client);
}
if (LinkBack == 4)
{
Text("How many mets are you depositing today?", Client);
Input(" ", 8, Client);
Link("Nevermind...", 255, Client);
Face(91, Client);
End(Client);
}
if (LinkBack == 5)
{
Text("How many dragonballs are you withdrawing today?", Client);
Input(" ", 9, Client);
Link("Nevermind...", 255, Client);
Face(91, Client);
End(Client);
}
if (LinkBack == 6)
{
Text("How many dragonballs are you depositing today?", Client);
Input(" ", 10, Client);
Link("Nevermind...", 255, Client);
Face(91, Client);
End(Client);
}
else if (LinkBack == 7)//withdraw mets
{
string Mets = ""; for (int i = 14; i < 14 + Data[13]; i++) { Mets += Convert.ToChar(Data[i]); }
Console.WriteLine("NameGiven = " + Mets);
int MetsInt = 0;
try
{
MetsInt = int.Parse(Mets);
Console.WriteLine("Int = " + MetsInt);
}
catch
{
Text("You did not enter a number!", Client);
Link("Oops, my bad!", 255, Client);
Face(91, Client);
End(Client);
Console.WriteLine("Error: Could not convert to int!");
}
if (Client.Char.MetPoint >= MetsInt)
{
if ((Client.Char.Inventory.Count + MetsInt) <= 40)
{
int Quantity = MetsInt;
while (Quantity > 0)
{
AddItem(1088001, 255, 0, 0, 0, 0, Client);
Quantity -= 1;
}
Client.Char.MetPoint -= MetsInt;
Database.SaveMetPoint(Client.Char);
Text("You have " + Client.Char.MetPoint + " MetPoints left", Client);
Link("Main Menu", 0, Client);
Link("Wow, thanks alot!", 255, Client);
Face(91, Client);
End(Client);
}
else
{
Text("You do not have enough room in your inventory", Client);
Link("Oops, my bad", 255, Client);
Face(91, Client);
End(Client);
}
}
else
{
Text("You do not have that many MetPoints!", Client);
Link("Oops, my bad", 255, Client);
Face(91, Client);
End(Client);
}
}
else if (LinkBack == 8)//deposit mets
{
string Mets = ""; for (int i = 14; i < 14 + Data[13]; i++) { Mets += Convert.ToChar(Data[i]); }
Console.WriteLine("NameGiven = " + Mets);
int MetsInt = 0;
try
{
MetsInt = int.Parse(Mets);
Console.WriteLine("Int = " + MetsInt);
}
catch
{
Text("You did not enter a number!", Client);
Link("Oops, my bad!", 255, Client);
Face(91, Client);
End(Client);
Console.WriteLine("Error: Could not convert to int!");
}
if (InventoryContains(1088001, Client, MetsInt))
{
RemoveItem(1088001, Client, MetsInt);
Client.Char.MetPoint += MetsInt;
Database.SaveMetPoint(Client.Char);
Text("You now have " + Client.Char.MetPoint + " MetPoints!", Client);
Link("Main Menu", 0, Client);
Link("Wow, thanks alot!", 255, Client);
Face(91, Client);
End(Client);
}
else
{
Text("You do not have that many mets in your inventory!", Client);
Link("Oops, my bad", 255, Client);
Face(91, Client);
End(Client);
}
}
else if (LinkBack == 9)//withdraw Dbs
{
string Dbs = ""; for (int i = 14; i < 14 + Data[13]; i++) { Dbs += Convert.ToChar(Data[i]); }
Console.WriteLine("NameGiven = " + Dbs);
int DbsInt = 0;
try
{
DbsInt = int.Parse(Dbs);
Console.WriteLine("Int = " + DbsInt);
}
catch
{
Text("You did not enter a number!", Client);
Link("Oops, my bad!", 255, Client);
Face(91, Client);
End(Client);
Console.WriteLine("Error: Could not convert to int!");
}
if (Client.Char.DbPoint >= DbsInt)
{
if ((Client.Char.Inventory.Count + DbsInt) <= 40)
{
int Quantity = DbsInt;
while (Quantity > 0)
{
AddItem(1088000, 255, 0, 0, 0, 0, Client);
Quantity -= 1;
}
Client.Char.DbPoint -= DbsInt;
Database.SaveDbPoint(Client.Char);
Text("You have " + Client.Char.DbPoint + " DbPoints left", Client);
Link("Main Menu", 0, Client);
Link("Wow, thanks alot!", 255, Client);
Face(91, Client);
End(Client);
}
else
{
Text("You do not have enough room in your inventory.", Client);
Link("Oops, my bad", 255, Client);
Face(91, Client);
End(Client);
}
}
else
{
Text("You do not have that many DbPoints!", Client);
Link("Oops, my bad", 255, Client);
Face(91, Client);
End(Client);
}
}
else if (LinkBack == 10)//deposit Dbs
{
string Dbs = ""; for (int i = 14; i < 14 + Data[13]; i++) { Dbs += Convert.ToChar(Data[i]); }
Console.WriteLine("NameGiven = " + Dbs);
int DbsInt = 0;
try
{
DbsInt = int.Parse(Dbs);
Console.WriteLine("Int = " + DbsInt);
}
catch
{
Text("You did not enter a number!", Client);
Link("Oops, my bad!", 255, Client);
Face(91, Client);
End(Client);
Console.WriteLine("Error: Could not convert to int!");
}
if (InventoryContains(1088000, Client, DbsInt))
{
RemoveItem(1088000, Client, DbsInt);
Client.Char.DbPoint += DbsInt;
Database.SaveDbPoint(Client.Char);
Text("You now have " + Client.Char.DbPoint + " DbPoints!", Client);
Link("Main Menu", 0, Client);
Link("Wow, thanks alot!", 255, Client);
Face(91, Client);
End(Client);
}
else
{
Text("You do not have that many DragonBalls in your inventory!", Client);
Link("Oops, my bad", 255, Client);
Face(91, Client);
End(Client);
}
}
break;
}
#endregion