#W# More spawner work. Added 'MyLevel' to basecreature and GetLevel Command.

This commit is contained in:
WarrentyExpired 2026-08-18 16:20:12 -04:00
parent 5df9b41822
commit dae9b56279
7 changed files with 144 additions and 3 deletions

View file

@ -100,7 +100,7 @@ namespace Server.Scripts.Commands
Server.SpawnGenerator.Parse( m, "townanimals.map" );
Console.WriteLine( "Spawning Camps..." );
Server.SpawnGenerator.Parse( m, "camps.map" );
Server.SpawnGenerator.Parse( m, "danger.map" );
Console.WriteLine( "Spawning NPC's..." );
Server.SpawnGenerator.Parse( m, "npcs.map" );

View file

@ -0,0 +1,54 @@
using System;
using Server;
using System.Collections;
using System.Collections.Generic;
using Server.Misc;
using Server.Items;
using Server.Network;
using Server.Commands;
using Server.Commands.Generic;
using Server.Mobiles;
using Server.Accounting;
using Server.Regions;
using System.IO;
using Server.Targeting;
namespace Server.Scripts.Commands
{
public class GetLevel
{
public static void Initialize()
{
CommandSystem.Register("GetLevel", AccessLevel.Counselor, new CommandEventHandler( GetLevels ));
}
[Usage("GetLevel")]
[Description("Gets the level of the creature.")]
public static void GetLevels( CommandEventArgs e )
{
e.Mobile.SendMessage( "What target do you want to inspect?" );
e.Mobile.Target = new InternalTarget();
}
private class InternalTarget : Target
{
public InternalTarget() : base ( 8, false, TargetFlags.None )
{
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is Mobile )
{
Mobile m = (Mobile)targeted;
from.SendMessage( "" + BaseCreature.MyLevel( m ) + "" );
}
else
{
from.SendMessage( "Not a valid creature!" );
}
}
}
}
}

View file

@ -3424,6 +3424,65 @@ namespace Server.Mobiles
m_AI.OnSpeech( e );
}
public static int MyLevel( Mobile m )
{
int level = 0;
if ( m is BaseCreature )
{
BaseCreature bc = (BaseCreature)m;
int psn = 0;
if ( bc.HitPoison == Poison.Lesser )
psn = 5;
else if ( bc.HitPoison == Poison.Regular )
psn = 10;
else if ( bc.HitPoison == Poison.Greater )
psn = 15;
else if ( bc.HitPoison == Poison.Deadly )
psn = 20;
else if ( bc.HitPoison == Poison.Lethal )
psn = 25;
if ( bc.PoisonImmune == Poison.Lesser )
psn = psn + 5;
else if ( bc.PoisonImmune == Poison.Regular )
psn = psn + 10;
else if ( bc.PoisonImmune == Poison.Greater )
psn = psn + 15;
else if ( bc.PoisonImmune == Poison.Deadly )
psn = psn + 20;
else if ( bc.PoisonImmune == Poison.Lethal )
psn = psn + 25;
int bard = 0;
if ( bc.BardImmune )
bard = 50;
else
{
if ( bc.Unprovokable )
bard = bard + 25;
if ( bc.Uncalmable )
bard = bard + 25;
}
int dmg = (int)( bc.DamageMax * 8 );
int sts = (int)( m.RawStatTotal / 6 );
int fam = (int)( m.Fame / 120 );
int arm = (int)( m.VirtualArmor * 2.5 );
level = psn + dmg + sts + fam + arm + bard;
if ( level > 1000 ){ level = 1000; }
else if ( level < 1 ){ level = 1; }
}
return level;
}
public override bool IsHarmfulCriminal( Mobile target )
{
if ( (Controlled && target == m_ControlMaster) || (Summoned && target == m_SummonMaster) )