ip-based account authentication and authorization
protocol extension fix to properly support pre-login packets refactored skill title calculation
This commit is contained in:
parent
944d12be39
commit
b1a05c68dd
3 changed files with 41 additions and 24 deletions
|
|
@ -853,9 +853,10 @@ namespace Server.Accounting
|
|||
/// <returns>True if allowed, false if not.</returns>
|
||||
public bool HasAccess( NetState ns )
|
||||
{
|
||||
if ( ns == null )
|
||||
return false;
|
||||
return ( ns != null && HasAccess( ns.Address ) );
|
||||
}
|
||||
|
||||
public bool HasAccess( IPAddress ipAddress ) {
|
||||
AccessLevel level = Misc.AccountHandler.LockdownLevel;
|
||||
|
||||
if ( level > AccessLevel.Player )
|
||||
|
|
@ -881,8 +882,6 @@ namespace Server.Accounting
|
|||
return false;
|
||||
}
|
||||
|
||||
IPAddress ipAddress = ns.Address;
|
||||
|
||||
bool accessAllowed = ( m_IPRestrictions.Length == 0 || IPLimiter.IsExempt( ipAddress ) );
|
||||
|
||||
for ( int i = 0; !accessAllowed && i < m_IPRestrictions.Length; ++i )
|
||||
|
|
@ -897,19 +896,21 @@ namespace Server.Accounting
|
|||
/// <param name="ns">NetState instance to record.</param>
|
||||
public void LogAccess( NetState ns )
|
||||
{
|
||||
if ( ns == null )
|
||||
return;
|
||||
|
||||
IPAddress ipAddress = ns.Address;
|
||||
if ( ns != null ) {
|
||||
LogAccess( ns.Address );
|
||||
}
|
||||
}
|
||||
|
||||
public void LogAccess( IPAddress ipAddress ) {
|
||||
if ( IPLimiter.IsExempt( ipAddress ) )
|
||||
return;
|
||||
|
||||
if ( m_LoginIPs.Length == 0 )
|
||||
if ( m_LoginIPs.Length == 0 ) {
|
||||
if ( AccountHandler.IPTable.ContainsKey( ipAddress ) )
|
||||
AccountHandler.IPTable[ipAddress]++;
|
||||
else
|
||||
AccountHandler.IPTable[ipAddress] = 1;
|
||||
}
|
||||
|
||||
bool contains = false;
|
||||
|
||||
|
|
@ -935,11 +936,17 @@ namespace Server.Accounting
|
|||
/// <returns>True if allowed, false if not.</returns>
|
||||
public bool CheckAccess( NetState ns )
|
||||
{
|
||||
if ( !HasAccess( ns ) )
|
||||
return false;
|
||||
return ( ns != null && CheckAccess( ns.Address ) );
|
||||
}
|
||||
|
||||
LogAccess( ns );
|
||||
return true;
|
||||
public bool CheckAccess( IPAddress ipAddress ) {
|
||||
bool hasAccess = this.HasAccess( ipAddress );
|
||||
|
||||
if ( hasAccess ) {
|
||||
LogAccess( ipAddress );
|
||||
}
|
||||
|
||||
return hasAccess;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace Server.Misc
|
|||
|
||||
public static void Initialize()
|
||||
{
|
||||
PacketHandlers.Register( 0xF0, 0, true, new OnPacketReceive( DecodeBundledPacket ) );
|
||||
PacketHandlers.Register( 0xF0, 0, false, new OnPacketReceive( DecodeBundledPacket ) );
|
||||
|
||||
Register( 0x00, true, new OnPacketReceive( QueryPartyLocations ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -214,23 +214,33 @@ namespace Server.Misc
|
|||
}
|
||||
else if ( showSkillTitle && beheld.Player )
|
||||
{
|
||||
Skill highest = GetHighestSkill( beheld );// beheld.Skills.Highest;
|
||||
string skillTitle = GetSkillTitle( beheld );
|
||||
|
||||
if ( highest != null && highest.BaseFixedPoint >= 300 )
|
||||
{
|
||||
string skillLevel = GetSkillLevel( highest );
|
||||
string skillTitle = highest.Info.Title;
|
||||
|
||||
if ( beheld.Female && skillTitle.EndsWith( "man" ) )
|
||||
skillTitle = skillTitle.Substring( 0, skillTitle.Length - 3 ) + "woman";
|
||||
|
||||
title.AppendFormat( ", {0} {1}", skillLevel, skillTitle );
|
||||
if ( skillTitle != null ) {
|
||||
title.Append( ", " ).Append( skillTitle );
|
||||
}
|
||||
}
|
||||
|
||||
return title.ToString();
|
||||
}
|
||||
|
||||
public static string GetSkillTitle( Mobile mob ) {
|
||||
Skill highest = GetHighestSkill( mob );// beheld.Skills.Highest;
|
||||
|
||||
if ( highest != null && highest.BaseFixedPoint >= 300 )
|
||||
{
|
||||
string skillLevel = GetSkillLevel( highest );
|
||||
string skillTitle = highest.Info.Title;
|
||||
|
||||
if ( mob.Female && skillTitle.EndsWith( "man" ) )
|
||||
skillTitle = skillTitle.Substring( 0, skillTitle.Length - 3 ) + "woman";
|
||||
|
||||
return String.Concat( skillLevel, " ", skillTitle );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Skill GetHighestSkill( Mobile m )
|
||||
{
|
||||
Skills skills = m.Skills;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue