Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
/*
|
||||
** QuestNote
|
||||
** ArteGordon
|
||||
**
|
||||
*/
|
||||
namespace Server.Items
|
||||
{
|
||||
public class QuestHolder : XmlQuestHolder
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public QuestHolder()
|
||||
: base()
|
||||
{
|
||||
Name = "A quest";
|
||||
TitleString = "A quest";
|
||||
}
|
||||
|
||||
public QuestHolder(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
base.OnDoubleClick(from);
|
||||
from.CloseGump(typeof(XmlQuestStatusGump));
|
||||
|
||||
from.SendGump(new XmlQuestStatusGump(this, this.TitleString));
|
||||
}
|
||||
|
||||
public override void OnSnoop(Mobile from)
|
||||
{
|
||||
if (from.AccessLevel > AccessLevel.Player)
|
||||
{
|
||||
from.CloseGump(typeof(XmlQuestStatusGump));
|
||||
|
||||
from.SendGump(new XmlQuestStatusGump(this, this.TitleString));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
/*
|
||||
** QuestNote
|
||||
** ArteGordon
|
||||
**
|
||||
** Version 1.02
|
||||
** updated 9/14/04
|
||||
** - changed the QuestNote to open the status gump directly, and removed the serialized properties related to the scroll gump
|
||||
** - added the OriginalQuestNote that has the scroll gump and behaves like the old QuestNote
|
||||
**
|
||||
** Version 1.01
|
||||
** updated 3/25/04
|
||||
** - Moved the TitleString and NoteString properties from the QuestNote class to the XmlQuestToken class.
|
||||
**
|
||||
** Version 1.0
|
||||
** updated 1/07/04
|
||||
** adds a item that displays text messages in a scroll gump and maintains quest state information. The size can be varied and the note text and text-color can be specified.
|
||||
** The title of the note and its color can also be set.
|
||||
*/
|
||||
namespace Server.Items
|
||||
{
|
||||
public class QuestNote : XmlQuestToken
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public QuestNote() : base( 0x14EE )
|
||||
{
|
||||
Name = "A quest note";
|
||||
TitleString = "A quest note";
|
||||
}
|
||||
|
||||
public QuestNote( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 2 ); // version
|
||||
// Version 2 has no serialized variables
|
||||
|
||||
// Version 0
|
||||
//writer.Write( this.m_NoteString ); // moved to the XmlQuestToken class in version 1
|
||||
//writer.Write( this.m_TitleString ); // moved to the XmlQuestToken class in version 1
|
||||
// Version 1
|
||||
//writer.Write( this.m_TextColor ); // no longer used
|
||||
//writer.Write( this.m_TitleColor ); // no longer used
|
||||
//writer.Write( this.m_size ); // no longer used
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
reader.ReadInt();
|
||||
reader.ReadInt();
|
||||
reader.ReadInt();
|
||||
//this.m_TextColor = reader.ReadInt();
|
||||
//this.m_TitleColor = reader.ReadInt();
|
||||
//this.m_size = reader.ReadInt();
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
reader.ReadString();
|
||||
reader.ReadString();
|
||||
reader.ReadInt();
|
||||
reader.ReadInt();
|
||||
reader.ReadInt();
|
||||
//this.NoteString = reader.ReadString();
|
||||
//this.TitleString = reader.ReadString();
|
||||
//this.m_TextColor = reader.ReadInt();
|
||||
//this.m_TitleColor = reader.ReadInt();
|
||||
//this.m_size = reader.ReadInt();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
base.OnDoubleClick(from);
|
||||
from.CloseGump( typeof( XmlQuestStatusGump ) );
|
||||
|
||||
from.SendGump( new XmlQuestStatusGump(this, this.TitleString) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class OriginalQuestNote : XmlQuestToken
|
||||
{
|
||||
private int m_size = 1;
|
||||
|
||||
private int m_TextColor = 0x3e8;
|
||||
private int m_TitleColor = 0xef0000; // cyan 0xf70000, black 0x3e8, brown 0xef0000 darkblue 0x7fff
|
||||
|
||||
[Constructable]
|
||||
public OriginalQuestNote() : base( 0x14EE )
|
||||
{
|
||||
Name = "A quest note";
|
||||
TitleString = "A quest note";
|
||||
}
|
||||
|
||||
public OriginalQuestNote( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Size
|
||||
{
|
||||
get{ return m_size; }
|
||||
set
|
||||
{
|
||||
m_size = value;
|
||||
if(m_size < 1) m_size = 1;
|
||||
//InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TextColor
|
||||
{
|
||||
get{ return m_TextColor; }
|
||||
set
|
||||
{
|
||||
m_TextColor = value;
|
||||
//InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TitleColor
|
||||
{
|
||||
get{ return m_TitleColor; }
|
||||
set
|
||||
{
|
||||
m_TitleColor = value;
|
||||
//InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
// Version 1
|
||||
writer.Write( this.m_TextColor );
|
||||
writer.Write( this.m_TitleColor );
|
||||
writer.Write( this.m_size );
|
||||
// Version 0
|
||||
//writer.Write( this.m_NoteString ); // moved to the XmlQuestToken class in version 1
|
||||
//writer.Write( this.m_TitleString ); // moved to the XmlQuestToken class in version 1
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
this.m_TextColor = reader.ReadInt();
|
||||
this.m_TitleColor = reader.ReadInt();
|
||||
this.m_size = reader.ReadInt();
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
this.NoteString = reader.ReadString();
|
||||
this.TitleString = reader.ReadString();
|
||||
this.m_TextColor = reader.ReadInt();
|
||||
this.m_TitleColor = reader.ReadInt();
|
||||
this.m_size = reader.ReadInt();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
base.OnDoubleClick(from);
|
||||
from.CloseGump( typeof( QuestNoteGump ) );
|
||||
from.SendGump( new QuestNoteGump( this ) );
|
||||
}
|
||||
}
|
||||
|
||||
public class QuestNoteGump : Gump
|
||||
{
|
||||
private OriginalQuestNote m_Note;
|
||||
|
||||
public static string HtmlFormat( string text, int color )
|
||||
{
|
||||
return String.Format( "<BASEFONT COLOR=#{0}>{1}</BASEFONT>", color, text);
|
||||
}
|
||||
|
||||
public QuestNoteGump( OriginalQuestNote note ) : base( 0, 0 )
|
||||
{
|
||||
m_Note = note;
|
||||
|
||||
AddPage( 0 );
|
||||
AddAlphaRegion( 40, 41, 225, /*371*/70*note.Size );
|
||||
// scroll top
|
||||
AddImageTiled( 3, 5, 300, 37, 0x820 );
|
||||
// scroll middle, upper portion
|
||||
AddImageTiled( 19, 41, 263, 70, 0x821 );
|
||||
for(int i=1;i<note.Size;i++)
|
||||
{
|
||||
// scroll middle , lower portion
|
||||
AddImageTiled( 19, 41+70*i, 263, 70, 0x822 );
|
||||
}
|
||||
// scroll bottom
|
||||
AddImageTiled( 20, 111+70*(note.Size-1), 273, 34, 0x823 );
|
||||
|
||||
// title string
|
||||
AddHtml( 55, 10, 200, 37, QuestNoteGump.HtmlFormat( note.TitleString, note.TitleColor), false , false );
|
||||
// text string
|
||||
AddHtml( 40, 41, 225, 70*note.Size, QuestNoteGump.HtmlFormat( note.NoteString, note.TextColor ), false , false );
|
||||
|
||||
// add the quest status gump button
|
||||
AddButton( 40, 50+ note.Size*70, 0x037, 0x037, 1, GumpButtonType.Reply, 0 );
|
||||
|
||||
}
|
||||
|
||||
public override void OnResponse( Server.Network.NetState state, RelayInfo info )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
XmlQuestStatusGump g = new XmlQuestStatusGump(m_Note, m_Note.TitleString);
|
||||
from.SendGump( g );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SimpleMap : MapItem
|
||||
{
|
||||
private int m_PinIndex;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int CurrentPin
|
||||
{
|
||||
// get/set the index (one-based) of the pin that will be referred to by PinLocation
|
||||
get{ return m_PinIndex; }
|
||||
set{ m_PinIndex = value;}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int NPins
|
||||
{
|
||||
get
|
||||
{
|
||||
if(Pins != null)
|
||||
{
|
||||
return Pins.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point2D PinLocation
|
||||
{
|
||||
set
|
||||
{
|
||||
// change the coordinates of the current pin
|
||||
if(Pins != null && CurrentPin > 0 && CurrentPin <=Pins.Count)
|
||||
{
|
||||
int mapx, mapy;
|
||||
ConvertToMap(value.X, value.Y, out mapx, out mapy);
|
||||
Pins[CurrentPin -1] = new Point2D(mapx, mapy);
|
||||
}
|
||||
}
|
||||
get
|
||||
{
|
||||
// get the coordinates of the current pin
|
||||
if(Pins != null && CurrentPin > 0 && CurrentPin <=Pins.Count)
|
||||
{
|
||||
int mapx, mapy;
|
||||
ConvertToWorld(((Point2D)Pins[CurrentPin -1]).X, ((Point2D)Pins[CurrentPin -1]).Y, out mapx, out mapy);
|
||||
return new Point2D(mapx, mapy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Point2D.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point2D NewPin
|
||||
{
|
||||
set
|
||||
{
|
||||
// add a new pin at the specified world coordinate
|
||||
AddWorldPin(value.X, value.Y);
|
||||
CurrentPin = NPins;
|
||||
}
|
||||
get
|
||||
{
|
||||
// return the last pin added to the Pins arraylist
|
||||
if(Pins != null && NPins > 0)
|
||||
{
|
||||
int mapx, mapy;
|
||||
ConvertToWorld(((Point2D)Pins[NPins -1]).X, ((Point2D)Pins[NPins -1]).Y, out mapx, out mapy);
|
||||
return new Point2D(mapx, mapy);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Point2D.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool ClearAllPins
|
||||
{
|
||||
get { return false; }
|
||||
set { if(value == true) ClearPins(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int PinRemove
|
||||
{
|
||||
set { RemovePin(value); }
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile ShowTo
|
||||
{
|
||||
set
|
||||
{
|
||||
if(value != null)
|
||||
{
|
||||
//DisplayTo(value);
|
||||
OnDoubleClick(value);
|
||||
}
|
||||
}
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
|
||||
[Constructable]
|
||||
public SimpleMap()
|
||||
{
|
||||
SetDisplay( 0, 0, 5119, 4095, 400, 400 );
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1025355; } } // map
|
||||
|
||||
public SimpleMap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
/*
|
||||
** SimpleNote
|
||||
** updated 1/3/04
|
||||
** ArteGordon
|
||||
** adds a simple item that displays text messages in a scroll gump. The size can be varied and the note text and text-color can be specified.
|
||||
** The title of the note and its color can also be set.
|
||||
*/
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SimpleNote : Item
|
||||
{
|
||||
private int m_size = 1;
|
||||
private string m_NoteString;
|
||||
private string m_TitleString;
|
||||
private int m_TextColor = 0x3e8;
|
||||
private int m_TitleColor = 0xef0000; // cyan 0xf70000, black 0x3e8, brown 0xef0000 darkblue 0x7fff
|
||||
|
||||
[Constructable]
|
||||
public SimpleNote() : base( 0x14EE )
|
||||
{
|
||||
Name = "A note";
|
||||
TitleString = "A note";
|
||||
}
|
||||
|
||||
public SimpleNote( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string NoteString
|
||||
{
|
||||
get{ return m_NoteString; }
|
||||
set { m_NoteString = value; InvalidateProperties();}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TitleString
|
||||
{
|
||||
get{ return m_TitleString; }
|
||||
set { m_TitleString = value; InvalidateProperties();}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Size
|
||||
{
|
||||
get{ return m_size; }
|
||||
set
|
||||
{
|
||||
m_size = value;
|
||||
if(m_size < 1) m_size = 1;
|
||||
InvalidateProperties();}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TextColor
|
||||
{
|
||||
get{ return m_TextColor; }
|
||||
set { m_TextColor = value; InvalidateProperties();}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TitleColor
|
||||
{
|
||||
get{ return m_TitleColor; }
|
||||
set { m_TitleColor = value; InvalidateProperties();}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( this.m_NoteString );
|
||||
writer.Write( this.m_TitleString );
|
||||
writer.Write( this.m_TextColor );
|
||||
writer.Write( this.m_TitleColor );
|
||||
writer.Write( this.m_size );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
this.m_NoteString = reader.ReadString();
|
||||
this.m_TitleString = reader.ReadString();
|
||||
this.m_TextColor = reader.ReadInt();
|
||||
this.m_TitleColor = reader.ReadInt();
|
||||
this.m_size = reader.ReadInt();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
SimpleNoteGump g = new SimpleNoteGump( this );
|
||||
from.SendGump( g );
|
||||
}
|
||||
}
|
||||
|
||||
public class SimpleNoteGump : Gump
|
||||
{
|
||||
private SimpleNote m_Note;
|
||||
|
||||
public static string HtmlFormat( string text, int color )
|
||||
{
|
||||
return String.Format( "<BASEFONT COLOR=#{0}>{1}</BASEFONT>", color, text);
|
||||
}
|
||||
|
||||
public SimpleNoteGump( SimpleNote note ) : base( 0, 0 )
|
||||
{
|
||||
m_Note = note;
|
||||
|
||||
AddPage( 0 );
|
||||
AddAlphaRegion( 40, 41, 225, /*371*/70*note.Size );
|
||||
// scroll top
|
||||
AddImageTiled( 3, 5, 300, 37, 0x820 );
|
||||
// scroll middle, upper portion
|
||||
AddImageTiled( 19, 41, 263, 70, 0x821 );
|
||||
for(int i=1;i<note.Size;i++)
|
||||
{
|
||||
// scroll middle , lower portion
|
||||
AddImageTiled( 19, 41+70*i, 263, 70, 0x822 );
|
||||
}
|
||||
// scroll bottom
|
||||
AddImageTiled( 20, 111+70*(note.Size-1), 273, 34, 0x823 );
|
||||
// title string
|
||||
AddHtml( 55, 10, 200, 37, SimpleNoteGump.HtmlFormat( note.TitleString, note.TitleColor), false , false );
|
||||
// text string
|
||||
AddHtml( 40, 41, 225, 70*note.Size, SimpleNoteGump.HtmlFormat( note.NoteString, note.TextColor ), false , false );
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
|
||||
/*
|
||||
SimpleTileTrap
|
||||
Written by Alari
|
||||
|
||||
based off SimpleSwitch. (did a search and replace on simpleswitch->simpletiletrap
|
||||
and then modified the code as appropriate.)
|
||||
|
||||
For this tile trap, 0 is the state when the player moves off or is not standing, and 1 is what is triggered when the player moves directly over the tile trap.
|
||||
*/
|
||||
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
|
||||
public class SimpleTileTrap : Item
|
||||
{
|
||||
|
||||
private int m_SwitchSound = 939;
|
||||
private Item m_TargetItem0 = null;
|
||||
private string m_TargetProperty0 = null;
|
||||
private Item m_TargetItem1 = null;
|
||||
private string m_TargetProperty1 = null;
|
||||
|
||||
[Constructable]
|
||||
public SimpleTileTrap() : base( 7107 )
|
||||
{
|
||||
Name = "A tile trap";
|
||||
Movable = false;
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
public SimpleTileTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int SwitchSound
|
||||
{
|
||||
get{ return m_SwitchSound; }
|
||||
set
|
||||
{
|
||||
m_SwitchSound = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Target0Item
|
||||
{
|
||||
get{ return m_TargetItem0; }
|
||||
set { m_TargetItem0 = value;InvalidateProperties();}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Target0Property
|
||||
{
|
||||
get{ return m_TargetProperty0; }
|
||||
set { m_TargetProperty0 = value;InvalidateProperties();}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Target0ItemName
|
||||
{ get{ if(m_TargetItem0 != null && !m_TargetItem0.Deleted) return m_TargetItem0.Name; else return null;} }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Target1Item
|
||||
{
|
||||
get{ return m_TargetItem1; }
|
||||
set { m_TargetItem1 = value;InvalidateProperties();}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Target1Property
|
||||
{
|
||||
get{ return m_TargetProperty1; }
|
||||
set { m_TargetProperty1 = value;InvalidateProperties();}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Target1ItemName
|
||||
{ get{ if(m_TargetItem1 != null && !m_TargetItem1.Deleted) return m_TargetItem1.Name; else return null;} }
|
||||
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( this.m_SwitchSound );
|
||||
writer.Write( this.m_TargetItem0 );
|
||||
writer.Write( this.m_TargetProperty0 );
|
||||
writer.Write( this.m_TargetItem1 );
|
||||
writer.Write( this.m_TargetProperty1 );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
|
||||
this.m_SwitchSound = reader.ReadInt();
|
||||
this.m_TargetItem0 = reader.ReadItem();
|
||||
this.m_TargetProperty0 = reader.ReadString();
|
||||
this.m_TargetItem1 = reader.ReadItem();
|
||||
this.m_TargetProperty1 = reader.ReadString();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckRange( Point3D loc, Point3D oldLoc, int range )
|
||||
{
|
||||
return CheckRange( loc, range ) && !CheckRange( oldLoc, range );
|
||||
}
|
||||
|
||||
public bool CheckRange( Point3D loc, int range )
|
||||
{
|
||||
return ( (this.Z + 8) >= loc.Z && (loc.Z + 16) > this.Z )
|
||||
&& Utility.InRange( GetWorldLocation(), loc, range );
|
||||
}
|
||||
|
||||
|
||||
public override bool HandlesOnMovement{ get{ return true; } } // Tell the core that we implement OnMovement
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
base.OnMovement( m, oldLocation );
|
||||
|
||||
if ( m.Location == oldLocation )
|
||||
return;
|
||||
|
||||
|
||||
if( ( m.Player && m.AccessLevel == AccessLevel.Player ) )
|
||||
{
|
||||
if ( CheckRange( m.Location, oldLocation, 0 ) )
|
||||
OnEnter( m );
|
||||
else if ( oldLocation == this.Location )
|
||||
OnExit( m );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnEnter( Mobile m )
|
||||
{
|
||||
string status_str;
|
||||
m.PlaySound(SwitchSound);
|
||||
BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty1, m_TargetItem1, m, this, out status_str);
|
||||
}
|
||||
|
||||
public virtual void OnExit( Mobile m )
|
||||
{
|
||||
string status_str;
|
||||
BaseXmlSpawner.ApplyObjectStringProperties(null, m_TargetProperty0, m_TargetItem0, m, this, out status_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class SingleUseSwitch : SimpleSwitch
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public SingleUseSwitch()
|
||||
{
|
||||
}
|
||||
|
||||
public SingleUseSwitch(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from == null || Disabled) return;
|
||||
|
||||
if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this))
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
return;
|
||||
}
|
||||
|
||||
base.OnDoubleClick(from);
|
||||
|
||||
// delete after use
|
||||
Delete();
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseRewardScroll : Item
|
||||
{
|
||||
public override double DefaultWeight
|
||||
{
|
||||
get { return 0.0; }
|
||||
}
|
||||
|
||||
public BaseRewardScroll() : base( 0x2D51 ){}
|
||||
|
||||
public BaseRewardScroll( Serial serial ) : base( serial ) { }
|
||||
|
||||
public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 );}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt();}
|
||||
}
|
||||
|
||||
public class RewardScrollDeed : Item
|
||||
{
|
||||
[Constructable]
|
||||
public RewardScrollDeed() : this( 1 )
|
||||
{
|
||||
ItemID = 5360;
|
||||
Movable = true;
|
||||
Hue = 1165;
|
||||
Name = "Reward Scroll Deed";
|
||||
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
from.AddToBackpack( new RewardScroll() );
|
||||
this.Delete();
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public RewardScrollDeed( int amount )
|
||||
{
|
||||
}
|
||||
|
||||
public RewardScrollDeed( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
|
||||
public class RewardScroll : BaseRewardScroll
|
||||
{
|
||||
[Constructable]
|
||||
public RewardScroll()
|
||||
{
|
||||
Stackable = true;
|
||||
Name = "Reward Scroll";
|
||||
Hue = 1165;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
}
|
||||
|
||||
public RewardScroll( Serial serial ) : base( serial ) { }
|
||||
|
||||
public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); writer.Write( (int) 0 );}
|
||||
|
||||
public override void Deserialize( GenericReader reader ) { base.Deserialize( reader ); int version = reader.ReadInt();}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Engines.PartySystem;
|
||||
using System.Data;
|
||||
using System.Xml;
|
||||
|
||||
/*
|
||||
** XmlQuestMaker
|
||||
**
|
||||
** Version 1.00
|
||||
** updated 9/03/04
|
||||
** ArteGordon
|
||||
**
|
||||
*/
|
||||
namespace Server.Items
|
||||
{
|
||||
|
||||
public class XmlQuestMaker : Item
|
||||
{
|
||||
|
||||
public XmlQuestMaker( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
[Constructable]
|
||||
public XmlQuestMaker() : base(0xED4)
|
||||
{
|
||||
Name = "XmlQuestMaker";
|
||||
Movable = false;
|
||||
Visible = true;
|
||||
}
|
||||
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
base.OnDoubleClick(from);
|
||||
|
||||
if(!(from is PlayerMobile)) return;
|
||||
|
||||
// make a quest note
|
||||
QuestHolder newquest = new QuestHolder();
|
||||
newquest.PlayerMade = true;
|
||||
newquest.Creator = from as PlayerMobile;
|
||||
newquest.Hue = 500;
|
||||
from.AddToBackpack(newquest);
|
||||
from.SendMessage("A blank quest has been added to your pack!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
using System;
|
||||
using Server;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using Server.Multis;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.XmlSpawner2
|
||||
{
|
||||
public class XmlSpawnerAddon : BaseAddon
|
||||
{
|
||||
|
||||
public override bool ShareHue { get { return false; } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int PartialVisibility
|
||||
{
|
||||
get
|
||||
{
|
||||
int nvisible = 0;
|
||||
// figure out what percentage of components is visible and return that value
|
||||
// go through the components
|
||||
for (int i = 0; i < Components.Count; i++)
|
||||
{
|
||||
if (Components[i].Visible) nvisible++;
|
||||
}
|
||||
|
||||
return (int)(100.0 * nvisible / Components.Count + 0.5);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (Components == null || Components.Count < 1) return;
|
||||
|
||||
// assign visibility to the components based upon the percentage value
|
||||
int nvisible = value * (Components.Count - 1) / 100;
|
||||
|
||||
// go through the components and assign visibility to the specified percentage
|
||||
// starting at the beginning of the component list
|
||||
for (int i = 0; i < Components.Count; i++)
|
||||
{
|
||||
Components[i].Visible = (i < nvisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create an addon with the static components described in the multi.txt file
|
||||
public static XmlSpawnerAddon ReadMultiFile(string filename, out string status_str)
|
||||
{
|
||||
status_str = null;
|
||||
|
||||
if (filename == null) return null;
|
||||
|
||||
XmlSpawnerAddon newaddon = null;
|
||||
|
||||
// look for the file in the default spawner locations
|
||||
string dirname = XmlSpawner.LocateFile(filename);
|
||||
|
||||
if (System.IO.File.Exists(dirname))
|
||||
{
|
||||
int ncomponents = 0;
|
||||
|
||||
newaddon = new XmlSpawnerAddon();
|
||||
|
||||
try
|
||||
{
|
||||
ncomponents = LoadAddonFromMulti(newaddon, dirname, out status_str);
|
||||
}
|
||||
catch
|
||||
{
|
||||
newaddon.Delete();
|
||||
status_str = "Bad Multi file : " + filename;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (ncomponents == 0)
|
||||
{
|
||||
newaddon.Delete();
|
||||
status_str += " : " + filename;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
status_str = "No such file : " + filename;
|
||||
}
|
||||
|
||||
return newaddon;
|
||||
}
|
||||
|
||||
// adds components from a multi.txt file to an existing addon
|
||||
public static int LoadAddonFromMulti(XmlSpawnerAddon newaddon, string filename, out string status_str)
|
||||
{
|
||||
status_str = null;
|
||||
|
||||
if (filename == null)
|
||||
{
|
||||
status_str = "Invalid filename";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (newaddon == null)
|
||||
{
|
||||
status_str = "Invalid addon";
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool badformat = false;
|
||||
int ncomponents = 0;
|
||||
|
||||
if (System.IO.File.Exists(filename))
|
||||
{
|
||||
|
||||
using (StreamReader sr = new StreamReader(filename))
|
||||
{
|
||||
string line;
|
||||
int linenumber = 0;
|
||||
|
||||
// Read and process lines from the file until the end of the file is reached.
|
||||
// Individual lines have the format of
|
||||
// itemid x y z visible [hue] ; attachment[,args]
|
||||
// where visible is a 0/1 and hue can be optionally specified for individual itemid entries.
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
{
|
||||
linenumber++;
|
||||
|
||||
// process the line
|
||||
if (line.Length == 0) continue;
|
||||
|
||||
// first parse out the component specification from any optional attachment specifications
|
||||
|
||||
string[] specs = line.Split(';');
|
||||
|
||||
// the component spec will always be first
|
||||
|
||||
if (specs == null || specs.Length < 1) continue;
|
||||
|
||||
string[] args = specs[0].Trim().Split(' ');
|
||||
|
||||
AddonComponent newcomponent = null;
|
||||
|
||||
if (args != null && args.Length >= 5)
|
||||
{
|
||||
|
||||
int itemid = -1;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int z = 0;
|
||||
int visible = 0;
|
||||
int hue = -1;
|
||||
|
||||
try
|
||||
{
|
||||
itemid = int.Parse(args[0]);
|
||||
x = int.Parse(args[1]);
|
||||
y = int.Parse(args[2]);
|
||||
z = int.Parse(args[3]);
|
||||
visible = int.Parse(args[4]);
|
||||
|
||||
// handle the optional fields that are not part of the original multi.txt specification
|
||||
if (args.Length > 5)
|
||||
{
|
||||
hue = int.Parse(args[5]);
|
||||
}
|
||||
}
|
||||
catch { badformat = true; }
|
||||
|
||||
if (itemid < 0 || badformat)
|
||||
{
|
||||
status_str = String.Format("Error line {0}", linenumber);
|
||||
break;
|
||||
}
|
||||
|
||||
// create the new component
|
||||
newcomponent = new AddonComponent(itemid);
|
||||
|
||||
// set the properties according to the specification
|
||||
newcomponent.Visible = (visible == 1);
|
||||
|
||||
if (hue >= 0)
|
||||
newcomponent.Hue = hue;
|
||||
|
||||
// add it to the addon
|
||||
newaddon.AddComponent(newcomponent, x, y, z);
|
||||
|
||||
ncomponents++;
|
||||
|
||||
}
|
||||
|
||||
// if a valid component was added, then check to see if any additional attachment specifications need to be processed
|
||||
if (newcomponent != null && specs.Length > 1)
|
||||
{
|
||||
for (int j = 1; j < specs.Length; j++)
|
||||
{
|
||||
|
||||
if (specs[j] == null) continue;
|
||||
|
||||
string attachstring = specs[j].Trim();
|
||||
|
||||
Type type = null;
|
||||
try
|
||||
{
|
||||
type = SpawnerType.GetType(BaseXmlSpawner.ParseObjectType(attachstring));
|
||||
}
|
||||
catch { }
|
||||
|
||||
// if so then create it
|
||||
if (type != null && type.IsSubclassOf(typeof(XmlAttachment)))
|
||||
{
|
||||
object newo = XmlSpawner.CreateObject(type, attachstring, false, true);
|
||||
if (newo is XmlAttachment)
|
||||
{
|
||||
// add the attachment to the target
|
||||
XmlAttach.AttachTo(newcomponent, (XmlAttachment)newo);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sr.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
status_str = "No such file : " + filename;
|
||||
}
|
||||
|
||||
if (badformat)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ncomponents;
|
||||
}
|
||||
}
|
||||
|
||||
public override BaseAddonDeed Deed
|
||||
{
|
||||
get
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public XmlSpawnerAddon()
|
||||
{
|
||||
}
|
||||
|
||||
public XmlSpawnerAddon(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(1); // Version
|
||||
// version 1
|
||||
writer.Write(PartialVisibility);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
PartialVisibility = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user