massive branch sync

This commit is contained in:
mark 2010-04-25 06:09:43 +00:00
parent 489bbabe93
commit b3e8ec0a08
192 changed files with 1249 additions and 1124 deletions

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.ContextMenus;
@ -12,8 +11,8 @@ namespace Server.Mobiles
{
public class AnimalTrainer : BaseVendor
{
private ArrayList m_SBInfos = new ArrayList();
protected override ArrayList SBInfos{ get { return m_SBInfos; } }
private List<SBInfo> m_SBInfos = new List<SBInfo>();
protected override List<SBInfo> SBInfos{ get { return m_SBInfos; } }
[Constructable]
public AnimalTrainer() : base( "the animal trainer" )
@ -217,19 +216,10 @@ namespace Server.Mobiles
if ( pet == null || pet.Deleted || from.Map != this.Map || !from.InRange( this, 14 ) || !from.Stabled.Contains( pet ) || !from.CheckAlive() )
return;
if ( (from.Followers + pet.ControlSlots) <= from.FollowersMax )
if ( CanClaim( from, pet ) )
{
pet.SetControlMaster( from );
DoClaim( from, pet );
if ( pet.Summoned )
pet.SummonMaster = from;
pet.ControlTarget = from;
pet.ControlOrder = OrderType.Follow;
pet.MoveToWorld( from.Location, from.Map );
pet.IsStabled = false;
from.Stabled.Remove( pet );
SayTo( from, 1042559 ); // Here you go... and good day to you!
@ -322,7 +312,12 @@ namespace Server.Mobiles
}
}
public void Claim( Mobile from )
public void Claim( Mobile from )
{
Claim( from, null );
}
public void Claim( Mobile from, string petName )
{
if ( Deleted || !from.CheckAlive() )
return;
@ -344,22 +339,9 @@ namespace Server.Mobiles
++stabled;
if ( (from.Followers + pet.ControlSlots) <= from.FollowersMax )
if ( CanClaim( from, pet ) )
{
pet.SetControlMaster( from );
if ( pet.Summoned )
pet.SummonMaster = from;
pet.ControlTarget = from;
pet.ControlOrder = OrderType.Follow;
pet.MoveToWorld( from.Location, from.Map );
pet.IsStabled = false;
if ( Core.SE )
pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully Happy
DoClaim( from, pet );
from.Stabled.RemoveAt( i );
--i;
@ -378,6 +360,29 @@ namespace Server.Mobiles
SayTo( from, 502671 ); // But I have no animals stabled with me at the moment!
}
public bool CanClaim( Mobile from, BaseCreature pet )
{
return ((from.Followers + pet.ControlSlots) <= from.FollowersMax);
}
private void DoClaim( Mobile from, BaseCreature pet )
{
pet.SetControlMaster( from );
if ( pet.Summoned )
pet.SummonMaster = from;
pet.ControlTarget = from;
pet.ControlOrder = OrderType.Follow;
pet.MoveToWorld( from.Location, from.Map );
pet.IsStabled = false;
if ( Core.SE )
pet.Loyalty = BaseCreature.MaxLoyalty; // Wonderfully Happy
}
public override bool HandlesOnSpeech( Mobile from )
{
return true;
@ -394,10 +399,34 @@ namespace Server.Mobiles
{
e.Handled = true;
if ( !Insensitive.Equals( e.Speech, "claim" ) )
BeginClaimList( e.Mobile );
else
Claim( e.Mobile );
if (!Insensitive.Equals( e.Speech, "claim" ))
{
bool showList = true;
if ( e.Speech.Length > 6 ) //sanity
{
string name = e.Speech.Substring( 6 ).Trim();
for ( int i = 0; i < e.Mobile.Stabled.Count; ++i )
{
if ( Insensitive.Equals( e.Mobile.Stabled[i].Name, name ) ) //Similar names?
{
showList = false;
break;
}
}
//What about pets with the same name, or 'similar' names, ie Fluffy 1, Fluffy 2?? - Similar names don't work.. what about identicals?
//What if you try and claim a pet that doesn't exist? -- GUMP
}
if ( showList )
BeginClaimList( e.Mobile );
}
else
{
Claim( e.Mobile );
}
}
else
{