AlphaDragon
Sorceror
?? Dont see an example? Just this:
Ok, all you need to do now is make the loop looks like my example.
Ok, all you need to do now is make the loop looks like my example.
... 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 ...
Errors:
+ Misc/ws-last working on - Copy.cs:
CS0139: Line 130: No enclosing loop out of which to break or continue
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( "---------------------------------------------------------------------------------------<
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( "&", "&" );
sb.Replace( "<", "<" );
sb.Replace( ">", ">" );
sb.Replace( "\"", """ );
sb.Replace( "'", "'" );
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 );
}
}
}
}
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
---------------------------------------------------------------------------------------
***************************************************************************************
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( "&", "&" );
sb.Replace( "<", "<" );
sb.Replace( ">", ">" );
sb.Replace( "\"", """ );
sb.Replace( "'", "'" );
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 );
}
}
}
}
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
---------------------------------------------------------------------------------------
***************************************************************************************
if (vi != null && vi.IsForSale)
if ( vi == null )
return;
if ( vi.IsForSale )
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( "&", "&" );
sb.Replace( "<", "<" );
sb.Replace( ">", ">" );
sb.Replace( "\"", """ );
sb.Replace( "'", "'" );
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 );
}
}
}
}
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( "&", "&" );
sb.Replace( "<", "<" );
sb.Replace( ">", ">" );
sb.Replace( "\"", """ );
sb.Replace( "'", "'" );
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 );
}
}
}
}
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>");
}
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
---------------------------------------------------------------------------------------
***************************************************************************************
else if ( item is Container)
{
foreach ( Item containersItem in Container.items())
{
op.WriteLine("This is a container item<br>");
}
}
Errors:
+ Misc/ws-last working on - Copy.cs:
CS0117: Line 131: 'Server.Items.Container' does not contain a definition for
'items'