Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -30,34 +30,34 @@ namespace Server.Factions
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Faction = Faction.ReadReference(reader);
|
||||
|
||||
LastStateTime = reader.ReadDateTime();
|
||||
CurrentState = (ElectionState)reader.ReadEncodedInt();
|
||||
|
||||
Candidates = new List<Candidate>();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
Candidate cd = new Candidate(reader);
|
||||
Faction = Faction.ReadReference(reader);
|
||||
|
||||
if (cd.Mobile != null)
|
||||
Candidates.Add(cd);
|
||||
LastStateTime = reader.ReadDateTime();
|
||||
CurrentState = (ElectionState)reader.ReadEncodedInt();
|
||||
|
||||
Candidates = new List<Candidate>();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
Candidate cd = new Candidate(reader);
|
||||
|
||||
if (cd.Mobile != null)
|
||||
Candidates.Add(cd);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
public Faction Faction{ get; }
|
||||
public Faction Faction { get; }
|
||||
|
||||
public List<Candidate> Candidates{ get; }
|
||||
public List<Candidate> Candidates { get; }
|
||||
|
||||
public ElectionState State
|
||||
{
|
||||
|
|
@ -69,10 +69,10 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public DateTime LastStateTime{ get; private set; }
|
||||
public DateTime LastStateTime { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public ElectionState CurrentState{ get; private set; }
|
||||
public ElectionState CurrentState { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
|
||||
public TimeSpan NextStateTime
|
||||
|
|
@ -263,100 +263,100 @@ namespace Server.Factions
|
|||
switch (CurrentState)
|
||||
{
|
||||
case ElectionState.Pending:
|
||||
{
|
||||
if (LastStateTime + PendingPeriod > DateTime.UtcNow)
|
||||
break;
|
||||
|
||||
Faction.Broadcast(1038023); // Campaigning for the Faction Commander election has begun.
|
||||
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Campaign;
|
||||
|
||||
break;
|
||||
}
|
||||
case ElectionState.Campaign:
|
||||
{
|
||||
if (LastStateTime + CampaignPeriod > DateTime.UtcNow)
|
||||
break;
|
||||
|
||||
if (Candidates.Count == 0)
|
||||
{
|
||||
Faction.Broadcast(1038025); // Nobody ran for office.
|
||||
State = ElectionState.Pending;
|
||||
if (LastStateTime + PendingPeriod > DateTime.UtcNow)
|
||||
break;
|
||||
|
||||
Faction.Broadcast(1038023); // Campaigning for the Faction Commander election has begun.
|
||||
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Campaign;
|
||||
|
||||
break;
|
||||
}
|
||||
else if (Candidates.Count == 1)
|
||||
case ElectionState.Campaign:
|
||||
{
|
||||
Faction.Broadcast(1038029); // Only one member ran for office.
|
||||
if (LastStateTime + CampaignPeriod > DateTime.UtcNow)
|
||||
break;
|
||||
|
||||
Candidate winner = Candidates[0];
|
||||
if (Candidates.Count == 0)
|
||||
{
|
||||
Faction.Broadcast(1038025); // Nobody ran for office.
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else if (Candidates.Count == 1)
|
||||
{
|
||||
Faction.Broadcast(1038029); // Only one member ran for office.
|
||||
|
||||
Mobile mob = winner.Mobile;
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
Candidate winner = Candidates[0];
|
||||
|
||||
if (pl == null || pl.Faction != Faction || mob == Faction.Commander)
|
||||
Mobile mob = winner.Mobile;
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
|
||||
if (pl == null || pl.Faction != Faction || mob == Faction.Commander)
|
||||
{
|
||||
Faction.Broadcast(1038026); // Faction leadership has not changed.
|
||||
}
|
||||
else
|
||||
{
|
||||
Faction.Broadcast(1038028); // The faction has a new commander.
|
||||
Faction.Commander = mob;
|
||||
}
|
||||
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else
|
||||
{
|
||||
Faction.Broadcast(1038030);
|
||||
State = ElectionState.Election;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ElectionState.Election:
|
||||
{
|
||||
if (LastStateTime + VotingPeriod > DateTime.UtcNow)
|
||||
break;
|
||||
|
||||
Faction.Broadcast(1038024); // The results for the Faction Commander election are in
|
||||
|
||||
Candidate winner = null;
|
||||
|
||||
for (int i = 0; i < Candidates.Count; ++i)
|
||||
{
|
||||
Candidate cd = Candidates[i];
|
||||
|
||||
PlayerState pl = PlayerState.Find(cd.Mobile);
|
||||
|
||||
if (pl == null || pl.Faction != Faction)
|
||||
continue;
|
||||
|
||||
// cd.CleanMuleVotes();
|
||||
|
||||
if (winner == null || cd.Votes > winner.Votes)
|
||||
winner = cd;
|
||||
}
|
||||
|
||||
if (winner == null)
|
||||
{
|
||||
Faction.Broadcast(1038026); // Faction leadership has not changed.
|
||||
}
|
||||
else if (winner.Mobile == Faction.Commander)
|
||||
{
|
||||
Faction.Broadcast(1038027); // The incumbent won the election.
|
||||
}
|
||||
else
|
||||
{
|
||||
Faction.Broadcast(1038028); // The faction has a new commander.
|
||||
Faction.Commander = mob;
|
||||
Faction.Commander = winner.Mobile;
|
||||
}
|
||||
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
}
|
||||
else
|
||||
{
|
||||
Faction.Broadcast(1038030);
|
||||
State = ElectionState.Election;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ElectionState.Election:
|
||||
{
|
||||
if (LastStateTime + VotingPeriod > DateTime.UtcNow)
|
||||
break;
|
||||
|
||||
Faction.Broadcast(1038024); // The results for the Faction Commander election are in
|
||||
|
||||
Candidate winner = null;
|
||||
|
||||
for (int i = 0; i < Candidates.Count; ++i)
|
||||
{
|
||||
Candidate cd = Candidates[i];
|
||||
|
||||
PlayerState pl = PlayerState.Find(cd.Mobile);
|
||||
|
||||
if (pl == null || pl.Faction != Faction)
|
||||
continue;
|
||||
|
||||
//cd.CleanMuleVotes();
|
||||
|
||||
if (winner == null || cd.Votes > winner.Votes)
|
||||
winner = cd;
|
||||
}
|
||||
|
||||
if (winner == null)
|
||||
{
|
||||
Faction.Broadcast(1038026); // Faction leadership has not changed.
|
||||
}
|
||||
else if (winner.Mobile == Faction.Commander)
|
||||
{
|
||||
Faction.Broadcast(1038027); // The incumbent won the election.
|
||||
}
|
||||
else
|
||||
{
|
||||
Faction.Broadcast(1038028); // The faction has a new commander.
|
||||
Faction.Commander = winner.Mobile;
|
||||
}
|
||||
|
||||
Candidates.Clear();
|
||||
State = ElectionState.Pending;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -385,23 +385,23 @@ namespace Server.Factions
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
From = reader.ReadMobile();
|
||||
Address = Utility.Intern(reader.ReadIPAddress());
|
||||
Time = reader.ReadDateTime();
|
||||
{
|
||||
From = reader.ReadMobile();
|
||||
Address = Utility.Intern(reader.ReadIPAddress());
|
||||
Time = reader.ReadDateTime();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Mobile From{ get; }
|
||||
public Mobile From { get; }
|
||||
|
||||
public Mobile Candidate{ get; }
|
||||
public Mobile Candidate { get; }
|
||||
|
||||
public IPAddress Address{ get; }
|
||||
public IPAddress Address { get; }
|
||||
|
||||
public DateTime Time{ get; }
|
||||
public DateTime Time { get; }
|
||||
|
||||
public object[] AcquireFields()
|
||||
{
|
||||
|
|
@ -458,40 +458,40 @@ namespace Server.Factions
|
|||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
Voters = new List<Voter>(count);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
Voter voter = new Voter(reader, Mobile);
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
if (voter.From != null)
|
||||
Voters.Add(voter);
|
||||
int count = reader.ReadEncodedInt();
|
||||
Voters = new List<Voter>(count);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
Voter voter = new Voter(reader, Mobile);
|
||||
|
||||
if (voter.From != null)
|
||||
Voters.Add(voter);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Mobile = reader.ReadMobile();
|
||||
{
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
List<Mobile> mobs = reader.ReadStrongMobileList();
|
||||
Voters = new List<Voter>(mobs.Count);
|
||||
List<Mobile> mobs = reader.ReadStrongMobileList();
|
||||
Voters = new List<Voter>(mobs.Count);
|
||||
|
||||
for (int i = 0; i < mobs.Count; ++i)
|
||||
Voters.Add(new Voter(mobs[i], Mobile));
|
||||
for (int i = 0; i < mobs.Count; ++i)
|
||||
Voters.Add(new Voter(mobs[i], Mobile));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Mobile Mobile{ get; }
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public List<Voter> Voters{ get; }
|
||||
public List<Voter> Voters { get; }
|
||||
|
||||
public int Votes => Voters.Count;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Server.Factions
|
|||
|
||||
public Faction() => State = new FactionState(this);
|
||||
|
||||
public StrongholdRegion StrongholdRegion{ get; set; }
|
||||
public StrongholdRegion StrongholdRegion { get; set; }
|
||||
|
||||
public FactionDefinition Definition
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public FactionState State{ get; set; }
|
||||
public FactionState State { get; set; }
|
||||
|
||||
public Election Election
|
||||
{
|
||||
|
|
@ -312,8 +312,8 @@ namespace Server.Factions
|
|||
|
||||
int killPoints = pl.KillPoints;
|
||||
|
||||
//Ordinarily, through normal faction removal, this will never find any sigils.
|
||||
//Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
|
||||
// Ordinarily, through normal faction removal, this will never find any sigils.
|
||||
// Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
|
||||
mob.Backpack?.FindItemsByType<Sigil>().ForEach(sigil => sigil.ReturnHome());
|
||||
|
||||
if (pl.RankIndex != -1)
|
||||
|
|
@ -451,8 +451,7 @@ namespace Server.Factions
|
|||
pm.SendLocalizedMessage(
|
||||
1042161); // You cannot join a faction because your guild is an Order or Chaos type.
|
||||
}
|
||||
else if (!Guild.NewGuildSystem && guild.Enemies?.Count > 0
|
||||
) //CAN join w/wars in new system
|
||||
else if (!Guild.NewGuildSystem && guild.Enemies?.Count > 0) // CAN join w/wars in new system
|
||||
{
|
||||
pm.SendLocalizedMessage(1005056); // You cannot join a faction with active Wars
|
||||
}
|
||||
|
|
@ -735,7 +734,7 @@ namespace Server.Factions
|
|||
|
||||
if (faction != null)
|
||||
from.SendGump(new ElectionManagementGump(faction.Election));
|
||||
//from.SendGump( new Gumps.PropertiesGump( from, faction.Election ) );
|
||||
// from.SendGump( new Gumps.PropertiesGump( from, faction.Election ) );
|
||||
else
|
||||
from.SendMessage("That stone has no faction assigned.");
|
||||
}
|
||||
|
|
@ -944,8 +943,6 @@ namespace Server.Factions
|
|||
silver.ToString("N0")); // Thou hast earned ~1_AMOUNT~ silver for vanquishing the vile creature.
|
||||
}
|
||||
|
||||
#region Ethics
|
||||
|
||||
if (bc.Map == Facet && bc.GetEthicAllegiance(killer) == BaseCreature.Allegiance.Enemy)
|
||||
{
|
||||
Player killerEPL = Player.Find(killer);
|
||||
|
|
@ -957,8 +954,6 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -967,13 +962,9 @@ namespace Server.Factions
|
|||
if (victimState == null)
|
||||
return;
|
||||
|
||||
#region Dueling
|
||||
|
||||
if (victim.Region.IsPartOf<SafeZone>())
|
||||
return;
|
||||
|
||||
#endregion
|
||||
|
||||
if (killer == victim || killerState.Faction != victimState.Faction)
|
||||
ApplySkillLoss(victim);
|
||||
|
||||
|
|
@ -983,8 +974,6 @@ namespace Server.Factions
|
|||
{
|
||||
killer?.SendLocalizedMessage(501693); // This victim is not worth enough to get kill points from.
|
||||
|
||||
#region Ethics
|
||||
|
||||
Player killerEPL = Player.Find(killer);
|
||||
Player victimEPL = Player.Find(victim);
|
||||
|
||||
|
|
@ -1005,8 +994,6 @@ namespace Server.Factions
|
|||
victimState.OnGivenSilverTo(killer);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1023,7 +1010,7 @@ namespace Server.Factions
|
|||
{
|
||||
victimState.IsActive = true;
|
||||
|
||||
if (1 > Utility.Random(3))
|
||||
if (Utility.Random(3) < 1)
|
||||
killerState.IsActive = true;
|
||||
|
||||
int silver = killerState.Faction.AwardSilver(killer, award * 40);
|
||||
|
|
@ -1045,8 +1032,6 @@ namespace Server.Factions
|
|||
victim.SendLocalizedMessage(1042738 + offset,
|
||||
args); // Thou has lost ~1_KILL_POINTS~ kill point(s) to ~3_ATTACKER_NAME~ for being vanquished!
|
||||
|
||||
#region Ethics
|
||||
|
||||
Player killerEPL = Player.Find(killer);
|
||||
Player victimEPL = Player.Find(victim);
|
||||
|
||||
|
|
@ -1066,8 +1051,6 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
victimState.OnGivenSilverTo(killer);
|
||||
}
|
||||
else
|
||||
|
|
@ -1139,7 +1122,7 @@ namespace Server.Factions
|
|||
|
||||
private class BroadcastPrompt : Prompt
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private readonly Faction m_Faction;
|
||||
|
||||
public BroadcastPrompt(Faction faction) => m_Faction = faction;
|
||||
|
||||
|
|
@ -1149,12 +1132,10 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
#region Skill Loss
|
||||
|
||||
public const double SkillLossFactor = 1.0 / 3;
|
||||
public static readonly TimeSpan SkillLossPeriod = TimeSpan.FromMinutes(20.0);
|
||||
|
||||
private static Dictionary<Mobile, SkillLossContext> m_SkillLoss = new Dictionary<Mobile, SkillLossContext>();
|
||||
private static readonly Dictionary<Mobile, SkillLossContext> m_SkillLoss = new Dictionary<Mobile, SkillLossContext>();
|
||||
|
||||
private class SkillLossContext
|
||||
{
|
||||
|
|
@ -1207,8 +1188,6 @@ namespace Server.Factions
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum FactionKickType
|
||||
|
|
@ -1220,7 +1199,7 @@ namespace Server.Factions
|
|||
|
||||
public class FactionKickCommand : BaseCommand
|
||||
{
|
||||
private FactionKickType m_KickType;
|
||||
private readonly FactionKickType m_KickType;
|
||||
|
||||
public FactionKickCommand(FactionKickType kickType)
|
||||
{
|
||||
|
|
@ -1233,28 +1212,28 @@ namespace Server.Factions
|
|||
switch (m_KickType)
|
||||
{
|
||||
case FactionKickType.Kick:
|
||||
{
|
||||
Commands = new[] { "FactionKick" };
|
||||
Usage = "FactionKick";
|
||||
Description =
|
||||
"Kicks the targeted player out of his current faction. This does not prevent them from rejoining.";
|
||||
break;
|
||||
}
|
||||
{
|
||||
Commands = new[] { "FactionKick" };
|
||||
Usage = "FactionKick";
|
||||
Description =
|
||||
"Kicks the targeted player out of his current faction. This does not prevent them from rejoining.";
|
||||
break;
|
||||
}
|
||||
case FactionKickType.Ban:
|
||||
{
|
||||
Commands = new[] { "FactionBan" };
|
||||
Usage = "FactionBan";
|
||||
Description =
|
||||
"Bans the account of a targeted player from joining factions. All players on the account are removed from their current faction, if any.";
|
||||
break;
|
||||
}
|
||||
{
|
||||
Commands = new[] { "FactionBan" };
|
||||
Usage = "FactionBan";
|
||||
Description =
|
||||
"Bans the account of a targeted player from joining factions. All players on the account are removed from their current faction, if any.";
|
||||
break;
|
||||
}
|
||||
case FactionKickType.Unban:
|
||||
{
|
||||
Commands = new[] { "FactionUnban" };
|
||||
Usage = "FactionUnban";
|
||||
Description = "Unbans the account of a targeted player from joining factions.";
|
||||
break;
|
||||
}
|
||||
{
|
||||
Commands = new[] { "FactionUnban" };
|
||||
Usage = "FactionUnban";
|
||||
Description = "Unbans the account of a targeted player from joining factions.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1265,81 +1244,81 @@ namespace Server.Factions
|
|||
switch (m_KickType)
|
||||
{
|
||||
case FactionKickType.Kick:
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
|
||||
if (pl != null)
|
||||
{
|
||||
pl.Faction.RemoveMember(mob);
|
||||
mob.SendMessage("You have been kicked from your faction.");
|
||||
AddResponse("They have been kicked from their faction.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFailure("They are not in a faction.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case FactionKickType.Ban:
|
||||
{
|
||||
if (mob.Account is Account acct)
|
||||
{
|
||||
if (acct.GetTag("FactionBanned") == null)
|
||||
if (pl != null)
|
||||
{
|
||||
acct.SetTag("FactionBanned", "true");
|
||||
AddResponse("The account has been banned from joining factions.");
|
||||
pl.Faction.RemoveMember(mob);
|
||||
mob.SendMessage("You have been kicked from your faction.");
|
||||
AddResponse("They have been kicked from their faction.");
|
||||
}
|
||||
else
|
||||
{
|
||||
AddResponse("The account is already banned from joining factions.");
|
||||
LogFailure("They are not in a faction.");
|
||||
}
|
||||
|
||||
for (int i = 0; i < acct.Length; ++i)
|
||||
break;
|
||||
}
|
||||
case FactionKickType.Ban:
|
||||
{
|
||||
if (mob.Account is Account acct)
|
||||
{
|
||||
mob = acct[i];
|
||||
|
||||
if (mob != null)
|
||||
if (acct.GetTag("FactionBanned") == null)
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
acct.SetTag("FactionBanned", "true");
|
||||
AddResponse("The account has been banned from joining factions.");
|
||||
}
|
||||
else
|
||||
{
|
||||
AddResponse("The account is already banned from joining factions.");
|
||||
}
|
||||
|
||||
if (pl != null)
|
||||
for (int i = 0; i < acct.Length; ++i)
|
||||
{
|
||||
mob = acct[i];
|
||||
|
||||
if (mob != null)
|
||||
{
|
||||
pl.Faction.RemoveMember(mob);
|
||||
mob.SendMessage("You have been kicked from your faction.");
|
||||
AddResponse("They have been kicked from their faction.");
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
|
||||
if (pl != null)
|
||||
{
|
||||
pl.Faction.RemoveMember(mob);
|
||||
mob.SendMessage("You have been kicked from your faction.");
|
||||
AddResponse("They have been kicked from their faction.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFailure("They have no assigned account.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case FactionKickType.Unban:
|
||||
{
|
||||
if (mob.Account is Account acct)
|
||||
{
|
||||
if (acct.GetTag("FactionBanned") == null)
|
||||
else
|
||||
{
|
||||
AddResponse("The account is not already banned from joining factions.");
|
||||
LogFailure("They have no assigned account.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case FactionKickType.Unban:
|
||||
{
|
||||
if (mob.Account is Account acct)
|
||||
{
|
||||
if (acct.GetTag("FactionBanned") == null)
|
||||
{
|
||||
AddResponse("The account is not already banned from joining factions.");
|
||||
}
|
||||
else
|
||||
{
|
||||
acct.RemoveTag("FactionBanned");
|
||||
AddResponse("The account may now freely join factions.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
acct.RemoveTag("FactionBanned");
|
||||
AddResponse("The account may now freely join factions.");
|
||||
LogFailure("They have no assigned account.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFailure("They have no assigned account.");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ namespace Server.Factions
|
|||
{
|
||||
public interface IFactionItem
|
||||
{
|
||||
FactionItem FactionItemState{ get; set; }
|
||||
FactionItem FactionItemState { get; set; }
|
||||
}
|
||||
|
||||
public class FactionItem
|
||||
|
|
@ -24,21 +24,21 @@ namespace Server.Factions
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Item = reader.ReadItem();
|
||||
Expiration = reader.ReadDateTime();
|
||||
break;
|
||||
}
|
||||
{
|
||||
Item = reader.ReadItem();
|
||||
Expiration = reader.ReadDateTime();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Faction = faction;
|
||||
}
|
||||
|
||||
public Item Item{ get; }
|
||||
public Item Item { get; }
|
||||
|
||||
public Faction Faction{ get; }
|
||||
public Faction Faction { get; }
|
||||
|
||||
public DateTime Expiration{ get; private set; }
|
||||
public DateTime Expiration { get; private set; }
|
||||
|
||||
public bool HasExpired
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ namespace Server.Factions
|
|||
private const int BroadcastsPerPeriod = 2;
|
||||
private static readonly TimeSpan BroadcastPeriod = TimeSpan.FromHours(1.0);
|
||||
private Mobile m_Commander;
|
||||
private Faction m_Faction;
|
||||
private readonly Faction m_Faction;
|
||||
|
||||
private DateTime[] m_LastBroadcasts = new DateTime[BroadcastsPerPeriod];
|
||||
private readonly DateTime[] m_LastBroadcasts = new DateTime[BroadcastsPerPeriod];
|
||||
|
||||
public FactionState(Faction faction)
|
||||
{
|
||||
|
|
@ -29,113 +29,113 @@ namespace Server.Factions
|
|||
switch (version)
|
||||
{
|
||||
case 5:
|
||||
{
|
||||
LastAtrophy = reader.ReadDateTime();
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
DateTime time = reader.ReadDateTime();
|
||||
|
||||
if (i < m_LastBroadcasts.Length)
|
||||
m_LastBroadcasts[i] = time;
|
||||
LastAtrophy = reader.ReadDateTime();
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
DateTime time = reader.ReadDateTime();
|
||||
|
||||
if (i < m_LastBroadcasts.Length)
|
||||
m_LastBroadcasts[i] = time;
|
||||
}
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
case 3:
|
||||
case 2:
|
||||
case 1:
|
||||
{
|
||||
Election = new Election(reader);
|
||||
{
|
||||
Election = new Election(reader);
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Faction = Faction.ReadReference(reader);
|
||||
|
||||
m_Commander = reader.ReadMobile();
|
||||
|
||||
if (version < 5)
|
||||
LastAtrophy = DateTime.UtcNow;
|
||||
|
||||
if (version < 4)
|
||||
{
|
||||
DateTime time = reader.ReadDateTime();
|
||||
m_Faction = Faction.ReadReference(reader);
|
||||
|
||||
if (m_LastBroadcasts.Length > 0)
|
||||
m_LastBroadcasts[0] = time;
|
||||
}
|
||||
m_Commander = reader.ReadMobile();
|
||||
|
||||
Tithe = reader.ReadEncodedInt();
|
||||
Silver = reader.ReadEncodedInt();
|
||||
if (version < 5)
|
||||
LastAtrophy = DateTime.UtcNow;
|
||||
|
||||
int memberCount = reader.ReadEncodedInt();
|
||||
|
||||
Members = new List<PlayerState>();
|
||||
|
||||
for (int i = 0; i < memberCount; ++i)
|
||||
{
|
||||
PlayerState pl = new PlayerState(reader, m_Faction, Members);
|
||||
|
||||
if (pl.Mobile != null)
|
||||
Members.Add(pl);
|
||||
}
|
||||
|
||||
m_Faction.State = this;
|
||||
|
||||
m_Faction.ZeroRankOffset = Members.Count;
|
||||
Members.Sort();
|
||||
|
||||
for (int i = Members.Count - 1; i >= 0; i--)
|
||||
{
|
||||
PlayerState player = Members[i];
|
||||
|
||||
if (player.KillPoints <= 0)
|
||||
m_Faction.ZeroRankOffset = i;
|
||||
else
|
||||
player.RankIndex = i;
|
||||
}
|
||||
|
||||
FactionItems = new List<FactionItem>();
|
||||
|
||||
if (version >= 2)
|
||||
{
|
||||
int factionItemCount = reader.ReadEncodedInt();
|
||||
|
||||
for (int i = 0; i < factionItemCount; ++i)
|
||||
if (version < 4)
|
||||
{
|
||||
FactionItem factionItem = new FactionItem(reader, m_Faction);
|
||||
DateTime time = reader.ReadDateTime();
|
||||
|
||||
Timer.DelayCall(TimeSpan.Zero, factionItem.CheckAttach); // sandbox attachment
|
||||
if (m_LastBroadcasts.Length > 0)
|
||||
m_LastBroadcasts[0] = time;
|
||||
}
|
||||
|
||||
Tithe = reader.ReadEncodedInt();
|
||||
Silver = reader.ReadEncodedInt();
|
||||
|
||||
int memberCount = reader.ReadEncodedInt();
|
||||
|
||||
Members = new List<PlayerState>();
|
||||
|
||||
for (int i = 0; i < memberCount; ++i)
|
||||
{
|
||||
PlayerState pl = new PlayerState(reader, m_Faction, Members);
|
||||
|
||||
if (pl.Mobile != null)
|
||||
Members.Add(pl);
|
||||
}
|
||||
|
||||
m_Faction.State = this;
|
||||
|
||||
m_Faction.ZeroRankOffset = Members.Count;
|
||||
Members.Sort();
|
||||
|
||||
for (int i = Members.Count - 1; i >= 0; i--)
|
||||
{
|
||||
PlayerState player = Members[i];
|
||||
|
||||
if (player.KillPoints <= 0)
|
||||
m_Faction.ZeroRankOffset = i;
|
||||
else
|
||||
player.RankIndex = i;
|
||||
}
|
||||
|
||||
FactionItems = new List<FactionItem>();
|
||||
|
||||
if (version >= 2)
|
||||
{
|
||||
int factionItemCount = reader.ReadEncodedInt();
|
||||
|
||||
for (int i = 0; i < factionItemCount; ++i)
|
||||
{
|
||||
FactionItem factionItem = new FactionItem(reader, m_Faction);
|
||||
|
||||
Timer.DelayCall(TimeSpan.Zero, factionItem.CheckAttach); // sandbox attachment
|
||||
}
|
||||
}
|
||||
|
||||
Traps = new List<BaseFactionTrap>();
|
||||
|
||||
if (version >= 3)
|
||||
{
|
||||
int factionTrapCount = reader.ReadEncodedInt();
|
||||
|
||||
for (int i = 0; i < factionTrapCount; ++i)
|
||||
if (reader.ReadItem() is BaseFactionTrap trap && !trap.CheckDecay())
|
||||
Traps.Add(trap);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Traps = new List<BaseFactionTrap>();
|
||||
|
||||
if (version >= 3)
|
||||
{
|
||||
int factionTrapCount = reader.ReadEncodedInt();
|
||||
|
||||
for (int i = 0; i < factionTrapCount; ++i)
|
||||
if (reader.ReadItem() is BaseFactionTrap trap && !trap.CheckDecay())
|
||||
Traps.Add(trap);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (version < 1)
|
||||
Election = new Election(m_Faction);
|
||||
}
|
||||
|
||||
public DateTime LastAtrophy{ get; set; }
|
||||
public DateTime LastAtrophy { get; set; }
|
||||
|
||||
public bool FactionMessageReady
|
||||
{
|
||||
|
|
@ -151,11 +151,11 @@ namespace Server.Factions
|
|||
|
||||
public bool IsAtrophyReady => DateTime.UtcNow >= LastAtrophy + TimeSpan.FromHours(47.0);
|
||||
|
||||
public List<FactionItem> FactionItems{ get; set; }
|
||||
public List<FactionItem> FactionItems { get; set; }
|
||||
|
||||
public List<BaseFactionTrap> Traps{ get; set; }
|
||||
public List<BaseFactionTrap> Traps { get; set; }
|
||||
|
||||
public Election Election{ get; set; }
|
||||
public Election Election { get; set; }
|
||||
|
||||
public Mobile Commander
|
||||
{
|
||||
|
|
@ -183,11 +183,11 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public int Tithe{ get; set; }
|
||||
public int Tithe { get; set; }
|
||||
|
||||
public int Silver{ get; set; }
|
||||
public int Silver { get; set; }
|
||||
|
||||
public List<PlayerState> Members{ get; set; }
|
||||
public List<PlayerState> Members { get; set; }
|
||||
|
||||
public int CheckAtrophy()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
|
|
@ -12,9 +11,9 @@ namespace Server.Factions
|
|||
Guards = new List<BaseFactionGuard>();
|
||||
}
|
||||
|
||||
public GuardDefinition Definition{ get; }
|
||||
public GuardDefinition Definition { get; }
|
||||
|
||||
public List<BaseFactionGuard> Guards{ get; }
|
||||
public List<BaseFactionGuard> Guards { get; }
|
||||
|
||||
public BaseFactionGuard Construct()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,128 +26,128 @@ namespace Server.Factions
|
|||
switch (keywords[i])
|
||||
{
|
||||
case 0x00E4: // *i wish to access the city treasury*
|
||||
{
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
if (town?.IsFinance(from) != true || !from.Alive)
|
||||
break;
|
||||
|
||||
if (FactionGump.Exists(from))
|
||||
from.SendLocalizedMessage(1042160); // You already have a faction menu open.
|
||||
else if (town.Owner != null && from is PlayerMobile mobile)
|
||||
mobile.SendGump(new FinanceGump(mobile, town.Owner, town));
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x0ED: // *i am sheriff*
|
||||
{
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
if (town?.IsSheriff(from) != true || !from.Alive)
|
||||
break;
|
||||
|
||||
if (FactionGump.Exists(from))
|
||||
from.SendLocalizedMessage(1042160); // You already have a faction menu open.
|
||||
else if (town.Owner != null)
|
||||
from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town));
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00EF: // *you are fired*
|
||||
{
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
if (town == null)
|
||||
break;
|
||||
|
||||
if (town.IsFinance(from) || town.IsSheriff(from))
|
||||
town.BeginOrderFiring(from);
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00E5: // *i wish to resign as finance minister*
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(from);
|
||||
|
||||
if (pl?.Finance != null)
|
||||
{
|
||||
pl.Finance.Finance = null;
|
||||
from.SendLocalizedMessage(1005081); // You have been fired as Finance Minister
|
||||
}
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00EE: // *i wish to resign as sheriff*
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(from);
|
||||
|
||||
if (pl?.Sheriff != null)
|
||||
{
|
||||
pl.Sheriff.Sheriff = null;
|
||||
from.SendLocalizedMessage(1010270); // You have been fired as Sheriff
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00E9: // *what is my faction term status*
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(from);
|
||||
|
||||
if (pl?.IsLeaving == true)
|
||||
{
|
||||
if (Faction.CheckLeaveTimer(from))
|
||||
if (town?.IsFinance(from) != true || !from.Alive)
|
||||
break;
|
||||
|
||||
TimeSpan remaining = pl.Leaving + Faction.LeavePeriod - DateTime.UtcNow;
|
||||
if (FactionGump.Exists(from))
|
||||
from.SendLocalizedMessage(1042160); // You already have a faction menu open.
|
||||
else if (town.Owner != null && from is PlayerMobile mobile)
|
||||
mobile.SendGump(new FinanceGump(mobile, town.Owner, town));
|
||||
|
||||
if (remaining.TotalDays >= 1)
|
||||
from.SendLocalizedMessage(1042743,
|
||||
remaining.TotalDays
|
||||
.ToString("N0")); // Your term of service will come to an end in ~1_DAYS~ days.
|
||||
else if (remaining.TotalHours >= 1)
|
||||
from.SendLocalizedMessage(1042741,
|
||||
remaining.TotalHours
|
||||
.ToString("N0")); // Your term of service will come to an end in ~1_HOURS~ hours.
|
||||
else
|
||||
from.SendLocalizedMessage(
|
||||
1042742); // Your term of service will come to an end in less than one hour.
|
||||
}
|
||||
else if (pl != null)
|
||||
{
|
||||
from.SendLocalizedMessage(1042233); // You are not in the process of quitting the faction.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00EA: // *message faction*
|
||||
{
|
||||
Faction faction = Faction.Find(from);
|
||||
|
||||
if (faction?.IsCommander(from) != true)
|
||||
break;
|
||||
}
|
||||
case 0x0ED: // *i am sheriff*
|
||||
{
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady)
|
||||
from.SendLocalizedMessage(
|
||||
1010264); // The required time has not yet passed since the last message was sent
|
||||
else
|
||||
faction.BeginBroadcast(from);
|
||||
if (town?.IsSheriff(from) != true || !from.Alive)
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
if (FactionGump.Exists(from))
|
||||
from.SendLocalizedMessage(1042160); // You already have a faction menu open.
|
||||
else if (town.Owner != null)
|
||||
from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town));
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00EF: // *you are fired*
|
||||
{
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
if (town == null)
|
||||
break;
|
||||
|
||||
if (town.IsFinance(from) || town.IsSheriff(from))
|
||||
town.BeginOrderFiring(from);
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00E5: // *i wish to resign as finance minister*
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(from);
|
||||
|
||||
if (pl?.Finance != null)
|
||||
{
|
||||
pl.Finance.Finance = null;
|
||||
from.SendLocalizedMessage(1005081); // You have been fired as Finance Minister
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00EE: // *i wish to resign as sheriff*
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(from);
|
||||
|
||||
if (pl?.Sheriff != null)
|
||||
{
|
||||
pl.Sheriff.Sheriff = null;
|
||||
from.SendLocalizedMessage(1010270); // You have been fired as Sheriff
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00E9: // *what is my faction term status*
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(from);
|
||||
|
||||
if (pl?.IsLeaving == true)
|
||||
{
|
||||
if (Faction.CheckLeaveTimer(from))
|
||||
break;
|
||||
|
||||
TimeSpan remaining = pl.Leaving + Faction.LeavePeriod - DateTime.UtcNow;
|
||||
|
||||
if (remaining.TotalDays >= 1)
|
||||
from.SendLocalizedMessage(1042743,
|
||||
remaining.TotalDays
|
||||
.ToString("N0")); // Your term of service will come to an end in ~1_DAYS~ days.
|
||||
else if (remaining.TotalHours >= 1)
|
||||
from.SendLocalizedMessage(1042741,
|
||||
remaining.TotalHours
|
||||
.ToString("N0")); // Your term of service will come to an end in ~1_HOURS~ hours.
|
||||
else
|
||||
from.SendLocalizedMessage(
|
||||
1042742); // Your term of service will come to an end in less than one hour.
|
||||
}
|
||||
else if (pl != null)
|
||||
{
|
||||
from.SendLocalizedMessage(1042233); // You are not in the process of quitting the faction.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00EA: // *message faction*
|
||||
{
|
||||
Faction faction = Faction.Find(from);
|
||||
|
||||
if (faction?.IsCommander(from) != true)
|
||||
break;
|
||||
|
||||
if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady)
|
||||
from.SendLocalizedMessage(
|
||||
1010264); // The required time has not yet passed since the last message was sent
|
||||
else
|
||||
faction.BeginBroadcast(from);
|
||||
|
||||
break;
|
||||
}
|
||||
case 0x00EC: // *showscore*
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(from);
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(from);
|
||||
|
||||
if (pl != null)
|
||||
Timer.DelayCall(TimeSpan.Zero, ShowScore_Sandbox, pl);
|
||||
if (pl != null)
|
||||
Timer.DelayCall(TimeSpan.Zero, ShowScore_Sandbox, pl);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x0178: // i honor your leadership
|
||||
{
|
||||
Faction.Find(from)?.BeginHonorLeadership(from);
|
||||
break;
|
||||
}
|
||||
{
|
||||
Faction.Find(from)?.BeginHonorLeadership(from);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,20 +22,20 @@ namespace Server.Factions
|
|||
Assigned = assigned;
|
||||
}
|
||||
|
||||
public SkillName Skill{ get; }
|
||||
public SkillName Skill { get; }
|
||||
|
||||
public double Requirement{ get; }
|
||||
public double Requirement { get; }
|
||||
|
||||
public TextDefinition Title{ get; }
|
||||
public TextDefinition Title { get; }
|
||||
|
||||
public TextDefinition Label{ get; }
|
||||
public TextDefinition Label { get; }
|
||||
|
||||
public TextDefinition Assigned{ get; }
|
||||
public TextDefinition Assigned { get; }
|
||||
}
|
||||
|
||||
public class MerchantTitles
|
||||
{
|
||||
public static MerchantTitleInfo[] Info{ get; } =
|
||||
public static MerchantTitleInfo[] Info { get; } =
|
||||
{
|
||||
new MerchantTitleInfo(SkillName.Inscribe, 90.0, new TextDefinition(1060773, "Scribe"),
|
||||
new TextDefinition(1011468, "SCRIBE"),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Server.Factions
|
|||
|
||||
public FactionPersistance(Serial serial) : base(serial) => Instance = this;
|
||||
|
||||
public static FactionPersistance Instance{ get; private set; }
|
||||
public static FactionPersistance Instance { get; private set; }
|
||||
|
||||
public override string DefaultName => "Faction Persistance - Internal";
|
||||
|
||||
|
|
@ -54,22 +54,22 @@ namespace Server.Factions
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
PersistedType type;
|
||||
{
|
||||
PersistedType type;
|
||||
|
||||
while ((type = (PersistedType)reader.ReadEncodedInt()) != PersistedType.Terminator)
|
||||
switch (type)
|
||||
{
|
||||
case PersistedType.Faction:
|
||||
new FactionState(reader);
|
||||
break;
|
||||
case PersistedType.Town:
|
||||
new TownState(reader);
|
||||
break;
|
||||
}
|
||||
while ((type = (PersistedType)reader.ReadEncodedInt()) != PersistedType.Terminator)
|
||||
switch (type)
|
||||
{
|
||||
case PersistedType.Faction:
|
||||
new FactionState(reader);
|
||||
break;
|
||||
case PersistedType.Town:
|
||||
new TownState(reader);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,32 +36,32 @@ namespace Server.Factions
|
|||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
IsActive = reader.ReadBool();
|
||||
LastHonorTime = reader.ReadDateTime();
|
||||
goto case 0;
|
||||
}
|
||||
{
|
||||
IsActive = reader.ReadBool();
|
||||
LastHonorTime = reader.ReadDateTime();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Mobile = reader.ReadMobile();
|
||||
{
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
m_KillPoints = reader.ReadEncodedInt();
|
||||
m_MerchantTitle = (MerchantTitle)reader.ReadEncodedInt();
|
||||
m_KillPoints = reader.ReadEncodedInt();
|
||||
m_MerchantTitle = (MerchantTitle)reader.ReadEncodedInt();
|
||||
|
||||
Leaving = reader.ReadDateTime();
|
||||
Leaving = reader.ReadDateTime();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Attach();
|
||||
}
|
||||
|
||||
public Mobile Mobile{ get; }
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public Faction Faction{ get; }
|
||||
public Faction Faction { get; }
|
||||
|
||||
public List<PlayerState> Owner{ get; }
|
||||
public List<PlayerState> Owner { get; }
|
||||
|
||||
public MerchantTitle MerchantTitle
|
||||
{
|
||||
|
|
@ -93,7 +93,7 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public List<SilverGivenEntry> SilverGiven{ get; private set; }
|
||||
public List<SilverGivenEntry> SilverGiven { get; private set; }
|
||||
|
||||
public int KillPoints
|
||||
{
|
||||
|
|
@ -233,13 +233,13 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public DateTime LastHonorTime{ get; set; }
|
||||
public DateTime LastHonorTime { get; set; }
|
||||
|
||||
public DateTime Leaving{ get; set; }
|
||||
public DateTime Leaving { get; set; }
|
||||
|
||||
public bool IsLeaving => Leaving > DateTime.MinValue;
|
||||
|
||||
public bool IsActive{ get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
|
||||
public int CompareTo(PlayerState ps) => (ps?.m_KillPoints ?? 0) - m_KillPoints;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ namespace Server.Factions
|
|||
TimeOfGift = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public Mobile GivenTo{ get; }
|
||||
public Mobile GivenTo { get; }
|
||||
|
||||
public DateTime TimeOfGift{ get; }
|
||||
public DateTime TimeOfGift { get; }
|
||||
|
||||
public bool IsExpired => TimeOfGift + ExpirePeriod < DateTime.UtcNow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Server.Factions
|
|||
Register();
|
||||
}
|
||||
|
||||
public Faction Faction{ get; set; }
|
||||
public Faction Faction { get; set; }
|
||||
|
||||
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Server.Factions
|
|||
StartIncomeTimer();
|
||||
}
|
||||
|
||||
public TownDefinition Definition{ get; set; }
|
||||
public TownDefinition Definition { get; set; }
|
||||
|
||||
public TownState State
|
||||
{
|
||||
|
|
@ -125,9 +125,9 @@ namespace Server.Factions
|
|||
set => m_State.LastIncome = value;
|
||||
}
|
||||
|
||||
public List<VendorList> VendorLists{ get; set; }
|
||||
public List<VendorList> VendorLists { get; set; }
|
||||
|
||||
public List<GuardList> GuardLists{ get; set; }
|
||||
public List<GuardList> GuardLists { get; set; }
|
||||
|
||||
public static List<Town> Towns => Reflector.Towns;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,42 +16,42 @@ namespace Server.Factions
|
|||
switch (version)
|
||||
{
|
||||
case 3:
|
||||
{
|
||||
LastIncome = reader.ReadDateTime();
|
||||
{
|
||||
LastIncome = reader.ReadDateTime();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
goto case 2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
Tax = reader.ReadEncodedInt();
|
||||
LastTaxChange = reader.ReadDateTime();
|
||||
{
|
||||
Tax = reader.ReadEncodedInt();
|
||||
LastTaxChange = reader.ReadDateTime();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
Silver = reader.ReadEncodedInt();
|
||||
{
|
||||
Silver = reader.ReadEncodedInt();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
Town = Town.ReadReference(reader);
|
||||
Owner = Faction.ReadReference(reader);
|
||||
{
|
||||
Town = Town.ReadReference(reader);
|
||||
Owner = Faction.ReadReference(reader);
|
||||
|
||||
m_Sheriff = reader.ReadMobile();
|
||||
m_Finance = reader.ReadMobile();
|
||||
m_Sheriff = reader.ReadMobile();
|
||||
m_Finance = reader.ReadMobile();
|
||||
|
||||
Town.State = this;
|
||||
Town.State = this;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Town Town{ get; set; }
|
||||
public Town Town { get; set; }
|
||||
|
||||
public Faction Owner{ get; set; }
|
||||
public Faction Owner { get; set; }
|
||||
|
||||
public Mobile Sheriff
|
||||
{
|
||||
|
|
@ -103,13 +103,13 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
public int Silver{ get; set; }
|
||||
public int Silver { get; set; }
|
||||
|
||||
public int Tax{ get; set; }
|
||||
public int Tax { get; set; }
|
||||
|
||||
public DateTime LastTaxChange{ get; set; }
|
||||
public DateTime LastTaxChange { get; set; }
|
||||
|
||||
public DateTime LastIncome{ get; set; }
|
||||
public DateTime LastIncome { get; set; }
|
||||
|
||||
public void Serialize(IGenericWriter writer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Server.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Utilities;
|
||||
|
||||
namespace Server.Factions
|
||||
{
|
||||
|
|
@ -12,9 +11,9 @@ namespace Server.Factions
|
|||
Vendors = new List<BaseFactionVendor>();
|
||||
}
|
||||
|
||||
public VendorDefinition Definition{ get; }
|
||||
public VendorDefinition Definition { get; }
|
||||
|
||||
public List<BaseFactionVendor> Vendors{ get; }
|
||||
public List<BaseFactionVendor> Vendors { get; }
|
||||
|
||||
public BaseFactionVendor Construct(Town town, Faction faction)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue