RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Slayer Entry Help

Kouri

Squire
I'm trying to make changes to the Slayer entries, trying to make them a bit more "specific" and add custom mobiles.

I added WyrmDispatcher slayer entry and removed all wyrm references from the DragonSlaying entry.

SlayerGroup.cs
Code:
reptilian.Opposition = new SlayerGroup[]{ arachnid };
reptilian.FoundOn = new Type[]{ typeof( TerathanAvenger ), typeof( TerathanMatriarch ) };
reptilian.Super = new SlayerEntry( SlayerName.ReptilianDeath, typeof( AncientWyrm ), typeof( DeepSeaSerpent ), typeof( GreaterDragon ), typeof( Dragon ), typeof( Drake ), typeof( GiantIceWorm ), typeof( IceSerpent ), typeof( GiantSerpent ), typeof( Hiryu ), typeof( IceSnake ), typeof( JukaLord ), typeof( JukaMage ), typeof( JukaWarrior ), typeof( LavaSerpent ), typeof( LavaSnake ), typeof( LesserHiryu ), typeof( Lizardman ), typeof( OphidianArchmage ), typeof( OphidianKnight ), typeof( OphidianMage ), typeof( OphidianMatriarch ), typeof( OphidianWarrior ), typeof( Reptalon ), typeof( SeaSerpent ), typeof( Serado ), typeof( SerpentineDragon ), typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( SkeletalDragon ), typeof( Snake ), typeof( SwampDragon ), typeof( WhiteWyrm ), typeof( Wyvern ), typeof( Yamandon ) );
reptilian.Entries = new SlayerEntry[]
{
new SlayerEntry( SlayerName.WyrmDispatcher, typeof( AncientWyrm ), typeof( ShadowWyrm ), typeof( WhiteWyrm ) ),
new SlayerEntry( SlayerName.DragonSlaying, typeof( GreaterDragon ), typeof( Dragon ), typeof( Drake ), typeof( Hiryu ), typeof( LesserHiryu ), typeof( Reptalon ), typeof( SerpentineDragon ), typeof( SkeletalDragon ), typeof( SwampDragon ), typeof( Wyvern ) ),
new SlayerEntry( SlayerName.LizardmanSlaughter, typeof( Lizardman ) ),
new SlayerEntry( SlayerName.Ophidian, typeof( OphidianArchmage ), typeof( OphidianKnight ), typeof( OphidianMage ), typeof( OphidianMatriarch ), typeof( OphidianWarrior ) ),
new SlayerEntry( SlayerName.SnakesBane, typeof( DeepSeaSerpent ), typeof( GiantIceWorm ), typeof( GiantSerpent ), typeof( IceSerpent ), typeof( IceSnake ), typeof( LavaSerpent ), typeof( LavaSnake ), typeof( SeaSerpent ), typeof( Serado ), typeof( SilverSerpent ), typeof( Snake ), typeof( Yamandon ) )
};

And I added the WyrmDispatcher name to the SlayerName script.

Now, unfortunately my server crashes when I access my acct via RunUO.

Code:
Server Crash Report
===================
 
RunUO Version 2.5, Build 0.24991
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 4.0.30319.296
Time: 8/17/2014 4:40:27 PM
Mobiles: 39967
Items: 207311
Exception:
System.TypeInitializationException: The type initializer for 'Server.Items.SlayerGroup' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Server.Items.SlayerGroup.CompileEntries(SlayerGroup[] groups)
   at Server.Items.SlayerGroup..cctor()
   --- End of inner exception stack trace ---
   at Server.Items.SlayerGroup.GetEntryByName(SlayerName name)
   at Server.Items.BaseWeapon.GetProperties(ObjectPropertyList list)
   at Server.Item.get_PropertyList()
   at Server.Item.InvalidateProperties()
   at Server.Item.set_Map(Map value)
   at Server.Mobile.set_Map(Map value)
   at Server.Mobile.set_NetState(NetState value)
   at Server.Network.PacketHandlers.PlayCharacter(NetState state, PacketReader pvSrc)
   at Server.Network.MessagePump.HandleReceive(NetState ns)
   at Server.Network.MessagePump.Slice()
   at Server.Core.Main(String[] args)

I edited out the new entries in both of the Slayer scripts but the server continues to crash.
 

Kouri

Squire
I didn't modify the SlayerEntry.cs, unfortunately I assumed it would work under the reptile slayer entry.

I did go back and make the wyrm entry in SlayerEntry.cs and I updated the cliloc.enu. I made all lines active in the SlayerGroup.cs and SlayerName.cs but I'm still getting the crash with the same error.

I was wrong, it is a different crash error.

Code:
RunUO Version 2.5, Build 0.24991
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 4.0.30319.296
Time: 8/17/2014 6:08:17 PM
Mobiles: 39969
Items: 207383
Exception:
System.TypeInitializationException: The type initializer for 'Server.Items.SlayerGroup' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Server.Items.SlayerGroup.CompileEntries(SlayerGroup[] groups)
   at Server.Items.SlayerGroup..cctor()
   --- End of inner exception stack trace ---
   at Server.Items.SlayerGroup.get_Groups()
   at Server.Items.BaseRunicTool.GetRandomSlayer()
   at Server.Items.BaseRunicTool.ApplyAttributesTo(BaseWeapon weapon, Boolean isRunicTool, Int32 luckChance, Int32 attributeCount, Int32 min, Int32 max)
   at Server.Items.TreasureMapChest.Fill(LockableContainer cont, Int32 level)
   at Server.Multis.BrigandCamp.AddCampChests()
   at Server.Multis.BrigandCamp.AddComponents()
   at Server.Timer.Slice()
   at Server.Core.Main(String[] args)
 
Clients:
- Count: 0
 

Kouri

Squire
I reloaded my original backed up files and tested that I was able to add new monsters to the current groups. I added 3 mobs to the LizardmanSlaughter slayer entry and I had no issues when I restarted the server.


Just to verify, SlayerEntry.cs, SlayerGroup.cs, and SlayerName.cs are the only files that I have to modify in order to completely add a new group or entry?
 

tindo

Sorceror
You have 5 reptile slayer entries but only 4 are expected by the CompileEntries method. Please post your entire Slayergroup.cs for assistance.
 

Kouri

Squire
I figured out the problem you specified tindo, and correctly accounted for all slayer entries and everything compiles.

Now I'm having another problem, I created a weapon with the WyrmDispatcher slayer name, it compiles fine but when I add the item there is no slayer attribute. I go into the props and manually add the WyrmDispatcher but for some reason the slayer that shows up is the DemonSlayer even though it says WyrmDispatcher in the props. I have checked and all cliloc entries correspond with what is in the SlayerEntry.cs script.

Just in case, here is my complete SlayerGroup.cs as requested.

Code:
using System;
using Server;
using Server.Mobiles;
 
namespace Server.Items
{
public class SlayerGroup
{
private static SlayerEntry[] m_TotalEntries;
private static SlayerGroup[] m_Groups;
 
public static SlayerEntry[] TotalEntries
{
get{ return m_TotalEntries; }
}
 
public static SlayerGroup[] Groups
{
get{ return m_Groups; }
}
 
public static SlayerEntry GetEntryByName( SlayerName name )
{
int v = (int)name;
 
if ( v >= 0 && v < m_TotalEntries.Length )
return m_TotalEntries[v];
 
return null;
}
 
public static SlayerName GetLootSlayerType( Type type )
{
for ( int i = 0; i < m_Groups.Length; ++i )
{
SlayerGroup group = m_Groups[i];
Type[] foundOn = group.FoundOn;
 
bool inGroup = false;
 
for ( int j = 0; foundOn != null && !inGroup && j < foundOn.Length; ++j )
inGroup = ( foundOn[j] == type );
 
if ( inGroup )
{
int index = Utility.Random( 1 + group.Entries.Length );
 
if ( index == 0 )
return group.m_Super.Name;
 
return group.Entries[index - 1].Name;
}
}
 
return SlayerName.Silver;
}
 
static SlayerGroup()
{
SlayerGroup humanoid = new SlayerGroup();
SlayerGroup undead = new SlayerGroup();
SlayerGroup elemental = new SlayerGroup();
SlayerGroup abyss = new SlayerGroup();
SlayerGroup arachnid = new SlayerGroup();
SlayerGroup reptilian = new SlayerGroup();
SlayerGroup fey = new SlayerGroup();
 
humanoid.Opposition = new SlayerGroup[]{ undead };
humanoid.FoundOn = new Type[]{ typeof( BoneKnight ), typeof( Lich ), typeof( LichLord ) };
humanoid.Super = new SlayerEntry( SlayerName.Repond, typeof( ArcticOgreLord ), typeof( Cyclops ), typeof( Ettin ), typeof( EvilMage ), typeof( EvilMageLord ), typeof( FrostTroll ), typeof( MeerCaptain ), typeof( MeerEternal ), typeof( MeerMage ), typeof( MeerWarrior ), typeof( Ogre ), typeof( OgreLord ), typeof( Orc ), typeof( OrcBomber ), typeof( OrcBrute ), typeof( OrcCaptain ), /*typeof( OrcChopper ), typeof( OrcScout ),*/ typeof( OrcishLord ), typeof( OrcishMage ), typeof( Ratman ), typeof( RatmanArcher ), typeof( RatmanMage ), typeof( SavageRider ), typeof( SavageShaman ), typeof( Savage ), typeof( Titan ), typeof( Troglodyte ), typeof( Troll ) );
humanoid.Entries = new SlayerEntry[]
{
new SlayerEntry( SlayerName.OgreTrashing, typeof( Ogre ), typeof( OgreLord ), typeof( ArcticOgreLord ) ),
new SlayerEntry( SlayerName.OrcSlaying, typeof( Orc ), typeof( OrcBomber ), typeof( OrcBrute ), typeof( OrcCaptain ),/* typeof( OrcChopper ), typeof( OrcScout ),*/ typeof( OrcishLord ), typeof( OrcishMage ) ),
new SlayerEntry( SlayerName.TrollSlaughter, typeof( Troll ), typeof( FrostTroll ) )
};
 
undead.Opposition = new SlayerGroup[]{ humanoid };
undead.Super = new SlayerEntry( SlayerName.Silver, typeof( AncientLich ), typeof( Bogle ), typeof( BoneKnight ), typeof( BoneMagi ),/* typeof( DarkGuardian ), */typeof( DarknightCreeper ), typeof( FleshGolem ), typeof( Ghoul ), typeof( GoreFiend ), typeof( HellSteed ), typeof( LadyOfTheSnow ), typeof( Lich ), typeof( LichLord ), typeof( Mummy ), typeof( PestilentBandage ), typeof( Revenant ), typeof( RevenantLion ), typeof( RottingCorpse ), typeof( Shade ), typeof( ShadowKnight ), typeof( SkeletalKnight ), typeof( SkeletalMage ), typeof( SkeletalMount ), typeof( Skeleton ), typeof( Spectre ), typeof( Wraith ), typeof( Zombie ) );
undead.Entries = new SlayerEntry[0];
 
fey.Opposition = new SlayerGroup[]{ abyss };
fey.Super = new SlayerEntry( SlayerName.Fey, typeof( Centaur ), typeof( CuSidhe ), typeof( EtherealWarrior ), typeof( Kirin ), typeof( LordOaks ), typeof( Pixie ), typeof( Silvani ), typeof( Treefellow ), typeof( Unicorn ), typeof( Wisp ), typeof( MLDryad ), typeof( Satyr ) );
fey.Entries = new SlayerEntry[0];
 
elemental.Opposition = new SlayerGroup[]{ abyss };
elemental.FoundOn = new Type[]{ typeof( Balron ), typeof( Daemon ) };
elemental.Super = new SlayerEntry( SlayerName.ElementalBan, typeof( AcidElemental ), typeof( AgapiteElemental ), typeof( AirElemental ), typeof( SummonedAirElemental ), typeof( BloodElemental ), typeof( BronzeElemental ), typeof( CopperElemental ), typeof( CrystalElemental ), typeof( DullCopperElemental ), typeof( EarthElemental ), typeof( SummonedEarthElemental ), typeof( Efreet ), typeof( FireElemental ), typeof( SummonedFireElemental ), typeof( GoldenElemental ), typeof( IceElemental ), typeof( KazeKemono ), typeof( PoisonElemental ), typeof( RaiJu ), typeof( SandVortex ), typeof( ShadowIronElemental ), typeof( SnowElemental ), typeof( ValoriteElemental ), typeof( VeriteElemental ), typeof( WaterElemental ), typeof( SummonedWaterElemental ) );
elemental.Entries = new SlayerEntry[]
{
new SlayerEntry( SlayerName.BloodDrinking, typeof( BloodElemental ) ),
new SlayerEntry( SlayerName.EarthShatter, typeof( AgapiteElemental ), typeof( BronzeElemental ), typeof( CopperElemental ), typeof( DullCopperElemental ), typeof( EarthElemental ), typeof( SummonedEarthElemental ), typeof( GoldenElemental ), typeof( ShadowIronElemental ), typeof( ValoriteElemental ), typeof( VeriteElemental ) ),
new SlayerEntry( SlayerName.ElementalHealth, typeof( PoisonElemental ) ),
new SlayerEntry( SlayerName.FlameDousing, typeof( FireElemental ), typeof( SummonedFireElemental ) ),
new SlayerEntry( SlayerName.SummerWind, typeof( SnowElemental ), typeof( IceElemental ) ),
new SlayerEntry( SlayerName.Vacuum, typeof( AirElemental ), typeof( SummonedAirElemental ) ),
new SlayerEntry( SlayerName.WaterDissipation, typeof( WaterElemental ), typeof( SummonedWaterElemental ) )
};
 
abyss.Opposition = new SlayerGroup[]{ elemental, fey };
abyss.FoundOn = new Type[]{ typeof( BloodElemental ) };
 
if( Core.AOS )
{
abyss.Super = new SlayerEntry( SlayerName.Exorcism, typeof( AbysmalHorror ), typeof( ArcaneDaemon ), typeof( Balron ), typeof( BoneDemon ), typeof( ChaosDaemon ), typeof( Daemon ), typeof( SummonedDaemon ), typeof( DemonKnight ), typeof( Devourer ), typeof( EnslavedGargoyle ), typeof( FanDancer ), typeof( FireGargoyle ), typeof( Gargoyle ), typeof( GargoyleDestroyer ), typeof( GargoyleEnforcer ), typeof( Gibberling ), typeof( HordeMinion ), typeof( IceFiend ), typeof( Imp ), typeof( Impaler ), typeof( Moloch ), typeof( Oni ), typeof( Ravager ), typeof( Semidar ), typeof( StoneGargoyle ), typeof( Succubus ), typeof( TsukiWolf ) );
 
abyss.Entries = new SlayerEntry[]
{
// Daemon Dismissal & Balron Damnation have been removed and moved up to super slayer on OSI.
new SlayerEntry( SlayerName.GargoylesFoe, typeof( EnslavedGargoyle ), typeof( FireGargoyle ), typeof( Gargoyle ), typeof( GargoyleDestroyer ), typeof( GargoyleEnforcer ), typeof( StoneGargoyle ) ),
};
}
else
{
abyss.Super = new SlayerEntry( SlayerName.Exorcism, typeof( AbysmalHorror ), typeof( Balron ), typeof( BoneDemon ), typeof( ChaosDaemon ), typeof( Daemon ), typeof( SummonedDaemon ), typeof( DemonKnight ), typeof( Devourer ), typeof( Gargoyle ), typeof( FireGargoyle ), typeof( Gibberling ), typeof( HordeMinion ), typeof( IceFiend ), typeof( Imp ), typeof( Impaler ), typeof( Ravager ), typeof( StoneGargoyle ), typeof( ArcaneDaemon ), typeof( EnslavedGargoyle ), typeof( GargoyleDestroyer ), typeof( GargoyleEnforcer ), typeof( Moloch ) );
 
abyss.Entries = new SlayerEntry[]
{
new SlayerEntry( SlayerName.DaemonDismissal, typeof( AbysmalHorror ), typeof( Balron ), typeof( BoneDemon ), typeof( ChaosDaemon ), typeof( Daemon ), typeof( SummonedDaemon ), typeof( DemonKnight ), typeof( Devourer ), typeof( Gibberling ), typeof( HordeMinion ), typeof( IceFiend ), typeof( Imp ), typeof( Impaler ), typeof( Ravager ), typeof( ArcaneDaemon ), typeof( Moloch ) ),
new SlayerEntry( SlayerName.GargoylesFoe, typeof( FireGargoyle ), typeof( Gargoyle ), typeof( StoneGargoyle ), typeof( EnslavedGargoyle ), typeof( GargoyleDestroyer ), typeof( GargoyleEnforcer ) ),
new SlayerEntry( SlayerName.BalronDamnation, typeof( Balron ) )
};
}
 
arachnid.Opposition = new SlayerGroup[]{ reptilian };
arachnid.FoundOn = new Type[]{ typeof( AncientWyrm ), typeof( GreaterDragon ), typeof( Dragon ), typeof( OphidianMatriarch ), typeof( ShadowWyrm ) };
arachnid.Super = new SlayerEntry( SlayerName.ArachnidDoom, typeof( DreadSpider ), typeof( FrostSpider ), typeof( GiantBlackWidow ), typeof( GiantSpider ), typeof( Mephitis ), typeof( Scorpion ), typeof( TerathanAvenger ), typeof( TerathanDrone ), typeof( TerathanMatriarch ), typeof( TerathanWarrior ) );
arachnid.Entries = new SlayerEntry[]
{
new SlayerEntry( SlayerName.ScorpionsBane, typeof( Scorpion ) ),
new SlayerEntry( SlayerName.SpidersDeath, typeof( DreadSpider ), typeof( FrostSpider ), typeof( GiantBlackWidow ), typeof( GiantSpider ), typeof( Mephitis ) ),
new SlayerEntry( SlayerName.Terathan, typeof( TerathanAvenger ), typeof( TerathanDrone ), typeof( TerathanMatriarch ), typeof( TerathanWarrior ) )
};
 
reptilian.Opposition = new SlayerGroup[]{ arachnid };
reptilian.FoundOn = new Type[]{ typeof( TerathanAvenger ), typeof( TerathanMatriarch ) };
reptilian.Super = new SlayerEntry( SlayerName.ReptilianDeath, typeof( AncientWyrm ), typeof( DeepSeaSerpent ), typeof( GreaterDragon ), typeof( Dragon ), typeof( Drake ), typeof( GiantIceWorm ), typeof( IceSerpent ), typeof( GiantSerpent ), typeof( Hiryu ), typeof( IceSnake ), typeof( JukaLord ), typeof( JukaMage ), typeof( JukaWarrior ), typeof( LavaSerpent ), typeof( LavaSnake ), typeof( LesserHiryu ), typeof( Lizardman ), typeof( OphidianArchmage ), typeof( OphidianKnight ), typeof( OphidianMage ), typeof( OphidianMatriarch ), typeof( OphidianWarrior ), typeof( Reptalon ), typeof( SeaSerpent ), typeof( Serado ), typeof( SerpentineDragon ), typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( SkeletalDragon ), typeof( Snake ), typeof( SwampDragon ), typeof( WhiteWyrm ), typeof( Wyvern ), typeof( Yamandon ) );
reptilian.Entries = new SlayerEntry[]
{
new SlayerEntry( SlayerName.DragonSlaying, typeof( GreaterDragon ), typeof( Dragon ), typeof( Drake ), typeof( Hiryu ), typeof( LesserHiryu ), typeof( Reptalon ), typeof( SerpentineDragon ), typeof( SkeletalDragon ), typeof( SwampDragon ), typeof( Wyvern ) ),
new SlayerEntry( SlayerName.WyrmDispatcher, typeof( AncientWyrm ), typeof( ShadowWyrm ), typeof( WhiteWyrm ) ),
new SlayerEntry( SlayerName.LizardmanSlaughter, typeof( Lizardman ), typeof( LizardWarrior), typeof( LizardArcher), typeof( LizardMage) ),
new SlayerEntry( SlayerName.Ophidian, typeof( OphidianArchmage ), typeof( OphidianKnight ), typeof( OphidianMage ), typeof( OphidianMatriarch ), typeof( OphidianWarrior ) ),
new SlayerEntry( SlayerName.SnakesBane, typeof( DeepSeaSerpent ), typeof( GiantIceWorm ), typeof( GiantSerpent ), typeof( IceSerpent ), typeof( IceSnake ), typeof( LavaSerpent ), typeof( LavaSnake ), typeof( SeaSerpent ), typeof( Serado ), typeof( SilverSerpent ), typeof( Snake ), typeof( Yamandon ) )
};
 
m_Groups = new SlayerGroup[]
{
humanoid,
undead,
elemental,
abyss,
arachnid,
reptilian,
fey
};
 
m_TotalEntries = CompileEntries( m_Groups );
}
 
private static SlayerEntry[] CompileEntries( SlayerGroup[] groups )
{
SlayerEntry[] entries = new SlayerEntry[29];
 
for ( int i = 0; i < groups.Length; ++i )
{
SlayerGroup g = groups[i];
 
g.Super.Group = g;
 
entries[(int)g.Super.Name] = g.Super;
 
for ( int j = 0; j < g.Entries.Length; ++j )
{
g.Entries[j].Group = g;
entries[(int)g.Entries[j].Name] = g.Entries[j];
}
}
 
return entries;
}
 
private SlayerGroup[] m_Opposition;
private SlayerEntry m_Super;
private SlayerEntry[] m_Entries;
private Type[] m_FoundOn;
 
public SlayerGroup[] Opposition{ get{ return m_Opposition; } set{ m_Opposition = value; } }
public SlayerEntry Super{ get{ return m_Super; } set{ m_Super = value; } }
public SlayerEntry[] Entries{ get{ return m_Entries; } set{ m_Entries = value; } }
public Type[] FoundOn{ get{ return m_FoundOn; } set{ m_FoundOn = value; } }
 
public bool OppositionSuperSlays( Mobile m )
{
for( int i = 0; i < Opposition.Length; i++ )
{
if ( Opposition[i].Super.Slays( m ) )
return true;
}
 
return false;
}
 
public SlayerGroup()
{
}
}
}
 

tindo

Sorceror
Not at home right to find the exact method but have you checked in the baseweapon.cs to make sure the method that shows the slayer name is getting the correct cliloc? I think its the GetProperties method and is likely using an offset to get the slayer name.
 

Kouri

Squire
I looked at the BaseWeapon.cs but I didn't see anything that mentioned slayer say offset, most of them called it up by entry name/title.
 

tindo

Sorceror
Code:
if (m_Slayer != SlayerName.None)
{
SlayerEntry entry = SlayerGroup.GetEntryByName(m_Slayer);
if (entry != null)
{
list.Add(entry.Title);
}
}

Code:
public static SlayerEntry GetEntryByName( SlayerName name )
{
int v = (int)name;
 
if ( v >= 0 && v < m_TotalEntries.Length )
return m_TotalEntries[v];
 
return null;
}

Ok, its getting the name by the entry number from slayername.cs, can you post that one please.
 

Kouri

Squire
SlayerName.cs

Code:
using System;
 
namespace Server.Items
{
public enum SlayerName
{
None,
Silver,
OrcSlaying,
TrollSlaughter,
OgreTrashing,
Repond,
DragonSlaying,
Terathan,
SnakesBane,
LizardmanSlaughter,
ReptilianDeath,
DaemonDismissal,
GargoylesFoe,
BalronDamnation,
WyrmDispatcher,
Exorcism,
Ophidian,
SpidersDeath,
ScorpionsBane,
ArachnidDoom,
FlameDousing,
WaterDissipation,
Vacuum,
ElementalHealth,
EarthShatter,
BloodDrinking,
SummerWind,
ElementalBan, // Bane?
Fey
}
}

I just put the WyrmDispatcher in there anywhere, it didn't look like it was in any order.
 

tindo

Sorceror
Actually, the order does make a difference. You have to remember that an Enum is not just a listing of names, its a NUMERICAL listing of names. So, each item in that Enum has a number associated with it, that is how it pulls the name.

*Edit* Just realized I didn't give you a solution, lol. You will need to match the Enum with your cliloc change.
 

Kouri

Squire
Thank you for the help tindo, everything looks to be working now, at least, everything is being displayed properly on the item icon.
 
Top