Portal restriction by item

11/07/2018 11:47 JaDroK#1
I want to add a restriction that the player need a item to go in portal and I did that:

if (Session.Character.Inventory.CountItem(1400) <= 0) // Not working

WHat Im doing wrong?

========[The code:]========

if (portal.DestinationMapId == 189)
{

if (Session.Character.PrestigeLevel < 1)
{
Session.SendPacket(UserInterfaceHelper.GenerateMsg ("You need atleast prestige 1 to go in there!", 10));
return;
}
else
{
if (Session.Character.Inventory.CountItem(1400) <= 0) // Not working
{
Session.SendPacket(UserInterfaceHelper.GenerateMsg ("You need to craft the key of Prestige Lobby first or reach Prestige 1!", 10));
return;
}
else
{
ServerManager.Instance.ChangeMap(Session.Character .CharacterId, 189, 42, 161);

}
}
}
11/07/2018 14:52 Zagith#2
This is hardcode, just create a new filed into Portal table with a migration and script it into basicpackethandler like this:

Code:
if (portal.RequiredItem != 0)
                {
                    if (Session.Character.Inventory.GetAllItems().All(i => i.ItemVNum != portal.RequiredItem))
                    {
                        Session.SendPacket(UserInterfaceHelper.GenerateMsg ("You need to craft the key of Prestige Lobby first or reach Prestige 1!", 10));
                        return;
                    }
                }
without else because you already have the ChangeMap method
11/07/2018 19:10 JaDroK#3
Quote:
Originally Posted by Zagith View Post
This is hardcode, just create a new filed into Portal table with a migration and script it into basicpackethandler like this:

Code:
if (portal.RequiredItem != 0)
                {
                    if (Session.Character.Inventory.GetAllItems().All(i => i.ItemVNum != portal.RequiredItem))
                    {
                        Session.SendPacket(UserInterfaceHelper.GenerateMsg ("You need to craft the key of Prestige Lobby first or reach Prestige 1!", 10));
                        return;
                    }
                }
without else because you already have the ChangeMap method
Thank you alot m8