RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

webstatus.cs display vendor and what vendor is selling- Error.

daat99

Moderator
Staff member
Like the example you quoted from my steps post.
Code:
... bla bla ...
op.WriteLine("Amount,Item,Price for the Amount,Description<br>");
foreach (Item item in pv.GetItems())
{
GetVendorItemsDisplay( op, pv, item);
}
op.WriteLine( "---------------------------------------------------------------------------------------<br>" );
... bla bla ...
 

AlphaDragon

Sorceror
Code:
Errors:
+ Misc/ws-last working on - Copy.cs:
    CS0139: Line 130: No enclosing loop out of which to break or continue
Wasnt this the loop?
Code:
  foreach (Item item in pv.GetItems())
                        {
                            VendorItem vi = pv.GetVendorItem(item);
                            if (vi != null && vi.IsForSale)
                            {
                                if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list.
                                    continue;
                                string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " ");
                                string name = item.Name;
                                if (string.IsNullOrEmpty(name))
                                {
                                    name = item.GetType().ToString();
                                    if (name.LastIndexOf('.') >= 0)
                                        name = name.Substring(name.LastIndexOf('.') + 1);
                                }                       
                                if (name.Length > 25)
                                    name = name.Substring(0, 25);
                       
                                string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description);
                                op.WriteLine( "{0} {1,-25} {2,7}  {3} <br>", item.Amount, name, vi.Price.ToString(), des );
                            }
HERE  *---->GetVendorItemsDisplay( op, pv, item);//HERE???? Wasnt this the loop???
                        }
 
                        op.WriteLine( "---------------------------------------------------------------------------------------<
 

daat99

Moderator
Staff member
This was the loop, the loops content needs to be inside the method and be replaced by the method call.

If you are having problems with it then please post the entire file so I can look at it and give you feedback.
 

AlphaDragon

Sorceror
I // Line 129 and 130, and it seemed to compile. But the output file is now giving me double info, and is not showing the items in the containers.

Code:
using System;
using System.IO;
using System.Text;
using Server;
using Server.Network;
using Server.Guilds;
 
//
using Server.Items;
using Server.Mobiles;
using Server.Accounting;
//
 
namespace Server.Misc
{
    public class StatusPage : Timer
    {
        public static bool Enabled = true;
 
        public static void Initialize()
        {
            if ( Enabled )
                new StatusPage().Start();
        }
 
        public StatusPage() : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 60.0 ) )
        {
            Priority = TimerPriority.FiveSeconds;
        }
 
        private static string Encode( string input )
        {
            StringBuilder sb = new StringBuilder( input );
 
            sb.Replace( "&", "&amp;" );
            sb.Replace( "<", "&lt;" );
            sb.Replace( ">", "&gt;" );
            sb.Replace( "\"", "&quot;" );
            sb.Replace( "'", "&apos;" );
 
            return sb.ToString();
        }
 
        protected override void OnTick()
        {
            if ( !Directory.Exists( "web" ) )
                Directory.CreateDirectory( "web" );
 
            using ( StreamWriter op = new StreamWriter( "web/status.html" ) )
            {
                op.WriteLine( "<html>" );
           
           
           
           
           
#region player vendors table
           
           
           
           
           
                op.WriteLine( "PLAYER VENDORS:<br>" );
                op.WriteLine( "***************************************************************************************<br>" );
 
                foreach ( Mobile mob in World.Mobiles.Values )
                {
                    if ( mob is PlayerVendor )
                    {
                        PlayerVendor pv = mob as PlayerVendor;
                        op.WriteLine( "Owners Name , Shops Name, Vendors Name, Location <br>" );
                        op.WriteLine( pv.Owner.Name + "," + pv.ShopName + "," + pv.Name + "," + pv.Map + " - " + pv.Location + "<br>" );
                   
                   
                        op.WriteLine("Amount,Item,Price for the Amount,Description<br>");
                   
                        foreach (Item item in pv.GetItems())
                        {
                            VendorItem vi = pv.GetVendorItem(item);
                            if (vi != null && vi.IsForSale)
                            {
                                if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list.
                                    continue;
                                string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " ");
                                string name = item.Name;
                                if (string.IsNullOrEmpty(name))
                                {
                                    name = item.GetType().ToString();
                                    if (name.LastIndexOf('.') >= 0)
                                        name = name.Substring(name.LastIndexOf('.') + 1);
                                }                           
                                if (name.Length > 25)
                                    name = name.Substring(0, 25);
                           
                                string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description);
                                op.WriteLine( "{0} {1,-25} {2,7}  {3} <br>", item.Amount, name, vi.Price.ToString(), des );
                            }
                            GetVendorItemsDisplay( op, pv, item);//HERE????
                        }
 
                        op.WriteLine( "---------------------------------------------------------------------------------------<br>" );
 
                    }
                    if(mob is PlayerVendor == null)
                        op.WriteLine( "There are no player vendors in the world at the moment.<br>" );
                }
                op.WriteLine( "***************************************************************************************<br>" );
           
           
           
           
           
#endregion player vendors table
       
       
       
       
       
            op.WriteLine( "  </body>" );
            op.WriteLine( "</html>" );
            }
        }
       
        private void GetVendorItemsDisplay(StreamWriter op, PlayerVendor pv, Item item)
        {
            VendorItem vi = pv.GetVendorItem(item);
            if (vi != null && vi.IsForSale)
            {
//                if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list.
//                    continue;
                string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " ");
                string name = item.Name;
                if (string.IsNullOrEmpty(name))
                {
                    name = item.GetType().ToString();
                    if (name.LastIndexOf('.') >= 0)
                        name = name.Substring(name.LastIndexOf('.') + 1);
                }
                if (name.Length > 25)
                    name = name.Substring(0, 25);
               
                string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description);
                op.WriteLine( "{0} {1,-25} {2,7}  {3} <br>", item.Amount, name, vi.Price.ToString(), des );
            }
        }
    }
}


Output file:
Code:
PLAYER VENDORS:
***************************************************************************************
Owners Name , Shops Name, Vendors Name, Location
TESTER,3,fdsfd,Trammel - (3499, 2572, 21)
Amount,Item,Price for the Amount,Description
3 Carrot 3 c
3 Carrot 3 c
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
fdsfd,2,Beta,Trammel - (3496, 2572, 21)
Amount,Item,Price for the Amount,Description
2 Banana 2 b
2 Banana 2 b
2 SulfurousAsh 999
2 SulfurousAsh 999
2 GraveDust 999
2 GraveDust 999
2 DragonKnight Token 999
2 DragonKnight Token 999
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,1,alphas,Trammel - (3494, 2572, 21)
Amount,Item,Price for the Amount,Description
1 Apple 1 a
1 Apple 1 a
1 BlackPearl 1
1 BlackPearl 1
1 RecallRune 2
1 RecallRune 2
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,Shop Not Yet Named,Selby,Trammel - (3496, 2570, 21)
Amount,Item,Price for the Amount,Description
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,shopnameBAGER,VENDORNAMEBAGMAN,Trammel - (3497, 2568, 21)
Amount,Item,Price for the Amount,Description
1 DragonKnight Token 120
1 DragonKnight Token 120
1 Boots 100 botiesDISCRIPTION
1 Boots 100 botiesDISCRIPTION
---------------------------------------------------------------------------------------
***************************************************************************************
 

daat99

Moderator
Staff member
Your loop in the original file still have the original code and doesn't look like the example I gave you before.
This is why you get double info.
 

AlphaDragon

Sorceror
:oops: I cleaned up the code to try and make it easier to work with and have been working with this one since. I have not changed it other then what you told me to add or mod.

:( So what do I need to change to stop the double info?

and,
What do I need to do to make it check all bags on the vendor to show all items that are for sale?
I guess its called: "recursion the containers" checking for items that are for sale and list them.
 

daat99

Moderator
Staff member
You need to make the loop to look like my example (remove duplicate code and leave the call to the method).

After that you need to add the "recursion" part but I'll explain that when we get everything else working right.
 

AlphaDragon

Sorceror
ok, now were are not showing doubles anymore. I think just need "recursion"?

Code:
using System;
using System.IO;
using System.Text;
using Server;
using Server.Network;
using Server.Guilds;
 
//
using Server.Items;
using Server.Mobiles;
using Server.Accounting;
//
 
namespace Server.Misc
{
    public class StatusPage : Timer
    {
        public static bool Enabled = true;
 
        public static void Initialize()
        {
            if ( Enabled )
                new StatusPage().Start();
        }
 
        public StatusPage() : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 60.0 ) )
        {
            Priority = TimerPriority.FiveSeconds;
        }
 
        private static string Encode( string input )
        {
            StringBuilder sb = new StringBuilder( input );
 
            sb.Replace( "&", "&amp;" );
            sb.Replace( "<", "&lt;" );
            sb.Replace( ">", "&gt;" );
            sb.Replace( "\"", "&quot;" );
            sb.Replace( "'", "&apos;" );
 
            return sb.ToString();
        }
 
        protected override void OnTick()
        {
            if ( !Directory.Exists( "web" ) )
                Directory.CreateDirectory( "web" );
 
            using ( StreamWriter op = new StreamWriter( "web/status.html" ) )
            {
                op.WriteLine( "<html>" );
           
           
           
           
           
#region player vendors table
           
           
           
           
           
                op.WriteLine( "PLAYER VENDORS:<br>" );
                op.WriteLine( "***************************************************************************************<br>" );
 
                foreach ( Mobile mob in World.Mobiles.Values )
                {
                    if ( mob is PlayerVendor )
                    {
                        PlayerVendor pv = mob as PlayerVendor;
                        op.WriteLine( "Owners Name , Shops Name, Vendors Name, Location <br>" );
                        op.WriteLine( pv.Owner.Name + "," + pv.ShopName + "," + pv.Name + "," + pv.Map + " - " + pv.Location + "<br>" );
                   
                   
                        op.WriteLine("Amount,Item,Price for the Amount,Description<br>");
                   
                        foreach (Item item in pv.GetItems())
                        {
                            GetVendorItemsDisplay( op, pv, item);//HERE????
                        }
 
                        op.WriteLine( "---------------------------------------------------------------------------------------<br>" );
 
                    }
                    if(mob is PlayerVendor == null)
                        op.WriteLine( "There are no player vendors in the world at the moment.<br>" );
                }
                op.WriteLine( "***************************************************************************************<br>" );
           
           
           
           
           
#endregion player vendors table
       
       
       
       
       
            op.WriteLine( "  </body>" );
            op.WriteLine( "</html>" );
            }
        }
       
        private void GetVendorItemsDisplay(StreamWriter op, PlayerVendor pv, Item item)
        {
            VendorItem vi = pv.GetVendorItem(item);
            if (vi != null && vi.IsForSale)
            {
//                if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list.
//                    continue;
                string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " ");
                string name = item.Name;
                if (string.IsNullOrEmpty(name))
                {
                    name = item.GetType().ToString();
                    if (name.LastIndexOf('.') >= 0)
                        name = name.Substring(name.LastIndexOf('.') + 1);
                }
                if (name.Length > 25)
                    name = name.Substring(0, 25);
               
                string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description);
                op.WriteLine( "{0} {1,-25} {2,7}  {3} <br>", item.Amount, name, vi.Price.ToString(), des );
            }
        }
    }
}
Code:
PLAYER VENDORS:
***************************************************************************************
Owners Name , Shops Name, Vendors Name, Location
TESTER,3,fdsfd,Trammel - (3499, 2572, 21)
Amount,Item,Price for the Amount,Description
3 Carrot 3 c
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
fdsfd,2,Beta,Trammel - (3496, 2572, 21)
Amount,Item,Price for the Amount,Description
2 Banana 2 b
2 SulfurousAsh 999
2 GraveDust 999
2 DragonKnight Token 999
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,1,alphas,Trammel - (3494, 2572, 21)
Amount,Item,Price for the Amount,Description
1 Apple 1 a
1 BlackPearl 1
1 RecallRune 2
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,Shop Not Yet Named,Selby,Trammel - (3496, 2570, 21)
Amount,Item,Price for the Amount,Description
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,shopnameBAGER,VENDORNAMEBAGMAN,Trammel - (3497, 2568, 21)
Amount,Item,Price for the Amount,Description
1 DragonKnight Token 120
1 Boots 100 botiesDISCRIPTION
---------------------------------------------------------------------------------------
***************************************************************************************
 

daat99

Moderator
Staff member
Ok, now that you have your new method being executed for every item on the vendor you can start swifting through the items and decide what to do with them.

Your current code already handled items that are for sale:
Code:
if (vi != null && vi.IsForSale)

Let's replace that single line with these lines (leave the rest unchanged:
Code:
if ( vi == null )
    return;
if ( vi.IsForSale )

Until further notice we'll work only with the new method.
 

AlphaDragon

Sorceror
Ok, Changed that,
Code:
using System;
using System.IO;
using System.Text;
using Server;
using Server.Network;
using Server.Guilds;
 
//
using Server.Items;
using Server.Mobiles;
using Server.Accounting;
//
 
namespace Server.Misc
{
    public class StatusPage : Timer
    {
        public static bool Enabled = true;
 
        public static void Initialize()
        {
            if ( Enabled )
                new StatusPage().Start();
        }
 
        public StatusPage() : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 60.0 ) )
        {
            Priority = TimerPriority.FiveSeconds;
        }
 
        private static string Encode( string input )
        {
            StringBuilder sb = new StringBuilder( input );
 
            sb.Replace( "&", "&amp;" );
            sb.Replace( "<", "&lt;" );
            sb.Replace( ">", "&gt;" );
            sb.Replace( "\"", "&quot;" );
            sb.Replace( "'", "&apos;" );
 
            return sb.ToString();
        }
 
        protected override void OnTick()
        {
            if ( !Directory.Exists( "web" ) )
                Directory.CreateDirectory( "web" );
 
            using ( StreamWriter op = new StreamWriter( "web/status.html" ) )
            {
                op.WriteLine( "<html>" );
           
           
           
           
           
#region player vendors table
           
           
           
           
           
                op.WriteLine( "PLAYER VENDORS:<br>" );
                op.WriteLine( "***************************************************************************************<br>" );
 
                foreach ( Mobile mob in World.Mobiles.Values )
                {
                    if ( mob is PlayerVendor )
                    {
                        PlayerVendor pv = mob as PlayerVendor;
                        op.WriteLine( "Owners Name , Shops Name, Vendors Name, Location <br>" );
                        op.WriteLine( pv.Owner.Name + "," + pv.ShopName + "," + pv.Name + "," + pv.Map + " - " + pv.Location + "<br>" );
                   
                   
                        op.WriteLine("Amount,Item,Price for the Amount,Description<br>");
                   
                        foreach (Item item in pv.GetItems())
                        {
                            GetVendorItemsDisplay( op, pv, item);//HERE????
                        }
 
                        op.WriteLine( "---------------------------------------------------------------------------------------<br>" );
 
                    }
                    if(mob is PlayerVendor == null)
                        op.WriteLine( "There are no player vendors in the world at the moment.<br>" );
                }
                op.WriteLine( "***************************************************************************************<br>" );
           
           
           
           
           
#endregion player vendors table
       
       
       
       
       
            op.WriteLine( "  </body>" );
            op.WriteLine( "</html>" );
            }
        }
       
        private void GetVendorItemsDisplay(StreamWriter op, PlayerVendor pv, Item item)
        {
            VendorItem vi = pv.GetVendorItem(item);
            if ( vi == null )
                return;
           
            if ( vi.IsForSale )
            {
//                if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list.
//                    continue;
                string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " ");
                string name = item.Name;
                if (string.IsNullOrEmpty(name))
                {
                    name = item.GetType().ToString();
                    if (name.LastIndexOf('.') >= 0)
                        name = name.Substring(name.LastIndexOf('.') + 1);
                }
                if (name.Length > 25)
                    name = name.Substring(0, 25);
               
                string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description);
                op.WriteLine( "{0} {1,-25} {2,7}  {3} <br>", item.Amount, name, vi.Price.ToString(), des );
            }
        }
    }
}
 

daat99

Moderator
Staff member
Please note that the lines you commented out are still required.
You need to replace the word "continue" with the word "return" because we're in a method and not in a loop.
 

AlphaDragon

Sorceror
Uncommented and replaced continue with return.
Code:
using System;
using System.IO;
using System.Text;
using Server;
using Server.Network;
using Server.Guilds;
 
//
using Server.Items;
using Server.Mobiles;
using Server.Accounting;
//
 
namespace Server.Misc
{
    public class StatusPage : Timer
    {
        public static bool Enabled = true;
 
        public static void Initialize()
        {
            if ( Enabled )
                new StatusPage().Start();
        }
 
        public StatusPage() : base( TimeSpan.FromSeconds( 5.0 ), TimeSpan.FromSeconds( 60.0 ) )
        {
            Priority = TimerPriority.FiveSeconds;
        }
 
        private static string Encode( string input )
        {
            StringBuilder sb = new StringBuilder( input );
 
            sb.Replace( "&", "&amp;" );
            sb.Replace( "<", "&lt;" );
            sb.Replace( ">", "&gt;" );
            sb.Replace( "\"", "&quot;" );
            sb.Replace( "'", "&apos;" );
 
            return sb.ToString();
        }
 
        protected override void OnTick()
        {
            if ( !Directory.Exists( "web" ) )
                Directory.CreateDirectory( "web" );
 
            using ( StreamWriter op = new StreamWriter( "web/status.html" ) )
            {
                op.WriteLine( "<html>" );
           
           
           
           
           
#region player vendors table
           
           
           
           
           
                op.WriteLine( "PLAYER VENDORS:<br>" );
                op.WriteLine( "***************************************************************************************<br>" );
 
                foreach ( Mobile mob in World.Mobiles.Values )
                {
                    if ( mob is PlayerVendor )
                    {
                        PlayerVendor pv = mob as PlayerVendor;
                        op.WriteLine( "Owners Name , Shops Name, Vendors Name, Location <br>" );
                        op.WriteLine( pv.Owner.Name + "," + pv.ShopName + "," + pv.Name + "," + pv.Map + " - " + pv.Location + "<br>" );
                   
                   
                        op.WriteLine("Amount,Item,Price for the Amount,Description<br>");
                   
                        foreach (Item item in pv.GetItems())
                        {
                            GetVendorItemsDisplay( op, pv, item);//HERE????
                        }
 
                        op.WriteLine( "---------------------------------------------------------------------------------------<br>" );
 
                    }
                    if(mob is PlayerVendor == null)
                        op.WriteLine( "There are no player vendors in the world at the moment.<br>" );
                }
                op.WriteLine( "***************************************************************************************<br>" );
           
           
           
           
           
#endregion player vendors table
       
       
       
       
       
            op.WriteLine( "  </body>" );
            op.WriteLine( "</html>" );
            }
        }
       
        private void GetVendorItemsDisplay(StreamWriter op, PlayerVendor pv, Item item)
        {
            VendorItem vi = pv.GetVendorItem(item);
            if ( vi == null )
                return;
           
            if ( vi.IsForSale )
            {
                if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list.
                    return;
                string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " ");
                string name = item.Name;
                if (string.IsNullOrEmpty(name))
                {
                    name = item.GetType().ToString();
                    if (name.LastIndexOf('.') >= 0)
                        name = name.Substring(name.LastIndexOf('.') + 1);
                }
                if (name.Length > 25)
                    name = name.Substring(0, 25);
               
                string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description);
                op.WriteLine( "{0} {1,-25} {2,7}  {3} <br>", item.Amount, name, vi.Price.ToString(), des );
            }
        }
    }
}
 

daat99

Moderator
Staff member
Now that you have your "null" check separated from your other checks and returns in case of a "null" item, we can proceed without fear of "null" crashes.

Like I mentioned above you already have code that handled items that are for sale.

Now you need to add code that handles items that aren't for sale, for example: containers.

After the "if ( vi.ForSale )" section you need to add "else if" section that checks if the item is a container.

For now just write the line "container found" inside that "else if" section.


Add that and post the code of that method (not need to post the old code outside the method for now) and the output file.
 

daat99

Moderator
Staff member
The else/if should check if the item is a container.

You already posted code in this thread that checks if something is a container or not (and that checks if it has items, you do NOT need the items count check now).
 

AlphaDragon

Sorceror
Sorry got confused with vi instead of item.:oops:

Code:
        private void GetVendorItemsDisplay(StreamWriter op, PlayerVendor pv, Item item)
        {
            VendorItem vi = pv.GetVendorItem(item);
            if ( vi == null )
                return;
           
            if ( vi.IsForSale )
            {
                if (pv.Owner == null || pv.Owner.Name == "1k5g6se84f895s854f884s6a") //If name same as this it will not show items in list.
                    return;
                string ownername = (pv.Name != pv.Owner.Name ? pv.Owner.Name : " ");
                string name = item.Name;
                if (string.IsNullOrEmpty(name))
                {
                    name = item.GetType().ToString();
                    if (name.LastIndexOf('.') >= 0)
                        name = name.Substring(name.LastIndexOf('.') + 1);
                }
                if (name.Length > 25)
                    name = name.Substring(0, 25);
               
                string des = (string.IsNullOrEmpty(vi.Description) ? " " : vi.Description);
                op.WriteLine( "{0} {1,-25} {2,7}  {3} <br>", item.Amount, name, vi.Price.ToString(), des );
            }
            else if ( item is Container)
                op.WriteLine("container found <br>");           
        }

Output:
Code:
PLAYER VENDORS:
***************************************************************************************
Owners Name , Shops Name, Vendors Name, Location
TESTER,3,fdsfd,Trammel - (3499, 2572, 21)
Amount,Item,Price for the Amount,Description
3 Carrot 3 c
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
fdsfd,2,Beta,Trammel - (3496, 2572, 21)
Amount,Item,Price for the Amount,Description
2 Banana 2 b
2 SulfurousAsh 999
2 GraveDust 999
2 DragonKnight Token 999
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,1,alphas,Trammel - (3494, 2572, 21)
Amount,Item,Price for the Amount,Description
1 Apple 1 a
1 BlackPearl 1
1 RecallRune 2
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,Shop Not Yet Named,Selby,Trammel - (3496, 2570, 21)
Amount,Item,Price for the Amount,Description
---------------------------------------------------------------------------------------
Owners Name , Shops Name, Vendors Name, Location
AlphaDragon,shopnameBAGER,VENDORNAMEBAGMAN,Trammel - (3497, 2568, 21)
Amount,Item,Price for the Amount,Description
container found
1 DragonKnight Token 120
container found
1 Boots 100 botiesDISCRIPTION
---------------------------------------------------------------------------------------
***************************************************************************************
 

daat99

Moderator
Staff member
Great.

Next step:
Replace the "container found" line with a loop that prints "item found" for every item inside the container.

Something similar to (make it compile):
foreach item2 in item.items...

Post the code and output when you're done.

NOTE:
Do NOT try to print all the item information, that won't help you because we'll delete it in a few posts.
The loop is what we need and the "item found" is just to show us we got it working right.
 

AlphaDragon

Sorceror
:oops: This is also where I got lost last time. I dont know what to write there.

Code:
            else if ( item is Container)
            {
                foreach ( Item containersItem in Container.items())
                {
                    op.WriteLine("This is a container item<br>");
                }
            }

Code:
Errors:
 + Misc/ws-last working on - Copy.cs:
    CS0117: Line 131: 'Server.Items.Container' does not contain a definition for
 'items'
 

daat99

Moderator
Staff member
Let's take a look at CharacterCreation (it all goes back to the start, isn't it).

This file has 2 loops that makes reagents inside a bag "newbied".

The bag of reagent is a container just like the "item" you got here.

Try to see how you can do the same and what you need to change.
 
Top