Bug fix for :
skillcaps and things that exceed it Possible threading issue Addition of Generic FindItemsByType - List<T> findItemsByType<T>() Change to make polymorph not have a timer and instead a toggle skill KiAttack no longer works with ranged weapons Poison strike speed and damage changed Necro spells now affected by FC Must have atleast 50 weapon skill if no shield equipped to use Evasion Stalking bonus capped at 10 + skill/10 Stalking bonus now Clears Bugfix w/Guilds Crashguard Exception message moved closer to the top of the file. Character creation of Pallys and necros using advanced skills now gives skill items Honor no longer works on Players Pre-ML area HitArea attacks nolonger require LoS Serialization fix for BladeOfTheRighteous RidingSwipe now has paralyzation immunity as with NerveStrike and ParaBlow AnkhEast renamed to AnkhNorth LeggingsOfBane no longer have 510 HP ElvenWashBasinEastAddon Fixed AnsellaGryen won't be renamed each time the server Restarts DiseasedCats are properly named Localization fixes in DefBlacksmithy BearMasks/DearMAsks and things that extend from them now can be repaired
This commit is contained in:
parent
c3eb5cebc6
commit
ce54fe8635
28 changed files with 1495 additions and 1290 deletions
|
|
@ -1032,6 +1032,82 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public List<T> FindItemsByType<T>() where T : Item
|
||||
{
|
||||
return FindItemsByType<T>( true );
|
||||
}
|
||||
|
||||
public List<T> FindItemsByType<T>( bool recurse ) where T : Item
|
||||
{
|
||||
if( m_FindItemsList.Count > 0 )
|
||||
m_FindItemsList.Clear();
|
||||
|
||||
List<T> list = new List<T>();
|
||||
|
||||
RecurseFindItemsByType<T>( this, recurse, list );
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static void RecurseFindItemsByType<T>( Item current, bool recurse, List<T> list ) where T : Item
|
||||
{
|
||||
if( current != null && current.Items.Count > 0 )
|
||||
{
|
||||
List<Item> items = current.Items;
|
||||
|
||||
for( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
Item item = items[i];
|
||||
|
||||
if( typeof( T ).IsAssignableFrom( item.GetType() ) )
|
||||
list.Add( (T)item );
|
||||
|
||||
if( recurse && item is Container )
|
||||
RecurseFindItemsByType<T>( item, recurse, list );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public T FindItemByType<T>() where T : Item
|
||||
{
|
||||
return FindItemByType<T>( true );
|
||||
}
|
||||
|
||||
public T FindItemByType<T>( bool recurse ) where T : Item
|
||||
{
|
||||
return RecurseFindItemByType<T>( this, recurse );
|
||||
}
|
||||
|
||||
private static T RecurseFindItemByType<T>( Item current, bool recurse ) where T : Item
|
||||
{
|
||||
if( current != null && current.Items.Count > 0 )
|
||||
{
|
||||
List<Item> list = current.Items;
|
||||
|
||||
for( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
Item item = list[i];
|
||||
|
||||
if( typeof( T ).IsAssignableFrom( item.GetType() ) )
|
||||
{
|
||||
return (T)item;
|
||||
}
|
||||
else if( recurse && item is Container )
|
||||
{
|
||||
T check = RecurseFindItemByType<T>( item, recurse );
|
||||
|
||||
if( check != null )
|
||||
return check;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Item[] FindItemsByType( Type[] types )
|
||||
{
|
||||
return FindItemsByType( types, true );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue