internal PlayerInfoRankChangingEventArgs([NotNull] PlayerInfo playerInfo, [NotNull] Player rankChanger, [NotNull] Rank newRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce) : base(playerInfo, rankChanger, playerInfo.Rank, reason, rankChangeType, announce) { NewRank = newRank; }
/// <summary> Adds a new PlayerInfo entry for a player who has never been online, by name. </summary> /// <returns> A newly-created PlayerInfo entry. </returns> public PlayerInfo AddUnrecognizedPlayer(string name, Rank startingRank, RankChangeType rankChangeType) { if (name == null) { throw new ArgumentNullException("name"); } if (startingRank == null) { throw new ArgumentNullException("startingRank"); } using (PlayerDB.GetWriteLock()) { using (MySqlTransaction transaction = connection.BeginTransaction()) { preInsertCommand.Transaction = transaction; preInsertCommand.ExecuteNonQuery(); int id = (int)preInsertCommand.InsertId; PlayerInfo info = new PlayerInfo(id, name, startingRank, rankChangeType, false); MySqlCommand updateCmd = GetUpdateCommand(info); updateCmd.Transaction = transaction; updateCmd.ExecuteNonQuery(); transaction.Commit(); preInsertCommand.Transaction = null; updateCmd.Transaction = null; return(info); } } }
public static PlayerInfo AddUnrecognizedPlayer( [NotNull] string name, RankChangeType rankChangeType ) { if( name == null ) throw new ArgumentNullException( "name" ); CheckIfLoaded(); PlayerInfo newInfo; using( GetWriteLock() ) { newInfo = provider.FindExact( name ); if( newInfo != null ) { throw new ArgumentException( "A PlayerDB entry already exists for this name.", "name" ); } var e = new PlayerInfoBeingCreatedEventArgs( name, IPAddress.None, RankManager.DefaultRank, true ); PlayerInfo.RaiseBeingCreatedEvent( e ); if( e.Cancel ) { throw new OperationCanceledException( "Canceled by a plugin." ); } newInfo = provider.AddUnrecognizedPlayer( name, e.StartingRank, rankChangeType ); newInfo.RaisePropertyChangedEvents = true; List.Add( newInfo ); } PlayerInfo.RaiseCreatedEvent( newInfo, false ); return newInfo; }
void GuessRankChangeType() { if (PreviousRank != null) { if (RankChangeReason == "~AutoRank" || RankChangeReason == "~AutoRankAll" || RankChangeReason == "~MassRank") { if (PreviousRank > Rank) { RankChangeType = RankChangeType.AutoDemoted; } else if (PreviousRank < Rank) { RankChangeType = RankChangeType.AutoPromoted; } } else { if (PreviousRank > Rank) { RankChangeType = RankChangeType.Demoted; } else if (PreviousRank < Rank) { RankChangeType = RankChangeType.Promoted; } } } else { RankChangeType = RankChangeType.Default; } }
internal PlayerInfoRankChangingEventArgs([NotNull] PlayerInfo target, [NotNull] Player rankChanger, [NotNull] Rank newRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce) { if (target == null) { throw new ArgumentNullException("target"); } if (rankChanger == null) { throw new ArgumentNullException("rankChanger"); } if (newRank == null) { throw new ArgumentNullException("newRank"); } PlayerInfo = target; RankChanger = rankChanger; OldRank = target.Rank; NewRank = newRank; Reason = reason; RankChangeType = rankChangeType; Announce = announce; NewRank = newRank; }
public static PlayerInfo AddFakeEntry([NotNull] string name, RankChangeType rankChangeType) { if (name == null) { throw new ArgumentNullException("name"); } CheckIfLoaded(); PlayerInfo info; lock ( AddLocker ) { info = Trie.Get(name); if (info != null) { throw new ArgumentException("A PlayerDB entry already exists for this name.", "name"); } var e = new PlayerInfoCreatingEventArgs(name, IPAddress.None, RankManager.DefaultRank, true); PlayerInfo.RaiseCreatingEvent(e); if (e.Cancel) { throw new OperationCanceledException("Cancelled by a plugin."); } info = new PlayerInfo(name, e.StartingRank, false, rankChangeType); list.Add(info); Trie.Add(info.Name, info); UpdateCache(); } PlayerInfo.RaiseCreatedEvent(info, false); return(info); }
/// <summary> Adds a new PlayerInfo entry for a player who has never been online, by name. </summary> /// <returns> A newly-created PlayerInfo entry. </returns> public PlayerInfo AddUnrecognizedPlayer( string name, Rank startingRank, RankChangeType rankChangeType ) { if( name == null ) throw new ArgumentNullException( "name" ); if( startingRank == null ) throw new ArgumentNullException( "startingRank" ); int id = GetNextID(); PlayerInfo info = new PlayerInfo( id, name, startingRank, rankChangeType, false ); trie.Add( name, info ); return info; }
public ConditionRankChangeType([NotNull] XElement el) { if (el == null) { throw new ArgumentNullException("el"); } Type = (RankChangeType)Enum.Parse(typeof(RankChangeType), el.Attribute("val").Value, true); }
static bool RaiseRankChangingEvent( [NotNull] PlayerInfo playerInfo, [NotNull] Player rankChanger, [NotNull] Rank newRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce ) { var h = RankChanging; if( h == null ) return false; var e = new PlayerInfoRankChangingEventArgs( playerInfo, rankChanger, newRank, reason, rankChangeType, announce ); h( null, e ); return e.Cancel; }
/// <summary> Adds a new PlayerInfo entry for an actual, logged-in player. </summary> /// <returns> A newly-created PlayerInfo entry. </returns> public PlayerInfo AddPlayer( string name, Rank startingRank, RankChangeType rankChangeType, IPAddress address ) { if( name == null ) throw new ArgumentNullException( "name" ); if( address == null ) throw new ArgumentNullException( "address" ); int id = GetNextID(); PlayerInfo info = new PlayerInfo( id, name, startingRank, rankChangeType, address ); trie.Add( name, info ); return info; }
public PlayerInfoRankChangedEventArgs(PlayerInfo playerInfo, Player rankChanger, Rank oldRank, string reason, RankChangeType rankChangeType) : base(playerInfo) { RankChanger = rankChanger; OldRank = oldRank; NewRank = playerInfo.Rank; Reason = reason; RankChangeType = rankChangeType; }
public void ProcessRankChange(Rank newRank, Player changer, string reason, RankChangeType type) { PreviousRank = Rank; Rank = newRank; RankChangeDate = DateTime.UtcNow; RankChangedBy = changer.Name; RankChangeReason = reason; RankChangeType = type; }
public ConditionRankChangeType([NotNull] XElement el) { if (el == null) { throw new ArgumentNullException("el"); } // ReSharper disable PossibleNullReferenceException Type = (RankChangeType)Enum.Parse(typeof(RankChangeType), el.Attribute("val").Value, true); // ReSharper restore PossibleNullReferenceException }
static void RaiseRankChangedEvent([NotNull] PlayerInfo playerInfo, [NotNull] Player rankChanger, [NotNull] Rank oldRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce) { var h = RankChanged; if (h != null) { h(null, new PlayerInfoRankChangedEventArgs(playerInfo, rankChanger, oldRank, reason, rankChangeType, announce)); } }
static void RaiseRankChangedEvent([NotNull] PlayerInfo playerInfo, [NotNull] Player rankChanger, [NotNull] Rank oldRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce) { var h = RankChanged; if (h != null) h(null, new PlayerInfoRankChangedEventArgs(playerInfo, rankChanger, oldRank, reason, rankChangeType, announce)); }
// fabricate info for an unrecognized player public PlayerInfo(string name, Rank rank, bool setLoginDate, RankChangeType rankChangeType) : this() { Name = name; Rank = rank; if (setLoginDate) { FirstLoginDate = DateTime.UtcNow; LastLoginDate = FirstLoginDate; LastSeen = FirstLoginDate; TimesVisited = 1; } RankChangeType = rankChangeType; }
static bool RaiseRankChangingEvent([NotNull] PlayerInfo playerInfo, [NotNull] Player rankChanger, [NotNull] Rank newRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce) { var h = RankChanging; if (h == null) { return(false); } var e = new PlayerInfoRankChangingEventArgs(playerInfo, rankChanger, newRank, reason, rankChangeType, announce); h(null, e); return(e.Cancel); }
/// <summary> Adds a new PlayerInfo entry for a player who has never been online, by name. </summary> /// <returns> A newly-created PlayerInfo entry. </returns> public PlayerInfo AddUnrecognizedPlayer(string name, Rank startingRank, RankChangeType rankChangeType) { if (name == null) { throw new ArgumentNullException("name"); } if (startingRank == null) { throw new ArgumentNullException("startingRank"); } int id = GetNextID(); PlayerInfo info = new PlayerInfo(id, name, startingRank, rankChangeType, false); trie.Add(name, info); return(info); }
/// <summary> Adds a new PlayerInfo entry for an actual, logged-in player. </summary> /// <returns> A newly-created PlayerInfo entry. </returns> public PlayerInfo AddPlayer(string name, Rank startingRank, RankChangeType rankChangeType, IPAddress address) { if (name == null) { throw new ArgumentNullException("name"); } if (address == null) { throw new ArgumentNullException("address"); } int id = GetNextID(); PlayerInfo info = new PlayerInfo(id, name, startingRank, rankChangeType, address); trie.Add(name, info); return(info); }
// create a record for an unrecognized or a super player public PlayerInfo(int id, [NotNull] string name, [NotNull] Rank startingRank, RankChangeType rankChangeType, bool isSuper) : this( id ) { if (name == null) { throw new ArgumentNullException("name"); } if (startingRank == null) { throw new ArgumentNullException("startingRank"); } this.name = name; rank = startingRank; this.rankChangeType = rankChangeType; LastModified = DateTime.UtcNow; IsSuper = isSuper; }
public void ProcessRankChange([NotNull] Rank newRank, [NotNull] string changer, [CanBeNull] string reason, RankChangeType type) { if (newRank == null) { throw new ArgumentNullException("newRank"); } if (changer == null) { throw new ArgumentNullException("changer"); } PreviousRank = Rank; Rank = newRank; RankChangeDate = DateTime.UtcNow; RankChangedBy = changer; RankChangeReason = reason; RankChangeType = type; LastModified = DateTime.UtcNow; }
internal PlayerInfoRankChangedEventArgs([NotNull] PlayerInfo playerInfo, [NotNull] Player rankChanger, [NotNull] Rank oldRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce) : base(playerInfo) { if (rankChanger == null) { throw new ArgumentNullException("rankChanger"); } if (oldRank == null) { throw new ArgumentNullException("oldRank"); } RankChanger = rankChanger; OldRank = oldRank; NewRank = playerInfo.Rank; Reason = reason; RankChangeType = rankChangeType; Announce = announce; }
PlayerInfo() { // reset everything to defaults LastIP = IPAddress.None; RankChangeDate = DateTime.MinValue; BanDate = DateTime.MinValue; UnbanDate = DateTime.MinValue; LastFailedLoginDate = DateTime.MinValue; FirstLoginDate = DateTime.MinValue; LastLoginDate = DateTime.MinValue; TotalTime = TimeSpan.Zero; RankChangeType = RankChangeType.Default; LastKickDate = DateTime.MinValue; LastSeen = DateTime.MinValue; BannedUntil = DateTime.MinValue; FrozenOn = DateTime.MinValue; MutedUntil = DateTime.MinValue; BandwidthUseMode = BandwidthUseMode.Default; LastModified = DateTime.UtcNow; }
public static PlayerInfo AddFakeEntry( string name, RankChangeType rankChangeType ) { if( name == null ) throw new ArgumentNullException( "name" ); PlayerInfo info; lock( AddLocker ) { info = Trie.Get( name ); if( info != null ) throw new ArgumentException( "A PlayerDB entry already exists for this name." ); var e = new PlayerInfoCreatingEventArgs( name, IPAddress.None, RankManager.DefaultRank, true ); Server.RaisePlayerInfoCreatingEvent( e ); if( e.Cancel ) throw new OperationCanceledException( "Cancelled by a plugin." ); info = new PlayerInfo( name, e.StartingRank, false, rankChangeType ); List.Add( info ); Trie.Add( info.Name, info ); UpdateCache(); } Server.RaisePlayerInfoCreatedEvent( info, false ); return info; }
/// <summary> Adds a new PlayerInfo entry for a player who has never been online, by name. </summary> /// <returns> A newly-created PlayerInfo entry. </returns> public PlayerInfo AddUnrecognizedPlayer( string name, Rank startingRank, RankChangeType rankChangeType ) { if( name == null ) throw new ArgumentNullException( "name" ); if( startingRank == null ) throw new ArgumentNullException( "startingRank" ); using( PlayerDB.GetWriteLock() ) { using( MySqlTransaction transaction = connection.BeginTransaction() ) { preInsertCommand.Transaction = transaction; preInsertCommand.ExecuteNonQuery(); int id = (int)preInsertCommand.InsertId; PlayerInfo info = new PlayerInfo( id, name, startingRank, rankChangeType, false ); MySqlCommand updateCmd = GetUpdateCommand( info ); updateCmd.Transaction = transaction; updateCmd.ExecuteNonQuery(); transaction.Commit(); preInsertCommand.Transaction = null; updateCmd.Transaction = null; return info; } } }
// fabricate info for an unrecognized player public PlayerInfo([NotNull] string name, [NotNull] Rank rank, bool setLoginDate, RankChangeType rankChangeType) : this() { if (name == null) { throw new ArgumentNullException("name"); } if (rank == null) { throw new ArgumentNullException("rank"); } Name = name; Rank = rank; if (setLoginDate) { FirstLoginDate = DateTime.UtcNow; LastLoginDate = FirstLoginDate; LastSeen = FirstLoginDate; TimesVisited = 1; } RankChangeType = rankChangeType; }
// create a record for a newly logged-in player public PlayerInfo(int id, [NotNull] string name, [NotNull] Rank startingRank, RankChangeType rankChangeType, [NotNull] IPAddress address) : this( id ) { if (name == null) { throw new ArgumentNullException("name"); } if (startingRank == null) { throw new ArgumentNullException("startingRank"); } if (address == null) { throw new ArgumentNullException("address"); } this.name = name; rank = startingRank; this.rankChangeType = rankChangeType; lastIP = address; firstLoginDate = DateTime.UtcNow; lastSeen = DateTime.UtcNow; lastLoginDate = DateTime.UtcNow; LastModified = DateTime.UtcNow; }
internal static bool RaisePlayerInfoRankChangingEvent( PlayerInfo playerInfo, Player rankChanger, Rank newRank, string reason, RankChangeType rankChangeType ) { var h = PlayerInfoRankChanging; if( h == null ) return false; var e = new PlayerInfoRankChangingEventArgs( playerInfo, rankChanger, newRank, reason, rankChangeType ); h( null, e ); return e.Cancel; }
internal static void RaisePlayerInfoRankChangedEvent( PlayerInfo playerInfo, Player rankChanger, Rank oldRank, string reason, RankChangeType rankChangeType ) { var h = PlayerInfoRankChanged; if( h != null ) h( null, new PlayerInfoRankChangedEventArgs( playerInfo, rankChanger, oldRank, reason, rankChangeType ) ); }
// fabricate info for an unrecognized player public PlayerInfo( string name, Rank rank, bool setLoginDate, RankChangeType rankChangeType ) : this() { Name = name; Rank = rank; if( setLoginDate ) { FirstLoginDate = DateTime.UtcNow; LastLoginDate = FirstLoginDate; LastSeen = FirstLoginDate; TimesVisited = 1; } RankChangeType = rankChangeType; }
public PlayerInfoRankChangingEventArgs(PlayerInfo playerInfo, Player rankChanger, Rank newRank, string reason, RankChangeType rankChangeType) : base(playerInfo, rankChanger, playerInfo.Rank, reason, rankChangeType) { NewRank = newRank; }
public void ProcessRankChange( Rank newRank, Player changer, string reason, RankChangeType type ) { PreviousRank = Rank; Rank = newRank; RankChangeDate = DateTime.UtcNow; RankChangedBy = changer.Name; RankChangeReason = reason; RankChangeType = type; }
public ConditionRankChangeType(RankChangeType type) { Type = type; }
public ConditionRankChangeType( RankChangeType type ) { Type = type; }
PlayerInfo() { // reset everything to defaults LastIP = IPAddress.None; RankChangeDate = DateTime.MinValue; BanDate = DateTime.MinValue; UnbanDate = DateTime.MinValue; LastFailedLoginDate = DateTime.MinValue; LastFailedLoginIP = IPAddress.None; FirstLoginDate = DateTime.MinValue; LastLoginDate = DateTime.MinValue; TotalTime = TimeSpan.Zero; RankChangeType = RankChangeType.Default; LastKickDate = DateTime.MinValue; LastSeen = DateTime.MinValue; BannedUntil = DateTime.MinValue; FrozenOn = DateTime.MinValue; MutedUntil = DateTime.MinValue; BandwidthUseMode = BandwidthUseMode.Default; }
internal PlayerInfoRankChangedEventArgs( [NotNull] PlayerInfo target, [NotNull] Player rankChanger, [NotNull] Rank oldRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce ) { if( target == null ) throw new ArgumentNullException( "target" ); if( rankChanger == null ) throw new ArgumentNullException( "rankChanger" ); if( oldRank == null ) throw new ArgumentNullException( "oldRank" ); PlayerInfo = target; RankChanger = rankChanger; OldRank = oldRank; NewRank = target.Rank; Reason = reason; RankChangeType = rankChangeType; Announce = announce; }
void GuessRankChangeType() { if( PreviousRank != null ) { if( RankChangeReason == "~AutoRank" || RankChangeReason == "~AutoRankAll" || RankChangeReason == "~MassRank" ) { if( PreviousRank > Rank ) { RankChangeType = RankChangeType.AutoDemoted; } else if( PreviousRank < Rank ) { RankChangeType = RankChangeType.AutoPromoted; } } else { if( PreviousRank > Rank ) { RankChangeType = RankChangeType.Demoted; } else if( PreviousRank < Rank ) { RankChangeType = RankChangeType.Promoted; } } } else { RankChangeType = RankChangeType.Default; } }
public ConditionRankChangeType( [NotNull] XElement el ) { if( el == null ) throw new ArgumentNullException( "el" ); Type = (RankChangeType)Enum.Parse( typeof( RankChangeType ), el.Attribute( "val" ).Value, true ); }
internal static void RaisePlayerInfoRankChangedEvent(PlayerInfo playerInfo, Player rankChanger, Rank oldRank, string reason, RankChangeType rankChangeType) { var h = PlayerInfoRankChanged; if (h != null) { h(null, new PlayerInfoRankChangedEventArgs(playerInfo, rankChanger, oldRank, reason, rankChangeType)); } }
internal PlayerInfoRankChangingEventArgs( [NotNull] PlayerInfo playerInfo, [NotNull] Player rankChanger, [NotNull] Rank newRank, [CanBeNull] string reason, RankChangeType rankChangeType, bool announce ) : base(playerInfo, rankChanger, playerInfo.Rank, reason, rankChangeType, announce) { NewRank = newRank; }
public ConditionRankChangeType( [NotNull] XElement el ) { if( el == null ) throw new ArgumentNullException( "el" ); // ReSharper disable PossibleNullReferenceException Type = (RankChangeType)Enum.Parse( typeof( RankChangeType ), el.Attribute( "val" ).Value, true ); // ReSharper restore PossibleNullReferenceException }
public PlayerInfoRankChangedEventArgs( PlayerInfo playerInfo, Player rankChanger, Rank oldRank, string reason, RankChangeType rankChangeType ) :base(playerInfo){ RankChanger=rankChanger; OldRank =oldRank; NewRank = playerInfo.Rank; Reason=reason; RankChangeType=rankChangeType; }
static void SetInfoHandler(Player player, CommandReader cmd) { string targetName = cmd.Next(); string propertyName = cmd.Next(); string valName = cmd.NextAll(); if (targetName == null || propertyName == null) { CdSetInfo.PrintUsage(player); return; } PlayerInfo info = PlayerDB.FindByPartialNameOrPrintMatches(player, targetName); if (info == null) { return; } switch (propertyName.ToLower()) { case "banreason": if (valName.Length == 0) { valName = null; } if (SetPlayerInfoField(player, "BanReason", info, info.BanReason, valName)) { info.BanReason = valName; } break; case "displayedname": string oldDisplayedName = info.DisplayedName; if (valName.Length == 0) { valName = null; } if (valName == info.DisplayedName) { if (valName == null) { player.Message("SetInfo: DisplayedName for {0} is not set.", info.Name); } else { player.Message("SetInfo: DisplayedName for {0} is already set to \"{1}&S\"", info.Name, valName); } break; } info.DisplayedName = valName; if (oldDisplayedName == null) { player.Message("SetInfo: DisplayedName for {0} set to \"{1}&S\"", info.Name, valName); } else if (valName == null) { player.Message("SetInfo: DisplayedName for {0} was reset (was \"{1}&S\")", info.Name, oldDisplayedName); } else { player.Message("SetInfo: DisplayedName for {0} changed from \"{1}&S\" to \"{2}&S\"", info.Name, oldDisplayedName, valName); } break; case "kickreason": if (valName.Length == 0) { valName = null; } if (SetPlayerInfoField(player, "KickReason", info, info.LastKickReason, valName)) { info.LastKickReason = valName; } break; case "name": if (valName.Equals(info.Name, StringComparison.OrdinalIgnoreCase)) { player.Message("SetInfo: You may change capitalization of player's real name. " + "If you'd like to make other changes to the way player's name is displayed, " + "use &H/SetInfo <Name> DisplayedName <NewName>"); break; } string oldName = info.Name; if (oldName != valName) { info.Name = valName; player.Message("Name capitalization changed from \"{0}\" to \"{1}\"", oldName, valName); } else { player.Message("Name capitalization is already \"{0}\"", oldName); } break; case "previousrank": Rank newPreviousRank; if (valName.Length > 0) { newPreviousRank = RankManager.FindRank(valName); if (newPreviousRank == null) { player.MessageNoRank(valName); break; } } else { newPreviousRank = null; } Rank oldPreviousRank = info.PreviousRank; if (newPreviousRank == oldPreviousRank) { if (newPreviousRank == null) { player.Message("SetInfo: PreviousRank for {0}&S is not set.", info.ClassyName); } else { player.Message("SetInfo: PreviousRank for {0}&S is already set to {1}", info.ClassyName, newPreviousRank.ClassyName); } break; } info.PreviousRank = newPreviousRank; if (oldPreviousRank == null) { player.Message("SetInfo: PreviousRank for {0}&S set to {1}&", info.ClassyName, newPreviousRank.ClassyName); } else if (newPreviousRank == null) { player.Message("SetInfo: PreviousRank for {0}&S was reset (was {1}&S)", info.ClassyName, oldPreviousRank.ClassyName); } else { player.Message("SetInfo: PreviousRank for {0}&S changed from {1}&S to {2}", info.ClassyName, oldPreviousRank.ClassyName, newPreviousRank.ClassyName); } break; case "rankchangetype": RankChangeType oldType = info.RankChangeType; try { info.RankChangeType = (RankChangeType)Enum.Parse(typeof(RankChangeType), valName, true); } catch (ArgumentException) { player.Message("SetInfo: Could not parse RankChangeType. Allowed values: {0}", String.Join(", ", Enum.GetNames(typeof(RankChangeType)))); break; } player.Message("SetInfo: RankChangeType for {0}&S changed from {1} to {2}", info.ClassyName, oldType, info.RankChangeType); break; case "rankreason": if (valName.Length == 0) { valName = null; } if (SetPlayerInfoField(player, "RankReason", info, info.RankChangeReason, valName)) { info.RankChangeReason = valName; } break; case "timeskicked": int oldTimesKicked = info.TimesKicked; if (ValidateInt(valName, 0, 9999)) { info.TimesKicked = Int32.Parse(valName); player.Message("SetInfo: TimesKicked for {0}&S changed from {1} to {2}", info.ClassyName, oldTimesKicked, info.TimesKicked); } else { player.Message("SetInfo: TimesKicked value out of range (Acceptable value range: 0-9999)"); } break; case "totaltime": TimeSpan newTotalTime; TimeSpan oldTotalTime = info.TotalTime; if (valName.TryParseMiniTimespan(out newTotalTime)) { if (newTotalTime > DateTimeUtil.MaxTimeSpan) { player.MessageMaxTimeSpan(); break; } info.TotalTime = newTotalTime; player.Message("SetInfo: TotalTime for {0}&S changed from {1} ({2}) to {3} ({4})", info.ClassyName, oldTotalTime.ToMiniString(), oldTotalTime.ToCompactString(), info.TotalTime.ToMiniString(), info.TotalTime.ToCompactString()); } else { player.Message("SetInfo: Could not parse value given for TotalTime."); } break; case "unbanreason": if (valName.Length == 0) { valName = null; } if (SetPlayerInfoField(player, "UnbanReason", info, info.UnbanReason, valName)) { info.UnbanReason = valName; } break; default: player.Message("Only the following properties are editable: " + "TimesKicked, PreviousRank, TotalTime, RankChangeType, " + "BanReason, UnbanReason, RankReason, KickReason, DisplayedName"); return; } }
public PlayerInfoRankChangingEventArgs( PlayerInfo playerInfo, Player rankChanger, Rank newRank, string reason, RankChangeType rankChangeType ) : base( playerInfo, rankChanger, playerInfo.Rank, reason, rankChangeType ) { NewRank = newRank; }
internal static bool RaisePlayerInfoRankChangingEvent(PlayerInfo playerInfo, Player rankChanger, Rank newRank, string reason, RankChangeType rankChangeType) { var h = PlayerInfoRankChanging; if (h == null) { return(false); } var e = new PlayerInfoRankChangingEventArgs(playerInfo, rankChanger, newRank, reason, rankChangeType); h(null, e); return(e.Cancel); }