Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -14,22 +14,16 @@ namespace Server.Factions
|
|||
public const int MaxCandidates = 10;
|
||||
public const int CandidateRank = 5;
|
||||
|
||||
private Faction m_Faction;
|
||||
private List<Candidate> m_Candidates;
|
||||
public Faction Faction { get; }
|
||||
|
||||
private ElectionState m_State;
|
||||
private DateTime m_LastStateTime;
|
||||
public List<Candidate> Candidates { get; }
|
||||
|
||||
public Faction Faction => m_Faction;
|
||||
|
||||
public List<Candidate> Candidates => m_Candidates;
|
||||
|
||||
public ElectionState State{ get => m_State;
|
||||
set{ m_State = value; m_LastStateTime = DateTime.UtcNow; } }
|
||||
public DateTime LastStateTime => m_LastStateTime;
|
||||
public ElectionState State{ get => CurrentState;
|
||||
set{ CurrentState = value; LastStateTime = DateTime.UtcNow; } }
|
||||
public DateTime LastStateTime { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ElectionState CurrentState => m_State;
|
||||
public ElectionState CurrentState { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public TimeSpan NextStateTime
|
||||
|
|
@ -38,7 +32,7 @@ namespace Server.Factions
|
|||
{
|
||||
TimeSpan period;
|
||||
|
||||
switch ( m_State )
|
||||
switch ( CurrentState )
|
||||
{
|
||||
default:
|
||||
case ElectionState.Pending: period = PendingPeriod; break;
|
||||
|
|
@ -46,7 +40,7 @@ namespace Server.Factions
|
|||
case ElectionState.Campaign: period = CampaignPeriod; break;
|
||||
}
|
||||
|
||||
TimeSpan until = (m_LastStateTime + period) - DateTime.UtcNow;
|
||||
TimeSpan until = (LastStateTime + period) - DateTime.UtcNow;
|
||||
|
||||
if ( until < TimeSpan.Zero )
|
||||
until = TimeSpan.Zero;
|
||||
|
|
@ -57,7 +51,7 @@ namespace Server.Factions
|
|||
{
|
||||
TimeSpan period;
|
||||
|
||||
switch ( m_State )
|
||||
switch ( CurrentState )
|
||||
{
|
||||
default:
|
||||
case ElectionState.Pending: period = PendingPeriod; break;
|
||||
|
|
@ -65,7 +59,7 @@ namespace Server.Factions
|
|||
case ElectionState.Campaign: period = CampaignPeriod; break;
|
||||
}
|
||||
|
||||
m_LastStateTime = DateTime.UtcNow - period + value;
|
||||
LastStateTime = DateTime.UtcNow - period + value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -78,8 +72,8 @@ namespace Server.Factions
|
|||
|
||||
public Election( Faction faction )
|
||||
{
|
||||
m_Faction = faction;
|
||||
m_Candidates = new List<Candidate>();
|
||||
Faction = faction;
|
||||
Candidates = new List<Candidate>();
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
|
|
@ -92,12 +86,12 @@ namespace Server.Factions
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Faction = Faction.ReadReference( reader );
|
||||
Faction = Faction.ReadReference( reader );
|
||||
|
||||
m_LastStateTime = reader.ReadDateTime();
|
||||
m_State = (ElectionState)reader.ReadEncodedInt();
|
||||
LastStateTime = reader.ReadDateTime();
|
||||
CurrentState = (ElectionState)reader.ReadEncodedInt();
|
||||
|
||||
m_Candidates = new List<Candidate>();
|
||||
Candidates = new List<Candidate>();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -106,7 +100,7 @@ namespace Server.Factions
|
|||
Candidate cd = new Candidate( reader );
|
||||
|
||||
if ( cd.Mobile != null )
|
||||
m_Candidates.Add( cd );
|
||||
Candidates.Add( cd );
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -120,15 +114,15 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
Faction.WriteReference( writer, Faction );
|
||||
|
||||
writer.Write( (DateTime) m_LastStateTime );
|
||||
writer.WriteEncodedInt( (int) m_State );
|
||||
writer.Write( (DateTime) LastStateTime );
|
||||
writer.WriteEncodedInt( (int) CurrentState );
|
||||
|
||||
writer.WriteEncodedInt( m_Candidates.Count );
|
||||
writer.WriteEncodedInt( Candidates.Count );
|
||||
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
m_Candidates[i].Serialize( writer );
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
Candidates[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public void AddCandidate( Mobile mob )
|
||||
|
|
@ -136,17 +130,17 @@ namespace Server.Factions
|
|||
if ( IsCandidate( mob ) )
|
||||
return;
|
||||
|
||||
m_Candidates.Add( new Candidate( mob ) );
|
||||
Candidates.Add( new Candidate( mob ) );
|
||||
mob.SendLocalizedMessage( 1010117 ); // You are now running for office.
|
||||
}
|
||||
|
||||
public void RemoveVoter( Mobile mob )
|
||||
{
|
||||
if ( m_State == ElectionState.Election )
|
||||
if ( CurrentState == ElectionState.Election )
|
||||
{
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
{
|
||||
List<Voter> voters = m_Candidates[i].Voters;
|
||||
List<Voter> voters = Candidates[i].Voters;
|
||||
|
||||
for ( int j = 0; j < voters.Count; ++j )
|
||||
{
|
||||
|
|
@ -166,38 +160,38 @@ namespace Server.Factions
|
|||
if ( cd == null )
|
||||
return;
|
||||
|
||||
m_Candidates.Remove( cd );
|
||||
Candidates.Remove( cd );
|
||||
mob.SendLocalizedMessage( 1038031 );
|
||||
|
||||
if ( m_State == ElectionState.Election )
|
||||
if ( CurrentState == ElectionState.Election )
|
||||
{
|
||||
if ( m_Candidates.Count == 1 )
|
||||
if ( Candidates.Count == 1 )
|
||||
{
|
||||
m_Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election.
|
||||
Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election.
|
||||
|
||||
Candidate winner = m_Candidates[0];
|
||||
Candidate winner = Candidates[0];
|
||||
|
||||
Mobile winMob = winner.Mobile;
|
||||
PlayerState pl = PlayerState.Find( winMob );
|
||||
|
||||
if ( pl == null || pl.Faction != m_Faction || winMob == m_Faction.Commander )
|
||||
if ( pl == null || pl.Faction != Faction || winMob == Faction.Commander )
|
||||
{
|
||||
m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
m_Faction.Commander = winMob;
|
||||
Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
Faction.Commander = winMob;
|
||||
}
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else if ( m_Candidates.Count == 0 ) // well, I guess this'll never happen
|
||||
else if ( Candidates.Count == 0 ) // well, I guess this'll never happen
|
||||
{
|
||||
m_Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election.
|
||||
Faction.Broadcast( 1038031 ); // There are no longer any valid candidates in the Faction Commander election.
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
}
|
||||
|
|
@ -210,7 +204,7 @@ namespace Server.Factions
|
|||
|
||||
public bool CanVote( Mobile mob )
|
||||
{
|
||||
return ( m_State == ElectionState.Election && !HasVoted( mob ) );
|
||||
return ( CurrentState == ElectionState.Election && !HasVoted( mob ) );
|
||||
}
|
||||
|
||||
public bool HasVoted( Mobile mob )
|
||||
|
|
@ -220,10 +214,10 @@ namespace Server.Factions
|
|||
|
||||
public Candidate FindCandidate( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
{
|
||||
if ( m_Candidates[i].Mobile == mob )
|
||||
return m_Candidates[i];
|
||||
if ( Candidates[i].Mobile == mob )
|
||||
return Candidates[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -231,16 +225,16 @@ namespace Server.Factions
|
|||
|
||||
public Candidate FindVoter( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
{
|
||||
List<Voter> voters = m_Candidates[i].Voters;
|
||||
List<Voter> voters = Candidates[i].Voters;
|
||||
|
||||
for ( int j = 0; j < voters.Count; ++j )
|
||||
{
|
||||
Voter voter = voters[j];
|
||||
|
||||
if ( voter.From == mob )
|
||||
return m_Candidates[i];
|
||||
return Candidates[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -252,20 +246,20 @@ namespace Server.Factions
|
|||
if ( IsCandidate( mob ) )
|
||||
return false;
|
||||
|
||||
if ( m_Candidates.Count >= MaxCandidates )
|
||||
if ( Candidates.Count >= MaxCandidates )
|
||||
return false;
|
||||
|
||||
if ( m_State != ElectionState.Campaign )
|
||||
if ( CurrentState != ElectionState.Campaign )
|
||||
return false; // sanity..
|
||||
|
||||
PlayerState pl = PlayerState.Find( mob );
|
||||
|
||||
return ( pl != null && pl.Faction == m_Faction && pl.Rank.Rank >= CandidateRank );
|
||||
return ( pl != null && pl.Faction == Faction && pl.Rank.Rank >= CandidateRank );
|
||||
}
|
||||
|
||||
public void Slice()
|
||||
{
|
||||
if ( m_Faction.Election != this )
|
||||
if ( Faction.Election != this )
|
||||
{
|
||||
m_Timer?.Stop();
|
||||
|
||||
|
|
@ -274,55 +268,55 @@ namespace Server.Factions
|
|||
return;
|
||||
}
|
||||
|
||||
switch ( m_State )
|
||||
switch ( CurrentState )
|
||||
{
|
||||
case ElectionState.Pending:
|
||||
{
|
||||
if ( (m_LastStateTime + PendingPeriod) > DateTime.UtcNow )
|
||||
if ( (LastStateTime + PendingPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
m_Faction.Broadcast( 1038023 ); // Campaigning for the Faction Commander election has begun.
|
||||
Faction.Broadcast( 1038023 ); // Campaigning for the Faction Commander election has begun.
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Campaign;
|
||||
|
||||
break;
|
||||
}
|
||||
case ElectionState.Campaign:
|
||||
{
|
||||
if ( (m_LastStateTime + CampaignPeriod) > DateTime.UtcNow )
|
||||
if ( (LastStateTime + CampaignPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
if ( m_Candidates.Count == 0 )
|
||||
if ( Candidates.Count == 0 )
|
||||
{
|
||||
m_Faction.Broadcast( 1038025 ); // Nobody ran for office.
|
||||
Faction.Broadcast( 1038025 ); // Nobody ran for office.
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else if ( m_Candidates.Count == 1 )
|
||||
else if ( Candidates.Count == 1 )
|
||||
{
|
||||
m_Faction.Broadcast( 1038029 ); // Only one member ran for office.
|
||||
Faction.Broadcast( 1038029 ); // Only one member ran for office.
|
||||
|
||||
Candidate winner = m_Candidates[0];
|
||||
Candidate winner = Candidates[0];
|
||||
|
||||
Mobile mob = winner.Mobile;
|
||||
PlayerState pl = PlayerState.Find( mob );
|
||||
|
||||
if ( pl == null || pl.Faction != m_Faction || mob == m_Faction.Commander )
|
||||
if ( pl == null || pl.Faction != Faction || mob == Faction.Commander )
|
||||
{
|
||||
m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
m_Faction.Commander = mob;
|
||||
Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
Faction.Commander = mob;
|
||||
}
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Faction.Broadcast( 1038030 );
|
||||
Faction.Broadcast( 1038030 );
|
||||
State = ElectionState.Election;
|
||||
}
|
||||
|
||||
|
|
@ -330,20 +324,20 @@ namespace Server.Factions
|
|||
}
|
||||
case ElectionState.Election:
|
||||
{
|
||||
if ( (m_LastStateTime + VotingPeriod) > DateTime.UtcNow )
|
||||
if ( (LastStateTime + VotingPeriod) > DateTime.UtcNow )
|
||||
break;
|
||||
|
||||
m_Faction.Broadcast( 1038024 ); // The results for the Faction Commander election are in
|
||||
Faction.Broadcast( 1038024 ); // The results for the Faction Commander election are in
|
||||
|
||||
Candidate winner = null;
|
||||
|
||||
for ( int i = 0; i < m_Candidates.Count; ++i )
|
||||
for ( int i = 0; i < Candidates.Count; ++i )
|
||||
{
|
||||
Candidate cd = m_Candidates[i];
|
||||
Candidate cd = Candidates[i];
|
||||
|
||||
PlayerState pl = PlayerState.Find( cd.Mobile );
|
||||
|
||||
if ( pl == null || pl.Faction != m_Faction )
|
||||
if ( pl == null || pl.Faction != Faction )
|
||||
continue;
|
||||
|
||||
//cd.CleanMuleVotes();
|
||||
|
|
@ -354,19 +348,19 @@ namespace Server.Factions
|
|||
|
||||
if ( winner == null )
|
||||
{
|
||||
m_Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
Faction.Broadcast( 1038026 ); // Faction leadership has not changed.
|
||||
}
|
||||
else if ( winner.Mobile == m_Faction.Commander )
|
||||
else if ( winner.Mobile == Faction.Commander )
|
||||
{
|
||||
m_Faction.Broadcast( 1038027 ); // The incumbent won the election.
|
||||
Faction.Broadcast( 1038027 ); // The incumbent won the election.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
m_Faction.Commander = winner.Mobile;
|
||||
Faction.Broadcast( 1038028 ); // The faction has a new commander.
|
||||
Faction.Commander = winner.Mobile;
|
||||
}
|
||||
|
||||
m_Candidates.Clear();
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
|
||||
break;
|
||||
|
|
@ -377,35 +371,29 @@ namespace Server.Factions
|
|||
|
||||
public class Voter
|
||||
{
|
||||
private Mobile m_From;
|
||||
private Mobile m_Candidate;
|
||||
public Mobile From { get; }
|
||||
|
||||
private IPAddress m_Address;
|
||||
private DateTime m_Time;
|
||||
public Mobile Candidate { get; }
|
||||
|
||||
public Mobile From => m_From;
|
||||
public IPAddress Address { get; }
|
||||
|
||||
public Mobile Candidate => m_Candidate;
|
||||
|
||||
public IPAddress Address => m_Address;
|
||||
|
||||
public DateTime Time => m_Time;
|
||||
public DateTime Time { get; }
|
||||
|
||||
public object[] AcquireFields()
|
||||
{
|
||||
TimeSpan gameTime = TimeSpan.Zero;
|
||||
|
||||
if ( m_From is PlayerMobile mobile )
|
||||
if ( From is PlayerMobile mobile )
|
||||
gameTime = mobile.GameTime;
|
||||
|
||||
int kp = 0;
|
||||
|
||||
PlayerState pl = PlayerState.Find( m_From );
|
||||
PlayerState pl = PlayerState.Find( From );
|
||||
|
||||
if ( pl != null )
|
||||
kp = pl.KillPoints;
|
||||
|
||||
int sk = m_From.Skills.Total;
|
||||
int sk = From.Skills.Total;
|
||||
|
||||
int factorSkills = 50 + ( (sk * 100 ) / 10000 );
|
||||
int factorKillPts = 100 + (kp*2);
|
||||
|
|
@ -418,25 +406,25 @@ namespace Server.Factions
|
|||
else if ( totalFactor < 0 )
|
||||
totalFactor = 0;
|
||||
|
||||
return new object[]{ m_From, m_Address, m_Time, totalFactor };
|
||||
return new object[]{ From, Address, Time, totalFactor };
|
||||
}
|
||||
|
||||
public Voter( Mobile from, Mobile candidate )
|
||||
{
|
||||
m_From = from;
|
||||
m_Candidate = candidate;
|
||||
From = from;
|
||||
Candidate = candidate;
|
||||
|
||||
if ( m_From.NetState != null )
|
||||
m_Address = m_From.NetState.Address;
|
||||
if ( From.NetState != null )
|
||||
Address = From.NetState.Address;
|
||||
else
|
||||
m_Address = IPAddress.None;
|
||||
Address = IPAddress.None;
|
||||
|
||||
m_Time = DateTime.UtcNow;
|
||||
Time = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public Voter( GenericReader reader, Mobile candidate )
|
||||
{
|
||||
m_Candidate = candidate;
|
||||
Candidate = candidate;
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -444,9 +432,9 @@ namespace Server.Factions
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_From = reader.ReadMobile();
|
||||
m_Address = Utility.Intern( reader.ReadIPAddress() );
|
||||
m_Time = reader.ReadDateTime();
|
||||
From = reader.ReadMobile();
|
||||
Address = Utility.Intern( reader.ReadIPAddress() );
|
||||
Time = reader.ReadDateTime();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -457,37 +445,35 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 );
|
||||
|
||||
writer.Write( (Mobile) m_From );
|
||||
writer.Write( (IPAddress) m_Address );
|
||||
writer.Write( (DateTime) m_Time );
|
||||
writer.Write( (Mobile) From );
|
||||
writer.Write( (IPAddress) Address );
|
||||
writer.Write( (DateTime) Time );
|
||||
}
|
||||
}
|
||||
|
||||
public class Candidate
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private List<Voter> m_Voters;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public List<Voter> Voters => m_Voters;
|
||||
public List<Voter> Voters { get; }
|
||||
|
||||
public int Votes => m_Voters.Count;
|
||||
public int Votes => Voters.Count;
|
||||
|
||||
public void CleanMuleVotes()
|
||||
{
|
||||
for ( int i = 0; i < m_Voters.Count; ++i )
|
||||
for ( int i = 0; i < Voters.Count; ++i )
|
||||
{
|
||||
Voter voter = (Voter)m_Voters[i];
|
||||
Voter voter = (Voter)Voters[i];
|
||||
|
||||
if ( (int)voter.AcquireFields()[3] < 90 )
|
||||
m_Voters.RemoveAt( i-- );
|
||||
Voters.RemoveAt( i-- );
|
||||
}
|
||||
}
|
||||
|
||||
public Candidate( Mobile mob )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Voters = new List<Voter>();
|
||||
Mobile = mob;
|
||||
Voters = new List<Voter>();
|
||||
}
|
||||
|
||||
public Candidate( GenericReader reader )
|
||||
|
|
@ -498,30 +484,30 @@ namespace Server.Factions
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
m_Voters = new List<Voter>( count );
|
||||
Voters = new List<Voter>( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
Voter voter = new Voter( reader, m_Mobile );
|
||||
Voter voter = new Voter( reader, Mobile );
|
||||
|
||||
if ( voter.From != null )
|
||||
m_Voters.Add( voter );
|
||||
Voters.Add( voter );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
List<Mobile> mobs = reader.ReadStrongMobileList();
|
||||
m_Voters = new List<Voter>( mobs.Count );
|
||||
Voters = new List<Voter>( mobs.Count );
|
||||
|
||||
for ( int i = 0; i < mobs.Count; ++i )
|
||||
m_Voters.Add( new Voter( mobs[i], m_Mobile ) );
|
||||
Voters.Add( new Voter( mobs[i], Mobile ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -532,12 +518,12 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.Write( (Mobile) Mobile );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Voters.Count );
|
||||
writer.WriteEncodedInt( (int) Voters.Count );
|
||||
|
||||
for ( int i = 0; i < m_Voters.Count; ++i )
|
||||
((Voter)m_Voters[i]).Serialize( writer );
|
||||
for ( int i = 0; i < Voters.Count; ++i )
|
||||
((Voter)Voters[i]).Serialize( writer );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,14 +18,8 @@ namespace Server.Factions
|
|||
public int ZeroRankOffset;
|
||||
|
||||
private FactionDefinition m_Definition;
|
||||
private FactionState m_State;
|
||||
private StrongholdRegion m_StrongholdRegion;
|
||||
|
||||
public StrongholdRegion StrongholdRegion
|
||||
{
|
||||
get => m_StrongholdRegion;
|
||||
set => m_StrongholdRegion = value;
|
||||
}
|
||||
public StrongholdRegion StrongholdRegion { get; set; }
|
||||
|
||||
public FactionDefinition Definition
|
||||
{
|
||||
|
|
@ -33,49 +27,45 @@ namespace Server.Factions
|
|||
set
|
||||
{
|
||||
m_Definition = value;
|
||||
m_StrongholdRegion = new StrongholdRegion( this );
|
||||
StrongholdRegion = new StrongholdRegion( this );
|
||||
}
|
||||
}
|
||||
|
||||
public FactionState State
|
||||
{
|
||||
get => m_State;
|
||||
set => m_State = value;
|
||||
}
|
||||
public FactionState State { get; set; }
|
||||
|
||||
public Election Election
|
||||
{
|
||||
get => m_State.Election;
|
||||
set => m_State.Election = value;
|
||||
get => State.Election;
|
||||
set => State.Election = value;
|
||||
}
|
||||
|
||||
public Mobile Commander
|
||||
{
|
||||
get => m_State.Commander;
|
||||
set => m_State.Commander = value;
|
||||
get => State.Commander;
|
||||
set => State.Commander = value;
|
||||
}
|
||||
|
||||
public int Tithe
|
||||
{
|
||||
get => m_State.Tithe;
|
||||
set => m_State.Tithe = value;
|
||||
get => State.Tithe;
|
||||
set => State.Tithe = value;
|
||||
}
|
||||
|
||||
public int Silver
|
||||
{
|
||||
get => m_State.Silver;
|
||||
set => m_State.Silver = value;
|
||||
get => State.Silver;
|
||||
set => State.Silver = value;
|
||||
}
|
||||
|
||||
public List<PlayerState> Members
|
||||
{
|
||||
get => m_State.Members;
|
||||
set => m_State.Members = value;
|
||||
get => State.Members;
|
||||
set => State.Members = value;
|
||||
}
|
||||
|
||||
public static readonly TimeSpan LeavePeriod = TimeSpan.FromDays( 3.0 );
|
||||
|
||||
public bool FactionMessageReady => m_State.FactionMessageReady;
|
||||
public bool FactionMessageReady => State.FactionMessageReady;
|
||||
|
||||
public void Broadcast( string text )
|
||||
{
|
||||
|
|
@ -117,7 +107,7 @@ namespace Server.Factions
|
|||
public void EndBroadcast( Mobile from, string text )
|
||||
{
|
||||
if ( from.AccessLevel == AccessLevel.Player )
|
||||
m_State.RegisterBroadcast();
|
||||
State.RegisterBroadcast();
|
||||
|
||||
Broadcast( Definition.HueBroadcast, "{0} [Commander] {1} : {2}", from.Name, Definition.FriendlyName, text );
|
||||
}
|
||||
|
|
@ -514,7 +504,7 @@ namespace Server.Factions
|
|||
|
||||
public Faction()
|
||||
{
|
||||
m_State = new FactionState( this );
|
||||
State = new FactionState( this );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
@ -949,8 +939,8 @@ namespace Server.Factions
|
|||
|
||||
public List<BaseFactionTrap> Traps
|
||||
{
|
||||
get => m_State.Traps;
|
||||
set => m_State.Traps = value;
|
||||
get => State.Traps;
|
||||
set => State.Traps = value;
|
||||
}
|
||||
|
||||
public const int StabilityFactor = 300; // 300% greater (3 times) than smallest faction
|
||||
|
|
|
|||
|
|
@ -11,28 +11,26 @@ namespace Server.Factions
|
|||
{
|
||||
public static readonly TimeSpan ExpirationPeriod = TimeSpan.FromDays( 21.0 );
|
||||
|
||||
private Item m_Item;
|
||||
private Faction m_Faction;
|
||||
private DateTime m_Expiration;
|
||||
public Item Item { get; }
|
||||
|
||||
public Item Item => m_Item;
|
||||
public Faction Faction => m_Faction;
|
||||
public DateTime Expiration => m_Expiration;
|
||||
public Faction Faction { get; }
|
||||
|
||||
public DateTime Expiration { get; private set; }
|
||||
|
||||
public bool HasExpired
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Item == null || m_Item.Deleted )
|
||||
if ( Item == null || Item.Deleted )
|
||||
return true;
|
||||
|
||||
return ( m_Expiration != DateTime.MinValue && DateTime.UtcNow >= m_Expiration );
|
||||
return ( Expiration != DateTime.MinValue && DateTime.UtcNow >= Expiration );
|
||||
}
|
||||
}
|
||||
|
||||
public void StartExpiration()
|
||||
{
|
||||
m_Expiration = DateTime.UtcNow + ExpirationPeriod;
|
||||
Expiration = DateTime.UtcNow + ExpirationPeriod;
|
||||
}
|
||||
|
||||
public void CheckAttach()
|
||||
|
|
@ -45,25 +43,25 @@ namespace Server.Factions
|
|||
|
||||
public void Attach()
|
||||
{
|
||||
if ( m_Item is IFactionItem item )
|
||||
if ( Item is IFactionItem item )
|
||||
item.FactionItemState = this;
|
||||
|
||||
m_Faction?.State.FactionItems.Add( this );
|
||||
Faction?.State.FactionItems.Add( this );
|
||||
}
|
||||
|
||||
public void Detach()
|
||||
{
|
||||
if ( m_Item is IFactionItem item )
|
||||
if ( Item is IFactionItem item )
|
||||
item.FactionItemState = null;
|
||||
|
||||
if ( m_Faction != null && m_Faction.State.FactionItems.Contains( this ) )
|
||||
m_Faction.State.FactionItems.Remove( this );
|
||||
if ( Faction != null && Faction.State.FactionItems.Contains( this ) )
|
||||
Faction.State.FactionItems.Remove( this );
|
||||
}
|
||||
|
||||
public FactionItem( Item item, Faction faction )
|
||||
{
|
||||
m_Item = item;
|
||||
m_Faction = faction;
|
||||
Item = item;
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public FactionItem( GenericReader reader, Faction faction )
|
||||
|
|
@ -74,21 +72,21 @@ namespace Server.Factions
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Item = reader.ReadItem();
|
||||
m_Expiration = reader.ReadDateTime();
|
||||
Item = reader.ReadItem();
|
||||
Expiration = reader.ReadDateTime();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_Faction = faction;
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 0 );
|
||||
|
||||
writer.Write( (Item) m_Item );
|
||||
writer.Write( (DateTime) m_Expiration );
|
||||
writer.Write( (Item) Item );
|
||||
writer.Write( (DateTime) Expiration );
|
||||
}
|
||||
|
||||
public static int GetMaxWearables( Mobile mob )
|
||||
|
|
|
|||
|
|
@ -7,22 +7,13 @@ namespace Server.Factions
|
|||
{
|
||||
private Faction m_Faction;
|
||||
private Mobile m_Commander;
|
||||
private int m_Tithe;
|
||||
private int m_Silver;
|
||||
private List<PlayerState> m_Members;
|
||||
private Election m_Election;
|
||||
private List<FactionItem> m_FactionItems;
|
||||
private List<BaseFactionTrap> m_FactionTraps;
|
||||
private DateTime m_LastAtrophy;
|
||||
|
||||
private const int BroadcastsPerPeriod = 2;
|
||||
private static readonly TimeSpan BroadcastPeriod = TimeSpan.FromHours( 1.0 );
|
||||
|
||||
private DateTime[] m_LastBroadcasts = new DateTime[BroadcastsPerPeriod];
|
||||
|
||||
public DateTime LastAtrophy{ get => m_LastAtrophy;
|
||||
set => m_LastAtrophy = value;
|
||||
}
|
||||
public DateTime LastAtrophy { get; set; }
|
||||
|
||||
public bool FactionMessageReady
|
||||
{
|
||||
|
|
@ -38,17 +29,17 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsAtrophyReady => DateTime.UtcNow >= (m_LastAtrophy + TimeSpan.FromHours( 47.0 ));
|
||||
public bool IsAtrophyReady => DateTime.UtcNow >= (LastAtrophy + TimeSpan.FromHours( 47.0 ));
|
||||
|
||||
public int CheckAtrophy()
|
||||
{
|
||||
if ( DateTime.UtcNow < (m_LastAtrophy + TimeSpan.FromHours( 47.0 )) )
|
||||
if ( DateTime.UtcNow < (LastAtrophy + TimeSpan.FromHours( 47.0 )) )
|
||||
return 0;
|
||||
|
||||
int distrib = 0;
|
||||
m_LastAtrophy = DateTime.UtcNow;
|
||||
LastAtrophy = DateTime.UtcNow;
|
||||
|
||||
List<PlayerState> members = new List<PlayerState>( m_Members );
|
||||
List<PlayerState> members = new List<PlayerState>( Members );
|
||||
|
||||
for ( int i = 0; i < members.Count; ++i )
|
||||
{
|
||||
|
|
@ -83,23 +74,11 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public List<FactionItem> FactionItems
|
||||
{
|
||||
get => m_FactionItems;
|
||||
set => m_FactionItems = value;
|
||||
}
|
||||
public List<FactionItem> FactionItems { get; set; }
|
||||
|
||||
public List<BaseFactionTrap> Traps
|
||||
{
|
||||
get => m_FactionTraps;
|
||||
set => m_FactionTraps = value;
|
||||
}
|
||||
public List<BaseFactionTrap> Traps { get; set; }
|
||||
|
||||
public Election Election
|
||||
{
|
||||
get => m_Election;
|
||||
set => m_Election = value;
|
||||
}
|
||||
public Election Election { get; set; }
|
||||
|
||||
public Mobile Commander
|
||||
{
|
||||
|
|
@ -127,32 +106,20 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public int Tithe
|
||||
{
|
||||
get => m_Tithe;
|
||||
set => m_Tithe = value;
|
||||
}
|
||||
public int Tithe { get; set; }
|
||||
|
||||
public int Silver
|
||||
{
|
||||
get => m_Silver;
|
||||
set => m_Silver = value;
|
||||
}
|
||||
public int Silver { get; set; }
|
||||
|
||||
public List<PlayerState> Members
|
||||
{
|
||||
get => m_Members;
|
||||
set => m_Members = value;
|
||||
}
|
||||
public List<PlayerState> Members { get; set; }
|
||||
|
||||
public FactionState( Faction faction )
|
||||
{
|
||||
m_Faction = faction;
|
||||
m_Tithe = 50;
|
||||
m_Members = new List<PlayerState>();
|
||||
m_Election = new Election( faction );
|
||||
m_FactionItems = new List<FactionItem>();
|
||||
m_FactionTraps = new List<BaseFactionTrap>();
|
||||
Tithe = 50;
|
||||
Members = new List<PlayerState>();
|
||||
Election = new Election( faction );
|
||||
FactionItems = new List<FactionItem>();
|
||||
Traps = new List<BaseFactionTrap>();
|
||||
}
|
||||
|
||||
public FactionState( GenericReader reader )
|
||||
|
|
@ -163,7 +130,7 @@ namespace Server.Factions
|
|||
{
|
||||
case 5:
|
||||
{
|
||||
m_LastAtrophy = reader.ReadDateTime();
|
||||
LastAtrophy = reader.ReadDateTime();
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
|
|
@ -184,7 +151,7 @@ namespace Server.Factions
|
|||
case 2:
|
||||
case 1:
|
||||
{
|
||||
m_Election = new Election( reader );
|
||||
Election = new Election( reader );
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
|
@ -195,7 +162,7 @@ namespace Server.Factions
|
|||
m_Commander = reader.ReadMobile();
|
||||
|
||||
if ( version < 5 )
|
||||
m_LastAtrophy = DateTime.UtcNow;
|
||||
LastAtrophy = DateTime.UtcNow;
|
||||
|
||||
if ( version < 4 )
|
||||
{
|
||||
|
|
@ -205,28 +172,28 @@ namespace Server.Factions
|
|||
m_LastBroadcasts[0] = time;
|
||||
}
|
||||
|
||||
m_Tithe = reader.ReadEncodedInt();
|
||||
m_Silver = reader.ReadEncodedInt();
|
||||
Tithe = reader.ReadEncodedInt();
|
||||
Silver = reader.ReadEncodedInt();
|
||||
|
||||
int memberCount = reader.ReadEncodedInt();
|
||||
|
||||
m_Members = new List<PlayerState>();
|
||||
Members = new List<PlayerState>();
|
||||
|
||||
for ( int i = 0; i < memberCount; ++i )
|
||||
{
|
||||
PlayerState pl = new PlayerState( reader, m_Faction, m_Members );
|
||||
PlayerState pl = new PlayerState( reader, m_Faction, Members );
|
||||
|
||||
if ( pl.Mobile != null )
|
||||
m_Members.Add( pl );
|
||||
Members.Add( pl );
|
||||
}
|
||||
|
||||
m_Faction.State = this;
|
||||
|
||||
m_Faction.ZeroRankOffset = m_Members.Count;
|
||||
m_Members.Sort();
|
||||
m_Faction.ZeroRankOffset = Members.Count;
|
||||
Members.Sort();
|
||||
|
||||
for ( int i = m_Members.Count - 1; i >= 0; i-- ) {
|
||||
PlayerState player = m_Members[i];
|
||||
for ( int i = Members.Count - 1; i >= 0; i-- ) {
|
||||
PlayerState player = Members[i];
|
||||
|
||||
if ( player.KillPoints <= 0 )
|
||||
m_Faction.ZeroRankOffset = i;
|
||||
|
|
@ -234,7 +201,7 @@ namespace Server.Factions
|
|||
player.RankIndex = i;
|
||||
}
|
||||
|
||||
m_FactionItems = new List<FactionItem>();
|
||||
FactionItems = new List<FactionItem>();
|
||||
|
||||
if ( version >= 2 )
|
||||
{
|
||||
|
|
@ -248,7 +215,7 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
m_FactionTraps = new List<BaseFactionTrap>();
|
||||
Traps = new List<BaseFactionTrap>();
|
||||
|
||||
if ( version >= 3 )
|
||||
{
|
||||
|
|
@ -257,7 +224,7 @@ namespace Server.Factions
|
|||
for ( int i = 0; i < factionTrapCount; ++i )
|
||||
{
|
||||
if ( reader.ReadItem() is BaseFactionTrap trap && !trap.CheckDecay() )
|
||||
m_FactionTraps.Add( trap );
|
||||
Traps.Add( trap );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -266,47 +233,47 @@ namespace Server.Factions
|
|||
}
|
||||
|
||||
if ( version < 1 )
|
||||
m_Election = new Election( m_Faction );
|
||||
Election = new Election( m_Faction );
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) 5 ); // version
|
||||
|
||||
writer.Write( m_LastAtrophy );
|
||||
writer.Write( LastAtrophy );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_LastBroadcasts.Length );
|
||||
|
||||
for ( int i = 0; i < m_LastBroadcasts.Length; ++i )
|
||||
writer.Write( (DateTime) m_LastBroadcasts[i] );
|
||||
|
||||
m_Election.Serialize( writer );
|
||||
Election.Serialize( writer );
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
|
||||
writer.Write( (Mobile) m_Commander );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Tithe );
|
||||
writer.WriteEncodedInt( (int) m_Silver );
|
||||
writer.WriteEncodedInt( (int) Tithe );
|
||||
writer.WriteEncodedInt( (int) Silver );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Members.Count );
|
||||
writer.WriteEncodedInt( (int) Members.Count );
|
||||
|
||||
for ( int i = 0; i < m_Members.Count; ++i )
|
||||
for ( int i = 0; i < Members.Count; ++i )
|
||||
{
|
||||
PlayerState pl = (PlayerState) m_Members[i];
|
||||
PlayerState pl = (PlayerState) Members[i];
|
||||
|
||||
pl.Serialize( writer );
|
||||
}
|
||||
|
||||
writer.WriteEncodedInt( (int) m_FactionItems.Count );
|
||||
writer.WriteEncodedInt( (int) FactionItems.Count );
|
||||
|
||||
for ( int i = 0; i < m_FactionItems.Count; ++i )
|
||||
m_FactionItems[i].Serialize( writer );
|
||||
for ( int i = 0; i < FactionItems.Count; ++i )
|
||||
FactionItems[i].Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_FactionTraps.Count );
|
||||
writer.WriteEncodedInt( (int) Traps.Count );
|
||||
|
||||
for ( int i = 0; i < m_FactionTraps.Count; ++i )
|
||||
writer.Write( (Item) m_FactionTraps[i] );
|
||||
for ( int i = 0; i < Traps.Count; ++i )
|
||||
writer.Write( (Item) Traps[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,22 +5,20 @@ namespace Server.Factions
|
|||
{
|
||||
public class GuardList
|
||||
{
|
||||
private GuardDefinition m_Definition;
|
||||
private List<BaseFactionGuard> m_Guards;
|
||||
public GuardDefinition Definition { get; }
|
||||
|
||||
public GuardDefinition Definition => m_Definition;
|
||||
public List<BaseFactionGuard> Guards => m_Guards;
|
||||
public List<BaseFactionGuard> Guards { get; }
|
||||
|
||||
public BaseFactionGuard Construct()
|
||||
{
|
||||
try{ return Activator.CreateInstance( m_Definition.Type ) as BaseFactionGuard; }
|
||||
try{ return Activator.CreateInstance( Definition.Type ) as BaseFactionGuard; }
|
||||
catch{ return null; }
|
||||
}
|
||||
|
||||
public GuardList( GuardDefinition definition )
|
||||
{
|
||||
m_Definition = definition;
|
||||
m_Guards = new List<BaseFactionGuard>();
|
||||
Definition = definition;
|
||||
Guards = new List<BaseFactionGuard>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,56 +12,53 @@ namespace Server.Factions
|
|||
|
||||
public class MerchantTitleInfo
|
||||
{
|
||||
private SkillName m_Skill;
|
||||
private double m_Requirement;
|
||||
private TextDefinition m_Title;
|
||||
private TextDefinition m_Label;
|
||||
private TextDefinition m_Assigned;
|
||||
public SkillName Skill { get; }
|
||||
|
||||
public SkillName Skill => m_Skill;
|
||||
public double Requirement => m_Requirement;
|
||||
public TextDefinition Title => m_Title;
|
||||
public TextDefinition Label => m_Label;
|
||||
public TextDefinition Assigned => m_Assigned;
|
||||
public double Requirement { get; }
|
||||
|
||||
public TextDefinition Title { get; }
|
||||
|
||||
public TextDefinition Label { get; }
|
||||
|
||||
public TextDefinition Assigned { get; }
|
||||
|
||||
public MerchantTitleInfo( SkillName skill, double requirement, TextDefinition title, TextDefinition label, TextDefinition assigned )
|
||||
{
|
||||
m_Skill = skill;
|
||||
m_Requirement = requirement;
|
||||
m_Title = title;
|
||||
m_Label = label;
|
||||
m_Assigned = assigned;
|
||||
Skill = skill;
|
||||
Requirement = requirement;
|
||||
Title = title;
|
||||
Label = label;
|
||||
Assigned = assigned;
|
||||
}
|
||||
}
|
||||
|
||||
public class MerchantTitles
|
||||
{
|
||||
private static MerchantTitleInfo[] m_Info = {
|
||||
new MerchantTitleInfo( SkillName.Inscribe, 90.0, new TextDefinition( 1060773, "Scribe" ), new TextDefinition( 1011468, "SCRIBE" ), new TextDefinition( 1010121, "You now have the faction title of scribe" ) ),
|
||||
new MerchantTitleInfo( SkillName.Carpentry, 90.0, new TextDefinition( 1060774, "Carpenter" ), new TextDefinition( 1011469, "CARPENTER" ), new TextDefinition( 1010122, "You now have the faction title of carpenter" ) ),
|
||||
new MerchantTitleInfo( SkillName.Tinkering, 90.0, new TextDefinition( 1022984, "Tinker" ), new TextDefinition( 1011470, "TINKER" ), new TextDefinition( 1010123, "You now have the faction title of tinker" ) ),
|
||||
new MerchantTitleInfo( SkillName.Blacksmith, 90.0, new TextDefinition( 1023016, "Blacksmith" ), new TextDefinition( 1011471, "BLACKSMITH" ), new TextDefinition( 1010124, "You now have the faction title of blacksmith" ) ),
|
||||
new MerchantTitleInfo( SkillName.Fletching, 90.0, new TextDefinition( 1023022, "Bowyer" ), new TextDefinition( 1011472, "BOWYER" ), new TextDefinition( 1010125, "You now have the faction title of Bowyer" ) ),
|
||||
new MerchantTitleInfo( SkillName.Tailoring, 90.0, new TextDefinition( 1022982, "Tailor" ), new TextDefinition( 1018300, "TAILOR" ), new TextDefinition( 1042162, "You now have the faction title of Tailor" ) ),
|
||||
};
|
||||
|
||||
public static MerchantTitleInfo[] Info => m_Info;
|
||||
public static MerchantTitleInfo[] Info { get; } =
|
||||
{
|
||||
new MerchantTitleInfo( SkillName.Inscribe, 90.0, new TextDefinition( 1060773, "Scribe" ), new TextDefinition( 1011468, "SCRIBE" ), new TextDefinition( 1010121, "You now have the faction title of scribe" ) ),
|
||||
new MerchantTitleInfo( SkillName.Carpentry, 90.0, new TextDefinition( 1060774, "Carpenter" ), new TextDefinition( 1011469, "CARPENTER" ), new TextDefinition( 1010122, "You now have the faction title of carpenter" ) ),
|
||||
new MerchantTitleInfo( SkillName.Tinkering, 90.0, new TextDefinition( 1022984, "Tinker" ), new TextDefinition( 1011470, "TINKER" ), new TextDefinition( 1010123, "You now have the faction title of tinker" ) ),
|
||||
new MerchantTitleInfo( SkillName.Blacksmith, 90.0, new TextDefinition( 1023016, "Blacksmith" ), new TextDefinition( 1011471, "BLACKSMITH" ), new TextDefinition( 1010124, "You now have the faction title of blacksmith" ) ),
|
||||
new MerchantTitleInfo( SkillName.Fletching, 90.0, new TextDefinition( 1023022, "Bowyer" ), new TextDefinition( 1011472, "BOWYER" ), new TextDefinition( 1010125, "You now have the faction title of Bowyer" ) ),
|
||||
new MerchantTitleInfo( SkillName.Tailoring, 90.0, new TextDefinition( 1022982, "Tailor" ), new TextDefinition( 1018300, "TAILOR" ), new TextDefinition( 1042162, "You now have the faction title of Tailor" ) ),
|
||||
};
|
||||
|
||||
public static MerchantTitleInfo GetInfo( MerchantTitle title )
|
||||
{
|
||||
int idx = (int)title - 1;
|
||||
|
||||
if ( idx >= 0 && idx < m_Info.Length )
|
||||
return m_Info[idx];
|
||||
if ( idx >= 0 && idx < Info.Length )
|
||||
return Info[idx];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool HasMerchantQualifications( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Info.Length; ++i )
|
||||
for ( int i = 0; i < Info.Length; ++i )
|
||||
{
|
||||
if ( IsQualified( mob, m_Info[i] ) )
|
||||
if ( IsQualified( mob, Info[i] ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,7 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionPersistance : Item
|
||||
{
|
||||
private static FactionPersistance m_Instance;
|
||||
|
||||
public static FactionPersistance Instance => m_Instance;
|
||||
public static FactionPersistance Instance { get; private set; }
|
||||
|
||||
public override string DefaultName => "Faction Persistance - Internal";
|
||||
|
||||
|
|
@ -14,8 +12,8 @@ namespace Server.Factions
|
|||
{
|
||||
Movable = false;
|
||||
|
||||
if ( m_Instance == null || m_Instance.Deleted )
|
||||
m_Instance = this;
|
||||
if ( Instance == null || Instance.Deleted )
|
||||
Instance = this;
|
||||
else
|
||||
base.Delete();
|
||||
}
|
||||
|
|
@ -29,7 +27,7 @@ namespace Server.Factions
|
|||
|
||||
public FactionPersistance( Serial serial ) : base( serial )
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
|
|||
|
|
@ -6,31 +6,26 @@ namespace Server.Factions
|
|||
{
|
||||
public class PlayerState : IComparable
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Faction m_Faction;
|
||||
private List<PlayerState> m_Owner;
|
||||
private int m_KillPoints;
|
||||
private DateTime m_Leaving;
|
||||
private MerchantTitle m_MerchantTitle;
|
||||
private RankDefinition m_Rank;
|
||||
private List<SilverGivenEntry> m_SilverGiven;
|
||||
private bool m_IsActive;
|
||||
|
||||
private Town m_Sheriff;
|
||||
private Town m_Finance;
|
||||
|
||||
private DateTime m_LastHonorTime;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public Faction Faction { get; }
|
||||
|
||||
public List<PlayerState> Owner { get; }
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public Faction Faction => m_Faction;
|
||||
public List<PlayerState> Owner => m_Owner;
|
||||
public MerchantTitle MerchantTitle{ get => m_MerchantTitle;
|
||||
set{ m_MerchantTitle = value; Invalidate(); } }
|
||||
public Town Sheriff{ get => m_Sheriff;
|
||||
set{ m_Sheriff = value; Invalidate(); } }
|
||||
public Town Finance{ get => m_Finance;
|
||||
set{ m_Finance = value; Invalidate(); } }
|
||||
public List<SilverGivenEntry> SilverGiven => m_SilverGiven;
|
||||
public List<SilverGivenEntry> SilverGiven { get; private set; }
|
||||
|
||||
public int KillPoints {
|
||||
get => m_KillPoints;
|
||||
|
|
@ -44,17 +39,17 @@ namespace Server.Factions
|
|||
return;
|
||||
}
|
||||
|
||||
m_Owner.Remove( this );
|
||||
m_Owner.Insert( m_Faction.ZeroRankOffset, this );
|
||||
Owner.Remove( this );
|
||||
Owner.Insert( Faction.ZeroRankOffset, this );
|
||||
|
||||
m_RankIndex = m_Faction.ZeroRankOffset;
|
||||
m_Faction.ZeroRankOffset++;
|
||||
m_RankIndex = Faction.ZeroRankOffset;
|
||||
Faction.ZeroRankOffset++;
|
||||
}
|
||||
while ( ( m_RankIndex - 1 ) >= 0 ) {
|
||||
PlayerState p = m_Owner[m_RankIndex-1] as PlayerState;
|
||||
PlayerState p = Owner[m_RankIndex-1] as PlayerState;
|
||||
if ( value > p.KillPoints ) {
|
||||
m_Owner[m_RankIndex] = p;
|
||||
m_Owner[m_RankIndex-1] = this;
|
||||
Owner[m_RankIndex] = p;
|
||||
Owner[m_RankIndex-1] = this;
|
||||
RankIndex--;
|
||||
p.RankIndex++;
|
||||
}
|
||||
|
|
@ -70,23 +65,23 @@ namespace Server.Factions
|
|||
return;
|
||||
}
|
||||
|
||||
while ( ( m_RankIndex + 1 ) < m_Faction.ZeroRankOffset ) {
|
||||
PlayerState p = m_Owner[m_RankIndex+1] as PlayerState;
|
||||
m_Owner[m_RankIndex+1] = this;
|
||||
m_Owner[m_RankIndex] = p;
|
||||
while ( ( m_RankIndex + 1 ) < Faction.ZeroRankOffset ) {
|
||||
PlayerState p = Owner[m_RankIndex+1] as PlayerState;
|
||||
Owner[m_RankIndex+1] = this;
|
||||
Owner[m_RankIndex] = p;
|
||||
RankIndex++;
|
||||
p.RankIndex--;
|
||||
}
|
||||
|
||||
m_RankIndex = -1;
|
||||
m_Faction.ZeroRankOffset--;
|
||||
Faction.ZeroRankOffset--;
|
||||
}
|
||||
else {
|
||||
while ( ( m_RankIndex + 1 ) < m_Faction.ZeroRankOffset ) {
|
||||
PlayerState p = m_Owner[m_RankIndex+1] as PlayerState;
|
||||
while ( ( m_RankIndex + 1 ) < Faction.ZeroRankOffset ) {
|
||||
PlayerState p = Owner[m_RankIndex+1] as PlayerState;
|
||||
if ( value < p.KillPoints ) {
|
||||
m_Owner[m_RankIndex+1] = this;
|
||||
m_Owner[m_RankIndex] = p;
|
||||
Owner[m_RankIndex+1] = this;
|
||||
Owner[m_RankIndex] = p;
|
||||
RankIndex++;
|
||||
p.RankIndex--;
|
||||
}
|
||||
|
|
@ -111,15 +106,15 @@ namespace Server.Factions
|
|||
public RankDefinition Rank {
|
||||
get {
|
||||
if ( m_InvalidateRank ) {
|
||||
RankDefinition[] ranks = m_Faction.Definition.Ranks;
|
||||
RankDefinition[] ranks = Faction.Definition.Ranks;
|
||||
int percent;
|
||||
|
||||
if ( m_Owner.Count == 1 )
|
||||
if ( Owner.Count == 1 )
|
||||
percent = 1000;
|
||||
else if ( m_RankIndex == -1 )
|
||||
percent = 0;
|
||||
else
|
||||
percent = ( ( m_Faction.ZeroRankOffset - m_RankIndex ) * 1000 ) / m_Faction.ZeroRankOffset;
|
||||
percent = ( ( Faction.ZeroRankOffset - m_RankIndex ) * 1000 ) / Faction.ZeroRankOffset;
|
||||
|
||||
for ( int i = 0; i < ranks.Length; i++ ) {
|
||||
RankDefinition check = ranks[i];
|
||||
|
|
@ -138,29 +133,25 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public DateTime LastHonorTime{ get => m_LastHonorTime;
|
||||
set => m_LastHonorTime = value;
|
||||
}
|
||||
public DateTime Leaving{ get => m_Leaving;
|
||||
set => m_Leaving = value;
|
||||
}
|
||||
public bool IsLeaving => ( m_Leaving > DateTime.MinValue );
|
||||
public DateTime LastHonorTime { get; set; }
|
||||
|
||||
public bool IsActive{ get => m_IsActive;
|
||||
set => m_IsActive = value;
|
||||
}
|
||||
public DateTime Leaving { get; set; }
|
||||
|
||||
public bool IsLeaving => ( Leaving > DateTime.MinValue );
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public bool CanGiveSilverTo( Mobile mob )
|
||||
{
|
||||
if ( m_SilverGiven == null )
|
||||
if ( SilverGiven == null )
|
||||
return true;
|
||||
|
||||
for ( int i = 0; i < m_SilverGiven.Count; ++i )
|
||||
for ( int i = 0; i < SilverGiven.Count; ++i )
|
||||
{
|
||||
SilverGivenEntry sge = m_SilverGiven[i];
|
||||
SilverGivenEntry sge = SilverGiven[i];
|
||||
|
||||
if ( sge.IsExpired )
|
||||
m_SilverGiven.RemoveAt( i-- );
|
||||
SilverGiven.RemoveAt( i-- );
|
||||
else if ( sge.GivenTo == mob )
|
||||
return false;
|
||||
}
|
||||
|
|
@ -170,15 +161,15 @@ namespace Server.Factions
|
|||
|
||||
public void OnGivenSilverTo( Mobile mob )
|
||||
{
|
||||
if ( m_SilverGiven == null )
|
||||
m_SilverGiven = new List<SilverGivenEntry>();
|
||||
if ( SilverGiven == null )
|
||||
SilverGiven = new List<SilverGivenEntry>();
|
||||
|
||||
m_SilverGiven.Add( new SilverGivenEntry( mob ) );
|
||||
SilverGiven.Add( new SilverGivenEntry( mob ) );
|
||||
}
|
||||
|
||||
public void Invalidate()
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile pm )
|
||||
if ( Mobile is PlayerMobile pm )
|
||||
{
|
||||
pm.InvalidateProperties();
|
||||
pm.InvalidateMyRunUO();
|
||||
|
|
@ -187,15 +178,15 @@ namespace Server.Factions
|
|||
|
||||
public void Attach()
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile mobile )
|
||||
if ( Mobile is PlayerMobile mobile )
|
||||
mobile.FactionPlayerState = this;
|
||||
}
|
||||
|
||||
public PlayerState( Mobile mob, Faction faction, List<PlayerState> owner )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Faction = faction;
|
||||
m_Owner = owner;
|
||||
Mobile = mob;
|
||||
Faction = faction;
|
||||
Owner = owner;
|
||||
|
||||
Attach();
|
||||
Invalidate();
|
||||
|
|
@ -203,8 +194,8 @@ namespace Server.Factions
|
|||
|
||||
public PlayerState( GenericReader reader, Faction faction, List<PlayerState> owner )
|
||||
{
|
||||
m_Faction = faction;
|
||||
m_Owner = owner;
|
||||
Faction = faction;
|
||||
Owner = owner;
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -212,18 +203,18 @@ namespace Server.Factions
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_IsActive = reader.ReadBool();
|
||||
m_LastHonorTime = reader.ReadDateTime();
|
||||
IsActive = reader.ReadBool();
|
||||
LastHonorTime = reader.ReadDateTime();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
m_KillPoints = reader.ReadEncodedInt();
|
||||
m_MerchantTitle = (MerchantTitle)reader.ReadEncodedInt();
|
||||
|
||||
m_Leaving = reader.ReadDateTime();
|
||||
Leaving = reader.ReadDateTime();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -236,15 +227,15 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_IsActive );
|
||||
writer.Write( m_LastHonorTime );
|
||||
writer.Write( IsActive );
|
||||
writer.Write( LastHonorTime );
|
||||
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.Write( (Mobile) Mobile );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_KillPoints );
|
||||
writer.WriteEncodedInt( (int) m_MerchantTitle );
|
||||
|
||||
writer.Write( (DateTime) m_Leaving );
|
||||
writer.Write( (DateTime) Leaving );
|
||||
}
|
||||
|
||||
public static PlayerState Find( Mobile mob )
|
||||
|
|
|
|||
|
|
@ -6,18 +6,16 @@ namespace Server.Factions
|
|||
{
|
||||
public static readonly TimeSpan ExpirePeriod = TimeSpan.FromHours( 3.0 );
|
||||
|
||||
private Mobile m_GivenTo;
|
||||
private DateTime m_TimeOfGift;
|
||||
public Mobile GivenTo { get; }
|
||||
|
||||
public Mobile GivenTo => m_GivenTo;
|
||||
public DateTime TimeOfGift => m_TimeOfGift;
|
||||
public DateTime TimeOfGift { get; }
|
||||
|
||||
public bool IsExpired => ( m_TimeOfGift + ExpirePeriod ) < DateTime.UtcNow;
|
||||
public bool IsExpired => ( TimeOfGift + ExpirePeriod ) < DateTime.UtcNow;
|
||||
|
||||
public SilverGivenEntry( Mobile givenTo )
|
||||
{
|
||||
m_GivenTo = givenTo;
|
||||
m_TimeOfGift = DateTime.UtcNow;
|
||||
GivenTo = givenTo;
|
||||
TimeOfGift = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,17 +5,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class StrongholdRegion : BaseRegion
|
||||
{
|
||||
private Faction m_Faction;
|
||||
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set => m_Faction = value;
|
||||
}
|
||||
public Faction Faction { get; set; }
|
||||
|
||||
public StrongholdRegion( Faction faction ) : base( faction.Definition.FriendlyName, Faction.Facet, DefaultPriority, faction.Definition.Stronghold.Area )
|
||||
{
|
||||
m_Faction = faction;
|
||||
Faction = faction;
|
||||
|
||||
Register();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,14 +9,9 @@ namespace Server.Factions
|
|||
[CustomEnum( new[]{ "Britain", "Magincia", "Minoc", "Moonglow", "Skara Brae", "Trinsic", "Vesper", "Yew" } )]
|
||||
public abstract class Town : IComparable
|
||||
{
|
||||
private TownDefinition m_Definition;
|
||||
private TownState m_State;
|
||||
|
||||
public TownDefinition Definition
|
||||
{
|
||||
get => m_Definition;
|
||||
set => m_Definition = value;
|
||||
}
|
||||
public TownDefinition Definition { get; set; }
|
||||
|
||||
public TownState State
|
||||
{
|
||||
|
|
@ -244,29 +239,18 @@ namespace Server.Factions
|
|||
return list;
|
||||
}
|
||||
|
||||
private List<VendorList> m_VendorLists;
|
||||
private List<GuardList> m_GuardLists;
|
||||
public List<VendorList> VendorLists { get; set; }
|
||||
|
||||
public List<VendorList> VendorLists
|
||||
{
|
||||
get => m_VendorLists;
|
||||
set => m_VendorLists = value;
|
||||
}
|
||||
|
||||
public List<GuardList> GuardLists
|
||||
{
|
||||
get => m_GuardLists;
|
||||
set => m_GuardLists = value;
|
||||
}
|
||||
public List<GuardList> GuardLists { get; set; }
|
||||
|
||||
public void ConstructGuardLists()
|
||||
{
|
||||
GuardDefinition[] defs = ( Owner == null ? new GuardDefinition[0] : Owner.Definition.Guards );
|
||||
|
||||
m_GuardLists = new List<GuardList>();
|
||||
GuardLists = new List<GuardList>();
|
||||
|
||||
for ( int i = 0; i < defs.Length; ++i )
|
||||
m_GuardLists.Add( new GuardList( defs[i] ) );
|
||||
GuardLists.Add( new GuardList( defs[i] ) );
|
||||
}
|
||||
|
||||
public GuardList FindGuardList( Type type )
|
||||
|
|
@ -288,10 +272,10 @@ namespace Server.Factions
|
|||
{
|
||||
VendorDefinition[] defs = VendorDefinition.Definitions;
|
||||
|
||||
m_VendorLists = new List<VendorList>();
|
||||
VendorLists = new List<VendorList>();
|
||||
|
||||
for ( int i = 0; i < defs.Length; ++i )
|
||||
m_VendorLists.Add( new VendorList( defs[i] ) );
|
||||
VendorLists.Add( new VendorList( defs[i] ) );
|
||||
}
|
||||
|
||||
public VendorList FindVendorList( Type type )
|
||||
|
|
@ -468,12 +452,12 @@ namespace Server.Factions
|
|||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
return m_Definition.Sort - ((Town)obj).m_Definition.Sort;
|
||||
return Definition.Sort - ((Town)obj).Definition.Sort;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return m_Definition.FriendlyName;
|
||||
return Definition.FriendlyName;
|
||||
}
|
||||
|
||||
public static void WriteReference( GenericWriter writer, Town town )
|
||||
|
|
|
|||
|
|
@ -4,29 +4,12 @@ namespace Server.Factions
|
|||
{
|
||||
public class TownState
|
||||
{
|
||||
private Town m_Town;
|
||||
private Faction m_Owner;
|
||||
|
||||
private Mobile m_Sheriff;
|
||||
private Mobile m_Finance;
|
||||
|
||||
private int m_Silver;
|
||||
private int m_Tax;
|
||||
public Town Town { get; set; }
|
||||
|
||||
private DateTime m_LastTaxChange;
|
||||
private DateTime m_LastIncome;
|
||||
|
||||
public Town Town
|
||||
{
|
||||
get => m_Town;
|
||||
set => m_Town = value;
|
||||
}
|
||||
|
||||
public Faction Owner
|
||||
{
|
||||
get => m_Owner;
|
||||
set => m_Owner = value;
|
||||
}
|
||||
public Faction Owner { get; set; }
|
||||
|
||||
public Mobile Sheriff
|
||||
{
|
||||
|
|
@ -48,7 +31,7 @@ namespace Server.Factions
|
|||
PlayerState pl = PlayerState.Find( m_Sheriff );
|
||||
|
||||
if ( pl != null )
|
||||
pl.Sheriff = m_Town;
|
||||
pl.Sheriff = Town;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,38 +56,22 @@ namespace Server.Factions
|
|||
PlayerState pl = PlayerState.Find( m_Finance );
|
||||
|
||||
if ( pl != null )
|
||||
pl.Finance = m_Town;
|
||||
pl.Finance = Town;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int Silver
|
||||
{
|
||||
get => m_Silver;
|
||||
set => m_Silver = value;
|
||||
}
|
||||
public int Silver { get; set; }
|
||||
|
||||
public int Tax
|
||||
{
|
||||
get => m_Tax;
|
||||
set => m_Tax = value;
|
||||
}
|
||||
public int Tax { get; set; }
|
||||
|
||||
public DateTime LastTaxChange
|
||||
{
|
||||
get => m_LastTaxChange;
|
||||
set => m_LastTaxChange = value;
|
||||
}
|
||||
public DateTime LastTaxChange { get; set; }
|
||||
|
||||
public DateTime LastIncome
|
||||
{
|
||||
get => m_LastIncome;
|
||||
set => m_LastIncome = value;
|
||||
}
|
||||
public DateTime LastIncome { get; set; }
|
||||
|
||||
public TownState( Town town )
|
||||
{
|
||||
m_Town = town;
|
||||
Town = town;
|
||||
}
|
||||
|
||||
public TownState( GenericReader reader )
|
||||
|
|
@ -115,32 +82,32 @@ namespace Server.Factions
|
|||
{
|
||||
case 3:
|
||||
{
|
||||
m_LastIncome = reader.ReadDateTime();
|
||||
LastIncome = reader.ReadDateTime();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_Tax = reader.ReadEncodedInt();
|
||||
m_LastTaxChange = reader.ReadDateTime();
|
||||
Tax = reader.ReadEncodedInt();
|
||||
LastTaxChange = reader.ReadDateTime();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Silver = reader.ReadEncodedInt();
|
||||
Silver = reader.ReadEncodedInt();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Town = Town.ReadReference( reader );
|
||||
m_Owner = Faction.ReadReference( reader );
|
||||
Town = Town.ReadReference( reader );
|
||||
Owner = Faction.ReadReference( reader );
|
||||
|
||||
m_Sheriff = reader.ReadMobile();
|
||||
m_Finance = reader.ReadMobile();
|
||||
|
||||
m_Town.State = this;
|
||||
Town.State = this;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -151,15 +118,15 @@ namespace Server.Factions
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 3 ); // version
|
||||
|
||||
writer.Write( (DateTime) m_LastIncome );
|
||||
writer.Write( (DateTime) LastIncome );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Tax );
|
||||
writer.Write( (DateTime) m_LastTaxChange );
|
||||
writer.WriteEncodedInt( (int) Tax );
|
||||
writer.Write( (DateTime) LastTaxChange );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Silver );
|
||||
writer.WriteEncodedInt( (int) Silver );
|
||||
|
||||
Town.WriteReference( writer, m_Town );
|
||||
Faction.WriteReference( writer, m_Owner );
|
||||
Town.WriteReference( writer, Town );
|
||||
Faction.WriteReference( writer, Owner );
|
||||
|
||||
writer.Write( (Mobile) m_Sheriff );
|
||||
writer.Write( (Mobile) m_Finance );
|
||||
|
|
|
|||
|
|
@ -5,22 +5,20 @@ namespace Server.Factions
|
|||
{
|
||||
public class VendorList
|
||||
{
|
||||
private VendorDefinition m_Definition;
|
||||
private List<BaseFactionVendor> m_Vendors;
|
||||
public VendorDefinition Definition { get; }
|
||||
|
||||
public VendorDefinition Definition => m_Definition;
|
||||
public List<BaseFactionVendor> Vendors => m_Vendors;
|
||||
public List<BaseFactionVendor> Vendors { get; }
|
||||
|
||||
public BaseFactionVendor Construct( Town town, Faction faction )
|
||||
{
|
||||
try{ return Activator.CreateInstance( m_Definition.Type, new object[]{ town, faction } ) as BaseFactionVendor; }
|
||||
try{ return Activator.CreateInstance( Definition.Type, new object[]{ town, faction } ) as BaseFactionVendor; }
|
||||
catch{ return null; }
|
||||
}
|
||||
|
||||
public VendorList( VendorDefinition definition )
|
||||
{
|
||||
m_Definition = definition;
|
||||
m_Vendors = new List<BaseFactionVendor>();
|
||||
Definition = definition;
|
||||
Vendors = new List<BaseFactionVendor>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,97 +2,83 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionDefinition
|
||||
{
|
||||
private int m_Sort;
|
||||
public int Sort { get; }
|
||||
|
||||
private int m_HuePrimary;
|
||||
private int m_HueSecondary;
|
||||
private int m_HueJoin;
|
||||
private int m_HueBroadcast;
|
||||
public int HuePrimary { get; }
|
||||
|
||||
private int m_WarHorseBody;
|
||||
private int m_WarHorseItem;
|
||||
public int HueSecondary { get; }
|
||||
|
||||
private string m_FriendlyName;
|
||||
private string m_Keyword;
|
||||
private string m_Abbreviation;
|
||||
public int HueJoin { get; }
|
||||
|
||||
private TextDefinition m_Name;
|
||||
private TextDefinition m_PropName;
|
||||
private TextDefinition m_Header;
|
||||
private TextDefinition m_About;
|
||||
private TextDefinition m_CityControl;
|
||||
private TextDefinition m_SigilControl;
|
||||
private TextDefinition m_SignupName;
|
||||
private TextDefinition m_FactionStoneName;
|
||||
private TextDefinition m_OwnerLabel;
|
||||
public int HueBroadcast { get; }
|
||||
|
||||
private TextDefinition m_GuardIgnore, m_GuardWarn, m_GuardAttack;
|
||||
public int WarHorseBody { get; }
|
||||
|
||||
private StrongholdDefinition m_Stronghold;
|
||||
public int WarHorseItem { get; }
|
||||
|
||||
private RankDefinition[] m_Ranks;
|
||||
private GuardDefinition[] m_Guards;
|
||||
public string FriendlyName { get; }
|
||||
|
||||
public int Sort => m_Sort;
|
||||
public string Keyword { get; }
|
||||
|
||||
public int HuePrimary => m_HuePrimary;
|
||||
public int HueSecondary => m_HueSecondary;
|
||||
public int HueJoin => m_HueJoin;
|
||||
public int HueBroadcast => m_HueBroadcast;
|
||||
public string Abbreviation { get; }
|
||||
|
||||
public int WarHorseBody => m_WarHorseBody;
|
||||
public int WarHorseItem => m_WarHorseItem;
|
||||
public TextDefinition Name { get; }
|
||||
|
||||
public string FriendlyName => m_FriendlyName;
|
||||
public string Keyword => m_Keyword;
|
||||
public string Abbreviation => m_Abbreviation;
|
||||
public TextDefinition PropName { get; }
|
||||
|
||||
public TextDefinition Name => m_Name;
|
||||
public TextDefinition PropName => m_PropName;
|
||||
public TextDefinition Header => m_Header;
|
||||
public TextDefinition About => m_About;
|
||||
public TextDefinition CityControl => m_CityControl;
|
||||
public TextDefinition SigilControl => m_SigilControl;
|
||||
public TextDefinition SignupName => m_SignupName;
|
||||
public TextDefinition FactionStoneName => m_FactionStoneName;
|
||||
public TextDefinition OwnerLabel => m_OwnerLabel;
|
||||
public TextDefinition Header { get; }
|
||||
|
||||
public TextDefinition GuardIgnore => m_GuardIgnore;
|
||||
public TextDefinition GuardWarn => m_GuardWarn;
|
||||
public TextDefinition GuardAttack => m_GuardAttack;
|
||||
public TextDefinition About { get; }
|
||||
|
||||
public StrongholdDefinition Stronghold => m_Stronghold;
|
||||
public TextDefinition CityControl { get; }
|
||||
|
||||
public RankDefinition[] Ranks => m_Ranks;
|
||||
public GuardDefinition[] Guards => m_Guards;
|
||||
public TextDefinition SigilControl { get; }
|
||||
|
||||
public TextDefinition SignupName { get; }
|
||||
|
||||
public TextDefinition FactionStoneName { get; }
|
||||
|
||||
public TextDefinition OwnerLabel { get; }
|
||||
|
||||
public TextDefinition GuardIgnore { get; }
|
||||
|
||||
public TextDefinition GuardWarn { get; }
|
||||
|
||||
public TextDefinition GuardAttack { get; }
|
||||
|
||||
public StrongholdDefinition Stronghold { get; }
|
||||
|
||||
public RankDefinition[] Ranks { get; }
|
||||
|
||||
public GuardDefinition[] Guards { get; }
|
||||
|
||||
public FactionDefinition( int sort, int huePrimary, int hueSecondary, int hueJoin, int hueBroadcast, int warHorseBody, int warHorseItem, string friendlyName, string keyword, string abbreviation, TextDefinition name, TextDefinition propName, TextDefinition header, TextDefinition about, TextDefinition cityControl, TextDefinition sigilControl, TextDefinition signupName, TextDefinition factionStoneName, TextDefinition ownerLabel, TextDefinition guardIgnore, TextDefinition guardWarn, TextDefinition guardAttack, StrongholdDefinition stronghold, RankDefinition[] ranks, GuardDefinition[] guards )
|
||||
{
|
||||
m_Sort = sort;
|
||||
m_HuePrimary = huePrimary;
|
||||
m_HueSecondary = hueSecondary;
|
||||
m_HueJoin = hueJoin;
|
||||
m_HueBroadcast = hueBroadcast;
|
||||
m_WarHorseBody = warHorseBody;
|
||||
m_WarHorseItem = warHorseItem;
|
||||
m_FriendlyName = friendlyName;
|
||||
m_Keyword = keyword;
|
||||
m_Abbreviation = abbreviation;
|
||||
m_Name = name;
|
||||
m_PropName = propName;
|
||||
m_Header = header;
|
||||
m_About = about;
|
||||
m_CityControl = cityControl;
|
||||
m_SigilControl = sigilControl;
|
||||
m_SignupName = signupName;
|
||||
m_FactionStoneName = factionStoneName;
|
||||
m_OwnerLabel = ownerLabel;
|
||||
m_GuardIgnore = guardIgnore;
|
||||
m_GuardWarn = guardWarn;
|
||||
m_GuardAttack = guardAttack;
|
||||
m_Stronghold = stronghold;
|
||||
m_Ranks = ranks;
|
||||
m_Guards = guards;
|
||||
Sort = sort;
|
||||
HuePrimary = huePrimary;
|
||||
HueSecondary = hueSecondary;
|
||||
HueJoin = hueJoin;
|
||||
HueBroadcast = hueBroadcast;
|
||||
WarHorseBody = warHorseBody;
|
||||
WarHorseItem = warHorseItem;
|
||||
FriendlyName = friendlyName;
|
||||
Keyword = keyword;
|
||||
Abbreviation = abbreviation;
|
||||
Name = name;
|
||||
PropName = propName;
|
||||
Header = header;
|
||||
About = about;
|
||||
CityControl = cityControl;
|
||||
SigilControl = sigilControl;
|
||||
SignupName = signupName;
|
||||
FactionStoneName = factionStoneName;
|
||||
OwnerLabel = ownerLabel;
|
||||
GuardIgnore = guardIgnore;
|
||||
GuardWarn = guardWarn;
|
||||
GuardAttack = guardAttack;
|
||||
Stronghold = stronghold;
|
||||
Ranks = ranks;
|
||||
Guards = guards;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,16 +6,14 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionItemDefinition
|
||||
{
|
||||
private int m_SilverCost;
|
||||
private Type m_VendorType;
|
||||
public int SilverCost { get; }
|
||||
|
||||
public int SilverCost => m_SilverCost;
|
||||
public Type VendorType => m_VendorType;
|
||||
public Type VendorType { get; }
|
||||
|
||||
public FactionItemDefinition( int silverCost, Type vendorType )
|
||||
{
|
||||
m_SilverCost = silverCost;
|
||||
m_VendorType = vendorType;
|
||||
SilverCost = silverCost;
|
||||
VendorType = vendorType;
|
||||
}
|
||||
|
||||
private static FactionItemDefinition m_MetalArmor = new FactionItemDefinition( 1000, typeof( Blacksmith ) );
|
||||
|
|
|
|||
|
|
@ -4,38 +4,31 @@ namespace Server.Factions
|
|||
{
|
||||
public class GuardDefinition
|
||||
{
|
||||
private Type m_Type;
|
||||
public Type Type { get; }
|
||||
|
||||
private int m_Price;
|
||||
private int m_Upkeep;
|
||||
private int m_Maximum;
|
||||
public int Price { get; }
|
||||
|
||||
private int m_ItemID;
|
||||
public int Upkeep { get; }
|
||||
|
||||
private TextDefinition m_Header;
|
||||
private TextDefinition m_Label;
|
||||
public int Maximum { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public int ItemID { get; }
|
||||
|
||||
public int Price => m_Price;
|
||||
public int Upkeep => m_Upkeep;
|
||||
public int Maximum => m_Maximum;
|
||||
public int ItemID => m_ItemID;
|
||||
public TextDefinition Header { get; }
|
||||
|
||||
public TextDefinition Header => m_Header;
|
||||
public TextDefinition Label => m_Label;
|
||||
public TextDefinition Label { get; }
|
||||
|
||||
public GuardDefinition( Type type, int itemID, int price, int upkeep, int maximum, TextDefinition header, TextDefinition label )
|
||||
{
|
||||
m_Type = type;
|
||||
Type = type;
|
||||
|
||||
m_Price = price;
|
||||
m_Upkeep = upkeep;
|
||||
m_Maximum = maximum;
|
||||
m_ItemID = itemID;
|
||||
Price = price;
|
||||
Upkeep = upkeep;
|
||||
Maximum = maximum;
|
||||
ItemID = itemID;
|
||||
|
||||
m_Header = header;
|
||||
m_Label = label;
|
||||
Header = header;
|
||||
Label = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,22 +2,20 @@ namespace Server.Factions
|
|||
{
|
||||
public class RankDefinition
|
||||
{
|
||||
private int m_Rank;
|
||||
private int m_Required;
|
||||
private int m_MaxWearables;
|
||||
private TextDefinition m_Title;
|
||||
public int Rank { get; }
|
||||
|
||||
public int Rank => m_Rank;
|
||||
public int Required => m_Required;
|
||||
public int MaxWearables => m_MaxWearables;
|
||||
public TextDefinition Title => m_Title;
|
||||
public int Required { get; }
|
||||
|
||||
public int MaxWearables { get; }
|
||||
|
||||
public TextDefinition Title { get; }
|
||||
|
||||
public RankDefinition( int rank, int required, int maxWearables, TextDefinition title )
|
||||
{
|
||||
m_Rank = rank;
|
||||
m_Required = required;
|
||||
m_Title = title;
|
||||
m_MaxWearables = maxWearables;
|
||||
Rank = rank;
|
||||
Required = required;
|
||||
Title = title;
|
||||
MaxWearables = maxWearables;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,24 +2,20 @@ namespace Server.Factions
|
|||
{
|
||||
public class StrongholdDefinition
|
||||
{
|
||||
private Rectangle2D[] m_Area;
|
||||
private Point3D m_JoinStone;
|
||||
private Point3D m_FactionStone;
|
||||
private Point3D[] m_Monoliths;
|
||||
public Rectangle2D[] Area { get; }
|
||||
|
||||
public Rectangle2D[] Area => m_Area;
|
||||
public Point3D JoinStone { get; }
|
||||
|
||||
public Point3D JoinStone => m_JoinStone;
|
||||
public Point3D FactionStone => m_FactionStone;
|
||||
public Point3D FactionStone { get; }
|
||||
|
||||
public Point3D[] Monoliths => m_Monoliths;
|
||||
public Point3D[] Monoliths { get; }
|
||||
|
||||
public StrongholdDefinition( Rectangle2D[] area, Point3D joinStone, Point3D factionStone, Point3D[] monoliths )
|
||||
{
|
||||
m_Area = area;
|
||||
m_JoinStone = joinStone;
|
||||
m_FactionStone = factionStone;
|
||||
m_Monoliths = monoliths;
|
||||
Area = area;
|
||||
JoinStone = joinStone;
|
||||
FactionStone = factionStone;
|
||||
Monoliths = monoliths;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,56 +2,47 @@ namespace Server.Factions
|
|||
{
|
||||
public class TownDefinition
|
||||
{
|
||||
private int m_Sort;
|
||||
private int m_SigilID;
|
||||
public int Sort { get; }
|
||||
|
||||
private string m_Region;
|
||||
public int SigilID { get; }
|
||||
|
||||
private string m_FriendlyName;
|
||||
public string Region { get; }
|
||||
|
||||
private TextDefinition m_TownName;
|
||||
private TextDefinition m_TownStoneHeader;
|
||||
private TextDefinition m_StrongholdMonolithName;
|
||||
private TextDefinition m_TownMonolithName;
|
||||
private TextDefinition m_TownStoneName;
|
||||
private TextDefinition m_SigilName;
|
||||
private TextDefinition m_CorruptedSigilName;
|
||||
public string FriendlyName { get; }
|
||||
|
||||
private Point3D m_Monolith;
|
||||
private Point3D m_TownStone;
|
||||
public TextDefinition TownName { get; }
|
||||
|
||||
public int Sort => m_Sort;
|
||||
public int SigilID => m_SigilID;
|
||||
public TextDefinition TownStoneHeader { get; }
|
||||
|
||||
public string Region => m_Region;
|
||||
public string FriendlyName => m_FriendlyName;
|
||||
public TextDefinition StrongholdMonolithName { get; }
|
||||
|
||||
public TextDefinition TownName => m_TownName;
|
||||
public TextDefinition TownStoneHeader => m_TownStoneHeader;
|
||||
public TextDefinition StrongholdMonolithName => m_StrongholdMonolithName;
|
||||
public TextDefinition TownMonolithName => m_TownMonolithName;
|
||||
public TextDefinition TownStoneName => m_TownStoneName;
|
||||
public TextDefinition SigilName => m_SigilName;
|
||||
public TextDefinition CorruptedSigilName => m_CorruptedSigilName;
|
||||
public TextDefinition TownMonolithName { get; }
|
||||
|
||||
public Point3D Monolith => m_Monolith;
|
||||
public Point3D TownStone => m_TownStone;
|
||||
public TextDefinition TownStoneName { get; }
|
||||
|
||||
public TextDefinition SigilName { get; }
|
||||
|
||||
public TextDefinition CorruptedSigilName { get; }
|
||||
|
||||
public Point3D Monolith { get; }
|
||||
|
||||
public Point3D TownStone { get; }
|
||||
|
||||
public TownDefinition( int sort, int sigilID, string region, string friendlyName, TextDefinition townName, TextDefinition townStoneHeader, TextDefinition strongholdMonolithName, TextDefinition townMonolithName, TextDefinition townStoneName, TextDefinition sigilName, TextDefinition corruptedSigilName, Point3D monolith, Point3D townStone )
|
||||
{
|
||||
m_Sort = sort;
|
||||
m_SigilID = sigilID;
|
||||
m_Region = region;
|
||||
m_FriendlyName = friendlyName;
|
||||
m_TownName = townName;
|
||||
m_TownStoneHeader = townStoneHeader;
|
||||
m_StrongholdMonolithName = strongholdMonolithName;
|
||||
m_TownMonolithName = townMonolithName;
|
||||
m_TownStoneName = townStoneName;
|
||||
m_SigilName = sigilName;
|
||||
m_CorruptedSigilName = corruptedSigilName;
|
||||
m_Monolith = monolith;
|
||||
m_TownStone = townStone;
|
||||
Sort = sort;
|
||||
SigilID = sigilID;
|
||||
Region = region;
|
||||
FriendlyName = friendlyName;
|
||||
TownName = townName;
|
||||
TownStoneHeader = townStoneHeader;
|
||||
StrongholdMonolithName = strongholdMonolithName;
|
||||
TownMonolithName = townMonolithName;
|
||||
TownStoneName = townStoneName;
|
||||
SigilName = sigilName;
|
||||
CorruptedSigilName = corruptedSigilName;
|
||||
Monolith = monolith;
|
||||
TownStone = townStone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,78 +4,70 @@ namespace Server.Factions
|
|||
{
|
||||
public class VendorDefinition
|
||||
{
|
||||
private Type m_Type;
|
||||
public Type Type { get; }
|
||||
|
||||
private int m_Price;
|
||||
private int m_Upkeep;
|
||||
private int m_Maximum;
|
||||
public int Price { get; }
|
||||
|
||||
private int m_ItemID;
|
||||
public int Upkeep { get; }
|
||||
|
||||
private TextDefinition m_Header;
|
||||
private TextDefinition m_Label;
|
||||
public int Maximum { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public int ItemID { get; }
|
||||
|
||||
public int Price => m_Price;
|
||||
public int Upkeep => m_Upkeep;
|
||||
public int Maximum => m_Maximum;
|
||||
public int ItemID => m_ItemID;
|
||||
public TextDefinition Header { get; }
|
||||
|
||||
public TextDefinition Header => m_Header;
|
||||
public TextDefinition Label => m_Label;
|
||||
public TextDefinition Label { get; }
|
||||
|
||||
public VendorDefinition( Type type, int itemID, int price, int upkeep, int maximum, TextDefinition header, TextDefinition label )
|
||||
{
|
||||
m_Type = type;
|
||||
Type = type;
|
||||
|
||||
m_Price = price;
|
||||
m_Upkeep = upkeep;
|
||||
m_Maximum = maximum;
|
||||
m_ItemID = itemID;
|
||||
Price = price;
|
||||
Upkeep = upkeep;
|
||||
Maximum = maximum;
|
||||
ItemID = itemID;
|
||||
|
||||
m_Header = header;
|
||||
m_Label = label;
|
||||
Header = header;
|
||||
Label = label;
|
||||
}
|
||||
|
||||
private static VendorDefinition[] m_Definitions = {
|
||||
new VendorDefinition( typeof( FactionBottleVendor ), 0xF0E,
|
||||
5000,
|
||||
1000,
|
||||
10,
|
||||
new TextDefinition( 1011549, "POTION BOTTLE VENDOR" ),
|
||||
new TextDefinition( 1011544, "Buy Potion Bottle Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionBoardVendor ), 0x1BD7,
|
||||
3000,
|
||||
500,
|
||||
10,
|
||||
new TextDefinition( 1011552, "WOOD VENDOR" ),
|
||||
new TextDefinition( 1011545, "Buy Wooden Board Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionOreVendor ), 0x19B8,
|
||||
3000,
|
||||
500,
|
||||
10,
|
||||
new TextDefinition( 1011553, "IRON ORE VENDOR" ),
|
||||
new TextDefinition( 1011546, "Buy Iron Ore Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionReagentVendor ), 0xF86,
|
||||
5000,
|
||||
1000,
|
||||
10,
|
||||
new TextDefinition( 1011554, "REAGENT VENDOR" ),
|
||||
new TextDefinition( 1011547, "Buy Reagent Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionHorseVendor ), 0x20DD,
|
||||
5000,
|
||||
1000,
|
||||
1,
|
||||
new TextDefinition( 1011556, "HORSE BREEDER" ),
|
||||
new TextDefinition( 1011555, "Buy Horse Breeder" )
|
||||
)
|
||||
};
|
||||
|
||||
public static VendorDefinition[] Definitions => m_Definitions;
|
||||
public static VendorDefinition[] Definitions { get; } =
|
||||
{
|
||||
new VendorDefinition( typeof( FactionBottleVendor ), 0xF0E,
|
||||
5000,
|
||||
1000,
|
||||
10,
|
||||
new TextDefinition( 1011549, "POTION BOTTLE VENDOR" ),
|
||||
new TextDefinition( 1011544, "Buy Potion Bottle Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionBoardVendor ), 0x1BD7,
|
||||
3000,
|
||||
500,
|
||||
10,
|
||||
new TextDefinition( 1011552, "WOOD VENDOR" ),
|
||||
new TextDefinition( 1011545, "Buy Wooden Board Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionOreVendor ), 0x19B8,
|
||||
3000,
|
||||
500,
|
||||
10,
|
||||
new TextDefinition( 1011553, "IRON ORE VENDOR" ),
|
||||
new TextDefinition( 1011546, "Buy Iron Ore Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionReagentVendor ), 0xF86,
|
||||
5000,
|
||||
1000,
|
||||
10,
|
||||
new TextDefinition( 1011554, "REAGENT VENDOR" ),
|
||||
new TextDefinition( 1011547, "Buy Reagent Vendor" )
|
||||
),
|
||||
new VendorDefinition( typeof( FactionHorseVendor ), 0x20DD,
|
||||
5000,
|
||||
1000,
|
||||
1,
|
||||
new TextDefinition( 1011556, "HORSE BREEDER" ),
|
||||
new TextDefinition( 1011555, "Buy Horse Breeder" )
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -2,13 +2,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class CouncilOfMages : Faction
|
||||
{
|
||||
private static Faction m_Instance;
|
||||
|
||||
public static Faction Instance => m_Instance;
|
||||
public static Faction Instance { get; private set; }
|
||||
|
||||
public CouncilOfMages()
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
|
||||
Definition =
|
||||
new FactionDefinition(
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class Minax : Faction
|
||||
{
|
||||
private static Faction m_Instance;
|
||||
|
||||
public static Faction Instance => m_Instance;
|
||||
public static Faction Instance { get; private set; }
|
||||
|
||||
public Minax()
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
|
||||
Definition =
|
||||
new FactionDefinition(
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class Shadowlords : Faction
|
||||
{
|
||||
private static Faction m_Instance;
|
||||
|
||||
public static Faction Instance => m_Instance;
|
||||
public static Faction Instance { get; private set; }
|
||||
|
||||
public Shadowlords()
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
|
||||
Definition =
|
||||
new FactionDefinition(
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ namespace Server.Factions
|
|||
{
|
||||
public class TrueBritannians : Faction
|
||||
{
|
||||
private static Faction m_Instance;
|
||||
|
||||
public static Faction Instance => m_Instance;
|
||||
public static Faction Instance { get; private set; }
|
||||
|
||||
public TrueBritannians()
|
||||
{
|
||||
m_Instance = this;
|
||||
Instance = this;
|
||||
|
||||
Definition =
|
||||
new FactionDefinition(
|
||||
|
|
|
|||
|
|
@ -80,18 +80,18 @@ namespace Server.Factions
|
|||
Movable = false;
|
||||
Town = town;
|
||||
Faction = faction;
|
||||
m_Monoliths.Add( this );
|
||||
Monoliths.Add( this );
|
||||
}
|
||||
|
||||
public BaseMonolith( Serial serial ) : base( serial )
|
||||
{
|
||||
m_Monoliths.Add( this );
|
||||
Monoliths.Add( this );
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
m_Monoliths.Remove( this );
|
||||
Monoliths.Remove( this );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -124,12 +124,6 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
private static List<BaseMonolith> m_Monoliths = new List<BaseMonolith>();
|
||||
|
||||
public static List<BaseMonolith> Monoliths
|
||||
{
|
||||
get => m_Monoliths;
|
||||
set => m_Monoliths = value;
|
||||
}
|
||||
public static List<BaseMonolith> Monoliths { get; set; } = new List<BaseMonolith>();
|
||||
}
|
||||
}
|
||||
|
|
@ -32,20 +32,17 @@ namespace Server {
|
|||
}
|
||||
|
||||
private sealed class WeightedItem {
|
||||
private int _weight;
|
||||
private Type _type;
|
||||
public int Weight { get; }
|
||||
|
||||
public int Weight => _weight;
|
||||
|
||||
public Type Type => _type;
|
||||
public Type Type { get; }
|
||||
|
||||
public WeightedItem( int weight, Type type ) {
|
||||
_weight = weight;
|
||||
_type = type;
|
||||
Weight = weight;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public Item Construct() {
|
||||
return Activator.CreateInstance( _type ) as Item;
|
||||
return Activator.CreateInstance( Type ) as Item;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,44 +22,21 @@ namespace Server.Factions
|
|||
// Once it's been returned the corrupting faction owns the town for this period of time
|
||||
public static readonly TimeSpan PurificationPeriod = TimeSpan.FromDays( 3.0 );
|
||||
|
||||
private BaseMonolith m_LastMonolith;
|
||||
|
||||
private Town m_Town;
|
||||
private Faction m_Corrupted;
|
||||
private Faction m_Corrupting;
|
||||
|
||||
private DateTime m_LastStolen;
|
||||
private DateTime m_GraceStart;
|
||||
private DateTime m_CorruptionStart;
|
||||
private DateTime m_PurificationStart;
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime LastStolen { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime LastStolen
|
||||
{
|
||||
get => m_LastStolen;
|
||||
set => m_LastStolen = value;
|
||||
}
|
||||
public DateTime GraceStart { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime GraceStart
|
||||
{
|
||||
get => m_GraceStart;
|
||||
set => m_GraceStart = value;
|
||||
}
|
||||
public DateTime CorruptionStart { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime CorruptionStart
|
||||
{
|
||||
get => m_CorruptionStart;
|
||||
set => m_CorruptionStart = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public DateTime PurificationStart
|
||||
{
|
||||
get => m_PurificationStart;
|
||||
set => m_PurificationStart = value;
|
||||
}
|
||||
public DateTime PurificationStart { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public Town Town
|
||||
|
|
@ -83,20 +60,16 @@ namespace Server.Factions
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor, AccessLevel.Administrator )]
|
||||
public BaseMonolith LastMonolith
|
||||
{
|
||||
get => m_LastMonolith;
|
||||
set => m_LastMonolith = value;
|
||||
}
|
||||
public BaseMonolith LastMonolith { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public bool IsBeingCorrupted => ( m_LastMonolith is StrongholdMonolith && m_LastMonolith.Faction == m_Corrupting && m_Corrupting != null );
|
||||
public bool IsBeingCorrupted => ( LastMonolith is StrongholdMonolith && LastMonolith.Faction == m_Corrupting && m_Corrupting != null );
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public bool IsCorrupted => ( m_Corrupted != null );
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public bool IsPurifying => ( m_PurificationStart != DateTime.MinValue );
|
||||
public bool IsPurifying => ( PurificationStart != DateTime.MinValue );
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public bool IsCorrupting => ( m_Corrupting != null && m_Corrupting != m_Corrupted );
|
||||
|
|
@ -198,7 +171,7 @@ namespace Server.Factions
|
|||
Movable = false;
|
||||
Town = town;
|
||||
|
||||
m_Sigils.Add( this );
|
||||
Sigils.Add( this );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
|
|
@ -220,13 +193,13 @@ namespace Server.Factions
|
|||
private void BeginCorrupting( Faction faction )
|
||||
{
|
||||
m_Corrupting = faction;
|
||||
m_CorruptionStart = DateTime.UtcNow;
|
||||
CorruptionStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
private void ClearCorrupting()
|
||||
{
|
||||
m_Corrupting = null;
|
||||
m_CorruptionStart = DateTime.MinValue;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
|
|
@ -237,7 +210,7 @@ namespace Server.Factions
|
|||
if ( !IsBeingCorrupted )
|
||||
return TimeSpan.Zero;
|
||||
|
||||
TimeSpan ts = ( m_CorruptionStart + CorruptionPeriod ) - DateTime.UtcNow;
|
||||
TimeSpan ts = ( CorruptionStart + CorruptionPeriod ) - DateTime.UtcNow;
|
||||
|
||||
if ( ts < TimeSpan.Zero )
|
||||
ts = TimeSpan.Zero;
|
||||
|
|
@ -301,25 +274,25 @@ namespace Server.Factions
|
|||
if ( m_Corrupted != newController )
|
||||
BeginCorrupting( newController );
|
||||
}
|
||||
else if ( m_GraceStart > DateTime.MinValue && (m_GraceStart + CorruptionGrace) < DateTime.UtcNow )
|
||||
else if ( GraceStart > DateTime.MinValue && (GraceStart + CorruptionGrace) < DateTime.UtcNow )
|
||||
{
|
||||
if ( m_Corrupted != newController )
|
||||
BeginCorrupting( newController ); // grace time over, reset period
|
||||
else
|
||||
ClearCorrupting();
|
||||
|
||||
m_GraceStart = DateTime.MinValue;
|
||||
GraceStart = DateTime.MinValue;
|
||||
}
|
||||
else if ( newController == oldController )
|
||||
{
|
||||
m_GraceStart = DateTime.MinValue; // returned within grace period
|
||||
GraceStart = DateTime.MinValue; // returned within grace period
|
||||
}
|
||||
else if ( m_GraceStart == DateTime.MinValue )
|
||||
else if ( GraceStart == DateTime.MinValue )
|
||||
{
|
||||
m_GraceStart = DateTime.UtcNow;
|
||||
GraceStart = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
m_PurificationStart = DateTime.MinValue;
|
||||
PurificationStart = DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -336,8 +309,8 @@ namespace Server.Factions
|
|||
tm.Sigil = this;
|
||||
|
||||
m_Corrupting = null;
|
||||
m_PurificationStart = DateTime.UtcNow;
|
||||
m_CorruptionStart = DateTime.MinValue;
|
||||
PurificationStart = DateTime.UtcNow;
|
||||
CorruptionStart = DateTime.MinValue;
|
||||
|
||||
m_Town.Capture( m_Corrupted );
|
||||
m_Corrupted = null;
|
||||
|
|
@ -355,7 +328,7 @@ namespace Server.Factions
|
|||
|
||||
public Sigil( Serial serial ) : base( serial )
|
||||
{
|
||||
m_Sigils.Add( this );
|
||||
Sigils.Add( this );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -368,12 +341,12 @@ namespace Server.Factions
|
|||
Faction.WriteReference( writer, m_Corrupted );
|
||||
Faction.WriteReference( writer, m_Corrupting );
|
||||
|
||||
writer.Write( (Item) m_LastMonolith );
|
||||
writer.Write( (Item) LastMonolith );
|
||||
|
||||
writer.Write( m_LastStolen );
|
||||
writer.Write( m_GraceStart );
|
||||
writer.Write( m_CorruptionStart );
|
||||
writer.Write( m_PurificationStart );
|
||||
writer.Write( LastStolen );
|
||||
writer.Write( GraceStart );
|
||||
writer.Write( CorruptionStart );
|
||||
writer.Write( PurificationStart );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -390,12 +363,12 @@ namespace Server.Factions
|
|||
m_Corrupted = Faction.ReadReference( reader );
|
||||
m_Corrupting = Faction.ReadReference( reader );
|
||||
|
||||
m_LastMonolith = reader.ReadItem() as BaseMonolith;
|
||||
LastMonolith = reader.ReadItem() as BaseMonolith;
|
||||
|
||||
m_LastStolen = reader.ReadDateTime();
|
||||
m_GraceStart = reader.ReadDateTime();
|
||||
m_CorruptionStart = reader.ReadDateTime();
|
||||
m_PurificationStart = reader.ReadDateTime();
|
||||
LastStolen = reader.ReadDateTime();
|
||||
GraceStart = reader.ReadDateTime();
|
||||
CorruptionStart = reader.ReadDateTime();
|
||||
PurificationStart = reader.ReadDateTime();
|
||||
|
||||
Update();
|
||||
|
||||
|
|
@ -409,7 +382,7 @@ namespace Server.Factions
|
|||
|
||||
public bool ReturnHome()
|
||||
{
|
||||
BaseMonolith monolith = m_LastMonolith;
|
||||
BaseMonolith monolith = LastMonolith;
|
||||
|
||||
if ( monolith == null && m_Town != null )
|
||||
monolith = m_Town.Monolith;
|
||||
|
|
@ -431,7 +404,7 @@ namespace Server.Factions
|
|||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
m_Sigils.Remove( this );
|
||||
Sigils.Remove( this );
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
|
|
@ -442,8 +415,6 @@ namespace Server.Factions
|
|||
base.Delete();
|
||||
}
|
||||
|
||||
private static List<Sigil> m_Sigils = new List<Sigil>();
|
||||
|
||||
public static List<Sigil> Sigils => m_Sigils;
|
||||
public static List<Sigil> Sigils { get; } = new List<Sigil>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,32 +15,16 @@ namespace Server.Factions
|
|||
|
||||
public abstract class BaseFactionTrap : BaseTrap
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private Mobile m_Placer;
|
||||
private DateTime m_TimeOfPlacement;
|
||||
|
||||
private Timer m_Concealing;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Faction Faction
|
||||
{
|
||||
get => m_Faction;
|
||||
set => m_Faction = value;
|
||||
}
|
||||
public Faction Faction { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Placer
|
||||
{
|
||||
get => m_Placer;
|
||||
set => m_Placer = value;
|
||||
}
|
||||
public Mobile Placer { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime TimeOfPlacement
|
||||
{
|
||||
get => m_TimeOfPlacement;
|
||||
set => m_TimeOfPlacement = value;
|
||||
}
|
||||
public DateTime TimeOfPlacement { get; set; }
|
||||
|
||||
public virtual int EffectSound => 0;
|
||||
|
||||
|
|
@ -79,24 +63,24 @@ namespace Server.Factions
|
|||
|
||||
int silverToAward = ( from.Alive ? 20 : 40 );
|
||||
|
||||
if ( silverToAward > 0 && m_Placer != null && m_Faction != null )
|
||||
if ( silverToAward > 0 && Placer != null && Faction != null )
|
||||
{
|
||||
PlayerState victimState = PlayerState.Find( from );
|
||||
|
||||
if ( victimState != null && victimState.CanGiveSilverTo( m_Placer ) && victimState.KillPoints > 0 )
|
||||
if ( victimState != null && victimState.CanGiveSilverTo( Placer ) && victimState.KillPoints > 0 )
|
||||
{
|
||||
int silverGiven = m_Faction.AwardSilver( m_Placer, silverToAward );
|
||||
int silverGiven = Faction.AwardSilver( Placer, silverToAward );
|
||||
|
||||
if ( silverGiven > 0 )
|
||||
{
|
||||
// TODO: Get real message
|
||||
if ( from.Alive )
|
||||
m_Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name );
|
||||
Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name );
|
||||
else
|
||||
m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
|
||||
Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
|
||||
}
|
||||
|
||||
victimState.OnGivenSilverTo( m_Placer );
|
||||
victimState.OnGivenSilverTo( Placer );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +115,7 @@ namespace Server.Factions
|
|||
{
|
||||
StrongholdRegion region = (StrongholdRegion) Region.Find( p, m ).GetRegion( typeof( StrongholdRegion ) );
|
||||
|
||||
if ( region != null && region.Faction == m_Faction )
|
||||
if ( region != null && region.Faction == Faction )
|
||||
return 0;
|
||||
|
||||
return 1010355; // This trap can only be placed in your stronghold
|
||||
|
|
@ -149,7 +133,7 @@ namespace Server.Factions
|
|||
{
|
||||
Town town = Town.FromRegion( Region.Find( p, m ) );
|
||||
|
||||
if ( town != null && town.Owner == m_Faction )
|
||||
if ( town != null && town.Owner == Faction )
|
||||
return 0;
|
||||
|
||||
return 1010357; // This trap can only be placed in a town your faction controls
|
||||
|
|
@ -181,9 +165,9 @@ namespace Server.Factions
|
|||
{
|
||||
Visible = false;
|
||||
|
||||
m_Faction = f;
|
||||
m_TimeOfPlacement = DateTime.UtcNow;
|
||||
m_Placer = m;
|
||||
Faction = f;
|
||||
TimeOfPlacement = DateTime.UtcNow;
|
||||
Placer = m;
|
||||
}
|
||||
|
||||
public BaseFactionTrap( Serial serial ) : base( serial )
|
||||
|
|
@ -197,7 +181,7 @@ namespace Server.Factions
|
|||
if ( decayPeriod == TimeSpan.MaxValue )
|
||||
return false;
|
||||
|
||||
if ( (m_TimeOfPlacement + decayPeriod) < DateTime.UtcNow )
|
||||
if ( (TimeOfPlacement + decayPeriod) < DateTime.UtcNow )
|
||||
{
|
||||
Timer.DelayCall( TimeSpan.Zero, Delete );
|
||||
return true;
|
||||
|
|
@ -229,9 +213,9 @@ namespace Server.Factions
|
|||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
writer.Write( (Mobile) m_Placer );
|
||||
writer.Write( (DateTime) m_TimeOfPlacement );
|
||||
Faction.WriteReference( writer, Faction );
|
||||
writer.Write( (Mobile) Placer );
|
||||
writer.Write( (DateTime) TimeOfPlacement );
|
||||
|
||||
if ( Visible )
|
||||
BeginConceal();
|
||||
|
|
@ -243,9 +227,9 @@ namespace Server.Factions
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Faction = Faction.ReadReference( reader );
|
||||
m_Placer = reader.ReadMobile();
|
||||
m_TimeOfPlacement = reader.ReadDateTime();
|
||||
Faction = Faction.ReadReference( reader );
|
||||
Placer = reader.ReadMobile();
|
||||
TimeOfPlacement = reader.ReadDateTime();
|
||||
|
||||
if ( Visible )
|
||||
BeginConceal();
|
||||
|
|
@ -255,8 +239,8 @@ namespace Server.Factions
|
|||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if ( m_Faction != null && m_Faction.Traps.Contains( this ) )
|
||||
m_Faction.Traps.Remove( this );
|
||||
if ( Faction != null && Faction.Traps.Contains( this ) )
|
||||
Faction.Traps.Remove( this );
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
|
@ -277,7 +261,7 @@ namespace Server.Factions
|
|||
if ( faction == null )
|
||||
return false;
|
||||
|
||||
return ( faction != m_Faction );
|
||||
return ( faction != Faction );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,8 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionTrapRemovalKit : Item
|
||||
{
|
||||
private int m_Charges;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Charges
|
||||
{
|
||||
get => m_Charges;
|
||||
set => m_Charges = value;
|
||||
}
|
||||
public int Charges { get; set; }
|
||||
|
||||
public override int LabelNumber => 1041508; // a faction trap removal kit
|
||||
|
||||
|
|
@ -17,14 +11,14 @@ namespace Server.Factions
|
|||
public FactionTrapRemovalKit() : base( 7867 )
|
||||
{
|
||||
LootType = LootType.Blessed;
|
||||
m_Charges = 25;
|
||||
Charges = 25;
|
||||
}
|
||||
|
||||
public void ConsumeCharge( Mobile consumer )
|
||||
{
|
||||
--m_Charges;
|
||||
--Charges;
|
||||
|
||||
if ( m_Charges <= 0 )
|
||||
if ( Charges <= 0 )
|
||||
{
|
||||
Delete();
|
||||
|
||||
|
|
@ -37,7 +31,7 @@ namespace Server.Factions
|
|||
base.GetProperties( list );
|
||||
|
||||
// NOTE: OSI does not list uses remaining; intentional difference
|
||||
list.Add( 1060584, m_Charges.ToString() ); // uses remaining: ~1_val~
|
||||
list.Add( 1060584, Charges.ToString() ); // uses remaining: ~1_val~
|
||||
}
|
||||
|
||||
public FactionTrapRemovalKit( Serial serial ) : base( serial )
|
||||
|
|
@ -50,7 +44,7 @@ namespace Server.Factions
|
|||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Charges );
|
||||
writer.WriteEncodedInt( (int) Charges );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -63,12 +57,12 @@ namespace Server.Factions
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Charges = reader.ReadEncodedInt();
|
||||
Charges = reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Charges = 25;
|
||||
Charges = 25;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ namespace Server.Factions
|
|||
{
|
||||
private Faction m_Faction;
|
||||
private Town m_Town;
|
||||
private Orders m_Orders;
|
||||
|
||||
public override bool BardImmune => true;
|
||||
|
||||
|
|
@ -22,7 +21,7 @@ namespace Server.Factions
|
|||
set{ Unregister(); m_Faction = value; Register(); }
|
||||
}
|
||||
|
||||
public Orders Orders => m_Orders;
|
||||
public Orders Orders { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public Town Town
|
||||
|
|
@ -79,7 +78,7 @@ namespace Server.Factions
|
|||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m.Player && m.Alive && InRange( m, 10 ) && !InRange( oldLocation, 10 ) && InLOS( m ) && m_Orders.GetReaction( Faction.Find( m ) ).Type == ReactionType.Warn )
|
||||
if ( m.Player && m.Alive && InRange( m, 10 ) && !InRange( oldLocation, 10 ) && InLOS( m ) && Orders.GetReaction( Faction.Find( m ) ).Type == ReactionType.Warn )
|
||||
{
|
||||
Direction = GetDirectionTo( m );
|
||||
|
||||
|
|
@ -141,7 +140,7 @@ namespace Server.Factions
|
|||
Say( def.String );
|
||||
}
|
||||
|
||||
m_Orders.SetReaction( faction, type );
|
||||
Orders.SetReaction( faction, type );
|
||||
}
|
||||
|
||||
private bool WasNamed( string speech )
|
||||
|
|
@ -217,7 +216,7 @@ namespace Server.Factions
|
|||
Home = Location;
|
||||
RangeHome = 6;
|
||||
Combatant = null;
|
||||
m_Orders.Movement = MovementType.Patrol;
|
||||
Orders.Movement = MovementType.Patrol;
|
||||
Say( 1005146 ); // This spot looks like it needs protection! I shall guard it with my life.
|
||||
understood = true;
|
||||
}
|
||||
|
|
@ -226,8 +225,8 @@ namespace Server.Factions
|
|||
Home = Location;
|
||||
RangeHome = 6;
|
||||
Combatant = null;
|
||||
m_Orders.Follow = from;
|
||||
m_Orders.Movement = MovementType.Follow;
|
||||
Orders.Follow = from;
|
||||
Orders.Movement = MovementType.Follow;
|
||||
Say( 1005144 ); // Yes, Sire.
|
||||
understood = true;
|
||||
}
|
||||
|
|
@ -391,7 +390,7 @@ namespace Server.Factions
|
|||
|
||||
public BaseFactionGuard( string title ) : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
|
||||
{
|
||||
m_Orders = new Orders( this );
|
||||
Orders = new Orders( this );
|
||||
Title = title;
|
||||
|
||||
RangeHome = 6;
|
||||
|
|
@ -410,7 +409,7 @@ namespace Server.Factions
|
|||
Faction.WriteReference( writer, m_Faction );
|
||||
Town.WriteReference( writer, m_Town );
|
||||
|
||||
m_Orders.Serialize( writer );
|
||||
Orders.Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -421,7 +420,7 @@ namespace Server.Factions
|
|||
|
||||
m_Faction = Faction.ReadReference( reader );
|
||||
m_Town = Town.ReadReference( reader );
|
||||
m_Orders = new Orders( this, reader );
|
||||
Orders = new Orders( this, reader );
|
||||
|
||||
Timer.DelayCall( TimeSpan.Zero, Register );
|
||||
}
|
||||
|
|
@ -449,16 +448,15 @@ namespace Server.Factions
|
|||
|
||||
public class VirtualMountItem : Item, IMountItem
|
||||
{
|
||||
private Mobile m_Rider;
|
||||
private VirtualMount m_Mount;
|
||||
|
||||
public Mobile Rider => m_Rider;
|
||||
public Mobile Rider { get; private set; }
|
||||
|
||||
public VirtualMountItem( Mobile mob ) : base( 0x3EA0 )
|
||||
{
|
||||
Layer = Layer.Mount;
|
||||
|
||||
m_Rider = mob;
|
||||
Rider = mob;
|
||||
m_Mount = new VirtualMount( this );
|
||||
}
|
||||
|
||||
|
|
@ -475,7 +473,7 @@ namespace Server.Factions
|
|||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Rider );
|
||||
writer.Write( (Mobile) Rider );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -484,9 +482,9 @@ namespace Server.Factions
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Rider = reader.ReadMobile();
|
||||
Rider = reader.ReadMobile();
|
||||
|
||||
if ( m_Rider == null )
|
||||
if ( Rider == null )
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,13 +26,11 @@ namespace Server.Factions
|
|||
|
||||
public class ComboEntry
|
||||
{
|
||||
private Type m_Spell;
|
||||
private TimeSpan m_Hold;
|
||||
private int m_Chance;
|
||||
public Type Spell { get; }
|
||||
|
||||
public Type Spell => m_Spell;
|
||||
public TimeSpan Hold => m_Hold;
|
||||
public int Chance => m_Chance;
|
||||
public TimeSpan Hold { get; }
|
||||
|
||||
public int Chance { get; }
|
||||
|
||||
public ComboEntry( Type spell ) : this( spell, 100, TimeSpan.Zero )
|
||||
{
|
||||
|
|
@ -44,24 +42,22 @@ namespace Server.Factions
|
|||
|
||||
public ComboEntry( Type spell, int chance, TimeSpan hold )
|
||||
{
|
||||
m_Spell = spell;
|
||||
m_Chance = chance;
|
||||
m_Hold = hold;
|
||||
Spell = spell;
|
||||
Chance = chance;
|
||||
Hold = hold;
|
||||
}
|
||||
}
|
||||
|
||||
public class SpellCombo
|
||||
{
|
||||
private int m_Mana;
|
||||
private ComboEntry[] m_Entries;
|
||||
public int Mana { get; }
|
||||
|
||||
public int Mana => m_Mana;
|
||||
public ComboEntry[] Entries => m_Entries;
|
||||
public ComboEntry[] Entries { get; }
|
||||
|
||||
public SpellCombo( int mana, params ComboEntry[] entries )
|
||||
{
|
||||
m_Mana = mana;
|
||||
m_Entries = entries;
|
||||
Mana = mana;
|
||||
Entries = entries;
|
||||
}
|
||||
|
||||
public static readonly SpellCombo Simple = new SpellCombo( 50,
|
||||
|
|
@ -83,9 +79,9 @@ namespace Server.Factions
|
|||
|
||||
public static Spell Process( Mobile mob, Mobile targ, ref SpellCombo combo, ref int index, ref DateTime releaseTime )
|
||||
{
|
||||
while ( ++index < combo.m_Entries.Length )
|
||||
while ( ++index < combo.Entries.Length )
|
||||
{
|
||||
ComboEntry entry = combo.m_Entries[index];
|
||||
ComboEntry entry = combo.Entries[index];
|
||||
|
||||
if ( entry.Spell == typeof( PoisonSpell ) && targ.Poisoned )
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -18,18 +18,14 @@ namespace Server.Factions.AI
|
|||
|
||||
public class Reaction
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private ReactionType m_Type;
|
||||
public Faction Faction { get; }
|
||||
|
||||
public Faction Faction => m_Faction;
|
||||
public ReactionType Type{ get => m_Type;
|
||||
set => m_Type = value;
|
||||
}
|
||||
public ReactionType Type { get; set; }
|
||||
|
||||
public Reaction( Faction faction, ReactionType type )
|
||||
{
|
||||
m_Faction = faction;
|
||||
m_Type = type;
|
||||
Faction = faction;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public Reaction( GenericReader reader )
|
||||
|
|
@ -40,8 +36,8 @@ namespace Server.Factions.AI
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Faction = Faction.ReadReference( reader );
|
||||
m_Type = (ReactionType) reader.ReadEncodedInt();
|
||||
Faction = Faction.ReadReference( reader );
|
||||
Type = (ReactionType) reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -52,27 +48,20 @@ namespace Server.Factions.AI
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
writer.WriteEncodedInt( (int) m_Type );
|
||||
Faction.WriteReference( writer, Faction );
|
||||
writer.WriteEncodedInt( (int) Type );
|
||||
}
|
||||
}
|
||||
|
||||
public class Orders
|
||||
{
|
||||
private BaseFactionGuard m_Guard;
|
||||
|
||||
private List<Reaction> m_Reactions;
|
||||
private MovementType m_Movement;
|
||||
private Mobile m_Follow;
|
||||
|
||||
public BaseFactionGuard Guard => m_Guard;
|
||||
public BaseFactionGuard Guard { get; }
|
||||
|
||||
public MovementType Movement{ get => m_Movement;
|
||||
set => m_Movement = value;
|
||||
}
|
||||
public Mobile Follow{ get => m_Follow;
|
||||
set => m_Follow = value;
|
||||
}
|
||||
public MovementType Movement { get; set; }
|
||||
|
||||
public Mobile Follow { get; set; }
|
||||
|
||||
public Reaction GetReaction( Faction faction )
|
||||
{
|
||||
|
|
@ -86,7 +75,7 @@ namespace Server.Factions.AI
|
|||
return reaction;
|
||||
}
|
||||
|
||||
reaction = new Reaction( faction, ( faction == null || faction == m_Guard.Faction ) ? ReactionType.Ignore : ReactionType.Attack );
|
||||
reaction = new Reaction( faction, ( faction == null || faction == Guard.Faction ) ? ReactionType.Ignore : ReactionType.Attack );
|
||||
m_Reactions.Add( reaction );
|
||||
|
||||
return reaction;
|
||||
|
|
@ -101,14 +90,14 @@ namespace Server.Factions.AI
|
|||
|
||||
public Orders( BaseFactionGuard guard )
|
||||
{
|
||||
m_Guard = guard;
|
||||
Guard = guard;
|
||||
m_Reactions = new List<Reaction>();
|
||||
m_Movement = MovementType.Patrol;
|
||||
Movement = MovementType.Patrol;
|
||||
}
|
||||
|
||||
public Orders( BaseFactionGuard guard, GenericReader reader )
|
||||
{
|
||||
m_Guard = guard;
|
||||
Guard = guard;
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -116,7 +105,7 @@ namespace Server.Factions.AI
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Follow = reader.ReadMobile();
|
||||
Follow = reader.ReadMobile();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
|
|
@ -127,7 +116,7 @@ namespace Server.Factions.AI
|
|||
for ( int i = 0; i < count; ++i )
|
||||
m_Reactions.Add( new Reaction( reader ) );
|
||||
|
||||
m_Movement = (MovementType)reader.ReadEncodedInt();
|
||||
Movement = (MovementType)reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -138,14 +127,14 @@ namespace Server.Factions.AI
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Follow );
|
||||
writer.Write( (Mobile) Follow );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Reactions.Count );
|
||||
|
||||
for ( int i = 0; i < m_Reactions.Count; ++i )
|
||||
m_Reactions[i].Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Movement );
|
||||
writer.WriteEncodedInt( (int) Movement );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,8 +41,7 @@ namespace Server.Factions
|
|||
m_Town?.UnregisterVendor( this );
|
||||
}
|
||||
|
||||
private List<SBInfo> m_SBInfos = new List<SBInfo>();
|
||||
protected override List<SBInfo> SBInfos => m_SBInfos;
|
||||
protected override List<SBInfo> SBInfos { get; } = new List<SBInfo>();
|
||||
|
||||
public override void InitSBInfo()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,15 +45,13 @@ namespace Server.Factions
|
|||
|
||||
public class SBFactionBoard : SBInfo
|
||||
{
|
||||
private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
|
||||
private IShopSellInfo m_SellInfo = new InternalSellInfo();
|
||||
|
||||
public SBFactionBoard()
|
||||
{
|
||||
}
|
||||
|
||||
public override IShopSellInfo SellInfo => m_SellInfo;
|
||||
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;
|
||||
public override IShopSellInfo SellInfo { get; } = new InternalSellInfo();
|
||||
|
||||
public override List<GenericBuyInfo> BuyInfo { get; } = new InternalBuyInfo();
|
||||
|
||||
public class InternalBuyInfo : List<GenericBuyInfo>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,15 +47,13 @@ namespace Server.Factions
|
|||
|
||||
public class SBFactionBottle : SBInfo
|
||||
{
|
||||
private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
|
||||
private IShopSellInfo m_SellInfo = new InternalSellInfo();
|
||||
|
||||
public SBFactionBottle()
|
||||
{
|
||||
}
|
||||
|
||||
public override IShopSellInfo SellInfo => m_SellInfo;
|
||||
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;
|
||||
public override IShopSellInfo SellInfo { get; } = new InternalSellInfo();
|
||||
|
||||
public override List<GenericBuyInfo> BuyInfo { get; } = new InternalBuyInfo();
|
||||
|
||||
public class InternalBuyInfo : List<GenericBuyInfo>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,15 +48,13 @@ namespace Server.Factions
|
|||
{
|
||||
private static readonly object[] m_FixedSizeArgs = { true };
|
||||
|
||||
private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
|
||||
private IShopSellInfo m_SellInfo = new InternalSellInfo();
|
||||
|
||||
public SBFactionOre()
|
||||
{
|
||||
}
|
||||
|
||||
public override IShopSellInfo SellInfo => m_SellInfo;
|
||||
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;
|
||||
public override IShopSellInfo SellInfo { get; } = new InternalSellInfo();
|
||||
|
||||
public override List<GenericBuyInfo> BuyInfo { get; } = new InternalBuyInfo();
|
||||
|
||||
public class InternalBuyInfo : List<GenericBuyInfo>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,15 +52,13 @@ namespace Server.Factions
|
|||
|
||||
public class SBFactionReagent : SBInfo
|
||||
{
|
||||
private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
|
||||
private IShopSellInfo m_SellInfo = new InternalSellInfo();
|
||||
|
||||
public SBFactionReagent()
|
||||
{
|
||||
}
|
||||
|
||||
public override IShopSellInfo SellInfo => m_SellInfo;
|
||||
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;
|
||||
public override IShopSellInfo SellInfo { get; } = new InternalSellInfo();
|
||||
|
||||
public override List<GenericBuyInfo> BuyInfo { get; } = new InternalBuyInfo();
|
||||
|
||||
public class InternalBuyInfo : List<GenericBuyInfo>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue