Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,116 +1,114 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum HeadType
|
||||
{
|
||||
Regular,
|
||||
Duel,
|
||||
Tournament
|
||||
}
|
||||
public enum HeadType
|
||||
{
|
||||
Regular,
|
||||
Duel,
|
||||
Tournament
|
||||
}
|
||||
|
||||
public class Head : Item
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string PlayerName { get; set; }
|
||||
public class Head : Item
|
||||
{
|
||||
[Constructible]
|
||||
public Head()
|
||||
: this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public HeadType HeadType { get; set; }
|
||||
[Constructible]
|
||||
public Head(string playerName)
|
||||
: this(HeadType.Regular, playerName)
|
||||
{
|
||||
}
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( PlayerName == null )
|
||||
return base.DefaultName;
|
||||
[Constructible]
|
||||
public Head(HeadType headType, string playerName)
|
||||
: base(0x1DA0)
|
||||
{
|
||||
HeadType = headType;
|
||||
PlayerName = playerName;
|
||||
}
|
||||
|
||||
switch ( HeadType )
|
||||
{
|
||||
default:
|
||||
return $"the head of {PlayerName}";
|
||||
public Head(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
case HeadType.Duel:
|
||||
return $"the head of {PlayerName}, taken in a duel";
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string PlayerName{ get; set; }
|
||||
|
||||
case HeadType.Tournament:
|
||||
return $"the head of {PlayerName}, taken in a tournament";
|
||||
}
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HeadType HeadType{ get; set; }
|
||||
|
||||
[Constructible]
|
||||
public Head()
|
||||
: this( null )
|
||||
{
|
||||
}
|
||||
public override string DefaultName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (PlayerName == null)
|
||||
return base.DefaultName;
|
||||
|
||||
[Constructible]
|
||||
public Head( string playerName )
|
||||
: this( HeadType.Regular, playerName )
|
||||
{
|
||||
}
|
||||
switch (HeadType)
|
||||
{
|
||||
default:
|
||||
return $"the head of {PlayerName}";
|
||||
|
||||
[Constructible]
|
||||
public Head( HeadType headType, string playerName )
|
||||
: base( 0x1DA0 )
|
||||
{
|
||||
HeadType = headType;
|
||||
PlayerName = playerName;
|
||||
}
|
||||
case HeadType.Duel:
|
||||
return $"the head of {PlayerName}, taken in a duel";
|
||||
|
||||
public Head( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
}
|
||||
case HeadType.Tournament:
|
||||
return $"the head of {PlayerName}, taken in a tournament";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write( (string) PlayerName );
|
||||
writer.WriteEncodedInt( (int) HeadType );
|
||||
}
|
||||
writer.Write(PlayerName);
|
||||
writer.WriteEncodedInt((int)HeadType);
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
PlayerName = reader.ReadString();
|
||||
HeadType = (HeadType) reader.ReadEncodedInt();
|
||||
break;
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
PlayerName = reader.ReadString();
|
||||
HeadType = (HeadType)reader.ReadEncodedInt();
|
||||
break;
|
||||
|
||||
case 0:
|
||||
string format = Name;
|
||||
case 0:
|
||||
string format = Name;
|
||||
|
||||
if ( format != null )
|
||||
{
|
||||
if ( format.StartsWith( "the head of " ) )
|
||||
format = format.Substring( "the head of ".Length );
|
||||
if (format != null)
|
||||
{
|
||||
if (format.StartsWith("the head of "))
|
||||
format = format.Substring("the head of ".Length);
|
||||
|
||||
if ( format.EndsWith( ", taken in a duel" ) )
|
||||
{
|
||||
format = format.Substring( 0, format.Length - ", taken in a duel".Length );
|
||||
HeadType = HeadType.Duel;
|
||||
}
|
||||
else if ( format.EndsWith( ", taken in a tournament" ) )
|
||||
{
|
||||
format = format.Substring( 0, format.Length - ", taken in a tournament".Length );
|
||||
HeadType = HeadType.Tournament;
|
||||
}
|
||||
}
|
||||
if (format.EndsWith(", taken in a duel"))
|
||||
{
|
||||
format = format.Substring(0, format.Length - ", taken in a duel".Length);
|
||||
HeadType = HeadType.Duel;
|
||||
}
|
||||
else if (format.EndsWith(", taken in a tournament"))
|
||||
{
|
||||
format = format.Substring(0, format.Length - ", taken in a tournament".Length);
|
||||
HeadType = HeadType.Tournament;
|
||||
}
|
||||
}
|
||||
|
||||
PlayerName = format;
|
||||
Name = null;
|
||||
PlayerName = format;
|
||||
Name = null;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue