Can someone help me ?

01/17/2019 19:50 em0tions#1
I am trying to create a NPC where players can make sockets to their equipment with DB's and ToughDrills and I am trying to find out what is wrong with this script.

#region Socketter
case 4400:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Hello there my friend. I am here to put a socket in Your Equipment. For the first socket I demand 40 DragonBalls and for the second one I demand 25 ToughDrills.");
dialog.Option("Headgear", 4001);
dialog.Option("Necklace", 4011);
dialog.Option("Ring", 4021);
dialog.Option("Armor", 4031);
dialog.Option("Boots", 4041);
dialog.Option("Tower", 4051);
dialog.Option("Fan", 4061);
dialog.Option("Alright.", 255);
dialog.Send();
break;
}
case 4001:
{
if (!client.Headgear.Free(4))
{
MsgItemInfo Item = null;
Item = client.Headgear.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 40 DragonBalls to socket your Headgear. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4002);
dialog.Send();
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 25 ToughDrills to socket your Headgear. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4002);
dialog.Send();
}
else
{
dialog.Text("I can't socket this Headgear once more.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Headgear first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
case 4011:
{
if (!client.Necklace.Free(4))
{
MsgItemInfo Item = null;
Item = client.Necklace.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 40 DragonBalls to socket your Necklace. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4012);
dialog.Send();
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 25 ToughDrills to socket your Necklace. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4012);
dialog.Send();
}
else
{
dialog.Text("I can't socket this Necklace once more.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Necklace first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
case 4021:
{
if (!client.Ring.Free(4))
{
MsgItemInfo Item = null;
Item = client.Ring.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 40 DragonBalls to socket your Ring. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4022);
dialog.Send();
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 25 ToughDrills to socket your Ring. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4022);
dialog.Send();
}
else
{
dialog.Text("I can't socket this Ring once more.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Ring first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
case 4031:
{
if (!client.Armor.Free(4))
{
MsgItemInfo Item = null;
Item = client.Armor.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 40 DragonBalls to socket your Armor. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4032);
dialog.Send();
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 25 ToughDrills to socket your Armor. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4032);
dialog.Send();
}
else
{
dialog.Text("I can't socket this Armor once more.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Armor first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
case 4041:
{
if (!client.Boots.Free(4))
{
MsgItemInfo Item = null;
Item = client.Boots.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 40 DragonBalls to socket your Boots. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4042);
dialog.Send();
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 25 ToughDrills to socket your Boots. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4042);
dialog.Send();
}
else
{
dialog.Text("I can't socket this Ring once more.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Ring first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
case 4051:
{
if (!client.Fan.Free(4))
{
MsgItemInfo Item = null;
Item = client.Fan.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 40 DragonBalls to socket your FanTalisman. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4052);
dialog.Send();
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 25 ToughDrills to socket your FanTalisman. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4052);
dialog.Send();
}
else
{
dialog.Text("I can't socket this FanTalisman once more.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the FanTalisman first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
case 4061:
{
if (!client.Tower.Free(4))
{
MsgItemInfo Item = null;
Item = client.Tower.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 40 DragonBalls to socket your TowerTalisman. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4062);
dialog.Send();
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
dialog.Text("My friend I will need 25 ToughDrills to socket your TowerTalisman. Are you sure you want to do this ?");
dialog.Option("Yea sure.", 4062);
dialog.Send();
}
else
{
dialog.Text("I can't socket this TowerTalisman once more.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the TowerTalisman first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
case 4002:
{
if (!client.Headgear.Free(4))
{
MsgItemInfo Item = null;
Item = client.Headgear.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1088000, 40))
{
client.Inventory.Remove(1088000, 40);
Item.SocketOne = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 40 DragonBalls !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1200005, 25))
{
client.Inventory.Remove(1200005, 25);
Item.SocketTwo = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 25 ToughDrills !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Headgear first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
}
case 4012:
{
if (!client.Necklace.Free(4))
{
MsgItemInfo Item = null;
Item = client.Necklace.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1088000, 40))
{
client.Inventory.Remove(1088000, 40);
Item.SocketOne = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 40 DragonBalls !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1200005, 25))
{
client.Inventory.Remove(1200005, 25);
Item.SocketTwo = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 25 ToughDrills !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Necklace first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
}
case 4022:
{
if (!client.Ring.Free(4))
{
MsgItemInfo Item = null;
Item = client.Ring.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1088000, 40))
{
client.Inventory.Remove(1088000, 40);
Item.SocketOne = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 40 DragonBalls !");
dialog.Option("Ah...", 255);
dialog.Send();
}
break;
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1200005, 25))
{
client.Inventory.Remove(1200005, 25);
Item.SocketTwo = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 25 ToughDrills !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Ring first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
}
case 4032:
{
if (!client.Armor.Free(4))
{
MsgItemInfo Item = null;
Item = client.Armor.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1088000, 40))
{
client.Inventory.Remove(1088000, 40);
Item.SocketOne = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 40 DragonBalls !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1200005, 25))
{
client.Inventory.Remove(1200005, 25);
Item.SocketTwo = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 25 ToughDrills !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Armor first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
}
case 4042:
{
if (!client.Boots.Free(4))
{
MsgItemInfo Item = null;
Item = client.Boots.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1088000, 40))
{
client.Inventory.Remove(1088000, 40);
Item.SocketOne = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 40 DragonBalls !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1200005, 25))
{
client.Inventory.Remove(1200005, 25);
Item.SocketTwo = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 25 ToughDrills !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the Boots first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
}
case 4052:
{
if (!client.Fan.Free(4))
{
MsgItemInfo Item = null;
Item = client.Fan.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1088000, 40))
{
client.Inventory.Remove(1088000, 40);
Item.SocketOne = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 40 DragonBalls !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1200005, 25))
{
client.Inventory.Remove(1200005, 25);
Item.SocketTwo = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 25 ToughDrills !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the FanTalisman first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
}
case 4062:
{
if (!client.Tower.Free(4))
{
MsgItemInfo Item = null;
Item = client.Tower.TryGetItem(4);
if (Item.SocketOne == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1088000, 40))
{
client.Inventory.Remove(1088000, 40);
Item.SocketOne = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 40 DragonBalls !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else if (Item.SocketTwo == COServer.Game.Enums.Gem.NoSocket)
{
if (client.Inventory.Contains(1200005, 25))
{
client.Inventory.Remove(1200005, 25);
Item.SocketTwo = COServer.Game.Enums.Gem.EmptySocket;
Item.Mode = COServer.Game.Enums.ItemMode.Update;
Item.Send(client);
COServer.Database.ConquerItemTable.UpdateSockets(I tem);
dialog.Text("Done !");
dialog.Option("Thank you.", 255);
dialog.Send();
}
else
{
dialog.Text("You don't have 25 ToughDrills !");
dialog.Option("Ah...", 255);
dialog.Send();
}
}
else
{
dialog.Text("You need to wear the TowerTalisman first.");
dialog.Option("Alright.", 255);
dialog.Send();
}
}
}
break;
}
}
#endregion
01/19/2019 01:48 12k#2
What is it doing that makes it broke? I don't want to read through all that if I don't have to haha
01/19/2019 14:52 em0tions#3
It's not taking the required items from the players inventory ( 40 dbs for first socket & 25 ToughDrills for the second socket) and it's not putting the socket in the item.
01/19/2019 17:00 12k#4
Unless the packet has changed (Which it may have since i've worked on servers), I don't believe the npcRequest.OptionID should be larger than a byte (255). From the looks of it everything else should be working. Is the dialog popping up and going through all the options like it should?
01/19/2019 17:33 em0tions#5
I am receiving an error message on my server console. The server source it's based on a 6609 client. So basically the command from the NPCs.cs it's not going to the next step. And the client it's not receiving the data from the source to finish the task (in this case, to take the required items and put the socket).
What I need to do ?
01/19/2019 19:05 Yupmoh#6
:wutface:
01/19/2019 19:11 12k#7
For future reference for anyone trying to view this thread, I'm helping him on discord. It's just a null reference exception.