#W# Added House limit to Settings.cs. Statichouses can now be odd shapes the statichouse.cfg can take more that 1 set of xy coords.
This commit is contained in:
parent
dc5e0577fd
commit
eea0f9defb
8 changed files with 246 additions and 80 deletions
|
|
@ -3256,7 +3256,7 @@ namespace Server.Multis
|
|||
return false;
|
||||
}
|
||||
|
||||
public static bool HasAccountHouse( Mobile m )
|
||||
/*public static bool HasAccountHouse( Mobile m )
|
||||
{
|
||||
Account a = m.Account as Account;
|
||||
|
||||
|
|
@ -3268,7 +3268,43 @@ namespace Server.Multis
|
|||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static bool HasAccountHouse( Mobile m )
|
||||
{
|
||||
Account a = m.Account as Account;
|
||||
|
||||
if ( a == null )
|
||||
return false;
|
||||
|
||||
int limit = ValidSettings.HousesPerAccount();
|
||||
|
||||
if ( limit < 0 )
|
||||
return false;
|
||||
|
||||
int count = 0;
|
||||
|
||||
for ( int i = 0; i < a.Length; ++i )
|
||||
{
|
||||
Mobile mob = a[i];
|
||||
|
||||
if ( mob != null )
|
||||
{
|
||||
List<BaseHouse> list = null;
|
||||
m_Table.TryGetValue( mob, out list );
|
||||
|
||||
if ( list != null )
|
||||
{
|
||||
for ( int j = 0; j < list.Count; ++j )
|
||||
{
|
||||
if ( !list[j].Deleted )
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ( count >= limit );
|
||||
}
|
||||
|
||||
public bool IsOwner( Mobile m )
|
||||
{
|
||||
|
|
@ -3976,4 +4012,4 @@ namespace Server.Multis
|
|||
return ( from == m_RegionOwner || AccountHandler.CheckAccount( from, m_RegionOwner ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue