Mikthebug
Member
This is how i solved it when i made my deeds. i know this is dex but should work with just changing dex for the correct stam name.
C#:
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using System.Collections;
using Server.Gumps;
using Server.Targeting;
using Server.Misc;
using Server.Accounting;
using System.Xml;
using Server.Mobiles;
namespace Server.Items
{
public class MinorPetDexterityScroll : Item
{
[Constructable]
public MinorPetDexterityScroll() : base( 0x14F0 )
{
base.Weight = 1.0;
base.Name = "a Minor Companion Dexterity Scroll";
base.Hue = 0x481;
LootType = LootType.Cursed;
}
public override void OnDoubleClick( Mobile from )
{
if ( IsChildOf( from.Backpack ) )
{
from.Target = new Dex1Target(from, this);
}
else
{
from.SendMessage("That must be in your backpack for you to use it.");
}
}
public MinorPetDexterityScroll( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class Dex1Target : Target
{
private Mobile m_From;
private MinorPetDexterityScroll m_Deed;
public Dex1Target( Mobile from, MinorPetDexterityScroll deed ) : base ( 3, false, TargetFlags.None )
{
m_Deed = deed;
m_From = from;
from.SendMessage("Select the companion you want to enhance.");
}
protected override void OnTarget( Mobile from, object targeted )
{
if (m_Deed.IsChildOf( m_From.Backpack ) )
{
if ( targeted is Mobile )
{
if ( targeted is BaseCreature )
{
BaseCreature creature = (BaseCreature)targeted;
if( !creature.Tamable ){
from.SendMessage("This animal is not tame.");
}
else if( !creature.Controlled || creature.ControlMaster != from ){
from.SendMessage("This is not you animal.");
}
else if( creature.IsDeadPet ){
from.SendMessage("This animal is dead.");
}
else if( creature.Summoned ){
from.SendMessage("You can not enhance a summoned creature.");
}
else if( creature.Body.IsHuman ){
from.SendMessage("You can not enhance a human.");
}
else if( creature.IsBonded == false ){
from.SendMessage("You need to bond with your companion to use that.");
}
else if( from.Skills[SkillName.AnimalLore].Base < creature.MinTameSkill ){
from.SendMessage("You do not know enough about your companion to enhance it.");
}
else if( creature.Dex >= 300 ){
from.SendMessage("Your companion can not become any stronger.");
}
else{
creature.Dex += 1;
from.SendMessage("You companion seems enhanced.");
m_Deed.Delete();
Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0, 0, 0, 0, 0, 5060, 0 );
Effects.PlaySound( from.Location, from.Map, 0x243 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 4, from.Y - 6, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
Effects.SendMovingParticles( new Entity( Serial.Zero, new Point3D( from.X - 6, from.Y - 4, from.Z + 15 ), from.Map ), from, 0x36D4, 7, 0, false, true, 0x497, 0, 9502, 1, 0, (EffectLayer)255, 0x100 );
}
}
}
}
}
}
}