7.0.9.x compat
updated spawner
This commit is contained in:
parent
e86794c4e6
commit
6441f12907
10 changed files with 367 additions and 88 deletions
|
|
@ -2,8 +2,13 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Server;
|
||||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
using CPA = Server.CommandPropertyAttribute;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
|
|
@ -40,15 +45,15 @@ namespace Server.Mobiles
|
|||
|
||||
public virtual int CreaturesNameCount { get { return m_CreaturesName.Count; } }
|
||||
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
Spawner s = newItem as Spawner;
|
||||
public override void OnAfterDuped( Item newItem )
|
||||
{
|
||||
Spawner s = newItem as Spawner;
|
||||
|
||||
if ( s == null )
|
||||
return;
|
||||
if ( s == null )
|
||||
return;
|
||||
|
||||
s.m_CreaturesName = new List<string>( m_CreaturesName );
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Count
|
||||
|
|
@ -148,7 +153,7 @@ namespace Server.Mobiles
|
|||
public Spawner( int amount, int minDelay, int maxDelay, int team, int homeRange, string creatureName ) : base( 0x1f13 )
|
||||
{
|
||||
List<string> creaturesName = new List<string>();
|
||||
creaturesName.Add( creatureName.ToLower() );
|
||||
creaturesName.Add( creatureName );
|
||||
InitSpawn( amount, TimeSpan.FromMinutes( minDelay ), TimeSpan.FromMinutes( maxDelay ), team, homeRange, creaturesName );
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +161,7 @@ namespace Server.Mobiles
|
|||
public Spawner( string creatureName ) : base( 0x1f13 )
|
||||
{
|
||||
List<string> creaturesName = new List<string>();
|
||||
creaturesName.Add( creatureName.ToLower() );
|
||||
creaturesName.Add( creatureName );
|
||||
InitSpawn( 1, TimeSpan.FromMinutes( 5 ), TimeSpan.FromMinutes( 10 ), 0, 4, creaturesName );
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +222,7 @@ namespace Server.Mobiles
|
|||
|
||||
list.Add( 1060656, m_Count.ToString() ); // amount to make: ~1_val~
|
||||
list.Add( 1061169, m_HomeRange.ToString() ); // range ~1_val~
|
||||
list.Add( 1060658, "walking range\t{0}", m_WalkingRange ); // ~1_val~: ~2_val~
|
||||
list.Add( 1060658, "walking range\t{0}", m_WalkingRange ); // ~1_val~: ~2_val~
|
||||
|
||||
list.Add( 1060659, "group\t{0}", m_Group ); // ~1_val~: ~2_val~
|
||||
list.Add( 1060660, "team\t{0}", m_Team ); // ~1_val~: ~2_val~
|
||||
|
|
@ -263,6 +268,11 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
public static string ParseType( string s )
|
||||
{
|
||||
return s.Split( null, 2 )[0];
|
||||
}
|
||||
|
||||
public void Defrag()
|
||||
{
|
||||
bool removed = false;
|
||||
|
|
@ -369,16 +379,13 @@ namespace Server.Mobiles
|
|||
if ( index >= m_CreaturesName.Count )
|
||||
return null;
|
||||
|
||||
|
||||
Type type = SpawnerType.GetType( m_CreaturesName[index] );
|
||||
Type type = ScriptCompiler.FindTypeByName( ParseType( m_CreaturesName[index] ) );
|
||||
|
||||
if ( type != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
object o = Activator.CreateInstance( type );
|
||||
|
||||
return ( o as IEntity );
|
||||
return Build( CommandSystem.Split( m_CreaturesName[index] ) );
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -386,7 +393,113 @@ namespace Server.Mobiles
|
|||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IEntity Build( string[] args )
|
||||
{
|
||||
string name = args[0];
|
||||
|
||||
Add.FixArgs( ref args );
|
||||
|
||||
string[,] props = null;
|
||||
|
||||
for ( int i = 0; i < args.Length; ++i )
|
||||
{
|
||||
if ( Insensitive.Equals( args[i], "set" ) )
|
||||
{
|
||||
int remains = args.Length - i - 1;
|
||||
|
||||
if ( remains >= 2 )
|
||||
{
|
||||
props = new string[remains / 2, 2];
|
||||
|
||||
remains /= 2;
|
||||
|
||||
for ( int j = 0; j < remains; ++j )
|
||||
{
|
||||
props[j, 0] = args[i + (j * 2) + 1];
|
||||
props[j, 1] = args[i + (j * 2) + 2];
|
||||
}
|
||||
|
||||
Add.FixSetString( ref args, i );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName( name );
|
||||
|
||||
if ( !Add.IsEntity( type ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PropertyInfo[] realProps = null;
|
||||
|
||||
if ( props != null )
|
||||
{
|
||||
realProps = new PropertyInfo[props.GetLength( 0 )];
|
||||
|
||||
PropertyInfo[] allProps = type.GetProperties( BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public );
|
||||
|
||||
for ( int i = 0; i < realProps.Length; ++i )
|
||||
{
|
||||
PropertyInfo thisProp = null;
|
||||
|
||||
string propName = props[i, 0];
|
||||
|
||||
for ( int j = 0; thisProp == null && j < allProps.Length; ++j )
|
||||
{
|
||||
if ( Insensitive.Equals( propName, allProps[j].Name ) )
|
||||
thisProp = allProps[j];
|
||||
}
|
||||
|
||||
if ( thisProp != null )
|
||||
{
|
||||
CPA attr = Properties.GetCPA( thisProp );
|
||||
|
||||
if ( attr != null && AccessLevel.GameMaster >= attr.WriteLevel && thisProp.CanWrite && !attr.ReadOnly )
|
||||
realProps[i] = thisProp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConstructorInfo[] ctors = type.GetConstructors();
|
||||
|
||||
for ( int i = 0; i < ctors.Length; ++i )
|
||||
{
|
||||
ConstructorInfo ctor = ctors[i];
|
||||
|
||||
if ( !Add.IsConstructable( ctor, AccessLevel.GameMaster ) )
|
||||
continue;
|
||||
|
||||
ParameterInfo[] paramList = ctor.GetParameters();
|
||||
|
||||
if ( args.Length == paramList.Length )
|
||||
{
|
||||
object[] paramValues = Add.ParseValues( paramList, args );
|
||||
|
||||
if ( paramValues == null )
|
||||
continue;
|
||||
|
||||
object built = ctor.Invoke( paramValues );
|
||||
|
||||
if ( built != null && realProps != null )
|
||||
{
|
||||
for ( int j = 0; j < realProps.Length; ++j )
|
||||
{
|
||||
if ( realProps[j] == null )
|
||||
continue;
|
||||
|
||||
string result = Properties.InternalSetValue( built, realProps[j], props[j, 1] );
|
||||
}
|
||||
}
|
||||
|
||||
return (IEntity)built;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Spawn( int index )
|
||||
|
|
@ -465,8 +578,16 @@ namespace Server.Mobiles
|
|||
// Try 10 times to find a Spawnable location.
|
||||
for ( int i = 0; i < 10; i++ )
|
||||
{
|
||||
int x = Location.X + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
|
||||
int y = Location.Y + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
|
||||
int x, y;
|
||||
|
||||
if ( m_HomeRange > 0 ) {
|
||||
x = Location.X + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
|
||||
y = Location.Y + (Utility.Random( (m_HomeRange * 2) + 1 ) - m_HomeRange);
|
||||
} else {
|
||||
x = Location.X;
|
||||
y = Location.Y;
|
||||
}
|
||||
|
||||
int z = Map.GetAverageZ( x, y );
|
||||
|
||||
if ( Map.CanSpawnMobile( new Point2D( x, y ), this.Z ) )
|
||||
|
|
@ -688,11 +809,12 @@ namespace Server.Mobiles
|
|||
|
||||
for ( int i = 0; i < size; ++i )
|
||||
{
|
||||
string typeName = reader.ReadString();
|
||||
string creatureString = reader.ReadString();
|
||||
|
||||
m_CreaturesName.Add( typeName );
|
||||
m_CreaturesName.Add( creatureString );
|
||||
string typeName = ParseType( creatureString );
|
||||
|
||||
if ( SpawnerType.GetType( typeName ) == null )
|
||||
if ( ScriptCompiler.FindTypeByName( typeName ) == null )
|
||||
{
|
||||
if ( m_WarnTimer == null )
|
||||
m_WarnTimer = new WarnTimer();
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Server.Mobiles
|
|||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 260, 371, 5054 );
|
||||
AddBackground( 0, 0, 410, 371, 5054 );
|
||||
|
||||
AddLabel( 95, 1, 0, "Creatures List" );
|
||||
|
||||
|
|
@ -37,8 +37,8 @@ namespace Server.Mobiles
|
|||
AddButton( 5, ( 22 * i ) + 20, 0xFA5, 0xFA7, 4 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
AddButton( 38, ( 22 * i ) + 20, 0xFA2, 0xFA4, 5 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
|
||||
AddImageTiled( 71, ( 22 * i ) + 20, 159, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 157, 21, 0xBBC );
|
||||
AddImageTiled( 71, ( 22 * i ) + 20, 309, 23, 0xA40 );
|
||||
AddImageTiled( 72, ( 22 * i ) + 21, 307, 21, 0xBBC );
|
||||
|
||||
string str = "";
|
||||
|
||||
|
|
@ -47,10 +47,10 @@ namespace Server.Mobiles
|
|||
str = (string)spawner.CreaturesName[i];
|
||||
int count = m_Spawner.CountCreatures( str );
|
||||
|
||||
AddLabel( 232, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
AddLabel( 382, ( 22 * i ) + 20, 0, count.ToString() );
|
||||
}
|
||||
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 154, 21, 0, i, str );
|
||||
AddTextEntry( 75, ( 22 * i ) + 21, 304, 21, 0, i, str );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,12 +70,14 @@ namespace Server.Mobiles
|
|||
{
|
||||
str = str.Trim();
|
||||
|
||||
Type type = SpawnerType.GetType( str );
|
||||
string t = Spawner.ParseType( str );
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName( t );
|
||||
|
||||
if ( type != null )
|
||||
creaturesName.Add( str );
|
||||
else
|
||||
from.SendMessage( "{0} is not a valid type name.", str );
|
||||
from.SendMessage( "{0} is not a valid type name.", t );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -494,17 +494,19 @@ namespace Server.Items
|
|||
{
|
||||
// The client must know about the spellbook or it will crash!
|
||||
|
||||
NetState ns = to.NetState;
|
||||
|
||||
if ( ns == null )
|
||||
return;
|
||||
|
||||
if ( Parent == null )
|
||||
{
|
||||
to.Send( this.WorldPacket );
|
||||
}
|
||||
else if ( Parent is Item )
|
||||
{
|
||||
if ( to.NetState == null )
|
||||
return;
|
||||
|
||||
// What will happen if the client doesn't know about our parent?
|
||||
if ( to.NetState.ContainerGridLines )
|
||||
if ( ns.ContainerGridLines )
|
||||
to.Send( new ContainerContentUpdate6017( this ) );
|
||||
else
|
||||
to.Send( new ContainerContentUpdate( this ) );
|
||||
|
|
@ -515,20 +517,20 @@ namespace Server.Items
|
|||
to.Send( new EquipUpdate( this ) );
|
||||
}
|
||||
|
||||
to.Send( new DisplaySpellbook( this ) );
|
||||
|
||||
if ( to.NetState == null )
|
||||
return;
|
||||
if ( ns.HighSeas )
|
||||
to.Send( new DisplaySpellbookHS( this ) );
|
||||
else
|
||||
to.Send( new DisplaySpellbook( this ) );
|
||||
|
||||
if ( Core.AOS ) {
|
||||
if ( to.NetState.NewSpellbook ) {
|
||||
if ( ns.NewSpellbook ) {
|
||||
to.Send( new NewSpellbookContent( this, ItemID, BookOffset + 1, m_Content ) );
|
||||
} else {
|
||||
to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( to.NetState.ContainerGridLines ) {
|
||||
if ( ns.ContainerGridLines ) {
|
||||
to.Send( new SpellbookContent6017( m_Count, BookOffset + 1, m_Content, this ) );
|
||||
} else {
|
||||
to.Send( new SpellbookContent( m_Count, BookOffset + 1, m_Content, this ) );
|
||||
|
|
|
|||
|
|
@ -37,7 +37,10 @@ namespace Server.Misc
|
|||
* - <rules> : Rules and restrictions associated with the map. See documentation for details
|
||||
*/
|
||||
|
||||
TileMatrixPatch.Enabled = false; //OSI client patch 6.0.0.0
|
||||
TileMatrixPatch.Enabled = false; // OSI Client Patch 6.0.0.0
|
||||
|
||||
TileData.PostHSFormat = true; // OSI Client Patch 7.0.9.0
|
||||
MultiData.PostHSFormat = true; // OSI Client Patch 7.0.9.0
|
||||
}
|
||||
|
||||
public static void RegisterMap( int mapIndex, int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules )
|
||||
|
|
|
|||
|
|
@ -634,15 +634,23 @@ namespace Server.Mobiles
|
|||
|
||||
SendPacksTo( from );
|
||||
|
||||
if ( from.NetState == null )
|
||||
NetState ns = from.NetState;
|
||||
|
||||
if ( ns == null )
|
||||
return;
|
||||
|
||||
if ( from.NetState.ContainerGridLines )
|
||||
if ( ns.ContainerGridLines )
|
||||
from.Send( new VendorBuyContent6017( list ) );
|
||||
else
|
||||
from.Send( new VendorBuyContent( list ) );
|
||||
|
||||
from.Send( new VendorBuyList( this, list ) );
|
||||
from.Send( new DisplayBuyList( this ) );
|
||||
|
||||
if ( ns.HighSeas )
|
||||
from.Send( new DisplayBuyListHS( this ) );
|
||||
else
|
||||
from.Send( new DisplayBuyList( this ) );
|
||||
|
||||
from.Send( new MobileStatusExtended( from ) );//make sure their gold amount is sent
|
||||
|
||||
if ( opls != null ) {
|
||||
|
|
|
|||
|
|
@ -1620,11 +1620,19 @@ namespace Server.Items
|
|||
|
||||
public virtual void DisplayTo( Mobile to )
|
||||
{
|
||||
ProcessOpeners( to );
|
||||
ProcessOpeners( to );
|
||||
|
||||
to.Send( new ContainerDisplay( this ) );
|
||||
NetState ns = to.NetState;
|
||||
|
||||
if ( ns == null )
|
||||
return;
|
||||
|
||||
if ( ns.HighSeas )
|
||||
to.Send( new ContainerDisplayHS( this ) );
|
||||
else
|
||||
to.Send( new ContainerDisplay( this ) );
|
||||
|
||||
if ( to.NetState != null && to.NetState.ContainerGridLines )
|
||||
if ( ns.ContainerGridLines )
|
||||
to.Send( new ContainerContent6017( to, this ) );
|
||||
else
|
||||
to.Send( new ContainerContent( to, this ) );
|
||||
|
|
|
|||
|
|
@ -26,6 +26,13 @@ namespace Server
|
|||
{
|
||||
public class MultiData
|
||||
{
|
||||
public static bool PostHSFormat {
|
||||
get { return _PostHSFormat; }
|
||||
set { _PostHSFormat = value; }
|
||||
}
|
||||
|
||||
private static bool _PostHSFormat = false;
|
||||
|
||||
private static MultiComponentList[] m_Components;
|
||||
|
||||
private static FileStream m_Index, m_Stream;
|
||||
|
|
@ -66,7 +73,7 @@ namespace Server
|
|||
|
||||
m_StreamReader.BaseStream.Seek( lookup, SeekOrigin.Begin );
|
||||
|
||||
return new MultiComponentList( m_StreamReader, length / 12 );
|
||||
return new MultiComponentList( m_StreamReader, length / ( _PostHSFormat ? 16 : 12 ) );
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -525,6 +532,9 @@ namespace Server
|
|||
allTiles[i].m_OffsetZ = reader.ReadInt16();
|
||||
allTiles[i].m_Flags = reader.ReadInt32();
|
||||
|
||||
if ( MultiData.PostHSFormat )
|
||||
reader.ReadInt32(); // ??
|
||||
|
||||
MultiTileEntry e = allTiles[i];
|
||||
|
||||
if ( i == 0 || e.m_Flags != 0 )
|
||||
|
|
|
|||
|
|
@ -201,7 +201,9 @@ namespace Server.Network {
|
|||
set {
|
||||
m_Version = value;
|
||||
|
||||
if ( value >= m_Version7000 ) {
|
||||
if ( value >= m_Version7090 ) {
|
||||
_ProtocolChanges = ProtocolChanges.Version7090;
|
||||
} else if ( value >= m_Version7000 ) {
|
||||
_ProtocolChanges = ProtocolChanges.Version7000;
|
||||
} else if ( value >= m_Version60142 ) {
|
||||
_ProtocolChanges = ProtocolChanges.Version60142;
|
||||
|
|
@ -229,27 +231,30 @@ namespace Server.Network {
|
|||
private static ClientVersion m_Version6017 = new ClientVersion( "6.0.1.7" );
|
||||
private static ClientVersion m_Version60142 = new ClientVersion( "6.0.14.2" );
|
||||
private static ClientVersion m_Version7000 = new ClientVersion( "7.0.0.0" );
|
||||
private static ClientVersion m_Version7090 = new ClientVersion( "7.0.9.0" );
|
||||
|
||||
private ProtocolChanges _ProtocolChanges;
|
||||
|
||||
private enum ProtocolChanges {
|
||||
NewSpellbook = 0x00000001,
|
||||
DamagePacket = 0x00000002,
|
||||
Unpack = 0x00000004,
|
||||
BuffIcon = 0x00000008,
|
||||
NewHaven = 0x00000010,
|
||||
ContainerGridLines = 0x00000020,
|
||||
NewSpellbook = 0x00000001,
|
||||
DamagePacket = 0x00000002,
|
||||
Unpack = 0x00000004,
|
||||
BuffIcon = 0x00000008,
|
||||
NewHaven = 0x00000010,
|
||||
ContainerGridLines = 0x00000020,
|
||||
ExtendedSupportedFeatures = 0x00000040,
|
||||
StygianAbyss = 0x00000080,
|
||||
StygianAbyss = 0x00000080,
|
||||
HighSeas = 0x00000100,
|
||||
|
||||
Version400a = NewSpellbook,
|
||||
Version407a = Version400a | DamagePacket,
|
||||
Version500a = Version407a | Unpack,
|
||||
Version502b = Version500a | BuffIcon,
|
||||
Version6000 = Version502b | NewHaven,
|
||||
Version6017 = Version6000 | ContainerGridLines,
|
||||
Version60142 = Version6017 | ExtendedSupportedFeatures,
|
||||
Version7000 = Version60142 | StygianAbyss
|
||||
Version400a = NewSpellbook,
|
||||
Version407a = Version400a | DamagePacket,
|
||||
Version500a = Version407a | Unpack,
|
||||
Version502b = Version500a | BuffIcon,
|
||||
Version6000 = Version502b | NewHaven,
|
||||
Version6017 = Version6000 | ContainerGridLines,
|
||||
Version60142 = Version6017 | ExtendedSupportedFeatures,
|
||||
Version7000 = Version60142 | StygianAbyss,
|
||||
Version7090 = Version7000 | HighSeas
|
||||
}
|
||||
|
||||
public bool NewSpellbook { get { return ((_ProtocolChanges & ProtocolChanges.NewSpellbook) != 0); } }
|
||||
|
|
@ -260,6 +265,7 @@ namespace Server.Network {
|
|||
public bool ContainerGridLines { get { return ((_ProtocolChanges & ProtocolChanges.ContainerGridLines) != 0); } }
|
||||
public bool ExtendedSupportedFeatures { get { return ((_ProtocolChanges & ProtocolChanges.ExtendedSupportedFeatures) != 0); } }
|
||||
public bool StygianAbyss { get { return ((_ProtocolChanges & ProtocolChanges.StygianAbyss) != 0); } }
|
||||
public bool HighSeas { get { return ((_ProtocolChanges & ProtocolChanges.HighSeas) != 0); } }
|
||||
|
||||
public bool IsUOTDClient {
|
||||
get {
|
||||
|
|
|
|||
|
|
@ -310,7 +310,17 @@ namespace Server.Network
|
|||
public DisplayBuyList( Mobile vendor ) : base( 0x24, 7 )
|
||||
{
|
||||
m_Stream.Write( (int)vendor.Serial );
|
||||
m_Stream.Write( (short)0x30 );//buy window id?
|
||||
m_Stream.Write( (short) 0x30 ); // buy window id?
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class DisplayBuyListHS : Packet
|
||||
{
|
||||
public DisplayBuyListHS( Mobile vendor ) : base( 0x24, 9 )
|
||||
{
|
||||
m_Stream.Write( (int)vendor.Serial );
|
||||
m_Stream.Write( (short) 0x30 ); // buy window id?
|
||||
m_Stream.Write( (short) 0x00 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1112,6 +1122,47 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class WorldItemHS : Packet
|
||||
{
|
||||
public WorldItemHS( Item item ) : base( 0xF3, 26 )
|
||||
{
|
||||
m_Stream.Write( (short) 0x1 );
|
||||
|
||||
int itemID = item.ItemID;
|
||||
|
||||
if ( item is BaseMulti ) {
|
||||
m_Stream.Write( (byte) 0x02 );
|
||||
itemID &= 0x3FFF;
|
||||
} else {
|
||||
m_Stream.Write( (byte) 0x00 );
|
||||
itemID &= 0x7FFF;
|
||||
}
|
||||
|
||||
m_Stream.Write( (int) item.Serial );
|
||||
|
||||
m_Stream.Write( (short) itemID );
|
||||
|
||||
m_Stream.Write( (byte) item.Direction );
|
||||
|
||||
int amount = item.Amount;
|
||||
m_Stream.Write( (short) amount );
|
||||
m_Stream.Write( (short) amount );
|
||||
|
||||
Point3D loc = item.Location;
|
||||
int x = loc.m_X & 0x7FFF;
|
||||
int y = loc.m_Y & 0x3FFF;
|
||||
m_Stream.Write( (short) x );
|
||||
m_Stream.Write( (short) y );
|
||||
m_Stream.Write( (sbyte) loc.m_Z );
|
||||
|
||||
m_Stream.Write( (byte) item.Light );
|
||||
m_Stream.Write( (short) item.Hue );
|
||||
m_Stream.Write( (byte) item.GetPacketFlags() );
|
||||
|
||||
m_Stream.Write( (short) 0x00 ); // ??
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class LiftRej : Packet
|
||||
{
|
||||
public LiftRej( LRReason reason ) : base( 0x27, 2 )
|
||||
|
|
@ -1518,6 +1569,16 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class DisplaySpellbookHS : Packet
|
||||
{
|
||||
public DisplaySpellbookHS( Item book ) : base( 0x24, 9 )
|
||||
{
|
||||
m_Stream.Write( (int) book.Serial );
|
||||
m_Stream.Write( (short) -1 );
|
||||
m_Stream.Write( (short) 0x7D );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NewSpellbookContent : Packet
|
||||
{
|
||||
public NewSpellbookContent( Item item, int graphic, int offset, ulong content ) : base( 0xBF )
|
||||
|
|
@ -1614,6 +1675,16 @@ namespace Server.Network
|
|||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerDisplayHS : Packet
|
||||
{
|
||||
public ContainerDisplayHS( Container c ) : base( 0x24, 9 )
|
||||
{
|
||||
m_Stream.Write( (int) c.Serial );
|
||||
m_Stream.Write( (short) c.GumpID );
|
||||
m_Stream.Write( (short) 0x7D );
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerContentUpdate : Packet
|
||||
{
|
||||
public ContainerContentUpdate( Item item ) : base( 0x25, 20 )
|
||||
|
|
|
|||
|
|
@ -199,6 +199,13 @@ namespace Server
|
|||
|
||||
public class TileData
|
||||
{
|
||||
public static bool PostHSFormat {
|
||||
get { return _PostHSFormat; }
|
||||
set { _PostHSFormat = value; }
|
||||
}
|
||||
|
||||
private static bool _PostHSFormat = false;
|
||||
|
||||
private static LandData[] m_LandData;
|
||||
private static ItemData[] m_ItemData;
|
||||
|
||||
|
|
@ -241,42 +248,82 @@ namespace Server
|
|||
{
|
||||
BinaryReader bin = new BinaryReader( fs );
|
||||
|
||||
m_LandData = new LandData[0x4000];
|
||||
if ( _PostHSFormat ) {
|
||||
m_LandData = new LandData[0x4000];
|
||||
|
||||
for ( int i = 0; i < 0x4000; ++i )
|
||||
{
|
||||
if ( (i & 0x1F) == 0 )
|
||||
for ( int i = 0; i < 0x4000; ++i )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
if ( i == 1 || ( i > 0 && (i & 0x1F) == 0 ) )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
}
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt64();
|
||||
bin.ReadInt16(); // skip 2 bytes -- textureID
|
||||
|
||||
m_LandData[i] = new LandData( ReadNameString( bin ), flags );
|
||||
}
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
bin.ReadInt16(); // skip 2 bytes -- textureID
|
||||
m_ItemData = new ItemData[0x8000];
|
||||
|
||||
m_LandData[i] = new LandData( ReadNameString( bin ), flags );
|
||||
}
|
||||
|
||||
m_ItemData = new ItemData[0x4000];
|
||||
|
||||
for ( int i = 0; i < 0x4000; ++i )
|
||||
{
|
||||
if ( (i & 0x1F) == 0 )
|
||||
for ( int i = 0; i < 0x8000; ++i )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
if ( (i & 0x1F) == 0 )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
}
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt64();
|
||||
int weight = bin.ReadByte();
|
||||
int quality = bin.ReadByte();
|
||||
bin.ReadInt16();
|
||||
bin.ReadByte();
|
||||
int quantity = bin.ReadByte();
|
||||
bin.ReadInt32();
|
||||
bin.ReadByte();
|
||||
int value = bin.ReadByte();
|
||||
int height = bin.ReadByte();
|
||||
|
||||
m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height );
|
||||
}
|
||||
} else {
|
||||
m_LandData = new LandData[0x4000];
|
||||
|
||||
for ( int i = 0; i < 0x4000; ++i )
|
||||
{
|
||||
if ( (i & 0x1F) == 0 )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
}
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
bin.ReadInt16(); // skip 2 bytes -- textureID
|
||||
|
||||
m_LandData[i] = new LandData( ReadNameString( bin ), flags );
|
||||
}
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
int weight = bin.ReadByte();
|
||||
int quality = bin.ReadByte();
|
||||
bin.ReadInt16();
|
||||
bin.ReadByte();
|
||||
int quantity = bin.ReadByte();
|
||||
bin.ReadInt32();
|
||||
bin.ReadByte();
|
||||
int value = bin.ReadByte();
|
||||
int height = bin.ReadByte();
|
||||
m_ItemData = new ItemData[0x4000];
|
||||
|
||||
m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height );
|
||||
for ( int i = 0; i < 0x4000; ++i )
|
||||
{
|
||||
if ( (i & 0x1F) == 0 )
|
||||
{
|
||||
bin.ReadInt32(); // header
|
||||
}
|
||||
|
||||
TileFlag flags = (TileFlag)bin.ReadInt32();
|
||||
int weight = bin.ReadByte();
|
||||
int quality = bin.ReadByte();
|
||||
bin.ReadInt16();
|
||||
bin.ReadByte();
|
||||
int quantity = bin.ReadByte();
|
||||
bin.ReadInt32();
|
||||
bin.ReadByte();
|
||||
int value = bin.ReadByte();
|
||||
int height = bin.ReadByte();
|
||||
|
||||
m_ItemData[i] = new ItemData( ReadNameString( bin ), flags, weight, quality, quantity, value, height );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue