This commit is contained in:
commit
47711d616e
2644 changed files with 479454 additions and 0 deletions
157
Scripts/Engines/AI/AI/AnimalAI.cs
Normal file
157
Scripts/Engines/AI/AI/AnimalAI.cs
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
|
||||
// Ideas
|
||||
// When you run on animals the panic
|
||||
// When if ( distance < 8 && Utility.RandomDouble() * Math.Sqrt( (8 - distance) / 6 ) >= incoming.Skills[SkillName.AnimalTaming].Value )
|
||||
// More your close, the more it can panic
|
||||
/*
|
||||
* AnimalHunterAI, AnimalHidingAI, AnimalDomesticAI...
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class AnimalAI : BaseAI
|
||||
{
|
||||
public AnimalAI(BaseCreature m) : base (m)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool DoActionWander()
|
||||
{
|
||||
// Old:
|
||||
#if false
|
||||
if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, true, false, true))
|
||||
{
|
||||
m_Mobile.DebugSay( "There is something near, I go away" );
|
||||
Action = ActionType.Backoff;
|
||||
}
|
||||
else if ( m_Mobile.IsHurt() || m_Mobile.Combatant != null )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am hurt or being attacked, I flee" );
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionWander();
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
|
||||
// New, only flee @ 10%
|
||||
|
||||
double hitPercent = (double)m_Mobile.Hits / m_Mobile.HitsMax;
|
||||
|
||||
if ( !m_Mobile.Summoned && !m_Mobile.Controlled && hitPercent < 0.1 ) // Less than 10% health
|
||||
{
|
||||
m_Mobile.DebugSay( "I am low on health!" );
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
else if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have detected {0}, attacking", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionWander();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
||||
if ( combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map )
|
||||
{
|
||||
m_Mobile.DebugSay( "My combatant is gone.." );
|
||||
|
||||
Action = ActionType.Wander;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( WalkMobileRange( combatant, 1, true, m_Mobile.RangeFight, m_Mobile.RangeFight ) )
|
||||
{
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo( combatant );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Mobile.GetDistanceToSqrt( combatant ) > m_Mobile.RangePerception + 1 )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I cannot find {0}", combatant.Name );
|
||||
|
||||
Action = ActionType.Wander;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_Mobile.Controlled && !m_Mobile.Summoned )
|
||||
{
|
||||
double hitPercent = (double)m_Mobile.Hits / m_Mobile.HitsMax;
|
||||
|
||||
if ( hitPercent < 0.1 )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am low on health!" );
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionBackoff()
|
||||
{
|
||||
double hitPercent = (double)m_Mobile.Hits / m_Mobile.HitsMax;
|
||||
|
||||
if ( !m_Mobile.Summoned && !m_Mobile.Controlled && hitPercent < 0.1 ) // Less than 10% health
|
||||
{
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AcquireFocusMob(m_Mobile.RangePerception * 2, FightMode.Closest, true, false , true))
|
||||
{
|
||||
if ( WalkMobileRange(m_Mobile.FocusMob, 1, false, m_Mobile.RangePerception, m_Mobile.RangePerception * 2) )
|
||||
{
|
||||
m_Mobile.DebugSay( "Well, here I am safe" );
|
||||
Action = ActionType.Wander;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay( "I have lost my focus, lets relax" );
|
||||
Action = ActionType.Wander;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionFlee()
|
||||
{
|
||||
AcquireFocusMob(m_Mobile.RangePerception * 2, m_Mobile.FightMode, true, false, true);
|
||||
|
||||
if ( m_Mobile.FocusMob == null )
|
||||
m_Mobile.FocusMob = m_Mobile.Combatant;
|
||||
|
||||
return base.DoActionFlee();
|
||||
}
|
||||
}
|
||||
}
|
||||
131
Scripts/Engines/AI/AI/ArcherAI.cs
Normal file
131
Scripts/Engines/AI/AI/ArcherAI.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class ArcherAI : BaseAI
|
||||
{
|
||||
public ArcherAI(BaseCreature m) : base (m)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool DoActionWander()
|
||||
{
|
||||
m_Mobile.DebugSay( "I have no combatant" );
|
||||
|
||||
if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true))
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have detected {0} and I will attack", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base.DoActionWander();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
if ( m_Mobile.Combatant == null || m_Mobile.Combatant.Deleted || !m_Mobile.Combatant.Alive || m_Mobile.Combatant.IsDeadBondedPet )
|
||||
{
|
||||
m_Mobile.DebugSay("My combatant is deleted");
|
||||
Action = ActionType.Guard;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( (m_Mobile.LastMoveTime + TimeSpan.FromSeconds( 1.0 )) < DateTime.Now )
|
||||
{
|
||||
if (WalkMobileRange(m_Mobile.Combatant, 1, true, m_Mobile.RangeFight, m_Mobile.Weapon.MaxRange))
|
||||
{
|
||||
// Be sure to face the combatant
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo(m_Mobile.Combatant.Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Mobile.Combatant != null )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I am still not in range of {0}", m_Mobile.Combatant.Name);
|
||||
|
||||
if ( (int) m_Mobile.GetDistanceToSqrt( m_Mobile.Combatant ) > m_Mobile.RangePerception + 1 )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have lost {0}", m_Mobile.Combatant.Name);
|
||||
|
||||
m_Mobile.Combatant = null;
|
||||
Action = ActionType.Guard;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When we have no ammo, we flee
|
||||
Container pack = m_Mobile.Backpack;
|
||||
|
||||
if ( pack == null || pack.FindItemByType( typeof( Arrow ) ) == null )
|
||||
{
|
||||
Action = ActionType.Flee;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// At 20% we should check if we must leave
|
||||
if ( m_Mobile.Hits < m_Mobile.HitsMax*20/100 )
|
||||
{
|
||||
bool bFlee = false;
|
||||
// if my current hits are more than my opponent, i don't care
|
||||
if ( m_Mobile.Combatant != null && m_Mobile.Hits < m_Mobile.Combatant.Hits)
|
||||
{
|
||||
int iDiff = m_Mobile.Combatant.Hits - m_Mobile.Hits;
|
||||
|
||||
if ( Utility.Random(0, 100) > 10 + iDiff) // 10% to flee + the diff of hits
|
||||
{
|
||||
bFlee = true;
|
||||
}
|
||||
}
|
||||
else if ( m_Mobile.Combatant != null && m_Mobile.Hits >= m_Mobile.Combatant.Hits)
|
||||
{
|
||||
if ( Utility.Random(0, 100) > 10 ) // 10% to flee
|
||||
{
|
||||
bFlee = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (bFlee)
|
||||
{
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionGuard()
|
||||
{
|
||||
if ( AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have detected {0}, attacking", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionGuard();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
2748
Scripts/Engines/AI/AI/BaseAI.cs
Normal file
2748
Scripts/Engines/AI/AI/BaseAI.cs
Normal file
File diff suppressed because it is too large
Load diff
87
Scripts/Engines/AI/AI/BerserkAI.cs
Normal file
87
Scripts/Engines/AI/AI/BerserkAI.cs
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class BerserkAI : BaseAI
|
||||
{
|
||||
public BerserkAI(BaseCreature m) : base (m)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool DoActionWander()
|
||||
{
|
||||
m_Mobile.DebugSay( "I have No Combatant" );
|
||||
|
||||
if( AcquireFocusMob( m_Mobile.RangePerception, FightMode.Closest, false, true, true) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have detected " + m_Mobile.FocusMob.Name + " and I will attack" );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionWander();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
if( m_Mobile.Combatant == null || m_Mobile.Combatant.Deleted )
|
||||
{
|
||||
m_Mobile.DebugSay("My combatant is deleted");
|
||||
Action = ActionType.Guard;
|
||||
return true;
|
||||
}
|
||||
|
||||
if( WalkMobileRange( m_Mobile.Combatant, 1, true, m_Mobile.RangeFight, m_Mobile.RangeFight ) )
|
||||
{
|
||||
// Be sure to face the combatant
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo( m_Mobile.Combatant.Location );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_Mobile.Combatant != null )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay("I am still not in range of " + m_Mobile.Combatant.Name);
|
||||
|
||||
if( (int) m_Mobile.GetDistanceToSqrt( m_Mobile.Combatant ) > m_Mobile.RangePerception + 1 )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have lost " + m_Mobile.Combatant.Name );
|
||||
|
||||
Action = ActionType.Guard;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionGuard()
|
||||
{
|
||||
if ( AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, true, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have detected {0}, attacking", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionGuard();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
176
Scripts/Engines/AI/AI/HealerAI.cs
Normal file
176
Scripts/Engines/AI/AI/HealerAI.cs
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Spells.First;
|
||||
using Server.Spells.Second;
|
||||
using Server.Spells.Fourth;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class HealerAI : BaseAI
|
||||
{
|
||||
private static NeedDelegate m_Cure = new NeedDelegate( NeedCure );
|
||||
private static NeedDelegate m_GHeal = new NeedDelegate( NeedGHeal );
|
||||
private static NeedDelegate m_LHeal = new NeedDelegate( NeedLHeal );
|
||||
private static NeedDelegate[] m_ACure = new NeedDelegate[] { m_Cure };
|
||||
private static NeedDelegate[] m_AGHeal = new NeedDelegate[] { m_GHeal };
|
||||
private static NeedDelegate[] m_ALHeal = new NeedDelegate[] { m_LHeal };
|
||||
private static NeedDelegate[] m_All = new NeedDelegate[] { m_Cure, m_GHeal, m_LHeal };
|
||||
|
||||
public HealerAI( BaseCreature m ) : base( m )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Think()
|
||||
{
|
||||
if ( m_Mobile.Deleted )
|
||||
return false;
|
||||
|
||||
Target targ = m_Mobile.Target;
|
||||
|
||||
if ( targ != null )
|
||||
{
|
||||
if ( targ is CureSpell.InternalTarget )
|
||||
{
|
||||
ProcessTarget( targ, m_ACure );
|
||||
}
|
||||
else if ( targ is GreaterHealSpell.InternalTarget )
|
||||
{
|
||||
ProcessTarget( targ, m_AGHeal );
|
||||
}
|
||||
else if ( targ is HealSpell.InternalTarget )
|
||||
{
|
||||
ProcessTarget( targ, m_ALHeal );
|
||||
}
|
||||
else
|
||||
{
|
||||
targ.Cancel( m_Mobile, TargetCancelType.Canceled );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Mobile toHelp = Find( m_All );
|
||||
|
||||
if ( toHelp != null )
|
||||
{
|
||||
if ( NeedCure( toHelp ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "{0} needs a cure", toHelp.Name );
|
||||
|
||||
if ( !(new CureSpell( m_Mobile, null )).Cast() )
|
||||
new CureSpell( m_Mobile, null ).Cast();
|
||||
}
|
||||
else if ( NeedGHeal( toHelp ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "{0} needs a greater heal", toHelp.Name );
|
||||
|
||||
if ( !(new GreaterHealSpell( m_Mobile, null )).Cast() )
|
||||
new HealSpell( m_Mobile, null ).Cast();
|
||||
}
|
||||
else if ( NeedLHeal( toHelp ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "{0} needs a lesser heal", toHelp.Name );
|
||||
|
||||
new HealSpell( m_Mobile, null ).Cast();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, FightMode.Weakest, false, true, false ) )
|
||||
{
|
||||
WalkMobileRange( m_Mobile.FocusMob, 1, false, 4, 7 );
|
||||
}
|
||||
else
|
||||
{
|
||||
WalkRandomInHome( 3, 2, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private delegate bool NeedDelegate( Mobile m );
|
||||
|
||||
private void ProcessTarget( Target targ, NeedDelegate[] func )
|
||||
{
|
||||
Mobile toHelp = Find( func );
|
||||
|
||||
if ( toHelp != null )
|
||||
{
|
||||
if ( targ.Range != -1 && !m_Mobile.InRange( toHelp, targ.Range ) )
|
||||
{
|
||||
DoMove( m_Mobile.GetDirectionTo( toHelp ) | Direction.Running );
|
||||
}
|
||||
else
|
||||
{
|
||||
targ.Invoke( m_Mobile, toHelp );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
targ.Cancel( m_Mobile, TargetCancelType.Canceled );
|
||||
}
|
||||
}
|
||||
|
||||
private Mobile Find( params NeedDelegate[] funcs )
|
||||
{
|
||||
if ( m_Mobile.Deleted )
|
||||
return null;
|
||||
|
||||
Map map = m_Mobile.Map;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
double prio = 0.0;
|
||||
Mobile found = null;
|
||||
|
||||
foreach ( Mobile m in m_Mobile.GetMobilesInRange( m_Mobile.RangePerception ) )
|
||||
{
|
||||
if ( !m_Mobile.CanSee( m ) || !(m is BaseCreature) || ((BaseCreature)m).Team != m_Mobile.Team )
|
||||
continue;
|
||||
|
||||
for ( int i = 0; i < funcs.Length; ++i )
|
||||
{
|
||||
if ( funcs[i]( m ) )
|
||||
{
|
||||
double val = -m_Mobile.GetDistanceToSqrt( m );
|
||||
|
||||
if ( found == null || val > prio )
|
||||
{
|
||||
prio = val;
|
||||
found = m;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool NeedCure( Mobile m )
|
||||
{
|
||||
return m.Poisoned;
|
||||
}
|
||||
|
||||
private static bool NeedGHeal( Mobile m )
|
||||
{
|
||||
return m.Hits < m.HitsMax - 40;
|
||||
}
|
||||
|
||||
private static bool NeedLHeal( Mobile m )
|
||||
{
|
||||
return m.Hits < m.HitsMax - 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
992
Scripts/Engines/AI/AI/MageAI.cs
Normal file
992
Scripts/Engines/AI/AI/MageAI.cs
Normal file
|
|
@ -0,0 +1,992 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Items;
|
||||
using Server.Spells;
|
||||
using Server.Spells.First;
|
||||
using Server.Spells.Second;
|
||||
using Server.Spells.Third;
|
||||
using Server.Spells.Fourth;
|
||||
using Server.Spells.Fifth;
|
||||
using Server.Spells.Sixth;
|
||||
using Server.Spells.Seventh;
|
||||
using Server.Misc;
|
||||
using Server.Regions;
|
||||
using Server.SkillHandlers;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class MageAI : BaseAI
|
||||
{
|
||||
private DateTime m_NextCastTime;
|
||||
private DateTime m_NextHealTime;
|
||||
|
||||
public MageAI( BaseCreature m ) : base( m )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Think()
|
||||
{
|
||||
if ( m_Mobile.Deleted )
|
||||
return false;
|
||||
|
||||
if ( ProcessTarget() )
|
||||
return true;
|
||||
else
|
||||
return base.Think();
|
||||
}
|
||||
|
||||
public virtual bool SmartAI
|
||||
{
|
||||
get{ return ( m_Mobile is BaseVendor || m_Mobile is BaseEscortable ); }
|
||||
}
|
||||
|
||||
private const double HealChance = 0.10; // 10% chance to heal at gm magery
|
||||
private const double TeleportChance = 0.05; // 5% chance to teleport at gm magery
|
||||
private const double DispelChance = 0.75; // 75% chance to dispel at gm magery
|
||||
|
||||
public virtual double ScaleByMagery( double v )
|
||||
{
|
||||
return m_Mobile.Skills[SkillName.Magery].Value * v * 0.01;
|
||||
}
|
||||
|
||||
public override bool DoActionWander()
|
||||
{
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I am going to attack {0}", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
m_NextCastTime = DateTime.Now;
|
||||
}
|
||||
else if ( SmartAI && m_Mobile.Mana < m_Mobile.ManaMax )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am going to meditate" );
|
||||
|
||||
m_Mobile.UseSkill( SkillName.Meditation );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay( "I am wandering" );
|
||||
|
||||
m_Mobile.Warmode = false;
|
||||
|
||||
base.DoActionWander();
|
||||
|
||||
if ( !m_Mobile.Controlled )
|
||||
{
|
||||
Spell spell = CheckCastHealingSpell();
|
||||
|
||||
if ( spell != null )
|
||||
spell.Cast();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Spell CheckCastHealingSpell()
|
||||
{
|
||||
// If I'm poisoned, always attempt to cure.
|
||||
if ( m_Mobile.Poisoned )
|
||||
return new CureSpell( m_Mobile, null );
|
||||
|
||||
// Summoned creatures never heal themselves.
|
||||
if ( m_Mobile.Summoned )
|
||||
return null;
|
||||
|
||||
if ( m_Mobile.Controlled )
|
||||
{
|
||||
if ( DateTime.Now < m_NextHealTime )
|
||||
return null;
|
||||
}
|
||||
|
||||
if ( !SmartAI )
|
||||
{
|
||||
if ( ScaleByMagery( HealChance ) < Utility.RandomDouble() )
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Utility.Random( 0, 4 + (m_Mobile.Hits == 0 ? m_Mobile.HitsMax : (m_Mobile.HitsMax / m_Mobile.Hits)) ) < 3 )
|
||||
return null;
|
||||
}
|
||||
|
||||
Spell spell = null;
|
||||
|
||||
if ( m_Mobile.Hits < (m_Mobile.HitsMax - 50) )
|
||||
{
|
||||
spell = new GreaterHealSpell( m_Mobile, null );
|
||||
|
||||
if ( spell == null )
|
||||
spell = new HealSpell( m_Mobile, null );
|
||||
}
|
||||
else if ( m_Mobile.Hits < (m_Mobile.HitsMax - 10) )
|
||||
spell = new HealSpell( m_Mobile, null );
|
||||
|
||||
double delay;
|
||||
|
||||
if ( m_Mobile.Int >= 500 )
|
||||
delay = Utility.RandomMinMax( 7, 10 );
|
||||
else
|
||||
delay = Math.Sqrt( 600 - m_Mobile.Int );
|
||||
|
||||
m_NextHealTime = DateTime.Now + TimeSpan.FromSeconds( delay );
|
||||
|
||||
return spell;
|
||||
}
|
||||
|
||||
public void RunTo( Mobile m )
|
||||
{
|
||||
if ( !SmartAI )
|
||||
{
|
||||
if ( !MoveTo( m, true, m_Mobile.RangeFight ) )
|
||||
OnFailedMove();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m.Paralyzed || m.Frozen )
|
||||
{
|
||||
if ( m_Mobile.InRange( m, 1 ) )
|
||||
RunFrom( m );
|
||||
else if ( !m_Mobile.InRange( m, m_Mobile.RangeFight > 2 ? m_Mobile.RangeFight : 2 ) && !MoveTo( m, true, 1 ) )
|
||||
OnFailedMove();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_Mobile.InRange( m, m_Mobile.RangeFight ) )
|
||||
{
|
||||
if ( !MoveTo( m, true, 1 ) )
|
||||
OnFailedMove();
|
||||
}
|
||||
else if ( m_Mobile.InRange( m, m_Mobile.RangeFight - 1 ) )
|
||||
{
|
||||
RunFrom( m );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void RunFrom( Mobile m )
|
||||
{
|
||||
Run( (m_Mobile.GetDirectionTo( m ) - 4) & Direction.Mask );
|
||||
}
|
||||
|
||||
public void OnFailedMove()
|
||||
{
|
||||
if ( !m_Mobile.DisallowAllMoves && (SmartAI ? Utility.Random( 4 ) == 0 : ScaleByMagery( TeleportChance ) > Utility.RandomDouble()) )
|
||||
{
|
||||
if ( m_Mobile.Target != null )
|
||||
m_Mobile.Target.Cancel( m_Mobile, TargetCancelType.Canceled );
|
||||
|
||||
new TeleportSpell( m_Mobile, null ).Cast();
|
||||
|
||||
m_Mobile.DebugSay( "I am stuck, I'm going to try teleporting away" );
|
||||
}
|
||||
else if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay( "I am stuck" );
|
||||
}
|
||||
}
|
||||
|
||||
public void Run( Direction d )
|
||||
{
|
||||
if ( (m_Mobile.Spell != null && m_Mobile.Spell.IsCasting) || m_Mobile.Paralyzed || m_Mobile.Frozen || m_Mobile.DisallowAllMoves )
|
||||
return;
|
||||
|
||||
m_Mobile.Direction = d | Direction.Running;
|
||||
|
||||
if ( !DoMove( m_Mobile.Direction, true ) )
|
||||
OnFailedMove();
|
||||
}
|
||||
|
||||
public virtual Spell GetRandomDamageSpell()
|
||||
{
|
||||
int maxCircle = (int)((m_Mobile.Skills[SkillName.Magery].Value + 20.0) / (100.0 / 7.0));
|
||||
|
||||
if ( maxCircle < 1 )
|
||||
maxCircle = 1;
|
||||
|
||||
switch ( Utility.Random( maxCircle*2 ) )
|
||||
{
|
||||
case 0: case 1: return new MagicArrowSpell( m_Mobile, null );
|
||||
case 2: case 3: return new HarmSpell( m_Mobile, null );
|
||||
case 4: case 5: return new FireballSpell( m_Mobile, null );
|
||||
case 6: case 7: return new LightningSpell( m_Mobile, null );
|
||||
case 8: case 9: return new MindBlastSpell( m_Mobile, null );
|
||||
case 10: return new EnergyBoltSpell( m_Mobile, null );
|
||||
case 11: return new ExplosionSpell( m_Mobile, null );
|
||||
default: return new FlameStrikeSpell( m_Mobile, null );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Spell GetRandomCurseSpell()
|
||||
{
|
||||
if ( Utility.RandomBool() )
|
||||
{
|
||||
if ( m_Mobile.Skills[SkillName.Magery].Value >= 40.0 )
|
||||
return new CurseSpell( m_Mobile, null );
|
||||
}
|
||||
|
||||
switch ( Utility.Random( 3 ) )
|
||||
{
|
||||
default:
|
||||
case 0: return new WeakenSpell( m_Mobile, null );
|
||||
case 1: return new ClumsySpell( m_Mobile, null );
|
||||
case 2: return new FeeblemindSpell( m_Mobile, null );
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Spell GetRandomManaDrainSpell()
|
||||
{
|
||||
if ( Utility.RandomBool() )
|
||||
{
|
||||
if ( m_Mobile.Skills[SkillName.Magery].Value >= 80.0 )
|
||||
return new ManaVampireSpell( m_Mobile, null );
|
||||
}
|
||||
|
||||
return new ManaDrainSpell( m_Mobile, null );
|
||||
}
|
||||
|
||||
public virtual Spell DoDispel( Mobile toDispel )
|
||||
{
|
||||
if ( !SmartAI )
|
||||
{
|
||||
if ( ScaleByMagery( DispelChance ) > Utility.RandomDouble() )
|
||||
return new DispelSpell( m_Mobile, null );
|
||||
|
||||
return ChooseSpell( toDispel );
|
||||
}
|
||||
|
||||
Spell spell = CheckCastHealingSpell();
|
||||
|
||||
if ( spell == null )
|
||||
{
|
||||
if ( !m_Mobile.DisallowAllMoves && Utility.Random( (int)m_Mobile.GetDistanceToSqrt( toDispel ) ) == 0 )
|
||||
spell = new TeleportSpell( m_Mobile, null );
|
||||
else if ( Utility.Random( 3 ) == 0 && !m_Mobile.InRange( toDispel, 3 ) && !toDispel.Paralyzed && !toDispel.Frozen )
|
||||
spell = new ParalyzeSpell( m_Mobile, null );
|
||||
else
|
||||
spell = new DispelSpell( m_Mobile, null );
|
||||
}
|
||||
|
||||
return spell;
|
||||
}
|
||||
|
||||
public virtual Spell ChooseSpell( Mobile c )
|
||||
{
|
||||
Spell spell = null;
|
||||
|
||||
if ( !SmartAI )
|
||||
{
|
||||
spell = CheckCastHealingSpell();
|
||||
|
||||
if ( spell != null )
|
||||
return spell;
|
||||
|
||||
switch ( Utility.Random( 16 ) )
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2: // Poison them
|
||||
{
|
||||
m_Mobile.DebugSay( "Attempting to poison" );
|
||||
|
||||
if ( !c.Poisoned )
|
||||
spell = new PoisonSpell( m_Mobile, null );
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Bless ourselves.
|
||||
{
|
||||
m_Mobile.DebugSay( "Blessing myself" );
|
||||
|
||||
spell = new BlessSpell( m_Mobile, null );
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
case 5:
|
||||
case 6: // Curse them.
|
||||
{
|
||||
m_Mobile.DebugSay( "Attempting to curse" );
|
||||
|
||||
spell = GetRandomCurseSpell();
|
||||
break;
|
||||
}
|
||||
case 7: // Paralyze them.
|
||||
{
|
||||
m_Mobile.DebugSay( "Attempting to paralyze" );
|
||||
|
||||
if ( m_Mobile.Skills[SkillName.Magery].Value > 50.0 )
|
||||
spell = new ParalyzeSpell( m_Mobile, null );
|
||||
|
||||
break;
|
||||
}
|
||||
case 8: // Drain mana
|
||||
{
|
||||
m_Mobile.DebugSay( "Attempting to drain mana" );
|
||||
|
||||
spell = GetRandomManaDrainSpell();
|
||||
break;
|
||||
}
|
||||
|
||||
default: // Damage them.
|
||||
{
|
||||
m_Mobile.DebugSay( "Just doing damage" );
|
||||
|
||||
spell = GetRandomDamageSpell();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return spell;
|
||||
}
|
||||
|
||||
spell = CheckCastHealingSpell();
|
||||
|
||||
if ( spell != null )
|
||||
return spell;
|
||||
|
||||
switch ( Utility.Random( 3 ) )
|
||||
{
|
||||
default:
|
||||
case 0: // Poison them
|
||||
{
|
||||
if ( !c.Poisoned )
|
||||
spell = new PoisonSpell( m_Mobile, null );
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Deal some damage
|
||||
{
|
||||
spell = GetRandomDamageSpell();
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Set up a combo
|
||||
{
|
||||
if ( m_Mobile.Mana < 40 && m_Mobile.Mana > 15 )
|
||||
{
|
||||
if ( c.Paralyzed && !c.Poisoned )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am going to meditate" );
|
||||
|
||||
m_Mobile.UseSkill( SkillName.Meditation );
|
||||
}
|
||||
else if ( !c.Poisoned )
|
||||
{
|
||||
spell = new ParalyzeSpell( m_Mobile, null );
|
||||
}
|
||||
}
|
||||
else if ( m_Mobile.Mana > 60 )
|
||||
{
|
||||
if ( Utility.Random( 2 ) == 0 && !c.Paralyzed && !c.Frozen && !c.Poisoned )
|
||||
{
|
||||
m_Combo = 0;
|
||||
spell = new ParalyzeSpell( m_Mobile, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Combo = 1;
|
||||
spell = new ExplosionSpell( m_Mobile, null );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return spell;
|
||||
}
|
||||
|
||||
protected int m_Combo = -1;
|
||||
|
||||
public virtual Spell DoCombo( Mobile c )
|
||||
{
|
||||
Spell spell = null;
|
||||
|
||||
if ( m_Combo == 0 )
|
||||
{
|
||||
spell = new ExplosionSpell( m_Mobile, null );
|
||||
++m_Combo; // Move to next spell
|
||||
}
|
||||
else if ( m_Combo == 1 )
|
||||
{
|
||||
spell = new WeakenSpell( m_Mobile, null );
|
||||
++m_Combo; // Move to next spell
|
||||
}
|
||||
else if ( m_Combo == 2 )
|
||||
{
|
||||
if ( !c.Poisoned )
|
||||
spell = new PoisonSpell( m_Mobile, null );
|
||||
|
||||
++m_Combo; // Move to next spell
|
||||
}
|
||||
|
||||
if ( m_Combo == 3 && spell == null )
|
||||
{
|
||||
switch ( Utility.Random( 3 ) )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
{
|
||||
if ( c.Int < c.Dex )
|
||||
spell = new FeeblemindSpell( m_Mobile, null );
|
||||
else
|
||||
spell = new ClumsySpell( m_Mobile, null );
|
||||
|
||||
++m_Combo; // Move to next spell
|
||||
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
spell = new EnergyBoltSpell( m_Mobile, null );
|
||||
m_Combo = -1; // Reset combo state
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
spell = new FlameStrikeSpell( m_Mobile, null );
|
||||
m_Combo = -1; // Reset combo state
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( m_Combo == 4 && spell == null )
|
||||
{
|
||||
spell = new MindBlastSpell( m_Mobile, null );
|
||||
m_Combo = -1;
|
||||
}
|
||||
|
||||
return spell;
|
||||
}
|
||||
|
||||
private TimeSpan GetDelay()
|
||||
{
|
||||
double del = ScaleByMagery( 3.0 );
|
||||
double min = 6.0 - (del * 0.75);
|
||||
double max = 6.0 - (del * 1.25);
|
||||
|
||||
return TimeSpan.FromSeconds( min + ((max - min) * Utility.RandomDouble()) );
|
||||
}
|
||||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
Mobile c = m_Mobile.Combatant;
|
||||
m_Mobile.Warmode = true;
|
||||
|
||||
if ( c == null || c.Deleted || !c.Alive || c.IsDeadBondedPet || !m_Mobile.CanSee( c ) || !m_Mobile.CanBeHarmful( c, false ) || c.Map != m_Mobile.Map )
|
||||
{
|
||||
// Our combatant is deleted, dead, hidden, or we cannot hurt them
|
||||
// Try to find another combatant
|
||||
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "Something happened to my combatant, so I am going to fight {0}", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = c = m_Mobile.FocusMob;
|
||||
m_Mobile.FocusMob = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay( "Something happened to my combatant, and nothing is around. I am on guard." );
|
||||
Action = ActionType.Guard;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_Mobile.InLOS( c ) )
|
||||
{
|
||||
m_Mobile.DebugSay( "I can't see my target" );
|
||||
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
m_Mobile.DebugSay( "Nobody else is around" );
|
||||
m_Mobile.Combatant = c = m_Mobile.FocusMob;
|
||||
m_Mobile.FocusMob = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( SmartAI && !m_Mobile.StunReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.Anatomy].Value >= 80.0 )
|
||||
EventSink.InvokeStunRequest( new StunRequestEventArgs( m_Mobile ) );
|
||||
|
||||
if ( !m_Mobile.InRange( c, m_Mobile.RangePerception ) )
|
||||
{
|
||||
// They are somewhat far away, can we find something else?
|
||||
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
m_Mobile.FocusMob = null;
|
||||
}
|
||||
else if ( !m_Mobile.InRange( c, m_Mobile.RangePerception * 3 ) )
|
||||
{
|
||||
m_Mobile.Combatant = null;
|
||||
}
|
||||
|
||||
c = m_Mobile.Combatant;
|
||||
|
||||
if ( c == null )
|
||||
{
|
||||
m_Mobile.DebugSay( "My combatant has fled, so I am on guard" );
|
||||
Action = ActionType.Guard;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_Mobile.Controlled && !m_Mobile.Summoned && !m_Mobile.IsParagon )
|
||||
{
|
||||
if ( m_Mobile.Hits < m_Mobile.HitsMax * 20/100 )
|
||||
{
|
||||
// We are low on health, should we flee?
|
||||
|
||||
bool flee = false;
|
||||
|
||||
if ( m_Mobile.Hits < c.Hits )
|
||||
{
|
||||
// We are more hurt than them
|
||||
|
||||
int diff = c.Hits - m_Mobile.Hits;
|
||||
|
||||
flee = ( Utility.Random( 0, 100 ) > (10 + diff) ); // (10 + diff)% chance to flee
|
||||
}
|
||||
else
|
||||
{
|
||||
flee = Utility.Random( 0, 100 ) > 10; // 10% chance to flee
|
||||
}
|
||||
|
||||
if ( flee )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I am going to flee from {0}", c.Name );
|
||||
|
||||
Action = ActionType.Flee;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Mobile.Spell == null && DateTime.Now > m_NextCastTime && m_Mobile.InRange( c, 12 ) )
|
||||
{
|
||||
// We are ready to cast a spell
|
||||
|
||||
Spell spell = null;
|
||||
Mobile toDispel = FindDispelTarget( true );
|
||||
|
||||
if ( m_Mobile.Poisoned ) // Top cast priority is cure
|
||||
{
|
||||
m_Mobile.DebugSay( "I am going to cure myself" );
|
||||
|
||||
spell = new CureSpell( m_Mobile, null );
|
||||
}
|
||||
else if ( toDispel != null ) // Something dispellable is attacking us
|
||||
{
|
||||
m_Mobile.DebugSay( "I am going to dispel {0}", toDispel );
|
||||
|
||||
spell = DoDispel( toDispel );
|
||||
}
|
||||
else if ( SmartAI && m_Combo != -1 ) // We are doing a spell combo
|
||||
{
|
||||
spell = DoCombo( c );
|
||||
}
|
||||
else if ( SmartAI && (c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned ) // They have a heal spell out
|
||||
{
|
||||
spell = new PoisonSpell( m_Mobile, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
spell = ChooseSpell( c );
|
||||
}
|
||||
|
||||
// Now we have a spell picked
|
||||
// Move first before casting
|
||||
|
||||
if ( SmartAI && toDispel != null )
|
||||
{
|
||||
if ( m_Mobile.InRange( toDispel, 10 ) )
|
||||
RunFrom( toDispel );
|
||||
else if ( !m_Mobile.InRange( toDispel, 12 ) )
|
||||
RunTo( toDispel );
|
||||
}
|
||||
else
|
||||
{
|
||||
RunTo( c );
|
||||
}
|
||||
|
||||
if ( spell != null )
|
||||
spell.Cast();
|
||||
|
||||
TimeSpan delay;
|
||||
|
||||
if ( SmartAI || ( spell is DispelSpell ) )
|
||||
delay = TimeSpan.FromSeconds( m_Mobile.ActiveSpeed );
|
||||
else
|
||||
delay = GetDelay();
|
||||
|
||||
m_NextCastTime = DateTime.Now + delay;
|
||||
}
|
||||
else if ( m_Mobile.Spell == null || !m_Mobile.Spell.IsCasting )
|
||||
{
|
||||
RunTo( c );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionGuard()
|
||||
{
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am going to attack {0}", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !m_Mobile.Controlled )
|
||||
{
|
||||
ProcessTarget();
|
||||
|
||||
Spell spell = CheckCastHealingSpell();
|
||||
|
||||
if ( spell != null )
|
||||
spell.Cast();
|
||||
}
|
||||
|
||||
base.DoActionGuard();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionFlee()
|
||||
{
|
||||
Mobile c = m_Mobile.Combatant;
|
||||
|
||||
if ( (m_Mobile.Mana > 20 || m_Mobile.Mana == m_Mobile.ManaMax) && m_Mobile.Hits > (m_Mobile.HitsMax / 2) )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am stronger now, my guard is up" );
|
||||
Action = ActionType.Guard;
|
||||
}
|
||||
else if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I am scared of {0}", m_Mobile.FocusMob.Name );
|
||||
|
||||
RunFrom( m_Mobile.FocusMob );
|
||||
m_Mobile.FocusMob = null;
|
||||
|
||||
if ( m_Mobile.Poisoned && Utility.Random( 0, 5 ) == 0 )
|
||||
new CureSpell( m_Mobile, null ).Cast();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay( "Area seems clear, but my guard is up" );
|
||||
|
||||
Action = ActionType.Guard;
|
||||
m_Mobile.Warmode = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Mobile FindDispelTarget( bool activeOnly )
|
||||
{
|
||||
if ( m_Mobile.Deleted || m_Mobile.Int < 95 || CanDispel( m_Mobile ) || m_Mobile.AutoDispel )
|
||||
return null;
|
||||
|
||||
if ( activeOnly )
|
||||
{
|
||||
List<AggressorInfo> aggressed = m_Mobile.Aggressed;
|
||||
List<AggressorInfo> aggressors = m_Mobile.Aggressors;
|
||||
|
||||
Mobile active = null;
|
||||
double activePrio = 0.0;
|
||||
|
||||
Mobile comb = m_Mobile.Combatant;
|
||||
|
||||
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && m_Mobile.InRange( comb, 12 ) && CanDispel( comb ) )
|
||||
{
|
||||
active = comb;
|
||||
activePrio = m_Mobile.GetDistanceToSqrt( comb );
|
||||
|
||||
if ( activePrio <= 2 )
|
||||
return active;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < aggressed.Count; ++i )
|
||||
{
|
||||
AggressorInfo info = aggressed[i];
|
||||
Mobile m = info.Defender;
|
||||
|
||||
if ( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, 12 ) && CanDispel( m ) )
|
||||
{
|
||||
double prio = m_Mobile.GetDistanceToSqrt( m );
|
||||
|
||||
if ( active == null || prio < activePrio )
|
||||
{
|
||||
active = m;
|
||||
activePrio = prio;
|
||||
|
||||
if ( activePrio <= 2 )
|
||||
return active;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < aggressors.Count; ++i )
|
||||
{
|
||||
AggressorInfo info = aggressors[i];
|
||||
Mobile m = info.Attacker;
|
||||
|
||||
if ( m != comb && m.Combatant == m_Mobile && m_Mobile.InRange( m, 12 ) && CanDispel( m ) )
|
||||
{
|
||||
double prio = m_Mobile.GetDistanceToSqrt( m );
|
||||
|
||||
if ( active == null || prio < activePrio )
|
||||
{
|
||||
active = m;
|
||||
activePrio = prio;
|
||||
|
||||
if ( activePrio <= 2 )
|
||||
return active;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return active;
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = m_Mobile.Map;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
Mobile active = null, inactive = null;
|
||||
double actPrio = 0.0, inactPrio = 0.0;
|
||||
|
||||
Mobile comb = m_Mobile.Combatant;
|
||||
|
||||
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
|
||||
{
|
||||
active = inactive = comb;
|
||||
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
|
||||
}
|
||||
|
||||
foreach ( Mobile m in m_Mobile.GetMobilesInRange( 12 ) )
|
||||
{
|
||||
if ( m != m_Mobile && CanDispel( m ) )
|
||||
{
|
||||
double prio = m_Mobile.GetDistanceToSqrt( m );
|
||||
|
||||
if ( !activeOnly && (inactive == null || prio < inactPrio) )
|
||||
{
|
||||
inactive = m;
|
||||
inactPrio = prio;
|
||||
}
|
||||
|
||||
if ( (m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio) )
|
||||
{
|
||||
active = m;
|
||||
actPrio = prio;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return active != null ? active : inactive;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool CanDispel( Mobile m )
|
||||
{
|
||||
return ( m is BaseCreature && ((BaseCreature)m).Summoned && m_Mobile.CanBeHarmful( m, false ) && !((BaseCreature)m).IsAnimatedDead );
|
||||
}
|
||||
|
||||
private static int[] m_Offsets = new int[]
|
||||
{
|
||||
-1, -1,
|
||||
-1, 0,
|
||||
-1, 1,
|
||||
0, -1,
|
||||
0, 1,
|
||||
1, -1,
|
||||
1, 0,
|
||||
1, 1,
|
||||
|
||||
-2, -2,
|
||||
-2, -1,
|
||||
-2, 0,
|
||||
-2, 1,
|
||||
-2, 2,
|
||||
-1, -2,
|
||||
-1, 2,
|
||||
0, -2,
|
||||
0, 2,
|
||||
1, -2,
|
||||
1, 2,
|
||||
2, -2,
|
||||
2, -1,
|
||||
2, 0,
|
||||
2, 1,
|
||||
2, 2
|
||||
};
|
||||
|
||||
private bool ProcessTarget()
|
||||
{
|
||||
Target targ = m_Mobile.Target;
|
||||
|
||||
if ( targ == null )
|
||||
return false;
|
||||
|
||||
bool isDispel = ( targ is DispelSpell.InternalTarget );
|
||||
bool isParalyze = ( targ is ParalyzeSpell.InternalTarget );
|
||||
bool isTeleport = ( targ is TeleportSpell.InternalTarget );
|
||||
bool teleportAway = false;
|
||||
|
||||
Mobile toTarget;
|
||||
|
||||
if ( isDispel )
|
||||
{
|
||||
toTarget = FindDispelTarget( false );
|
||||
|
||||
if ( !SmartAI && toTarget != null )
|
||||
RunTo( toTarget );
|
||||
else if ( toTarget != null && m_Mobile.InRange( toTarget, 10 ) )
|
||||
RunFrom( toTarget );
|
||||
}
|
||||
else if ( SmartAI && (isParalyze || isTeleport) )
|
||||
{
|
||||
toTarget = FindDispelTarget( true );
|
||||
|
||||
if ( toTarget == null )
|
||||
{
|
||||
toTarget = m_Mobile.Combatant;
|
||||
|
||||
if ( toTarget != null )
|
||||
RunTo( toTarget );
|
||||
}
|
||||
else if ( m_Mobile.InRange( toTarget, 10 ) )
|
||||
{
|
||||
RunFrom( toTarget );
|
||||
teleportAway = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
teleportAway = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
toTarget = m_Mobile.Combatant;
|
||||
|
||||
if ( toTarget != null )
|
||||
RunTo( toTarget );
|
||||
}
|
||||
|
||||
if ( (targ.Flags & TargetFlags.Harmful) != 0 && toTarget != null )
|
||||
{
|
||||
if ( (targ.Range == -1 || m_Mobile.InRange( toTarget, targ.Range )) && m_Mobile.CanSee( toTarget ) && m_Mobile.InLOS( toTarget ) )
|
||||
{
|
||||
targ.Invoke( m_Mobile, toTarget );
|
||||
}
|
||||
else if ( isDispel )
|
||||
{
|
||||
targ.Cancel( m_Mobile, TargetCancelType.Canceled );
|
||||
}
|
||||
}
|
||||
else if ( (targ.Flags & TargetFlags.Beneficial) != 0 )
|
||||
{
|
||||
targ.Invoke( m_Mobile, m_Mobile );
|
||||
}
|
||||
else if ( isTeleport && toTarget != null )
|
||||
{
|
||||
Map map = m_Mobile.Map;
|
||||
|
||||
if ( map == null )
|
||||
{
|
||||
targ.Cancel( m_Mobile, TargetCancelType.Canceled );
|
||||
return true;
|
||||
}
|
||||
|
||||
int px, py;
|
||||
|
||||
if ( teleportAway )
|
||||
{
|
||||
int rx = m_Mobile.X - toTarget.X;
|
||||
int ry = m_Mobile.Y - toTarget.Y;
|
||||
|
||||
double d = m_Mobile.GetDistanceToSqrt( toTarget );
|
||||
|
||||
px = toTarget.X + (int)(rx * (10 / d));
|
||||
py = toTarget.Y + (int)(ry * (10 / d));
|
||||
}
|
||||
else
|
||||
{
|
||||
px = toTarget.X;
|
||||
py = toTarget.Y;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Offsets.Length; i += 2 )
|
||||
{
|
||||
int x = m_Offsets[i], y = m_Offsets[i + 1];
|
||||
|
||||
Point3D p = new Point3D( px + x, py + y, 0 );
|
||||
|
||||
LandTarget lt = new LandTarget( p, map );
|
||||
|
||||
if ( (targ.Range == -1 || m_Mobile.InRange( p, targ.Range )) && m_Mobile.InLOS( lt ) && map.CanSpawnMobile( px + x, py + y, lt.Z ) && !SpellHelper.CheckMulti( p, map ) )
|
||||
{
|
||||
targ.Invoke( m_Mobile, lt );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int teleRange = targ.Range;
|
||||
|
||||
if ( teleRange < 0 )
|
||||
teleRange = 12;
|
||||
|
||||
for ( int i = 0; i < 10; ++i )
|
||||
{
|
||||
Point3D randomPoint = new Point3D( m_Mobile.X - teleRange + Utility.Random( teleRange * 2 + 1 ), m_Mobile.Y - teleRange + Utility.Random( teleRange * 2 + 1 ), 0 );
|
||||
|
||||
LandTarget lt = new LandTarget( randomPoint, map );
|
||||
|
||||
if ( m_Mobile.InLOS( lt ) && map.CanSpawnMobile( lt.X, lt.Y, lt.Z ) && !SpellHelper.CheckMulti( randomPoint, map ) )
|
||||
{
|
||||
targ.Invoke( m_Mobile, new LandTarget( randomPoint, map ) );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
targ.Cancel( m_Mobile, TargetCancelType.Canceled );
|
||||
}
|
||||
else
|
||||
{
|
||||
targ.Cancel( m_Mobile, TargetCancelType.Canceled );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
183
Scripts/Engines/AI/AI/MeleeAI.cs
Normal file
183
Scripts/Engines/AI/AI/MeleeAI.cs
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
|
||||
//
|
||||
// This is a first simple AI
|
||||
//
|
||||
//
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class MeleeAI : BaseAI
|
||||
{
|
||||
public MeleeAI(BaseCreature m) : base (m)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool DoActionWander()
|
||||
{
|
||||
m_Mobile.DebugSay( "I have no combatant" );
|
||||
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have detected {0}, attacking", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionWander();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
||||
if ( combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet )
|
||||
{
|
||||
m_Mobile.DebugSay( "My combatant is gone, so my guard is up" );
|
||||
|
||||
Action = ActionType.Guard;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !m_Mobile.InRange( combatant, m_Mobile.RangePerception ) )
|
||||
{
|
||||
// They are somewhat far away, can we find something else?
|
||||
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
m_Mobile.FocusMob = null;
|
||||
}
|
||||
else if ( !m_Mobile.InRange( combatant, m_Mobile.RangePerception * 3 ) )
|
||||
{
|
||||
m_Mobile.Combatant = null;
|
||||
}
|
||||
|
||||
combatant = m_Mobile.Combatant;
|
||||
|
||||
if ( combatant == null )
|
||||
{
|
||||
m_Mobile.DebugSay( "My combatant has fled, so I am on guard" );
|
||||
Action = ActionType.Guard;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/*if ( !m_Mobile.InLOS( combatant ) )
|
||||
{
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
m_Mobile.Combatant = combatant = m_Mobile.FocusMob;
|
||||
m_Mobile.FocusMob = null;
|
||||
}
|
||||
}*/
|
||||
|
||||
if ( MoveTo( combatant, true, m_Mobile.RangeFight ) )
|
||||
{
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo( combatant );
|
||||
}
|
||||
else if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
|
||||
return true;
|
||||
}
|
||||
else if ( m_Mobile.GetDistanceToSqrt( combatant ) > m_Mobile.RangePerception + 1 )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I cannot find {0}, so my guard is up", combatant.Name );
|
||||
|
||||
Action = ActionType.Guard;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
|
||||
}
|
||||
|
||||
if ( !m_Mobile.Controlled && !m_Mobile.Summoned && !m_Mobile.IsParagon )
|
||||
{
|
||||
if ( m_Mobile.Hits < m_Mobile.HitsMax * 20/100 )
|
||||
{
|
||||
// We are low on health, should we flee?
|
||||
|
||||
bool flee = false;
|
||||
|
||||
if ( m_Mobile.Hits < combatant.Hits )
|
||||
{
|
||||
// We are more hurt than them
|
||||
|
||||
int diff = combatant.Hits - m_Mobile.Hits;
|
||||
|
||||
flee = ( Utility.Random( 0, 100 ) < (10 + diff) ); // (10 + diff)% chance to flee
|
||||
}
|
||||
else
|
||||
{
|
||||
flee = Utility.Random( 0, 100 ) < 10; // 10% chance to flee
|
||||
}
|
||||
|
||||
if ( flee )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I am going to flee from {0}", combatant.Name );
|
||||
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionGuard()
|
||||
{
|
||||
if ( AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I have detected {0}, attacking", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionGuard();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionFlee()
|
||||
{
|
||||
if ( m_Mobile.Hits > m_Mobile.HitsMax/2 )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am stronger now, so I will continue fighting" );
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.FocusMob = m_Mobile.Combatant;
|
||||
base.DoActionFlee();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
100
Scripts/Engines/AI/AI/PredatorAI.cs
Normal file
100
Scripts/Engines/AI/AI/PredatorAI.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
|
||||
|
||||
/*
|
||||
* PredatorAI, its an animal that can attack
|
||||
* Dont flee but dont attack if not hurt or attacked
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class PredatorAI : BaseAI
|
||||
{
|
||||
public PredatorAI(BaseCreature m) : base (m)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool DoActionWander()
|
||||
{
|
||||
if ( m_Mobile.Combatant != null )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am hurt or being attacked, I kill him" );
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, true, false, true))
|
||||
{
|
||||
m_Mobile.DebugSay( "There is something near, I go away" );
|
||||
Action = ActionType.Backoff;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionWander();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
||||
if ( combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map )
|
||||
{
|
||||
m_Mobile.DebugSay( "My combatant is gone, so my guard is up" );
|
||||
Action = ActionType.Wander;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( WalkMobileRange( combatant, 1, true, m_Mobile.RangeFight, m_Mobile.RangeFight ) )
|
||||
{
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo( combatant );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Mobile.GetDistanceToSqrt( combatant ) > m_Mobile.RangePerception + 1 )
|
||||
{
|
||||
m_Mobile.DebugSay( "I cannot find {0}", combatant.Name );
|
||||
|
||||
Action = ActionType.Wander;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionBackoff()
|
||||
{
|
||||
if ( m_Mobile.IsHurt() || m_Mobile.Combatant != null )
|
||||
{
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (AcquireFocusMob(m_Mobile.RangePerception * 2, FightMode.Closest, true, false , true))
|
||||
{
|
||||
if ( WalkMobileRange(m_Mobile.FocusMob, 1, false, m_Mobile.RangePerception, m_Mobile.RangePerception * 2) )
|
||||
{
|
||||
m_Mobile.DebugSay( "Well, here I am safe" );
|
||||
Action = ActionType.Wander;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay( "I have lost my focus, lets relax" );
|
||||
Action = ActionType.Wander;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
194
Scripts/Engines/AI/AI/ThiefAI.cs
Normal file
194
Scripts/Engines/AI/AI/ThiefAI.cs
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
using Server.Items;
|
||||
|
||||
//
|
||||
// This is a first simple AI
|
||||
//
|
||||
//
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class ThiefAI : BaseAI
|
||||
{
|
||||
public ThiefAI(BaseCreature m) : base (m)
|
||||
{
|
||||
}
|
||||
|
||||
private Item m_toDisarm;
|
||||
public override bool DoActionWander()
|
||||
{
|
||||
m_Mobile.DebugSay( "I have no combatant" );
|
||||
|
||||
if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
m_Mobile.DebugSay( "I have detected {0}, attacking", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionWander();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionCombat()
|
||||
{
|
||||
Mobile combatant = m_Mobile.Combatant;
|
||||
|
||||
if ( combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map )
|
||||
{
|
||||
m_Mobile.DebugSay( "My combatant is gone, so my guard is up" );
|
||||
|
||||
Action = ActionType.Guard;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( WalkMobileRange( combatant, 1, true, m_Mobile.RangeFight, m_Mobile.RangeFight ) )
|
||||
{
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo( combatant );
|
||||
if ( m_toDisarm == null )
|
||||
m_toDisarm = combatant.FindItemOnLayer( Layer.OneHanded );
|
||||
|
||||
if ( m_toDisarm == null )
|
||||
m_toDisarm = combatant.FindItemOnLayer( Layer.TwoHanded );
|
||||
|
||||
if ( m_toDisarm != null && m_toDisarm.IsChildOf( m_Mobile.Backpack ) )
|
||||
{
|
||||
m_toDisarm = combatant.FindItemOnLayer( Layer.OneHanded );
|
||||
if ( m_toDisarm == null )
|
||||
m_toDisarm = combatant.FindItemOnLayer( Layer.TwoHanded );
|
||||
}
|
||||
if ( !m_Mobile.DisarmReady && m_Mobile.Skills[SkillName.Wrestling].Value >= 80.0 && m_Mobile.Skills[SkillName.ArmsLore].Value >= 80.0 && m_toDisarm != null )
|
||||
EventSink.InvokeDisarmRequest( new DisarmRequestEventArgs( m_Mobile ) );
|
||||
|
||||
if ( m_toDisarm != null && m_toDisarm.IsChildOf( combatant.Backpack ) && m_Mobile.NextSkillTime <= DateTime.Now && (m_toDisarm.LootType != LootType.Blessed && m_toDisarm.LootType != LootType.Newbied) )
|
||||
{
|
||||
m_Mobile.DebugSay( "Trying to steal from combatant." );
|
||||
m_Mobile.UseSkill( SkillName.Stealing );
|
||||
if ( m_Mobile.Target != null )
|
||||
m_Mobile.Target.Invoke( m_Mobile, m_toDisarm );
|
||||
}
|
||||
else if ( m_toDisarm == null && m_Mobile.NextSkillTime <= DateTime.Now )
|
||||
{
|
||||
Container cpack = combatant.Backpack;
|
||||
|
||||
if ( cpack != null )
|
||||
{
|
||||
Item steala = cpack.FindItemByType( typeof ( Bandage ) );
|
||||
if ( steala != null )
|
||||
{
|
||||
m_Mobile.DebugSay( "Trying to steal from combatant." );
|
||||
m_Mobile.UseSkill( SkillName.Stealing );
|
||||
if ( m_Mobile.Target != null )
|
||||
m_Mobile.Target.Invoke( m_Mobile, steala );
|
||||
}
|
||||
Item stealb = cpack.FindItemByType( typeof ( Nightshade ) );
|
||||
if ( stealb != null )
|
||||
{
|
||||
m_Mobile.DebugSay( "Trying to steal from combatant." );
|
||||
m_Mobile.UseSkill( SkillName.Stealing );
|
||||
if ( m_Mobile.Target != null )
|
||||
m_Mobile.Target.Invoke( m_Mobile, stealb );
|
||||
}
|
||||
Item stealc = cpack.FindItemByType( typeof ( BlackPearl ) );
|
||||
if ( stealc != null )
|
||||
{
|
||||
m_Mobile.DebugSay( "Trying to steal from combatant." );
|
||||
m_Mobile.UseSkill( SkillName.Stealing );
|
||||
if ( m_Mobile.Target != null )
|
||||
m_Mobile.Target.Invoke( m_Mobile, stealc );
|
||||
}
|
||||
|
||||
Item steald = cpack.FindItemByType( typeof ( MandrakeRoot ) );
|
||||
if ( steald != null )
|
||||
{
|
||||
m_Mobile.DebugSay( "Trying to steal from combatant." );
|
||||
m_Mobile.UseSkill( SkillName.Stealing );
|
||||
if ( m_Mobile.Target != null )
|
||||
m_Mobile.Target.Invoke( m_Mobile, steald );
|
||||
}
|
||||
else if ( steala == null && stealb == null && stealc == null && steald == null )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am going to flee from {0}", combatant.Name );
|
||||
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
|
||||
}
|
||||
|
||||
if ( m_Mobile.Hits < m_Mobile.HitsMax * 20/100 && !m_Mobile.IsParagon )
|
||||
{
|
||||
// We are low on health, should we flee?
|
||||
|
||||
bool flee = false;
|
||||
|
||||
if ( m_Mobile.Hits < combatant.Hits )
|
||||
{
|
||||
// We are more hurt than them
|
||||
|
||||
int diff = combatant.Hits - m_Mobile.Hits;
|
||||
|
||||
flee = ( Utility.Random( 0, 100 ) > (10 + diff) ); // (10 + diff)% chance to flee
|
||||
}
|
||||
else
|
||||
{
|
||||
flee = Utility.Random( 0, 100 ) > 10; // 10% chance to flee
|
||||
}
|
||||
|
||||
if ( flee )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am going to flee from {0}", combatant.Name );
|
||||
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionGuard()
|
||||
{
|
||||
if ( AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) )
|
||||
{
|
||||
m_Mobile.DebugSay( "I have detected {0}, attacking", m_Mobile.FocusMob.Name );
|
||||
|
||||
m_Mobile.Combatant = m_Mobile.FocusMob;
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.DoActionGuard();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionFlee()
|
||||
{
|
||||
if ( m_Mobile.Hits > m_Mobile.HitsMax/2 )
|
||||
{
|
||||
m_Mobile.DebugSay( "I am stronger now, so I will continue fighting" );
|
||||
Action = ActionType.Combat;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.FocusMob = m_Mobile.Combatant;
|
||||
base.DoActionFlee();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
149
Scripts/Engines/AI/AI/VendorAI.cs
Normal file
149
Scripts/Engines/AI/AI/VendorAI.cs
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
|
||||
//
|
||||
// This is a first simple AI
|
||||
//
|
||||
//
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class VendorAI : BaseAI
|
||||
{
|
||||
public VendorAI(BaseCreature m) : base (m)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool DoActionWander()
|
||||
{
|
||||
m_Mobile.DebugSay( "I'm fine" );
|
||||
|
||||
if ( m_Mobile.Combatant != null )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "{0} is attacking me", m_Mobile.Combatant.Name );
|
||||
|
||||
m_Mobile.Say( Utility.RandomList( 1005305, 501603 ) );
|
||||
|
||||
Action = ActionType.Flee;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Mobile.FocusMob != null )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "{0} has talked to me", m_Mobile.FocusMob.Name );
|
||||
|
||||
Action = ActionType.Interact;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.Warmode = false;
|
||||
|
||||
base.DoActionWander();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionInteract()
|
||||
{
|
||||
Mobile customer = m_Mobile.FocusMob;
|
||||
|
||||
if ( m_Mobile.Combatant != null )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "{0} is attacking me", m_Mobile.Combatant.Name );
|
||||
|
||||
m_Mobile.Say( Utility.RandomList( 1005305, 501603 ) );
|
||||
|
||||
Action = ActionType.Flee;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( customer == null || customer.Deleted || customer.Map != m_Mobile.Map )
|
||||
{
|
||||
m_Mobile.DebugSay( "My customer have disapeared" );
|
||||
m_Mobile.FocusMob = null;
|
||||
|
||||
Action = ActionType.Wander;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( customer.InRange( m_Mobile, m_Mobile.RangeFight ) )
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "I am with {0}", customer.Name );
|
||||
|
||||
m_Mobile.Direction = m_Mobile.GetDirectionTo( customer );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_Mobile.Debug )
|
||||
m_Mobile.DebugSay( "{0} is gone", customer.Name );
|
||||
|
||||
m_Mobile.FocusMob = null;
|
||||
|
||||
Action = ActionType.Wander;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DoActionGuard()
|
||||
{
|
||||
m_Mobile.FocusMob = m_Mobile.Combatant;
|
||||
return base.DoActionGuard();
|
||||
}
|
||||
|
||||
public override bool HandlesOnSpeech( Mobile from )
|
||||
{
|
||||
if ( from.InRange( m_Mobile, 4 ) )
|
||||
return true;
|
||||
|
||||
return base.HandlesOnSpeech( from );
|
||||
}
|
||||
|
||||
// Temporary
|
||||
public override void OnSpeech( SpeechEventArgs e )
|
||||
{
|
||||
base.OnSpeech( e );
|
||||
|
||||
Mobile from = e.Mobile;
|
||||
|
||||
if ( m_Mobile is BaseVendor && from.InRange( m_Mobile, Core.AOS ? 1 : 4 ) && !e.Handled )
|
||||
{
|
||||
if ( e.HasKeyword( 0x14D ) ) // *vendor sell*
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
((BaseVendor)m_Mobile).VendorSell( from );
|
||||
m_Mobile.FocusMob = from;
|
||||
}
|
||||
else if ( e.HasKeyword( 0x3C ) )
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
((BaseVendor)m_Mobile).VendorBuy( from );
|
||||
m_Mobile.FocusMob = from;
|
||||
}
|
||||
else if ( WasNamed( e.Speech ) )
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
if ( e.HasKeyword( 0x177 ) ) // *sell*
|
||||
((BaseVendor)m_Mobile).VendorSell( from );
|
||||
else if ( e.HasKeyword( 0x171 ) ) // *buy*
|
||||
((BaseVendor)m_Mobile).VendorBuy( from );
|
||||
|
||||
m_Mobile.FocusMob = from;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
4792
Scripts/Engines/AI/Creature/BaseCreature.cs
Normal file
4792
Scripts/Engines/AI/Creature/BaseCreature.cs
Normal file
File diff suppressed because it is too large
Load diff
152
Scripts/Engines/AI/Creature/Dummy.cs
Normal file
152
Scripts/Engines/AI/Creature/Dummy.cs
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a test creature
|
||||
/// You can set its value in game
|
||||
/// It die after 5 minutes, so your test server stay clean
|
||||
/// Create a macro to help your creation "[add Dummy 1 15 7 -1 0.5 2"
|
||||
///
|
||||
/// A iTeam of negative will set a faction at random
|
||||
///
|
||||
/// Say Kill if you want them to die
|
||||
///
|
||||
/// </summary>
|
||||
public class Dummy : BaseCreature
|
||||
{
|
||||
public Timer m_Timer;
|
||||
|
||||
[Constructable]
|
||||
public Dummy(AIType iAI, FightMode iFightMode, int iRangePerception, int iRangeFight, double dActiveSpeed, double dPassiveSpeed) : base(iAI, iFightMode, iRangePerception, iRangeFight, dActiveSpeed, dPassiveSpeed)
|
||||
{
|
||||
this.Body = 400 + Utility.Random(2);
|
||||
this.Hue = Utility.RandomSkinHue();
|
||||
|
||||
this.Skills[SkillName.DetectHidden].Base = 100;
|
||||
this.Skills[SkillName.MagicResist].Base = 120;
|
||||
|
||||
Team = Utility.Random(3);
|
||||
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
Utility.AssignRandomHair( this, iHue );
|
||||
|
||||
LeatherGloves glv = new LeatherGloves();
|
||||
glv.Hue = iHue;
|
||||
glv.LootType = LootType.Newbied;
|
||||
AddItem(glv);
|
||||
|
||||
Container pack = new Backpack();
|
||||
|
||||
pack.Movable = false;
|
||||
|
||||
AddItem( pack );
|
||||
|
||||
m_Timer = new AutokillTimer(this);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public Dummy( Serial serial ) : base( serial )
|
||||
{
|
||||
m_Timer = new AutokillTimer(this);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
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 override bool HandlesOnSpeech( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return true;
|
||||
|
||||
return base.HandlesOnSpeech( from );
|
||||
}
|
||||
|
||||
public override void OnSpeech( SpeechEventArgs e )
|
||||
{
|
||||
base.OnSpeech( e );
|
||||
|
||||
if (e.Mobile.AccessLevel >= AccessLevel.GameMaster)
|
||||
{
|
||||
if (e.Speech == "kill")
|
||||
{
|
||||
m_Timer.Stop();
|
||||
m_Timer.Delay = TimeSpan.FromSeconds( Utility.Random(1, 5) );
|
||||
m_Timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnTeamChange()
|
||||
{
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
Item item = FindItemOnLayer( Layer.OuterTorso );
|
||||
|
||||
if ( item != null )
|
||||
item.Hue = jHue;
|
||||
|
||||
item = FindItemOnLayer( Layer.Helm );
|
||||
|
||||
if ( item != null )
|
||||
item.Hue = iHue;
|
||||
|
||||
item = FindItemOnLayer( Layer.Gloves );
|
||||
|
||||
if ( item != null )
|
||||
item.Hue = iHue;
|
||||
|
||||
item = FindItemOnLayer( Layer.Shoes );
|
||||
|
||||
if ( item != null )
|
||||
item.Hue = iHue;
|
||||
|
||||
HairHue = iHue;
|
||||
|
||||
item = FindItemOnLayer( Layer.MiddleTorso );
|
||||
|
||||
if ( item != null )
|
||||
item.Hue = iHue;
|
||||
|
||||
item = FindItemOnLayer( Layer.OuterLegs );
|
||||
|
||||
if ( item != null )
|
||||
item.Hue = iHue;
|
||||
}
|
||||
|
||||
private class AutokillTimer : Timer
|
||||
{
|
||||
private Dummy m_Owner;
|
||||
|
||||
public AutokillTimer( Dummy owner ) : base( TimeSpan.FromMinutes(5.0) )
|
||||
{
|
||||
m_Owner = owner;
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Owner.Kill();
|
||||
Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
814
Scripts/Engines/AI/Creature/DummySpecific.cs
Normal file
814
Scripts/Engines/AI/Creature/DummySpecific.cs
Normal file
|
|
@ -0,0 +1,814 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a test creature
|
||||
/// You can set its value in game
|
||||
/// It die after 5 minutes, so your test server stay clean
|
||||
/// Create a macro to help your creation "[add Dummy 1 15 7 -1 0.5 2"
|
||||
///
|
||||
/// A iTeam of negative will set a faction at random
|
||||
///
|
||||
/// Say Kill if you want them to die
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
public class DummyMace : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummyMace() : base(AIType.AI_Melee, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
// A Dummy Macer
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 125, 125, 90 );
|
||||
this.Skills[SkillName.Macing].Base = 120;
|
||||
this.Skills[SkillName.Anatomy].Base = 120;
|
||||
this.Skills[SkillName.Healing].Base = 120;
|
||||
this.Skills[SkillName.Tactics].Base = 120;
|
||||
|
||||
|
||||
// Name
|
||||
this.Name = "Macer";
|
||||
|
||||
// Equip
|
||||
WarHammer war = new WarHammer();
|
||||
war.Movable = true;
|
||||
war.Crafter = this;
|
||||
war.Quality = WeaponQuality.Regular;
|
||||
AddItem( war );
|
||||
|
||||
Boots bts = new Boots();
|
||||
bts.Hue = iHue;
|
||||
AddItem( bts );
|
||||
|
||||
ChainChest cht = new ChainChest();
|
||||
cht.Movable = false;
|
||||
cht.LootType = LootType.Newbied;
|
||||
cht.Crafter = this;
|
||||
cht.Quality = ArmorQuality.Regular;
|
||||
AddItem( cht );
|
||||
|
||||
ChainLegs chl = new ChainLegs();
|
||||
chl.Movable = false;
|
||||
chl.LootType = LootType.Newbied;
|
||||
chl.Crafter = this;
|
||||
chl.Quality = ArmorQuality.Regular;
|
||||
AddItem( chl );
|
||||
|
||||
PlateArms pla = new PlateArms();
|
||||
pla.Movable = false;
|
||||
pla.LootType = LootType.Newbied;
|
||||
pla.Crafter = this;
|
||||
pla.Quality = ArmorQuality.Regular;
|
||||
AddItem( pla );
|
||||
|
||||
Bandage band = new Bandage( 50 );
|
||||
AddToBackpack( band );
|
||||
}
|
||||
|
||||
public DummyMace( 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 DummyFence : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummyFence() : base(AIType.AI_Melee, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
// A Dummy Fencer
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 125, 125, 90 );
|
||||
this.Skills[SkillName.Fencing].Base = 120;
|
||||
this.Skills[SkillName.Anatomy].Base = 120;
|
||||
this.Skills[SkillName.Healing].Base = 120;
|
||||
this.Skills[SkillName.Tactics].Base = 120;
|
||||
|
||||
// Name
|
||||
this.Name = "Fencer";
|
||||
|
||||
// Equip
|
||||
Spear ssp = new Spear();
|
||||
ssp.Movable = true;
|
||||
ssp.Crafter = this;
|
||||
ssp.Quality = WeaponQuality.Regular;
|
||||
AddItem( ssp );
|
||||
|
||||
Boots snd = new Boots();
|
||||
snd.Hue = iHue;
|
||||
snd.LootType = LootType.Newbied;
|
||||
AddItem( snd );
|
||||
|
||||
ChainChest cht = new ChainChest();
|
||||
cht.Movable = false;
|
||||
cht.LootType = LootType.Newbied;
|
||||
cht.Crafter = this;
|
||||
cht.Quality = ArmorQuality.Regular;
|
||||
AddItem( cht );
|
||||
|
||||
ChainLegs chl = new ChainLegs();
|
||||
chl.Movable = false;
|
||||
chl.LootType = LootType.Newbied;
|
||||
chl.Crafter = this;
|
||||
chl.Quality = ArmorQuality.Regular;
|
||||
AddItem( chl );
|
||||
|
||||
PlateArms pla = new PlateArms();
|
||||
pla.Movable = false;
|
||||
pla.LootType = LootType.Newbied;
|
||||
pla.Crafter = this;
|
||||
pla.Quality = ArmorQuality.Regular;
|
||||
AddItem( pla );
|
||||
|
||||
Bandage band = new Bandage( 50 );
|
||||
AddToBackpack( band );
|
||||
}
|
||||
|
||||
public DummyFence( 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 DummySword : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummySword() : base(AIType.AI_Melee, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
// A Dummy Swordsman
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 125, 125, 90 );
|
||||
this.Skills[SkillName.Swords].Base = 120;
|
||||
this.Skills[SkillName.Anatomy].Base = 120;
|
||||
this.Skills[SkillName.Healing].Base = 120;
|
||||
this.Skills[SkillName.Tactics].Base = 120;
|
||||
this.Skills[SkillName.Parry].Base = 120;
|
||||
|
||||
|
||||
// Name
|
||||
this.Name = "Swordsman";
|
||||
|
||||
// Equip
|
||||
Katana kat = new Katana();
|
||||
kat.Crafter = this;
|
||||
kat.Movable = true;
|
||||
kat.Quality = WeaponQuality.Regular;
|
||||
AddItem( kat );
|
||||
|
||||
Boots bts = new Boots();
|
||||
bts.Hue = iHue;
|
||||
AddItem( bts );
|
||||
|
||||
ChainChest cht = new ChainChest();
|
||||
cht.Movable = false;
|
||||
cht.LootType = LootType.Newbied;
|
||||
cht.Crafter = this;
|
||||
cht.Quality = ArmorQuality.Regular;
|
||||
AddItem( cht );
|
||||
|
||||
ChainLegs chl = new ChainLegs();
|
||||
chl.Movable = false;
|
||||
chl.LootType = LootType.Newbied;
|
||||
chl.Crafter = this;
|
||||
chl.Quality = ArmorQuality.Regular;
|
||||
AddItem( chl );
|
||||
|
||||
PlateArms pla = new PlateArms();
|
||||
pla.Movable = false;
|
||||
pla.LootType = LootType.Newbied;
|
||||
pla.Crafter = this;
|
||||
pla.Quality = ArmorQuality.Regular;
|
||||
AddItem( pla );
|
||||
|
||||
Bandage band = new Bandage( 50 );
|
||||
AddToBackpack( band );
|
||||
}
|
||||
|
||||
public DummySword( 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 DummyNox : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummyNox() : base(AIType.AI_Mage, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
|
||||
// A Dummy Nox or Pure Mage
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 90, 90, 125 );
|
||||
this.Skills[SkillName.Magery].Base = 120;
|
||||
this.Skills[SkillName.EvalInt].Base = 120;
|
||||
this.Skills[SkillName.Inscribe].Base = 100;
|
||||
this.Skills[SkillName.Wrestling].Base = 120;
|
||||
this.Skills[SkillName.Meditation].Base = 120;
|
||||
this.Skills[SkillName.Poisoning].Base = 100;
|
||||
|
||||
|
||||
// Name
|
||||
this.Name = "Nox Mage";
|
||||
|
||||
// Equip
|
||||
Spellbook book = new Spellbook();
|
||||
book.Movable = false;
|
||||
book.LootType = LootType.Newbied;
|
||||
book.Content =0xFFFFFFFFFFFFFFFF;
|
||||
AddItem( book );
|
||||
|
||||
Kilt kilt = new Kilt();
|
||||
kilt.Hue = jHue;
|
||||
AddItem( kilt );
|
||||
|
||||
Sandals snd = new Sandals();
|
||||
snd.Hue = iHue;
|
||||
snd.LootType = LootType.Newbied;
|
||||
AddItem( snd );
|
||||
|
||||
SkullCap skc = new SkullCap();
|
||||
skc.Hue = iHue;
|
||||
AddItem( skc );
|
||||
|
||||
// Spells
|
||||
AddSpellAttack( typeof(Spells.First.MagicArrowSpell) );
|
||||
AddSpellAttack( typeof(Spells.First.WeakenSpell) );
|
||||
AddSpellAttack( typeof(Spells.Third.FireballSpell) );
|
||||
AddSpellDefense( typeof(Spells.Third.WallOfStoneSpell) );
|
||||
AddSpellDefense( typeof(Spells.First.HealSpell) );
|
||||
}
|
||||
|
||||
public DummyNox( 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 DummyStun : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummyStun() : base(AIType.AI_Mage, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
|
||||
// A Dummy Stun Mage
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 90, 90, 125 );
|
||||
this.Skills[SkillName.Magery].Base = 100;
|
||||
this.Skills[SkillName.EvalInt].Base = 120;
|
||||
this.Skills[SkillName.Anatomy].Base = 80;
|
||||
this.Skills[SkillName.Wrestling].Base = 80;
|
||||
this.Skills[SkillName.Meditation].Base = 100;
|
||||
this.Skills[SkillName.Poisoning].Base = 100;
|
||||
|
||||
|
||||
// Name
|
||||
this.Name = "Stun Mage";
|
||||
|
||||
// Equip
|
||||
Spellbook book = new Spellbook();
|
||||
book.Movable = false;
|
||||
book.LootType = LootType.Newbied;
|
||||
book.Content =0xFFFFFFFFFFFFFFFF;
|
||||
AddItem( book );
|
||||
|
||||
LeatherArms lea = new LeatherArms();
|
||||
lea.Movable = false;
|
||||
lea.LootType = LootType.Newbied;
|
||||
lea.Crafter = this;
|
||||
lea.Quality = ArmorQuality.Regular;
|
||||
AddItem( lea );
|
||||
|
||||
LeatherChest lec = new LeatherChest();
|
||||
lec.Movable = false;
|
||||
lec.LootType = LootType.Newbied;
|
||||
lec.Crafter = this;
|
||||
lec.Quality = ArmorQuality.Regular;
|
||||
AddItem( lec );
|
||||
|
||||
LeatherGorget leg = new LeatherGorget();
|
||||
leg.Movable = false;
|
||||
leg.LootType = LootType.Newbied;
|
||||
leg.Crafter = this;
|
||||
leg.Quality = ArmorQuality.Regular;
|
||||
AddItem( leg );
|
||||
|
||||
LeatherLegs lel = new LeatherLegs();
|
||||
lel.Movable = false;
|
||||
lel.LootType = LootType.Newbied;
|
||||
lel.Crafter = this;
|
||||
lel.Quality = ArmorQuality.Regular;
|
||||
AddItem( lel );
|
||||
|
||||
Boots bts = new Boots();
|
||||
bts.Hue = iHue;
|
||||
AddItem( bts );
|
||||
|
||||
Cap cap = new Cap();
|
||||
cap.Hue = iHue;
|
||||
AddItem( cap );
|
||||
|
||||
// Spells
|
||||
AddSpellAttack( typeof(Spells.First.MagicArrowSpell) );
|
||||
AddSpellAttack( typeof(Spells.First.WeakenSpell) );
|
||||
AddSpellAttack( typeof(Spells.Third.FireballSpell) );
|
||||
AddSpellDefense( typeof(Spells.Third.WallOfStoneSpell) );
|
||||
AddSpellDefense( typeof(Spells.First.HealSpell) );
|
||||
}
|
||||
|
||||
public DummyStun( 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 DummySuper : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummySuper() : base(AIType.AI_Mage, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
// A Dummy Super Mage
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 125, 125, 125 );
|
||||
this.Skills[SkillName.Magery].Base = 120;
|
||||
this.Skills[SkillName.EvalInt].Base = 120;
|
||||
this.Skills[SkillName.Anatomy].Base = 120;
|
||||
this.Skills[SkillName.Wrestling].Base = 120;
|
||||
this.Skills[SkillName.Meditation].Base = 120;
|
||||
this.Skills[SkillName.Poisoning].Base = 100;
|
||||
this.Skills[SkillName.Inscribe].Base = 100;
|
||||
|
||||
// Name
|
||||
this.Name = "Super Mage";
|
||||
|
||||
// Equip
|
||||
Spellbook book = new Spellbook();
|
||||
book.Movable = false;
|
||||
book.LootType = LootType.Newbied;
|
||||
book.Content =0xFFFFFFFFFFFFFFFF;
|
||||
AddItem( book );
|
||||
|
||||
LeatherArms lea = new LeatherArms();
|
||||
lea.Movable = false;
|
||||
lea.LootType = LootType.Newbied;
|
||||
lea.Crafter = this;
|
||||
lea.Quality = ArmorQuality.Regular;
|
||||
AddItem( lea );
|
||||
|
||||
LeatherChest lec = new LeatherChest();
|
||||
lec.Movable = false;
|
||||
lec.LootType = LootType.Newbied;
|
||||
lec.Crafter = this;
|
||||
lec.Quality = ArmorQuality.Regular;
|
||||
AddItem( lec );
|
||||
|
||||
LeatherGorget leg = new LeatherGorget();
|
||||
leg.Movable = false;
|
||||
leg.LootType = LootType.Newbied;
|
||||
leg.Crafter = this;
|
||||
leg.Quality = ArmorQuality.Regular;
|
||||
AddItem( leg );
|
||||
|
||||
LeatherLegs lel = new LeatherLegs();
|
||||
lel.Movable = false;
|
||||
lel.LootType = LootType.Newbied;
|
||||
lel.Crafter = this;
|
||||
lel.Quality = ArmorQuality.Regular;
|
||||
AddItem( lel );
|
||||
|
||||
Sandals snd = new Sandals();
|
||||
snd.Hue = iHue;
|
||||
snd.LootType = LootType.Newbied;
|
||||
AddItem( snd );
|
||||
|
||||
JesterHat jhat = new JesterHat();
|
||||
jhat.Hue = iHue;
|
||||
AddItem( jhat );
|
||||
|
||||
Doublet dblt = new Doublet();
|
||||
dblt.Hue = iHue;
|
||||
AddItem( dblt );
|
||||
|
||||
// Spells
|
||||
AddSpellAttack( typeof(Spells.First.MagicArrowSpell) );
|
||||
AddSpellAttack( typeof(Spells.First.WeakenSpell) );
|
||||
AddSpellAttack( typeof(Spells.Third.FireballSpell) );
|
||||
AddSpellDefense( typeof(Spells.Third.WallOfStoneSpell) );
|
||||
AddSpellDefense( typeof(Spells.First.HealSpell) );
|
||||
}
|
||||
|
||||
public DummySuper( 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 DummyHealer : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummyHealer() : base(AIType.AI_Healer, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
// A Dummy Healer Mage
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 125, 125, 125 );
|
||||
this.Skills[SkillName.Magery].Base = 120;
|
||||
this.Skills[SkillName.EvalInt].Base = 120;
|
||||
this.Skills[SkillName.Anatomy].Base = 120;
|
||||
this.Skills[SkillName.Wrestling].Base = 120;
|
||||
this.Skills[SkillName.Meditation].Base = 120;
|
||||
this.Skills[SkillName.Healing].Base = 100;
|
||||
|
||||
// Name
|
||||
this.Name = "Healer";
|
||||
|
||||
// Equip
|
||||
Spellbook book = new Spellbook();
|
||||
book.Movable = false;
|
||||
book.LootType = LootType.Newbied;
|
||||
book.Content =0xFFFFFFFFFFFFFFFF;
|
||||
AddItem( book );
|
||||
|
||||
LeatherArms lea = new LeatherArms();
|
||||
lea.Movable = false;
|
||||
lea.LootType = LootType.Newbied;
|
||||
lea.Crafter = this;
|
||||
lea.Quality = ArmorQuality.Regular;
|
||||
AddItem( lea );
|
||||
|
||||
LeatherChest lec = new LeatherChest();
|
||||
lec.Movable = false;
|
||||
lec.LootType = LootType.Newbied;
|
||||
lec.Crafter = this;
|
||||
lec.Quality = ArmorQuality.Regular;
|
||||
AddItem( lec );
|
||||
|
||||
LeatherGorget leg = new LeatherGorget();
|
||||
leg.Movable = false;
|
||||
leg.LootType = LootType.Newbied;
|
||||
leg.Crafter = this;
|
||||
leg.Quality = ArmorQuality.Regular;
|
||||
AddItem( leg );
|
||||
|
||||
LeatherLegs lel = new LeatherLegs();
|
||||
lel.Movable = false;
|
||||
lel.LootType = LootType.Newbied;
|
||||
lel.Crafter = this;
|
||||
lel.Quality = ArmorQuality.Regular;
|
||||
AddItem( lel );
|
||||
|
||||
Sandals snd = new Sandals();
|
||||
snd.Hue = iHue;
|
||||
snd.LootType = LootType.Newbied;
|
||||
AddItem( snd );
|
||||
|
||||
Cap cap = new Cap();
|
||||
cap.Hue = iHue;
|
||||
AddItem( cap );
|
||||
|
||||
Robe robe = new Robe();
|
||||
robe.Hue = iHue;
|
||||
AddItem( robe );
|
||||
|
||||
}
|
||||
|
||||
public DummyHealer( 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 DummyAssassin : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummyAssassin() : base(AIType.AI_Melee, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
// A Dummy Hybrid Assassin
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 105, 105, 105 );
|
||||
this.Skills[SkillName.Magery].Base = 120;
|
||||
this.Skills[SkillName.EvalInt].Base = 120;
|
||||
this.Skills[SkillName.Swords].Base = 120;
|
||||
this.Skills[SkillName.Tactics].Base = 120;
|
||||
this.Skills[SkillName.Meditation].Base = 120;
|
||||
this.Skills[SkillName.Poisoning].Base = 100;
|
||||
|
||||
// Name
|
||||
this.Name = "Hybrid Assassin";
|
||||
|
||||
// Equip
|
||||
Spellbook book = new Spellbook();
|
||||
book.Movable = false;
|
||||
book.LootType = LootType.Newbied;
|
||||
book.Content =0xFFFFFFFFFFFFFFFF;
|
||||
AddToBackpack( book );
|
||||
|
||||
Katana kat = new Katana();
|
||||
kat.Movable = false;
|
||||
kat.LootType = LootType.Newbied;
|
||||
kat.Crafter = this;
|
||||
kat.Poison = Poison.Deadly;
|
||||
kat.PoisonCharges = 12;
|
||||
kat.Quality = WeaponQuality.Regular;
|
||||
AddToBackpack( kat );
|
||||
|
||||
LeatherArms lea = new LeatherArms();
|
||||
lea.Movable = false;
|
||||
lea.LootType = LootType.Newbied;
|
||||
lea.Crafter = this;
|
||||
lea.Quality = ArmorQuality.Regular;
|
||||
AddItem( lea );
|
||||
|
||||
LeatherChest lec = new LeatherChest();
|
||||
lec.Movable = false;
|
||||
lec.LootType = LootType.Newbied;
|
||||
lec.Crafter = this;
|
||||
lec.Quality = ArmorQuality.Regular;
|
||||
AddItem( lec );
|
||||
|
||||
LeatherGorget leg = new LeatherGorget();
|
||||
leg.Movable = false;
|
||||
leg.LootType = LootType.Newbied;
|
||||
leg.Crafter = this;
|
||||
leg.Quality = ArmorQuality.Regular;
|
||||
AddItem( leg );
|
||||
|
||||
LeatherLegs lel = new LeatherLegs();
|
||||
lel.Movable = false;
|
||||
lel.LootType = LootType.Newbied;
|
||||
lel.Crafter = this;
|
||||
lel.Quality = ArmorQuality.Regular;
|
||||
AddItem( lel );
|
||||
|
||||
Sandals snd = new Sandals();
|
||||
snd.Hue = iHue;
|
||||
snd.LootType = LootType.Newbied;
|
||||
AddItem( snd );
|
||||
|
||||
Cap cap = new Cap();
|
||||
cap.Hue = iHue;
|
||||
AddItem( cap );
|
||||
|
||||
Robe robe = new Robe();
|
||||
robe.Hue = iHue;
|
||||
AddItem( robe );
|
||||
|
||||
DeadlyPoisonPotion pota = new DeadlyPoisonPotion();
|
||||
pota.LootType = LootType.Newbied;
|
||||
AddToBackpack( pota );
|
||||
|
||||
DeadlyPoisonPotion potb = new DeadlyPoisonPotion();
|
||||
potb.LootType = LootType.Newbied;
|
||||
AddToBackpack( potb );
|
||||
|
||||
DeadlyPoisonPotion potc = new DeadlyPoisonPotion();
|
||||
potc.LootType = LootType.Newbied;
|
||||
AddToBackpack( potc );
|
||||
|
||||
DeadlyPoisonPotion potd = new DeadlyPoisonPotion();
|
||||
potd.LootType = LootType.Newbied;
|
||||
AddToBackpack( potd );
|
||||
|
||||
Bandage band = new Bandage( 50 );
|
||||
AddToBackpack( band );
|
||||
|
||||
}
|
||||
|
||||
public DummyAssassin( 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 DummyTheif : Dummy
|
||||
{
|
||||
|
||||
[Constructable]
|
||||
public DummyTheif() : base(AIType.AI_Thief, FightMode.Closest, 15, 1, 0.2, 0.6)
|
||||
{
|
||||
// A Dummy Hybrid Theif
|
||||
int iHue = 20 + Team * 40;
|
||||
int jHue = 25 + Team * 40;
|
||||
|
||||
// Skills and Stats
|
||||
this.InitStats( 105, 105, 105 );
|
||||
this.Skills[SkillName.Healing].Base = 120;
|
||||
this.Skills[SkillName.Anatomy].Base = 120;
|
||||
this.Skills[SkillName.Stealing].Base = 120;
|
||||
this.Skills[SkillName.ArmsLore].Base = 100;
|
||||
this.Skills[SkillName.Meditation].Base = 120;
|
||||
this.Skills[SkillName.Wrestling].Base = 120;
|
||||
|
||||
// Name
|
||||
this.Name = "Hybrid Theif";
|
||||
|
||||
// Equip
|
||||
Spellbook book = new Spellbook();
|
||||
book.Movable = false;
|
||||
book.LootType = LootType.Newbied;
|
||||
book.Content =0xFFFFFFFFFFFFFFFF;
|
||||
AddItem( book );
|
||||
|
||||
LeatherArms lea = new LeatherArms();
|
||||
lea.Movable = false;
|
||||
lea.LootType = LootType.Newbied;
|
||||
lea.Crafter = this;
|
||||
lea.Quality = ArmorQuality.Regular;
|
||||
AddItem( lea );
|
||||
|
||||
LeatherChest lec = new LeatherChest();
|
||||
lec.Movable = false;
|
||||
lec.LootType = LootType.Newbied;
|
||||
lec.Crafter = this;
|
||||
lec.Quality = ArmorQuality.Regular;
|
||||
AddItem( lec );
|
||||
|
||||
LeatherGorget leg = new LeatherGorget();
|
||||
leg.Movable = false;
|
||||
leg.LootType = LootType.Newbied;
|
||||
leg.Crafter = this;
|
||||
leg.Quality = ArmorQuality.Regular;
|
||||
AddItem( leg );
|
||||
|
||||
LeatherLegs lel = new LeatherLegs();
|
||||
lel.Movable = false;
|
||||
lel.LootType = LootType.Newbied;
|
||||
lel.Crafter = this;
|
||||
lel.Quality = ArmorQuality.Regular;
|
||||
AddItem( lel );
|
||||
|
||||
Sandals snd = new Sandals();
|
||||
snd.Hue = iHue;
|
||||
snd.LootType = LootType.Newbied;
|
||||
AddItem( snd );
|
||||
|
||||
Cap cap = new Cap();
|
||||
cap.Hue = iHue;
|
||||
AddItem( cap );
|
||||
|
||||
Robe robe = new Robe();
|
||||
robe.Hue = iHue;
|
||||
AddItem( robe );
|
||||
|
||||
Bandage band = new Bandage( 50 );
|
||||
AddToBackpack( band );
|
||||
}
|
||||
|
||||
public DummyTheif( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
140
Scripts/Engines/AI/Creature/OppositionGroup.cs
Normal file
140
Scripts/Engines/AI/Creature/OppositionGroup.cs
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class OppositionGroup
|
||||
{
|
||||
private Type[][] m_Types;
|
||||
|
||||
public OppositionGroup( Type[][] types )
|
||||
{
|
||||
m_Types = types;
|
||||
}
|
||||
|
||||
public bool IsEnemy( object from, object target )
|
||||
{
|
||||
int fromGroup = IndexOf( from );
|
||||
int targGroup = IndexOf( target );
|
||||
|
||||
return ( fromGroup != -1 && targGroup != -1 && fromGroup != targGroup );
|
||||
}
|
||||
|
||||
public int IndexOf( object obj )
|
||||
{
|
||||
if ( obj == null )
|
||||
return -1;
|
||||
|
||||
Type type = obj.GetType();
|
||||
|
||||
for ( int i = 0; i < m_Types.Length; ++i )
|
||||
{
|
||||
Type[] group = m_Types[i];
|
||||
|
||||
bool contains = false;
|
||||
|
||||
for ( int j = 0; !contains && j < group.Length; ++j )
|
||||
contains = ( type == group[j] );
|
||||
|
||||
if ( contains )
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static OppositionGroup m_TerathansAndOphidians = new OppositionGroup( new Type[][]
|
||||
{
|
||||
new Type[]
|
||||
{
|
||||
typeof( TerathanAvenger ),
|
||||
typeof( TerathanDrone ),
|
||||
typeof( TerathanMatriarch ),
|
||||
typeof( TerathanWarrior )
|
||||
},
|
||||
new Type[]
|
||||
{
|
||||
typeof( OphidianArchmage ),
|
||||
typeof( OphidianKnight ),
|
||||
typeof( OphidianMage ),
|
||||
typeof( OphidianMatriarch ),
|
||||
typeof( OphidianWarrior )
|
||||
}
|
||||
} );
|
||||
|
||||
public static OppositionGroup TerathansAndOphidians
|
||||
{
|
||||
get{ return m_TerathansAndOphidians; }
|
||||
}
|
||||
|
||||
private static OppositionGroup m_SavagesAndOrcs = new OppositionGroup( new Type[][]
|
||||
{
|
||||
new Type[]
|
||||
{
|
||||
typeof( Orc ),
|
||||
typeof( OrcBomber ),
|
||||
typeof( OrcBrute ),
|
||||
typeof( OrcCaptain ),
|
||||
typeof( OrcishLord ),
|
||||
typeof( OrcishMage ),
|
||||
typeof( SpawnedOrcishLord )
|
||||
},
|
||||
new Type[]
|
||||
{
|
||||
typeof( Savage ),
|
||||
typeof( SavageRider ),
|
||||
typeof( SavageRidgeback ),
|
||||
typeof( SavageShaman )
|
||||
}
|
||||
} );
|
||||
|
||||
public static OppositionGroup SavagesAndOrcs
|
||||
{
|
||||
get{ return m_SavagesAndOrcs; }
|
||||
}
|
||||
|
||||
private static OppositionGroup m_FeyAndUndead = new OppositionGroup( new Type[][]
|
||||
{
|
||||
new Type[]
|
||||
{
|
||||
typeof( Centaur ),
|
||||
typeof( EtherealWarrior ),
|
||||
typeof( Kirin ),
|
||||
typeof( LordOaks ),
|
||||
typeof( Pixie ),
|
||||
typeof( Silvani ),
|
||||
typeof( Unicorn ),
|
||||
typeof( Wisp ),
|
||||
typeof( Treefellow )
|
||||
},
|
||||
new Type[]
|
||||
{
|
||||
typeof( AncientLich ),
|
||||
typeof( Bogle ),
|
||||
typeof( LichLord ),
|
||||
typeof( Shade ),
|
||||
typeof( Spectre ),
|
||||
typeof( Wraith ),
|
||||
typeof( BoneKnight ),
|
||||
typeof( Ghoul ),
|
||||
typeof( Mummy ),
|
||||
typeof( SkeletalKnight ),
|
||||
typeof( Skeleton ),
|
||||
typeof( Zombie ),
|
||||
typeof( ShadowKnight ),
|
||||
typeof( DarknightCreeper ),
|
||||
typeof( RevenantLion ),
|
||||
typeof( LadyOfTheSnow ),
|
||||
typeof( RottingCorpse ),
|
||||
typeof( SkeletalDragon ),
|
||||
typeof( Lich )
|
||||
}
|
||||
} );
|
||||
|
||||
public static OppositionGroup FeyAndUndead
|
||||
{
|
||||
get{ return m_FeyAndUndead; }
|
||||
}
|
||||
}
|
||||
}
|
||||
182
Scripts/Engines/AI/Creature/Paragon.cs
Normal file
182
Scripts/Engines/AI/Creature/Paragon.cs
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class Paragon
|
||||
{
|
||||
public static double ChestChance = .10; // Chance that a paragon will carry a paragon chest
|
||||
public static Map[] Maps = new Map[] // Maps that paragons will spawn on
|
||||
{
|
||||
Map.Ilshenar
|
||||
};
|
||||
|
||||
public static Type[] Artifacts = new Type[]
|
||||
{
|
||||
typeof( GoldBricks ), typeof( PhillipsWoodenSteed ),
|
||||
typeof( AlchemistsBauble ), typeof( ArcticDeathDealer ),
|
||||
typeof( BlazeOfDeath ), typeof( BowOfTheJukaKing ),
|
||||
typeof( BurglarsBandana ), typeof( CavortingClub ),
|
||||
typeof( EnchantedTitanLegBone ), typeof( GwennosHarp ),
|
||||
typeof( IolosLute ), typeof( LunaLance ),
|
||||
typeof( NightsKiss ), typeof( NoxRangersHeavyCrossbow ),
|
||||
typeof( OrcishVisage ), typeof( PolarBearMask ),
|
||||
typeof( ShieldOfInvulnerability ), typeof( StaffOfPower ),
|
||||
typeof( VioletCourage ), typeof( HeartOfTheLion ),
|
||||
typeof( WrathOfTheDryad ), typeof( PixieSwatter ),
|
||||
typeof( GlovesOfThePugilist )
|
||||
};
|
||||
|
||||
public static int Hue = 0x501; // Paragon hue
|
||||
|
||||
// Buffs
|
||||
public static double HitsBuff = 5.0;
|
||||
public static double StrBuff = 1.05;
|
||||
public static double IntBuff = 1.20;
|
||||
public static double DexBuff = 1.20;
|
||||
public static double SkillsBuff = 1.20;
|
||||
public static double SpeedBuff = 1.20;
|
||||
public static double FameBuff = 1.40;
|
||||
public static double KarmaBuff = 1.40;
|
||||
public static int DamageBuff = 5;
|
||||
|
||||
public static void Convert( BaseCreature bc )
|
||||
{
|
||||
if ( bc.IsParagon )
|
||||
return;
|
||||
|
||||
bc.Hue = Hue;
|
||||
|
||||
if ( bc.HitsMaxSeed >= 0 )
|
||||
bc.HitsMaxSeed = (int)( bc.HitsMaxSeed * HitsBuff );
|
||||
|
||||
bc.RawStr = (int)( bc.RawStr * StrBuff );
|
||||
bc.RawInt = (int)( bc.RawInt * IntBuff );
|
||||
bc.RawDex = (int)( bc.RawDex * DexBuff );
|
||||
|
||||
bc.Hits = bc.HitsMax;
|
||||
bc.Mana = bc.ManaMax;
|
||||
bc.Stam = bc.StamMax;
|
||||
|
||||
for( int i = 0; i < bc.Skills.Length; i++ )
|
||||
{
|
||||
Skill skill = (Skill)bc.Skills[i];
|
||||
|
||||
if ( skill.Base > 0.0 )
|
||||
skill.Base *= SkillsBuff;
|
||||
}
|
||||
|
||||
bc.PassiveSpeed /= SpeedBuff;
|
||||
bc.ActiveSpeed /= SpeedBuff;
|
||||
|
||||
bc.DamageMin += DamageBuff;
|
||||
bc.DamageMax += DamageBuff;
|
||||
|
||||
if ( bc.Fame > 0 )
|
||||
bc.Fame = (int)( bc.Fame * FameBuff );
|
||||
|
||||
if ( bc.Fame > 32000 )
|
||||
bc.Fame = 32000;
|
||||
|
||||
// TODO: Mana regeneration rate = Sqrt( buffedFame ) / 4
|
||||
|
||||
if ( bc.Karma != 0 )
|
||||
{
|
||||
bc.Karma = (int)( bc.Karma * KarmaBuff );
|
||||
|
||||
if( Math.Abs( bc.Karma ) > 32000 )
|
||||
bc.Karma = 32000 * Math.Sign( bc.Karma );
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnConvert( BaseCreature bc )
|
||||
{
|
||||
if ( !bc.IsParagon )
|
||||
return;
|
||||
|
||||
bc.Hue = 0;
|
||||
|
||||
if ( bc.HitsMaxSeed >= 0 )
|
||||
bc.HitsMaxSeed = (int)( bc.HitsMaxSeed / HitsBuff );
|
||||
|
||||
bc.RawStr = (int)( bc.RawStr / StrBuff );
|
||||
bc.RawInt = (int)( bc.RawInt / IntBuff );
|
||||
bc.RawDex = (int)( bc.RawDex / DexBuff );
|
||||
|
||||
bc.Hits = bc.HitsMax;
|
||||
bc.Mana = bc.ManaMax;
|
||||
bc.Stam = bc.StamMax;
|
||||
|
||||
for( int i = 0; i < bc.Skills.Length; i++ )
|
||||
{
|
||||
Skill skill = (Skill)bc.Skills[i];
|
||||
|
||||
if ( skill.Base > 0.0 )
|
||||
skill.Base /= SkillsBuff;
|
||||
}
|
||||
|
||||
bc.PassiveSpeed *= SpeedBuff;
|
||||
bc.ActiveSpeed *= SpeedBuff;
|
||||
|
||||
bc.DamageMin -= DamageBuff;
|
||||
bc.DamageMax -= DamageBuff;
|
||||
|
||||
if ( bc.Fame > 0 )
|
||||
bc.Fame = (int)( bc.Fame / FameBuff );
|
||||
if ( bc.Karma != 0 )
|
||||
bc.Karma = (int)( bc.Karma / KarmaBuff );
|
||||
}
|
||||
|
||||
public static bool CheckConvert( BaseCreature bc )
|
||||
{
|
||||
return CheckConvert( bc, bc.Location, bc.Map );
|
||||
}
|
||||
|
||||
public static bool CheckConvert( BaseCreature bc, Point3D location, Map m )
|
||||
{
|
||||
if ( !Core.AOS )
|
||||
return false;
|
||||
|
||||
if ( Array.IndexOf( Maps, m ) == -1 )
|
||||
return false;
|
||||
|
||||
if ( bc is BaseChampion || bc is Harrower || bc is BaseVendor || bc is BaseEscortable || bc is Clone )
|
||||
return false;
|
||||
|
||||
int fame = bc.Fame;
|
||||
|
||||
if ( fame > 32000 )
|
||||
fame = 32000;
|
||||
|
||||
double chance = 1 / Math.Round( 20.0 - ( fame / 3200 ));
|
||||
|
||||
return ( chance > Utility.RandomDouble() );
|
||||
}
|
||||
|
||||
public static bool CheckArtifactChance( Mobile m, BaseCreature bc )
|
||||
{
|
||||
if ( !Core.AOS )
|
||||
return false;
|
||||
|
||||
double fame = (double)bc.Fame;
|
||||
|
||||
if ( fame > 32000 )
|
||||
fame = 32000;
|
||||
|
||||
double chance = 1 / ( Math.Max( 10, 100 * ( 0.83 - Math.Round( Math.Log( Math.Round( fame / 6000, 3 ) + 0.001, 10 ), 3 ) ) ) * ( 100 - Math.Sqrt( m.Luck ) ) / 100.0 );
|
||||
|
||||
return chance > Utility.RandomDouble();
|
||||
}
|
||||
|
||||
public static void GiveArtifactTo( Mobile m )
|
||||
{
|
||||
Item item = (Item)Activator.CreateInstance( Artifacts[Utility.Random(Artifacts.Length)] );
|
||||
|
||||
if ( m.AddToBackpack( item ) )
|
||||
m.SendMessage( "As a reward for slaying the mighty paragon, an artifact has been placed in your backpack." );
|
||||
else
|
||||
m.SendMessage( "As your backpack is full, your reward for destroying the legendary paragon has been placed at your feet." );
|
||||
}
|
||||
}
|
||||
}
|
||||
213
Scripts/Engines/AI/Creature/SpeedInfo.cs
Normal file
213
Scripts/Engines/AI/Creature/SpeedInfo.cs
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public class SpeedInfo
|
||||
{
|
||||
// Should we use the new method of speeds?
|
||||
private static bool Enabled = true;
|
||||
|
||||
private double m_ActiveSpeed;
|
||||
private double m_PassiveSpeed;
|
||||
private Type[] m_Types;
|
||||
|
||||
public double ActiveSpeed
|
||||
{
|
||||
get{ return m_ActiveSpeed; }
|
||||
set{ m_ActiveSpeed = value; }
|
||||
}
|
||||
|
||||
public double PassiveSpeed
|
||||
{
|
||||
get{ return m_PassiveSpeed; }
|
||||
set{ m_PassiveSpeed = value; }
|
||||
}
|
||||
|
||||
public Type[] Types
|
||||
{
|
||||
get{ return m_Types; }
|
||||
set{ m_Types = value; }
|
||||
}
|
||||
|
||||
public SpeedInfo( double activeSpeed, double passiveSpeed, Type[] types )
|
||||
{
|
||||
m_ActiveSpeed = activeSpeed;
|
||||
m_PassiveSpeed = passiveSpeed;
|
||||
m_Types = types;
|
||||
}
|
||||
|
||||
public static bool Contains( object obj )
|
||||
{
|
||||
if ( !Enabled )
|
||||
return false;
|
||||
|
||||
if ( m_Table == null )
|
||||
LoadTable();
|
||||
|
||||
SpeedInfo sp = (SpeedInfo)m_Table[obj.GetType()];
|
||||
|
||||
return ( sp != null );
|
||||
}
|
||||
|
||||
public static bool GetSpeeds( object obj, ref double activeSpeed, ref double passiveSpeed )
|
||||
{
|
||||
if ( !Enabled )
|
||||
return false;
|
||||
|
||||
if ( m_Table == null )
|
||||
LoadTable();
|
||||
|
||||
SpeedInfo sp = (SpeedInfo)m_Table[obj.GetType()];
|
||||
|
||||
if ( sp == null )
|
||||
return false;
|
||||
|
||||
activeSpeed = sp.ActiveSpeed;
|
||||
passiveSpeed = sp.PassiveSpeed;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void LoadTable()
|
||||
{
|
||||
m_Table = new Hashtable();
|
||||
|
||||
for ( int i = 0; i < m_Speeds.Length; ++i )
|
||||
{
|
||||
SpeedInfo info = m_Speeds[i];
|
||||
Type[] types = info.Types;
|
||||
|
||||
for ( int j = 0; j < types.Length; ++j )
|
||||
m_Table[types[j]] = info;
|
||||
}
|
||||
}
|
||||
|
||||
private static Hashtable m_Table;
|
||||
|
||||
private static SpeedInfo[] m_Speeds = new SpeedInfo[]
|
||||
{
|
||||
/* Slow */
|
||||
new SpeedInfo( 0.3, 0.6, new Type[]
|
||||
{
|
||||
typeof( AntLion ), typeof( ArcticOgreLord ), typeof( BogThing ),
|
||||
typeof( Bogle ), typeof( BoneKnight ), typeof( EarthElemental ),
|
||||
typeof( Ettin ), typeof( FrostOoze ), typeof( FrostTroll ),
|
||||
typeof( GazerLarva ), typeof( Ghoul ), typeof( Golem ),
|
||||
typeof( HeadlessOne ), typeof( Jwilson ), typeof( Mummy ),
|
||||
typeof( Ogre ), typeof( OgreLord ), typeof( PlagueBeast ),
|
||||
typeof( Quagmire ), typeof( Rat ), typeof( RottingCorpse ),
|
||||
typeof( Sewerrat ), typeof( Skeleton ), typeof( Slime ),
|
||||
typeof( Zombie ), typeof( Walrus ), typeof( RestlessSoul ),
|
||||
typeof( CrystalElemental ), typeof( DarknightCreeper ), typeof( MoundOfMaggots ),
|
||||
typeof( Juggernaut ), typeof( Yamandon ), typeof( Serado )
|
||||
} ),
|
||||
/* Fast */
|
||||
new SpeedInfo( 0.2, 0.4, new Type[]
|
||||
{
|
||||
typeof( LordOaks ), typeof( Silvani ), typeof( AirElemental ),
|
||||
typeof( AncientWyrm ), typeof( Balron ), typeof( BladeSpirits ),
|
||||
typeof( DreadSpider ), typeof( Efreet ), typeof( EtherealWarrior ),
|
||||
typeof( Lich ), typeof( Nightmare ), typeof( OphidianArchmage ),
|
||||
typeof( OphidianMage ), typeof( OphidianWarrior ), typeof( OphidianMatriarch ),
|
||||
typeof( OphidianKnight ), typeof( PoisonElemental ), typeof( Revenant ),
|
||||
typeof( SandVortex ), typeof( SavageRider ), typeof( SavageShaman ),
|
||||
typeof( SnowElemental ), typeof( WhiteWyrm ), typeof( Wisp ),
|
||||
typeof( DemonKnight ), typeof( GiantBlackWidow ), typeof( SummonedAirElemental ),
|
||||
typeof( LesserHiryu ), typeof( Hiryu ), typeof( LadyOfTheSnow ),
|
||||
typeof( RaiJu ), typeof( Ronin )
|
||||
} ),
|
||||
/* Very Fast */
|
||||
new SpeedInfo( 0.175, 0.350, new Type[]
|
||||
{
|
||||
typeof( Barracoon ), typeof( Mephitis ), typeof( Neira ),
|
||||
typeof( Rikktor ), typeof( Semidar ), typeof( EnergyVortex ),
|
||||
typeof( Beetle ), typeof( Pixie ), typeof( SilverSerpent ),
|
||||
typeof( VorpalBunny ), typeof( FleshRenderer ), typeof( KhaldunRevenant ),
|
||||
typeof( FactionDragoon ), typeof( FactionKnight ), typeof( FactionPaladin ),
|
||||
typeof( FactionHenchman ), typeof( FactionMercenary ), typeof( FactionNecromancer ),
|
||||
typeof( FactionSorceress ), typeof( FactionWizard ), typeof( FactionBerserker ),
|
||||
typeof( FactionPaladin ), typeof( Leviathan ), typeof( FireBeetle ),
|
||||
typeof( FanDancer ), typeof( EliteNinja )
|
||||
} ),
|
||||
/* Medium */
|
||||
new SpeedInfo( 0.25, 0.5, new Type[]
|
||||
{
|
||||
typeof( ToxicElemental ), typeof( AgapiteElemental ), typeof( Alligator ),
|
||||
typeof( AncientLich ), typeof( Betrayer ), typeof( Bird ),
|
||||
typeof( BlackBear ), typeof( BlackSolenInfiltratorQueen ), typeof( BlackSolenInfiltratorWarrior ),
|
||||
typeof( BlackSolenQueen ), typeof( BlackSolenWarrior ), typeof( BlackSolenWorker ),
|
||||
typeof( BloodElemental ), typeof( Boar ), typeof( Bogling ),
|
||||
typeof( BoneMagi ), typeof( Brigand ), typeof( BronzeElemental ),
|
||||
typeof( BrownBear ), typeof( Bull ), typeof( BullFrog ),
|
||||
typeof( Cat ), typeof( Centaur ), typeof( ChaosDaemon ),
|
||||
typeof( Chicken ), typeof( GolemController ), typeof( CopperElemental ),
|
||||
typeof( CopperElemental ), typeof( Cougar ), typeof( Cow ),
|
||||
typeof( Cyclops ), typeof( Daemon ), typeof( DeepSeaSerpent ),
|
||||
typeof( DesertOstard ), typeof( DireWolf ), typeof( Dog ),
|
||||
typeof( Dolphin ), typeof( Dragon ), typeof( Drake ),
|
||||
typeof( DullCopperElemental ), typeof( Eagle ), typeof( ElderGazer ),
|
||||
typeof( EvilMage ), typeof( EvilMageLord ), typeof( Executioner ),
|
||||
typeof( Savage ), typeof( FireElemental ), typeof( FireGargoyle ),
|
||||
typeof( FireSteed ), typeof( ForestOstard ), typeof( FrenziedOstard ),
|
||||
typeof( FrostSpider ), typeof( Gargoyle ), typeof( Gazer ),
|
||||
typeof( IceSerpent ), typeof( GiantRat ), typeof( GiantSerpent ),
|
||||
typeof( GiantSpider ), typeof( GiantToad ), typeof( Goat ),
|
||||
typeof( GoldenElemental ), typeof( Gorilla ), typeof( GreatHart ),
|
||||
typeof( GreyWolf ), typeof( GrizzlyBear ), typeof( Guardian ),
|
||||
typeof( Harpy ), typeof( Harrower ), typeof( HellHound ),
|
||||
typeof( Hind ), typeof( HordeMinion ), typeof( Horse ),
|
||||
typeof( Horse ), typeof( IceElemental ), typeof( IceFiend ),
|
||||
typeof( IceSnake ), typeof( Imp ), typeof( JackRabbit ),
|
||||
typeof( Kirin ), typeof( Kraken ), typeof( PredatorHellCat ),
|
||||
typeof( LavaLizard ), typeof( LavaSerpent ), typeof( LavaSnake ),
|
||||
typeof( Lizardman ), typeof( Llama ), typeof( Mongbat ),
|
||||
typeof( StrongMongbat ), typeof( MountainGoat ), typeof( Orc ),
|
||||
typeof( OrcBomber ), typeof( OrcBrute ), typeof( OrcCaptain ),
|
||||
typeof( OrcishLord ), typeof( OrcishMage ), typeof( PackHorse ),
|
||||
typeof( PackLlama ), typeof( Panther ), typeof( Pig ),
|
||||
typeof( PlagueSpawn ), typeof( PolarBear ), typeof( Rabbit ),
|
||||
typeof( Ratman ), typeof( RatmanArcher ), typeof( RatmanMage ),
|
||||
typeof( RedSolenInfiltratorQueen ), typeof( RedSolenInfiltratorWarrior ), typeof( RedSolenQueen ),
|
||||
typeof( RedSolenWarrior ), typeof( RedSolenWorker ), typeof( RidableLlama ),
|
||||
typeof( Ridgeback ), typeof( Scorpion ), typeof( SeaSerpent ),
|
||||
typeof( SerpentineDragon ), typeof( Shade ), typeof( ShadowIronElemental ),
|
||||
typeof( ShadowWisp ), typeof( ShadowWyrm ), typeof( Sheep ),
|
||||
typeof( SilverSteed ), typeof( SkeletalDragon ), typeof( SkeletalMage ),
|
||||
typeof( SkeletalMount ), typeof( HellCat ), typeof( Snake ),
|
||||
typeof( SnowLeopard ), typeof( SpectralArmour ), typeof( Spectre ),
|
||||
typeof( StoneGargoyle ), typeof( StoneHarpy ), typeof( SwampDragon ),
|
||||
typeof( ScaledSwampDragon ), typeof( SwampTentacle ), typeof( TerathanAvenger ),
|
||||
typeof( TerathanDrone ), typeof( TerathanMatriarch ), typeof( TerathanWarrior ),
|
||||
typeof( TimberWolf ), typeof( Titan ), typeof( Troll ),
|
||||
typeof( Unicorn ), typeof( ValoriteElemental ), typeof( VeriteElemental ),
|
||||
typeof( CoMWarHorse ), typeof( MinaxWarHorse ), typeof( SLWarHorse ),
|
||||
typeof( TBWarHorse ), typeof( WaterElemental ), typeof( WhippingVine ),
|
||||
typeof( WhiteWolf ), typeof( Wraith ), typeof( Wyvern ),
|
||||
typeof( KhaldunZealot ), typeof( KhaldunSummoner ), typeof( SavageRidgeback ),
|
||||
typeof( LichLord ), typeof( SkeletalKnight ), typeof( SummonedDaemon ),
|
||||
typeof( SummonedEarthElemental ), typeof( SummonedWaterElemental ), typeof( SummonedFireElemental ),
|
||||
typeof( MeerWarrior ), typeof( MeerEternal ), typeof( MeerMage ),
|
||||
typeof( MeerCaptain ), typeof( JukaLord ), typeof( JukaMage ),
|
||||
typeof( JukaWarrior ), typeof( AbysmalHorror ), typeof( BoneDemon ),
|
||||
typeof( Devourer ), typeof( FleshGolem ), typeof( Gibberling ),
|
||||
typeof( GoreFiend ), typeof( Impaler ), typeof( PatchworkSkeleton ),
|
||||
typeof( Ravager ), typeof( ShadowKnight ), typeof( SkitteringHopper ),
|
||||
typeof( Treefellow ), typeof( VampireBat ), typeof( WailingBanshee ),
|
||||
typeof( WandererOfTheVoid ), typeof( Cursed ), typeof( GrimmochDrummel ),
|
||||
typeof( LysanderGathenwale ), typeof( MorgBergen ), typeof( ShadowFiend ),
|
||||
typeof( SpectralArmour ), typeof( TavaraSewel ), typeof( ArcaneDaemon ),
|
||||
typeof( Doppleganger ), typeof( EnslavedGargoyle ), typeof( ExodusMinion ),
|
||||
typeof( ExodusOverseer ), typeof( GargoyleDestroyer ), typeof( GargoyleEnforcer ),
|
||||
typeof( Moloch ), typeof( BakeKitsune ), typeof( DeathwatchBeetleHatchling ),
|
||||
typeof( Kappa ), typeof( KazeKemono ), typeof( DeathwatchBeetle ),
|
||||
typeof( TsukiWolf ), typeof( YomotsuElder ), typeof( YomotsuPriest ),
|
||||
typeof( YomotsuWarrior ), typeof( RevenantLion ), typeof( Oni ),
|
||||
typeof( RuneBeetle ), typeof( Gaman ), typeof( Crane )
|
||||
} )
|
||||
};
|
||||
}
|
||||
}
|
||||
45
Scripts/Engines/AI/Targets/AIControlMobileTarget.cs
Normal file
45
Scripts/Engines/AI/Targets/AIControlMobileTarget.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Mobiles;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Targets
|
||||
{
|
||||
public class AIControlMobileTarget : Target
|
||||
{
|
||||
private ArrayList m_List;
|
||||
private OrderType m_Order;
|
||||
|
||||
public OrderType Order
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Order;
|
||||
}
|
||||
}
|
||||
|
||||
public AIControlMobileTarget( BaseAI ai, OrderType order ) : base( -1, false, ( order == OrderType.Attack ? TargetFlags.Harmful : TargetFlags.None ) )
|
||||
{
|
||||
m_List = new ArrayList();
|
||||
m_Order = order;
|
||||
|
||||
AddAI( ai );
|
||||
}
|
||||
|
||||
public void AddAI( BaseAI ai )
|
||||
{
|
||||
if ( !m_List.Contains( ai ) )
|
||||
m_List.Add( ai );
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( o is Mobile )
|
||||
{
|
||||
for ( int i = 0; i < m_List.Count; ++i )
|
||||
((BaseAI)m_List[i]).EndPickTarget( from, (Mobile)o, m_Order );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Scripts/Engines/AI/Team/Team.cs
Normal file
32
Scripts/Engines/AI/Team/Team.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
/*
|
||||
* NPC could use a team objets..
|
||||
*
|
||||
* -List of members
|
||||
* -List of ennemy teams
|
||||
* -List of ally team
|
||||
* -Team could be set automaticaly at mobile creation by the region system
|
||||
* -Team could be the owner of a common timer instead of one by creature
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class Team
|
||||
{
|
||||
//private ArrayList m_arAlly;
|
||||
//private ArrayList m_arFoe;
|
||||
|
||||
//private ArrayList m_arMember;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
29
Scripts/Engines/AI/Team/TeamRegistry.cs
Normal file
29
Scripts/Engines/AI/Team/TeamRegistry.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
/*
|
||||
* NPC could use a faction objets..
|
||||
*
|
||||
* -List of members
|
||||
* -List of ennemy factions
|
||||
* -List of neutral factions
|
||||
* -List of ally faction
|
||||
* -Team could be set automaticaly at mobile creation by the region system
|
||||
* -Team could be the owner of a common timer instead of one by creature
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Server.Mobiles
|
||||
{
|
||||
public class TeamRegistry
|
||||
{
|
||||
//private ArrayList m_arTeam;
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
88
Scripts/Engines/BulkOrders/Books/BOBFilter.cs
Normal file
88
Scripts/Engines/BulkOrders/Books/BOBFilter.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBFilter
|
||||
{
|
||||
private int m_Type;
|
||||
private int m_Quality;
|
||||
private int m_Material;
|
||||
private int m_Quantity;
|
||||
|
||||
public bool IsDefault
|
||||
{
|
||||
get{ return ( m_Type == 0 && m_Quality == 0 && m_Material == 0 && m_Quantity == 0 ); }
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_Type = 0;
|
||||
m_Quality = 0;
|
||||
m_Material = 0;
|
||||
m_Quantity = 0;
|
||||
}
|
||||
|
||||
public int Type
|
||||
{
|
||||
get{ return m_Type; }
|
||||
set{ m_Type = value; }
|
||||
}
|
||||
|
||||
public int Quality
|
||||
{
|
||||
get{ return m_Quality; }
|
||||
set{ m_Quality = value; }
|
||||
}
|
||||
|
||||
public int Material
|
||||
{
|
||||
get{ return m_Material; }
|
||||
set{ m_Material = value; }
|
||||
}
|
||||
|
||||
public int Quantity
|
||||
{
|
||||
get{ return m_Quantity; }
|
||||
set{ m_Quantity = value; }
|
||||
}
|
||||
|
||||
public BOBFilter()
|
||||
{
|
||||
}
|
||||
|
||||
public BOBFilter( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Type = reader.ReadEncodedInt();
|
||||
m_Quality = reader.ReadEncodedInt();
|
||||
m_Material = reader.ReadEncodedInt();
|
||||
m_Quantity = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
if ( IsDefault )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( 1 ); // version
|
||||
|
||||
writer.WriteEncodedInt( m_Type );
|
||||
writer.WriteEncodedInt( m_Quality );
|
||||
writer.WriteEncodedInt( m_Material );
|
||||
writer.WriteEncodedInt( m_Quantity );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
215
Scripts/Engines/BulkOrders/Books/BOBFilterGump.cs
Normal file
215
Scripts/Engines/BulkOrders/Books/BOBFilterGump.cs
Normal file
|
|
@ -0,0 +1,215 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBFilterGump : Gump
|
||||
{
|
||||
private PlayerMobile m_From;
|
||||
private BulkOrderBook m_Book;
|
||||
|
||||
private const int LabelColor = 0x7FFF;
|
||||
|
||||
private static int[,] m_MaterialFilters = new int[,]
|
||||
{
|
||||
{ 1044067, 1 }, // Blacksmithy
|
||||
{ 1062226, 3 }, // Iron
|
||||
{ 1018332, 4 }, // Dull Copper
|
||||
{ 1018333, 5 }, // Shadow Iron
|
||||
{ 1018334, 6 }, // Copper
|
||||
{ 1018335, 7 }, // Bronze
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1018336, 8 }, // Golden
|
||||
{ 1018337, 9 }, // Agapite
|
||||
{ 1018338, 10 }, // Verite
|
||||
{ 1018339, 11 }, // Valorite
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044094, 2 }, // Tailoring
|
||||
{ 1044286, 12 }, // Cloth
|
||||
{ 1062235, 13 }, // Leather
|
||||
{ 1062236, 14 }, // Spined
|
||||
{ 1062237, 15 }, // Horned
|
||||
{ 1062238, 16 } // Barbed
|
||||
};
|
||||
|
||||
private static int[,] m_TypeFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1062224, 1 }, // Small
|
||||
{ 1062225, 2 } // Large
|
||||
};
|
||||
|
||||
private static int[,] m_QualityFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1011542, 1 }, // Normal
|
||||
{ 1060636, 2 } // Exceptional
|
||||
};
|
||||
|
||||
private static int[,] m_AmountFilters = new int[,]
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1049706, 1 }, // 10
|
||||
{ 1016007, 2 }, // 15
|
||||
{ 1062239, 3 } // 20
|
||||
};
|
||||
|
||||
private static int[][,] m_Filters = new int[][,]
|
||||
{
|
||||
m_TypeFilters,
|
||||
m_QualityFilters,
|
||||
m_MaterialFilters,
|
||||
m_AmountFilters
|
||||
};
|
||||
|
||||
private static int[] m_XOffsets_Type = new int[]{ 0, 75, 170 };
|
||||
private static int[] m_XOffsets_Quality = new int[]{ 0, 75, 170 };
|
||||
private static int[] m_XOffsets_Amount = new int[]{ 0, 75, 180, 275 };
|
||||
private static int[] m_XOffsets_Material = new int[]{ 0, 105, 210, 305, 390, 485 };
|
||||
|
||||
private static int[] m_XWidths_Small = new int[]{ 50, 50, 70, 50 };
|
||||
private static int[] m_XWidths_Large = new int[]{ 80, 50, 50, 50, 50, 50 };
|
||||
|
||||
private void AddFilterList( int x, int y, int[] xOffsets, int yOffset, int[,] filters, int[] xWidths, int filterValue, int filterIndex )
|
||||
{
|
||||
for ( int i = 0; i < filters.GetLength( 0 ); ++i )
|
||||
{
|
||||
int number = filters[i, 0];
|
||||
|
||||
if ( number == 0 )
|
||||
continue;
|
||||
|
||||
bool isSelected = ( filters[i, 1] == filterValue );
|
||||
|
||||
if ( !isSelected && (i % xOffsets.Length) == 0 )
|
||||
isSelected = ( filterValue == 0 );
|
||||
|
||||
AddHtmlLocalized( x + 35 + xOffsets[i % xOffsets.Length], y + ((i / xOffsets.Length) * yOffset), xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor, false, false );
|
||||
AddButton( x + xOffsets[i % xOffsets.Length], y + ((i / xOffsets.Length) * yOffset), 4005, 4007, 4 + filterIndex + (i * 4), GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
BOBFilter f = ( m_From.UseOwnFilter ? m_From.BOBFilter : m_Book.Filter );
|
||||
|
||||
int index = info.ButtonID;
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case 0: // Apply
|
||||
{
|
||||
m_From.SendGump( new BOBGump( m_From, m_Book ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Set Book Filter
|
||||
{
|
||||
m_From.UseOwnFilter = false;
|
||||
m_From.SendGump( new BOBFilterGump( m_From, m_Book ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Set Your Filter
|
||||
{
|
||||
m_From.UseOwnFilter = true;
|
||||
m_From.SendGump( new BOBFilterGump( m_From, m_Book ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Clear Filter
|
||||
{
|
||||
f.Clear();
|
||||
m_From.SendGump( new BOBFilterGump( m_From, m_Book ) );
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
index -= 4;
|
||||
|
||||
int type = index % 4;
|
||||
index /= 4;
|
||||
|
||||
if ( type >= 0 && type < m_Filters.Length )
|
||||
{
|
||||
int[,] filters = m_Filters[type];
|
||||
|
||||
if ( index >= 0 && index < filters.GetLength( 0 ) )
|
||||
{
|
||||
if ( filters[index, 0] == 0 )
|
||||
break;
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case 0: f.Type = filters[index, 1]; break;
|
||||
case 1: f.Quality = filters[index, 1]; break;
|
||||
case 2: f.Material = filters[index, 1]; break;
|
||||
case 3: f.Quantity = filters[index, 1]; break;
|
||||
}
|
||||
|
||||
m_From.SendGump( new BOBFilterGump( m_From, m_Book ) );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BOBFilterGump( PlayerMobile from, BulkOrderBook book ) : base( 12, 24 )
|
||||
{
|
||||
from.CloseGump( typeof( BOBGump ) );
|
||||
from.CloseGump( typeof( BOBFilterGump ) );
|
||||
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
|
||||
BOBFilter f = ( from.UseOwnFilter ? from.BOBFilter : book.Filter );
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 10, 10, 600, 439, 5054 );
|
||||
|
||||
AddImageTiled( 18, 20, 583, 420, 2624 );
|
||||
AddAlphaRegion( 18, 20, 583, 420 );
|
||||
|
||||
AddImage( 5, 5, 10460 );
|
||||
AddImage( 585, 5, 10460 );
|
||||
AddImage( 5, 424, 10460 );
|
||||
AddImage( 585, 424, 10460 );
|
||||
|
||||
AddHtmlLocalized( 270, 32, 200, 32, 1062223, LabelColor, false, false ); // Filter Preference
|
||||
|
||||
AddHtmlLocalized( 26, 64, 120, 32, 1062228, LabelColor, false, false ); // Bulk Order Type
|
||||
AddFilterList( 25, 96, m_XOffsets_Type, 40, m_TypeFilters, m_XWidths_Small, f.Type, 0 );
|
||||
|
||||
AddHtmlLocalized( 320, 64, 50, 32, 1062215, LabelColor, false, false ); // Quality
|
||||
AddFilterList( 320, 96, m_XOffsets_Quality, 40, m_QualityFilters, m_XWidths_Small, f.Quality, 1 );
|
||||
|
||||
AddHtmlLocalized( 26, 160, 120, 32, 1062232, LabelColor, false, false ); // Material Type
|
||||
AddFilterList( 25, 192, m_XOffsets_Material, 40, m_MaterialFilters, m_XWidths_Large, f.Material, 2 );
|
||||
|
||||
AddHtmlLocalized( 26, 320, 120, 32, 1062217, LabelColor, false, false ); // Amount
|
||||
AddFilterList( 25, 352, m_XOffsets_Amount, 40, m_AmountFilters, m_XWidths_Small, f.Quantity, 3 );
|
||||
|
||||
AddHtmlLocalized( 75, 416, 120, 32, 1062477, ( from.UseOwnFilter ? LabelColor : 16927 ), false, false ); // Set Book Filter
|
||||
AddButton( 40, 416, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddHtmlLocalized( 235, 416, 120, 32, 1062478, ( from.UseOwnFilter ? 16927 : LabelColor ), false, false ); // Set Your Filter
|
||||
AddButton( 200, 416, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddHtmlLocalized( 405, 416, 120, 32, 1062231, LabelColor, false, false ); // Clear Filter
|
||||
AddButton( 370, 416, 4005, 4007, 3, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddHtmlLocalized( 540, 416, 50, 32, 1011046, LabelColor, false, false ); // APPLY
|
||||
AddButton( 505, 416, 4017, 4018, 0, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
611
Scripts/Engines/BulkOrders/Books/BOBGump.cs
Normal file
611
Scripts/Engines/BulkOrders/Books/BOBGump.cs
Normal file
|
|
@ -0,0 +1,611 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Prompts;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBGump : Gump
|
||||
{
|
||||
private PlayerMobile m_From;
|
||||
private BulkOrderBook m_Book;
|
||||
private ArrayList m_List;
|
||||
|
||||
private int m_Page;
|
||||
|
||||
private const int LabelColor = 0x7FFF;
|
||||
|
||||
public Item Reconstruct( object obj )
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
item = ((BOBLargeEntry)obj).Reconstruct();
|
||||
else if ( obj is BOBSmallEntry )
|
||||
item = ((BOBSmallEntry)obj).Reconstruct();
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public bool CheckFilter( object obj )
|
||||
{
|
||||
if ( obj is BOBLargeEntry )
|
||||
{
|
||||
BOBLargeEntry e = (BOBLargeEntry)obj;
|
||||
|
||||
return CheckFilter( e.Material, e.AmountMax, true, e.RequireExceptional, e.DeedType, ( e.Entries.Length > 0 ? e.Entries[0].ItemType : null ) );
|
||||
}
|
||||
else if ( obj is BOBSmallEntry )
|
||||
{
|
||||
BOBSmallEntry e = (BOBSmallEntry)obj;
|
||||
|
||||
return CheckFilter( e.Material, e.AmountMax, false, e.RequireExceptional, e.DeedType, e.ItemType );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckFilter( BulkMaterialType mat, int amountMax, bool isLarge, bool reqExc, BODType deedType, Type itemType )
|
||||
{
|
||||
BOBFilter f = ( m_From.UseOwnFilter ? m_From.BOBFilter : m_Book.Filter );
|
||||
|
||||
if ( f.IsDefault )
|
||||
return true;
|
||||
|
||||
if ( f.Quality == 1 && reqExc )
|
||||
return false;
|
||||
else if ( f.Quality == 2 && !reqExc )
|
||||
return false;
|
||||
|
||||
if ( f.Quantity == 1 && amountMax != 10 )
|
||||
return false;
|
||||
else if ( f.Quantity == 2 && amountMax != 15 )
|
||||
return false;
|
||||
else if ( f.Quantity == 3 && amountMax != 20 )
|
||||
return false;
|
||||
|
||||
if ( f.Type == 1 && isLarge )
|
||||
return false;
|
||||
else if ( f.Type == 2 && !isLarge )
|
||||
return false;
|
||||
|
||||
switch ( f.Material )
|
||||
{
|
||||
default:
|
||||
case 0: return true;
|
||||
case 1: return ( deedType == BODType.Smith );
|
||||
case 2: return ( deedType == BODType.Tailor );
|
||||
|
||||
case 3: return ( mat == BulkMaterialType.None && BGTClassifier.Classify( deedType, itemType ) == BulkGenericType.Iron );
|
||||
case 4: return ( mat == BulkMaterialType.DullCopper );
|
||||
case 5: return ( mat == BulkMaterialType.ShadowIron );
|
||||
case 6: return ( mat == BulkMaterialType.Copper );
|
||||
case 7: return ( mat == BulkMaterialType.Bronze );
|
||||
case 8: return ( mat == BulkMaterialType.Gold );
|
||||
case 9: return ( mat == BulkMaterialType.Agapite );
|
||||
case 10: return ( mat == BulkMaterialType.Verite );
|
||||
case 11: return ( mat == BulkMaterialType.Valorite );
|
||||
|
||||
case 12: return ( mat == BulkMaterialType.None && BGTClassifier.Classify( deedType, itemType ) == BulkGenericType.Cloth );
|
||||
case 13: return ( mat == BulkMaterialType.None && BGTClassifier.Classify( deedType, itemType ) == BulkGenericType.Leather );
|
||||
case 14: return ( mat == BulkMaterialType.Spined );
|
||||
case 15: return ( mat == BulkMaterialType.Horned );
|
||||
case 16: return ( mat == BulkMaterialType.Barbed );
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIndexForPage( int page )
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
while ( page-- > 0 )
|
||||
index += GetCountForIndex( index );
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
public int GetCountForIndex( int index )
|
||||
{
|
||||
int slots = 0;
|
||||
int count = 0;
|
||||
|
||||
ArrayList list = m_List;
|
||||
|
||||
for ( int i = index; i >= 0 && i < list.Count; ++i )
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if ( CheckFilter( obj ) )
|
||||
{
|
||||
int add;
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
add = ((BOBLargeEntry)obj).Entries.Length;
|
||||
else
|
||||
add = 1;
|
||||
|
||||
if ( (slots + add) > 10 )
|
||||
break;
|
||||
|
||||
slots += add;
|
||||
}
|
||||
|
||||
++count;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public object GetMaterialName( BulkMaterialType mat, BODType type, Type itemType )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case BODType.Smith:
|
||||
{
|
||||
switch ( mat )
|
||||
{
|
||||
case BulkMaterialType.None: return 1062226;
|
||||
case BulkMaterialType.DullCopper: return 1018332;
|
||||
case BulkMaterialType.ShadowIron: return 1018333;
|
||||
case BulkMaterialType.Copper: return 1018334;
|
||||
case BulkMaterialType.Bronze: return 1018335;
|
||||
case BulkMaterialType.Gold: return 1018336;
|
||||
case BulkMaterialType.Agapite: return 1018337;
|
||||
case BulkMaterialType.Verite: return 1018338;
|
||||
case BulkMaterialType.Valorite: return 1018339;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BODType.Tailor:
|
||||
{
|
||||
switch ( mat )
|
||||
{
|
||||
case BulkMaterialType.None:
|
||||
{
|
||||
if ( itemType.IsSubclassOf( typeof( BaseArmor ) ) || itemType.IsSubclassOf( typeof( BaseShoes ) ) )
|
||||
return 1062235;
|
||||
|
||||
return 1044286;
|
||||
}
|
||||
case BulkMaterialType.Spined: return 1062236;
|
||||
case BulkMaterialType.Horned: return 1062237;
|
||||
case BulkMaterialType.Barbed: return 1062238;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return "Invalid";
|
||||
}
|
||||
|
||||
public BOBGump( PlayerMobile from, BulkOrderBook book ) : this( from, book, 0, null )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
int index = info.ButtonID;
|
||||
|
||||
switch ( index )
|
||||
{
|
||||
case 0: // EXIT
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1: // Set Filter
|
||||
{
|
||||
m_From.SendGump( new BOBFilterGump( m_From, m_Book ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Previous page
|
||||
{
|
||||
if ( m_Page > 0 )
|
||||
m_From.SendGump( new BOBGump( m_From, m_Book, m_Page - 1, m_List ) );
|
||||
|
||||
return;
|
||||
}
|
||||
case 3: // Next page
|
||||
{
|
||||
if ( GetIndexForPage( m_Page + 1 ) < m_List.Count )
|
||||
m_From.SendGump( new BOBGump( m_From, m_Book, m_Page + 1, m_List ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Price all
|
||||
{
|
||||
if ( m_Book.IsChildOf( m_From.Backpack ) )
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt( m_Book, null, m_Page, m_List );
|
||||
m_From.SendMessage( "Type in a price for all deeds in the book:" );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
bool canDrop = m_Book.IsChildOf( m_From.Backpack );
|
||||
bool canPrice = canDrop || (m_Book.RootParent is PlayerVendor);
|
||||
|
||||
index -= 5;
|
||||
|
||||
int type = index % 2;
|
||||
index /= 2;
|
||||
|
||||
if ( index < 0 || index >= m_List.Count )
|
||||
break;
|
||||
|
||||
object obj = m_List[index];
|
||||
|
||||
if ( !m_Book.Entries.Contains( obj ) )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1062382 ); // The deed selected is not available.
|
||||
break;
|
||||
}
|
||||
|
||||
if ( type == 0 ) // Drop
|
||||
{
|
||||
if ( m_Book.IsChildOf( m_From.Backpack ) )
|
||||
{
|
||||
Item item = Reconstruct( obj );
|
||||
|
||||
if ( item != null )
|
||||
{
|
||||
m_From.AddToBackpack( item );
|
||||
m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack.
|
||||
|
||||
m_Book.Entries.Remove( obj );
|
||||
m_Book.InvalidateProperties();
|
||||
|
||||
if ( m_Book.Entries.Count > 0 )
|
||||
m_From.SendGump( new BOBGump( m_From, m_Book, 0, null ) );
|
||||
else
|
||||
m_From.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage( "Internal error. The bulk order deed could not be reconstructed." );
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Set Price | Buy
|
||||
{
|
||||
if ( m_Book.IsChildOf( m_From.Backpack ) )
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt( m_Book, obj, m_Page, m_List );
|
||||
m_From.SendLocalizedMessage( 1062383 ); // Type in a price for the deed:
|
||||
}
|
||||
else if ( m_Book.RootParent is PlayerVendor )
|
||||
{
|
||||
PlayerVendor pv = (PlayerVendor)m_Book.RootParent;
|
||||
|
||||
VendorItem vi = pv.GetVendorItem( m_Book );
|
||||
|
||||
int price = 0;
|
||||
|
||||
if ( vi != null && !vi.IsForSale )
|
||||
{
|
||||
if ( obj is BOBLargeEntry )
|
||||
price = ((BOBLargeEntry)obj).Price;
|
||||
else if ( obj is BOBSmallEntry )
|
||||
price = ((BOBSmallEntry)obj).Price;
|
||||
}
|
||||
|
||||
if ( price == 0 )
|
||||
m_From.SendLocalizedMessage( 1062382 ); // The deed selected is not available.
|
||||
else
|
||||
m_From.SendGump( new BODBuyGump( m_From, m_Book, obj, price ) );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SetPricePrompt : Prompt
|
||||
{
|
||||
private BulkOrderBook m_Book;
|
||||
private object m_Object;
|
||||
private int m_Page;
|
||||
private ArrayList m_List;
|
||||
|
||||
public SetPricePrompt( BulkOrderBook book, object obj, int page, ArrayList list )
|
||||
{
|
||||
m_Book = book;
|
||||
m_Object = obj;
|
||||
m_Page = page;
|
||||
m_List = list;
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( m_Object != null && !m_Book.Entries.Contains( m_Object ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062382 ); // The deed selected is not available.
|
||||
return;
|
||||
}
|
||||
|
||||
int price = Utility.ToInt32( text );
|
||||
|
||||
if ( price < 0 || price > 250000000 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062390 ); // The price you requested is outrageous!
|
||||
}
|
||||
else if ( m_Object == null )
|
||||
{
|
||||
for ( int i = 0; i < m_List.Count; ++i )
|
||||
{
|
||||
object obj = m_List[i];
|
||||
|
||||
if ( !m_Book.Entries.Contains( obj ) )
|
||||
continue;
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
((BOBLargeEntry)obj).Price = price;
|
||||
else if ( obj is BOBSmallEntry )
|
||||
((BOBSmallEntry)obj).Price = price;
|
||||
}
|
||||
|
||||
from.SendMessage( "Deed prices set." );
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) );
|
||||
}
|
||||
else if ( m_Object is BOBLargeEntry )
|
||||
{
|
||||
((BOBLargeEntry)m_Object).Price = price;
|
||||
|
||||
from.SendLocalizedMessage( 1062384 ); // Deed price set.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) );
|
||||
}
|
||||
else if ( m_Object is BOBSmallEntry )
|
||||
{
|
||||
((BOBSmallEntry)m_Object).Price = price;
|
||||
|
||||
from.SendLocalizedMessage( 1062384 ); // Deed price set.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, m_Book, m_Page, m_List ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BOBGump( PlayerMobile from, BulkOrderBook book, int page, ArrayList list ) : base( 12, 24 )
|
||||
{
|
||||
from.CloseGump( typeof( BOBGump ) );
|
||||
from.CloseGump( typeof( BOBFilterGump ) );
|
||||
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
m_Page = page;
|
||||
|
||||
if ( list == null )
|
||||
{
|
||||
list = new ArrayList( book.Entries.Count );
|
||||
|
||||
for ( int i = 0; i < book.Entries.Count; ++i )
|
||||
{
|
||||
object obj = book.Entries[i];
|
||||
|
||||
if ( CheckFilter( obj ) )
|
||||
list.Add( obj );
|
||||
}
|
||||
}
|
||||
|
||||
m_List = list;
|
||||
|
||||
int index = GetIndexForPage( page );
|
||||
int count = GetCountForIndex( index );
|
||||
|
||||
int tableIndex = 0;
|
||||
|
||||
PlayerVendor pv = book.RootParent as PlayerVendor;
|
||||
|
||||
bool canDrop = book.IsChildOf( from.Backpack );
|
||||
bool canBuy = ( pv != null );
|
||||
bool canPrice = ( canDrop || canBuy );
|
||||
|
||||
if ( canBuy )
|
||||
{
|
||||
VendorItem vi = pv.GetVendorItem( book );
|
||||
|
||||
canBuy = ( vi != null && !vi.IsForSale );
|
||||
}
|
||||
|
||||
int width = 600;
|
||||
|
||||
if ( !canPrice )
|
||||
width = 516;
|
||||
|
||||
X = (624 - width) / 2;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 10, 10, width, 439, 5054 );
|
||||
AddImageTiled( 18, 20, width - 17, 420, 2624 );
|
||||
|
||||
if ( canPrice )
|
||||
{
|
||||
AddImageTiled( 573, 64, 24, 352, 200 );
|
||||
AddImageTiled( 493, 64, 78, 352, 1416 );
|
||||
}
|
||||
|
||||
if ( canDrop )
|
||||
AddImageTiled( 24, 64, 32, 352, 1416 );
|
||||
|
||||
AddImageTiled( 58, 64, 36, 352, 200 );
|
||||
AddImageTiled( 96, 64, 133, 352, 1416 );
|
||||
AddImageTiled( 231, 64, 80, 352, 200 );
|
||||
AddImageTiled( 313, 64, 100, 352, 1416 );
|
||||
AddImageTiled( 415, 64, 76, 352, 200 );
|
||||
|
||||
for ( int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i )
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if ( !CheckFilter( obj ) )
|
||||
continue;
|
||||
|
||||
AddImageTiled( 24, 94 + (tableIndex * 32), canPrice ? 573 : 489, 2, 2624 );
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
tableIndex += ((BOBLargeEntry)obj).Entries.Length;
|
||||
else if ( obj is BOBSmallEntry )
|
||||
++tableIndex;
|
||||
}
|
||||
|
||||
AddAlphaRegion( 18, 20, width - 17, 420 );
|
||||
AddImage( 5, 5, 10460 );
|
||||
AddImage( width - 15, 5, 10460 );
|
||||
AddImage( 5, 424, 10460 );
|
||||
AddImage( width - 15, 424, 10460 );
|
||||
|
||||
AddHtmlLocalized( canPrice ? 266 : 224, 32, 200, 32, 1062220, LabelColor, false, false ); // Bulk Order Book
|
||||
AddHtmlLocalized( 63, 64, 200, 32, 1062213, LabelColor, false, false ); // Type
|
||||
AddHtmlLocalized( 147, 64, 200, 32, 1062214, LabelColor, false, false ); // Item
|
||||
AddHtmlLocalized( 246, 64, 200, 32, 1062215, LabelColor, false, false ); // Quality
|
||||
AddHtmlLocalized( 336, 64, 200, 32, 1062216, LabelColor, false, false ); // Material
|
||||
AddHtmlLocalized( 429, 64, 200, 32, 1062217, LabelColor, false, false ); // Amount
|
||||
|
||||
AddButton( 35, 32, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 70, 32, 200, 32, 1062476, LabelColor, false, false ); // Set Filter
|
||||
|
||||
BOBFilter f = ( from.UseOwnFilter ? from.BOBFilter : book.Filter );
|
||||
|
||||
if ( f.IsDefault )
|
||||
AddHtmlLocalized( canPrice ? 470 : 386, 32, 120, 32, 1062475, 16927, false, false ); // Using No Filter
|
||||
else if ( from.UseOwnFilter )
|
||||
AddHtmlLocalized( canPrice ? 470 : 386, 32, 120, 32, 1062451, 16927, false, false ); // Using Your Filter
|
||||
else
|
||||
AddHtmlLocalized( canPrice ? 470 : 386, 32, 120, 32, 1062230, 16927, false, false ); // Using Book Filter
|
||||
|
||||
AddButton( 375, 416, 4017, 4018, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 410, 416, 120, 20, 1011441, LabelColor, false, false ); // EXIT
|
||||
|
||||
if ( canDrop )
|
||||
AddHtmlLocalized( 26, 64, 50, 32, 1062212, LabelColor, false, false ); // Drop
|
||||
|
||||
if ( canPrice )
|
||||
{
|
||||
AddHtmlLocalized( 516, 64, 200, 32, 1062218, LabelColor, false, false ); // Price
|
||||
|
||||
if ( canBuy )
|
||||
{
|
||||
AddHtmlLocalized( 576, 64, 200, 32, 1062219, LabelColor, false, false ); // Buy
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized( 576, 64, 200, 32, 1062227, LabelColor, false, false ); // Set
|
||||
|
||||
AddButton( 450, 416, 4005, 4007, 4, GumpButtonType.Reply, 0 );
|
||||
AddHtml( 485, 416, 120, 20, "<BASEFONT COLOR=#FFFFFF>Price all</FONT>", false, false );
|
||||
}
|
||||
}
|
||||
|
||||
tableIndex = 0;
|
||||
|
||||
if ( page > 0 )
|
||||
{
|
||||
AddButton( 75, 416, 4014, 4016, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 110, 416, 150, 20, 1011067, LabelColor, false, false ); // Previous page
|
||||
}
|
||||
|
||||
if ( GetIndexForPage( page + 1 ) < list.Count )
|
||||
{
|
||||
AddButton( 225, 416, 4005, 4007, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 260, 416, 150, 20, 1011066, LabelColor, false, false ); // Next page
|
||||
}
|
||||
|
||||
for ( int i = index; i < (index + count) && i >= 0 && i < list.Count; ++i )
|
||||
{
|
||||
object obj = list[i];
|
||||
|
||||
if ( !CheckFilter( obj ) )
|
||||
continue;
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
{
|
||||
BOBLargeEntry e = (BOBLargeEntry)obj;
|
||||
|
||||
int y = 96 + (tableIndex * 32);
|
||||
|
||||
if ( canDrop )
|
||||
AddButton( 35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( canDrop || (canBuy && e.Price > 0) )
|
||||
{
|
||||
AddButton( 579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
AddLabel( 495, y, 1152, e.Price.ToString() );
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 61, y, 50, 32, 1062225, LabelColor, false, false ); // Large
|
||||
|
||||
for ( int j = 0; j < e.Entries.Length; ++j )
|
||||
{
|
||||
BOBLargeSubEntry sub = e.Entries[j];
|
||||
|
||||
AddHtmlLocalized( 103, y, 130, 32, sub.Number, LabelColor, false, false );
|
||||
|
||||
if ( e.RequireExceptional )
|
||||
AddHtmlLocalized( 235, y, 80, 20, 1060636, LabelColor, false, false ); // exceptional
|
||||
else
|
||||
AddHtmlLocalized( 235, y, 80, 20, 1011542, LabelColor, false, false ); // normal
|
||||
|
||||
object name = GetMaterialName( e.Material, e.DeedType, sub.ItemType );
|
||||
|
||||
if ( name is int )
|
||||
AddHtmlLocalized( 316, y, 100, 20, (int)name, LabelColor, false, false );
|
||||
else if ( name is string )
|
||||
AddLabel( 316, y, 1152, (string)name );
|
||||
|
||||
AddLabel( 421, y, 1152, String.Format( "{0} / {1}", sub.AmountCur, e.AmountMax ) );
|
||||
|
||||
++tableIndex;
|
||||
y += 32;
|
||||
}
|
||||
}
|
||||
else if ( obj is BOBSmallEntry )
|
||||
{
|
||||
BOBSmallEntry e = (BOBSmallEntry)obj;
|
||||
|
||||
int y = 96 + (tableIndex++ * 32);
|
||||
|
||||
if ( canDrop )
|
||||
AddButton( 35, y + 2, 5602, 5606, 5 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( canDrop || (canBuy && e.Price > 0) )
|
||||
{
|
||||
AddButton( 579, y + 2, 2117, 2118, 6 + (i * 2), GumpButtonType.Reply, 0 );
|
||||
AddLabel( 495, y, 1152, e.Price.ToString() );
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 61, y, 50, 32, 1062224, LabelColor, false, false ); // Small
|
||||
|
||||
AddHtmlLocalized( 103, y, 130, 32, e.Number, LabelColor, false, false );
|
||||
|
||||
if ( e.RequireExceptional )
|
||||
AddHtmlLocalized( 235, y, 80, 20, 1060636, LabelColor, false, false ); // exceptional
|
||||
else
|
||||
AddHtmlLocalized( 235, y, 80, 20, 1011542, LabelColor, false, false ); // normal
|
||||
|
||||
object name = GetMaterialName( e.Material, e.DeedType, e.ItemType );
|
||||
|
||||
if ( name is int )
|
||||
AddHtmlLocalized( 316, y, 100, 20, (int)name, LabelColor, false, false );
|
||||
else if ( name is string )
|
||||
AddLabel( 316, y, 1152, (string)name );
|
||||
|
||||
AddLabel( 421, y, 1152, String.Format( "{0} / {1}", e.AmountCur, e.AmountMax ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
110
Scripts/Engines/BulkOrders/Books/BOBLargeEntry.cs
Normal file
110
Scripts/Engines/BulkOrders/Books/BOBLargeEntry.cs
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBLargeEntry
|
||||
{
|
||||
private bool m_RequireExceptional;
|
||||
private BODType m_DeedType;
|
||||
private BulkMaterialType m_Material;
|
||||
private int m_AmountMax;
|
||||
private int m_Price;
|
||||
private BOBLargeSubEntry[] m_Entries;
|
||||
|
||||
public bool RequireExceptional{ get{ return m_RequireExceptional; } }
|
||||
public BODType DeedType{ get{ return m_DeedType; } }
|
||||
public BulkMaterialType Material{ get{ return m_Material; } }
|
||||
public int AmountMax{ get{ return m_AmountMax; } }
|
||||
public int Price{ get{ return m_Price; } set{ m_Price = value; } }
|
||||
public BOBLargeSubEntry[] Entries{ get{ return m_Entries; } }
|
||||
|
||||
public Item Reconstruct()
|
||||
{
|
||||
LargeBOD bod = null;
|
||||
|
||||
if ( m_DeedType == BODType.Smith )
|
||||
bod = new LargeSmithBOD( m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries() );
|
||||
else if ( m_DeedType == BODType.Tailor )
|
||||
bod = new LargeTailorBOD( m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries() );
|
||||
|
||||
for ( int i = 0; bod != null && i < bod.Entries.Length; ++i )
|
||||
bod.Entries[i].Owner = bod;
|
||||
|
||||
return bod;
|
||||
}
|
||||
|
||||
private LargeBulkEntry[] ReconstructEntries()
|
||||
{
|
||||
LargeBulkEntry[] entries = new LargeBulkEntry[m_Entries.Length];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
entries[i] = new LargeBulkEntry( null, new SmallBulkEntry( m_Entries[i].ItemType, m_Entries[i].Number, m_Entries[i].Graphic ) );
|
||||
entries[i].Amount = m_Entries[i].AmountCur;
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public BOBLargeEntry( LargeBOD bod )
|
||||
{
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
if ( bod is LargeTailorBOD )
|
||||
m_DeedType = BODType.Tailor;
|
||||
else if ( bod is LargeSmithBOD )
|
||||
m_DeedType = BODType.Smith;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i] = new BOBLargeSubEntry( bod.Entries[i] );
|
||||
}
|
||||
|
||||
public BOBLargeEntry( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i] = new BOBLargeSubEntry( reader );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( (bool) m_RequireExceptional );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_DeedType );
|
||||
writer.WriteEncodedInt( (int) m_Material );
|
||||
writer.WriteEncodedInt( (int) m_AmountMax );
|
||||
writer.WriteEncodedInt( (int) m_Price );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Length );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i].Serialize( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
58
Scripts/Engines/BulkOrders/Books/BOBLargeSubEntry.cs
Normal file
58
Scripts/Engines/BulkOrders/Books/BOBLargeSubEntry.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBLargeSubEntry
|
||||
{
|
||||
private Type m_ItemType;
|
||||
private int m_AmountCur;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
|
||||
public Type ItemType{ get{ return m_ItemType; } }
|
||||
public int AmountCur{ get{ return m_AmountCur; } }
|
||||
public int Number{ get{ return m_Number; } }
|
||||
public int Graphic{ get{ return m_Graphic; } }
|
||||
|
||||
public BOBLargeSubEntry( LargeBulkEntry lbe )
|
||||
{
|
||||
m_ItemType = lbe.Details.Type;
|
||||
m_AmountCur = lbe.Amount;
|
||||
m_Number = lbe.Details.Number;
|
||||
m_Graphic = lbe.Details.Graphic;
|
||||
}
|
||||
|
||||
public BOBLargeSubEntry( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_ItemType == null ? null : m_ItemType.FullName );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_AmountCur );
|
||||
writer.WriteEncodedInt( (int) m_Number );
|
||||
writer.WriteEncodedInt( (int) m_Graphic );
|
||||
}
|
||||
}
|
||||
}
|
||||
101
Scripts/Engines/BulkOrders/Books/BOBSmallEntry.cs
Normal file
101
Scripts/Engines/BulkOrders/Books/BOBSmallEntry.cs
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBSmallEntry
|
||||
{
|
||||
private Type m_ItemType;
|
||||
private bool m_RequireExceptional;
|
||||
private BODType m_DeedType;
|
||||
private BulkMaterialType m_Material;
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private int m_Price;
|
||||
|
||||
public Type ItemType{ get{ return m_ItemType; } }
|
||||
public bool RequireExceptional{ get{ return m_RequireExceptional; } }
|
||||
public BODType DeedType{ get{ return m_DeedType; } }
|
||||
public BulkMaterialType Material{ get{ return m_Material; } }
|
||||
public int AmountCur{ get{ return m_AmountCur; } }
|
||||
public int AmountMax{ get{ return m_AmountMax; } }
|
||||
public int Number{ get{ return m_Number; } }
|
||||
public int Graphic{ get{ return m_Graphic; } }
|
||||
public int Price{ get{ return m_Price; } set{ m_Price = value; } }
|
||||
|
||||
public Item Reconstruct()
|
||||
{
|
||||
SmallBOD bod = null;
|
||||
|
||||
if ( m_DeedType == BODType.Smith )
|
||||
bod = new SmallSmithBOD( m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material );
|
||||
else if ( m_DeedType == BODType.Tailor )
|
||||
bod = new SmallTailorBOD( m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material );
|
||||
|
||||
return bod;
|
||||
}
|
||||
|
||||
public BOBSmallEntry( SmallBOD bod )
|
||||
{
|
||||
m_ItemType = bod.Type;
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
if ( bod is SmallTailorBOD )
|
||||
m_DeedType = BODType.Tailor;
|
||||
else if ( bod is SmallSmithBOD )
|
||||
m_DeedType = BODType.Smith;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountCur = bod.AmountCur;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
m_Number = bod.Number;
|
||||
m_Graphic = bod.Graphic;
|
||||
}
|
||||
|
||||
public BOBSmallEntry( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_ItemType == null ? null : m_ItemType.FullName );
|
||||
|
||||
writer.Write( (bool) m_RequireExceptional );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_DeedType );
|
||||
writer.WriteEncodedInt( (int) m_Material );
|
||||
writer.WriteEncodedInt( (int) m_AmountCur );
|
||||
writer.WriteEncodedInt( (int) m_AmountMax );
|
||||
writer.WriteEncodedInt( (int) m_Number );
|
||||
writer.WriteEncodedInt( (int) m_Graphic );
|
||||
writer.WriteEncodedInt( (int) m_Price );
|
||||
}
|
||||
}
|
||||
}
|
||||
126
Scripts/Engines/BulkOrders/Books/BODBuyGump.cs
Normal file
126
Scripts/Engines/BulkOrders/Books/BODBuyGump.cs
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BODBuyGump : Gump
|
||||
{
|
||||
private PlayerMobile m_From;
|
||||
private BulkOrderBook m_Book;
|
||||
private object m_Object;
|
||||
private int m_Price;
|
||||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 2 )
|
||||
{
|
||||
PlayerVendor pv = m_Book.RootParent as PlayerVendor;
|
||||
|
||||
if ( m_Book.Entries.Contains( m_Object ) && pv != null )
|
||||
{
|
||||
int price = 0;
|
||||
|
||||
VendorItem vi = pv.GetVendorItem( m_Book );
|
||||
|
||||
if ( vi != null && !vi.IsForSale )
|
||||
{
|
||||
if ( m_Object is BOBLargeEntry )
|
||||
price = ((BOBLargeEntry)m_Object).Price;
|
||||
else if ( m_Object is BOBSmallEntry )
|
||||
price = ((BOBSmallEntry)m_Object).Price;
|
||||
}
|
||||
|
||||
if ( price != m_Price )
|
||||
{
|
||||
pv.SayTo( m_From, "The price has been been changed. If you like, you may offer to purchase the item again." );
|
||||
}
|
||||
else if ( price == 0 )
|
||||
{
|
||||
pv.SayTo( m_From, 1062382 ); // The deed selected is not available.
|
||||
}
|
||||
else
|
||||
{
|
||||
Item item = null;
|
||||
|
||||
if ( m_Object is BOBLargeEntry )
|
||||
item = ((BOBLargeEntry)m_Object).Reconstruct();
|
||||
else if ( m_Object is BOBSmallEntry )
|
||||
item = ((BOBSmallEntry)m_Object).Reconstruct();
|
||||
|
||||
if ( item == null )
|
||||
{
|
||||
m_From.SendMessage( "Internal error. The bulk order deed could not be reconstructed." );
|
||||
}
|
||||
else
|
||||
{
|
||||
pv.Say( m_From.Name );
|
||||
|
||||
Container pack = m_From.Backpack;
|
||||
|
||||
if ( (pack != null && pack.ConsumeTotal( typeof( Gold ), price )) || Banker.Withdraw( m_From, price ) )
|
||||
{
|
||||
m_Book.Entries.Remove( m_Object );
|
||||
m_Book.InvalidateProperties();
|
||||
|
||||
pv.HoldGold += price;
|
||||
|
||||
if ( m_From.AddToBackpack( item ) )
|
||||
m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack.
|
||||
else
|
||||
pv.SayTo( m_From, 503204 ); // You do not have room in your backpack for this.
|
||||
|
||||
if ( m_Book.Entries.Count > 0 )
|
||||
m_From.SendGump( new BOBGump( m_From, m_Book ) );
|
||||
else
|
||||
m_From.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
pv.SayTo( m_From, 503205 ); // You cannot afford this item.
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( pv == null )
|
||||
m_From.SendLocalizedMessage( 1062382 ); // The deed selected is not available.
|
||||
else
|
||||
pv.SayTo( m_From, 1062382 ); // The deed selected is not available.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage( 503207 ); // Cancelled purchase.
|
||||
}
|
||||
}
|
||||
|
||||
public BODBuyGump( PlayerMobile from, BulkOrderBook book, object obj, int price ) : base( 100, 200 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
m_Object = obj;
|
||||
m_Price = price;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 100, 10, 300, 150, 5054 );
|
||||
|
||||
AddHtmlLocalized( 125, 20, 250, 24, 1019070, false, false ); // You have agreed to purchase:
|
||||
AddHtmlLocalized( 125, 45, 250, 24, 1045151, false, false ); // a bulk order deed
|
||||
|
||||
AddHtmlLocalized( 125, 70, 250, 24, 1019071, false, false ); // for the amount of:
|
||||
AddLabel( 125, 95, 0, price.ToString() );
|
||||
|
||||
AddButton( 250, 130, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 282, 130, 100, 24, 1011012, false, false ); // CANCEL
|
||||
|
||||
AddButton( 120, 130, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 152, 130, 100, 24, 1011036, false, false ); // OKAY
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Scripts/Engines/BulkOrders/Books/BODType.cs
Normal file
10
Scripts/Engines/BulkOrders/Books/BODType.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public enum BODType
|
||||
{
|
||||
Smith,
|
||||
Tailor
|
||||
}
|
||||
}
|
||||
271
Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs
Normal file
271
Scripts/Engines/BulkOrders/Books/BulkOrderBook.cs
Normal file
|
|
@ -0,0 +1,271 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Multis;
|
||||
using Server.Prompts;
|
||||
using Server.Mobiles;
|
||||
using Server.ContextMenus;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BulkOrderBook : Item, ISecurable
|
||||
{
|
||||
private ArrayList m_Entries;
|
||||
private BOBFilter m_Filter;
|
||||
private string m_BookName;
|
||||
private SecureLevel m_Level;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string BookName
|
||||
{
|
||||
get{ return m_BookName; }
|
||||
set{ m_BookName = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get{ return m_Level; }
|
||||
set{ m_Level = value; }
|
||||
}
|
||||
|
||||
public ArrayList Entries
|
||||
{
|
||||
get{ return m_Entries; }
|
||||
}
|
||||
|
||||
public BOBFilter Filter
|
||||
{
|
||||
get{ return m_Filter; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public BulkOrderBook() : base( 0x2259 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_Entries = new ArrayList();
|
||||
m_Filter = new BOBFilter();
|
||||
|
||||
m_Level = SecureLevel.CoOwners;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else if ( m_Entries.Count == 0 )
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
else if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
{
|
||||
if ( dropped is LargeBOD )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it.
|
||||
return false;
|
||||
}
|
||||
else if ( m_Entries.Count < 500 )
|
||||
{
|
||||
m_Entries.Add( new BOBLargeEntry( (LargeBOD)dropped ) );
|
||||
InvalidateProperties();
|
||||
|
||||
from.SendLocalizedMessage( 1062386 ); // Deed added to book.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
|
||||
dropped.Delete();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1062387 ); // The book is full of deeds.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if ( dropped is SmallBOD )
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it.
|
||||
return false;
|
||||
}
|
||||
else if ( m_Entries.Count < 500 )
|
||||
{
|
||||
m_Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
InvalidateProperties();
|
||||
|
||||
from.SendLocalizedMessage( 1062386 ); // Deed added to book.
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
|
||||
dropped.Delete();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1062387 ); // The book is full of deeds.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1062388 ); // That is not a bulk order deed.
|
||||
return false;
|
||||
}
|
||||
|
||||
public BulkOrderBook( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
|
||||
writer.Write( m_BookName );
|
||||
|
||||
m_Filter.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Count );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
{
|
||||
object obj = m_Entries[i];
|
||||
|
||||
if ( obj is BOBLargeEntry )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 );
|
||||
((BOBLargeEntry)obj).Serialize( writer );
|
||||
}
|
||||
else if ( obj is BOBSmallEntry )
|
||||
{
|
||||
writer.WriteEncodedInt( 1 );
|
||||
((BOBSmallEntry)obj).Serialize( writer );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( -1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_BookName = reader.ReadString();
|
||||
|
||||
m_Filter = new BOBFilter( reader );
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Entries = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
int v = reader.ReadEncodedInt();
|
||||
|
||||
switch ( v )
|
||||
{
|
||||
case 0: m_Entries.Add( new BOBLargeEntry( reader ) ); break;
|
||||
case 1: m_Entries.Add( new BOBSmallEntry( reader ) ); break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1062344, m_Entries.Count.ToString() ); // Deeds in book: ~1_val~
|
||||
|
||||
if ( m_BookName != null && m_BookName.Length > 0 )
|
||||
list.Add( 1062481, m_BookName ); // Book Name: ~1_val~
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
if ( from.CheckAlive() && IsChildOf( from.Backpack ) )
|
||||
list.Add( new NameBookEntry( from, this ) );
|
||||
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
}
|
||||
|
||||
private class NameBookEntry : ContextMenuEntry
|
||||
{
|
||||
private Mobile m_From;
|
||||
private BulkOrderBook m_Book;
|
||||
|
||||
public NameBookEntry( Mobile from, BulkOrderBook book ) : base( 6216 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if ( m_From.CheckAlive() && m_Book.IsChildOf( m_From.Backpack ) )
|
||||
{
|
||||
m_From.Prompt = new NameBookPrompt( m_Book );
|
||||
m_From.SendLocalizedMessage( 1062479 ); // Type in the new name of the book:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class NameBookPrompt : Prompt
|
||||
{
|
||||
private BulkOrderBook m_Book;
|
||||
|
||||
public NameBookPrompt( BulkOrderBook book )
|
||||
{
|
||||
m_Book = book;
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( text.Length > 40 )
|
||||
text = text.Substring( 0, 40 );
|
||||
|
||||
if ( from.CheckAlive() && m_Book.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
m_Book.BookName = Utility.FixHtml( text.Trim() );
|
||||
|
||||
from.SendLocalizedMessage( 1062480 ); // The bulk order book's name has been changed.
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
45
Scripts/Engines/BulkOrders/BulkMaterialType.cs
Normal file
45
Scripts/Engines/BulkOrders/BulkMaterialType.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public enum BulkMaterialType
|
||||
{
|
||||
None,
|
||||
DullCopper,
|
||||
ShadowIron,
|
||||
Copper,
|
||||
Bronze,
|
||||
Gold,
|
||||
Agapite,
|
||||
Verite,
|
||||
Valorite,
|
||||
Spined,
|
||||
Horned,
|
||||
Barbed
|
||||
}
|
||||
|
||||
public enum BulkGenericType
|
||||
{
|
||||
Iron,
|
||||
Cloth,
|
||||
Leather
|
||||
}
|
||||
|
||||
public class BGTClassifier
|
||||
{
|
||||
public static BulkGenericType Classify( BODType deedType, Type itemType )
|
||||
{
|
||||
if ( deedType == BODType.Tailor )
|
||||
{
|
||||
if ( itemType == null || itemType.IsSubclassOf( typeof( BaseArmor ) ) || itemType.IsSubclassOf( typeof( BaseShoes ) ) )
|
||||
return BulkGenericType.Leather;
|
||||
|
||||
return BulkGenericType.Cloth;
|
||||
}
|
||||
|
||||
return BulkGenericType.Iron;
|
||||
}
|
||||
}
|
||||
}
|
||||
256
Scripts/Engines/BulkOrders/LargeBOD.cs
Normal file
256
Scripts/Engines/BulkOrders/LargeBOD.cs
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias( "Scripts.Engines.BulkOrders.LargeBOD" )]
|
||||
public abstract class LargeBOD : Item
|
||||
{
|
||||
private int m_AmountMax;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
private LargeBulkEntry[] m_Entries;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int AmountMax{ get{ return m_AmountMax; } set{ m_AmountMax = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RequireExceptional{ get{ return m_RequireExceptional; } set{ m_RequireExceptional = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BulkMaterialType Material{ get{ return m_Material; } set{ m_Material = value; InvalidateProperties(); } }
|
||||
|
||||
public LargeBulkEntry[] Entries{ get{ return m_Entries; } set{ m_Entries = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Complete
|
||||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
{
|
||||
if ( m_Entries[i].Amount < m_AmountMax )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract ArrayList ComputeRewards( bool full );
|
||||
public abstract int ComputeGold();
|
||||
public abstract int ComputeFame();
|
||||
|
||||
public virtual void GetRewards( out Item reward, out int gold, out int fame )
|
||||
{
|
||||
reward = null;
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
ArrayList rewards = ComputeRewards( false );
|
||||
|
||||
if ( rewards.Count > 0 )
|
||||
{
|
||||
reward = (Item)rewards[Utility.Random( rewards.Count )];
|
||||
|
||||
for ( int i = 0; i < rewards.Count; ++i )
|
||||
{
|
||||
if ( rewards[i] != reward )
|
||||
((Item)rewards[i]).Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static BulkMaterialType GetRandomMaterial( BulkMaterialType start, double[] chances )
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for ( int i = 0; i < chances.Length; ++i )
|
||||
{
|
||||
if ( random < chances[i] )
|
||||
return ( i == 0 ? BulkMaterialType.None : start + (i - 1) );
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public override int LabelNumber{ get{ return 1045151; } } // a bulk order deed
|
||||
|
||||
public LargeBOD( int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries ) : base( Core.AOS ? 0x2258 : 0x14EF )
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
m_Entries = entries;
|
||||
}
|
||||
|
||||
public LargeBOD() : base( Core.AOS ? 0x2258 : 0x14EF )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1060655 ); // large bulk order
|
||||
|
||||
if ( m_RequireExceptional )
|
||||
list.Add( 1045141 ); // All items must be exceptional.
|
||||
|
||||
if ( m_Material != BulkMaterialType.None )
|
||||
list.Add( LargeBODGump.GetMaterialNumberFor( m_Material ) ); // All items must be made with x material.
|
||||
|
||||
list.Add( 1060656, m_AmountMax.ToString() ); // amount to make: ~1_val~
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
list.Add( 1060658 + i, "#{0}\t{1}", m_Entries[i].Details.Number, m_Entries[i].Amount ); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
from.SendGump( new LargeBODGump( from, this ) );
|
||||
else
|
||||
from.SendLocalizedMessage( 1045156 ); // You must have the deed in your backpack to use it.
|
||||
}
|
||||
|
||||
public void BeginCombine( Mobile from )
|
||||
{
|
||||
if ( !Complete )
|
||||
from.Target = new LargeBODTarget( this );
|
||||
else
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
|
||||
public void EndCombine( Mobile from, object o )
|
||||
{
|
||||
if ( o is Item && ((Item)o).IsChildOf( from.Backpack ) )
|
||||
{
|
||||
if ( o is SmallBOD )
|
||||
{
|
||||
SmallBOD small = (SmallBOD)o;
|
||||
|
||||
LargeBulkEntry entry = null;
|
||||
|
||||
for ( int i = 0; entry == null && i < m_Entries.Length; ++i )
|
||||
{
|
||||
if ( m_Entries[i].Details.Type == small.Type )
|
||||
entry = m_Entries[i];
|
||||
}
|
||||
|
||||
if ( entry == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045160 ); // That is not a bulk order for this large request.
|
||||
}
|
||||
else if ( m_RequireExceptional && !small.RequireExceptional )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045161 ); // Both orders must be of exceptional quality.
|
||||
}
|
||||
else if ( m_Material >= BulkMaterialType.DullCopper && m_Material <= BulkMaterialType.Valorite && small.Material != m_Material )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045162 ); // Both orders must use the same ore type.
|
||||
}
|
||||
else if ( m_Material >= BulkMaterialType.Spined && m_Material <= BulkMaterialType.Barbed && small.Material != m_Material )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049351 ); // Both orders must use the same leather type.
|
||||
}
|
||||
else if ( m_AmountMax != small.AmountMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045163 ); // The two orders have different requested amounts and cannot be combined.
|
||||
}
|
||||
else if ( small.AmountCur < small.AmountMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045164 ); // The order to combine with is not completed.
|
||||
}
|
||||
else if ( entry.Amount >= m_AmountMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else
|
||||
{
|
||||
entry.Amount += small.AmountCur;
|
||||
small.Delete();
|
||||
|
||||
from.SendLocalizedMessage( 1045165 ); // The orders have been combined.
|
||||
|
||||
from.SendGump( new LargeBODGump( from, this ) );
|
||||
|
||||
if ( !Complete )
|
||||
BeginCombine( from );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1045159 ); // That is not a bulk order.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1045158 ); // You must have the item in your backpack to target it.
|
||||
}
|
||||
}
|
||||
|
||||
public LargeBOD( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_AmountMax );
|
||||
writer.Write( m_RequireExceptional );
|
||||
writer.Write( (int) m_Material );
|
||||
|
||||
writer.Write( (int) m_Entries.Length );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_AmountMax = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
m_Entries = new LargeBulkEntry[reader.ReadInt()];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i] = new LargeBulkEntry( this, reader );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 1.0;
|
||||
|
||||
if ( Core.AOS && ItemID == 0x14EF )
|
||||
ItemID = 0x2258;
|
||||
|
||||
if ( Parent == null && Map == Map.Internal && Location == Point3D.Zero )
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
106
Scripts/Engines/BulkOrders/LargeBODAcceptGump.cs
Normal file
106
Scripts/Engines/BulkOrders/LargeBODAcceptGump.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODAcceptGump : Gump
|
||||
{
|
||||
private LargeBOD m_Deed;
|
||||
private Mobile m_From;
|
||||
|
||||
public LargeBODAcceptGump( Mobile from, LargeBOD deed ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump( typeof( LargeBODAcceptGump ) );
|
||||
m_From.CloseGump( typeof( SmallBODAcceptGump ) );
|
||||
|
||||
LargeBulkEntry[] entries = deed.Entries;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 25, 10, 430, 240 + (entries.Length * 24), 5054 );
|
||||
|
||||
AddImageTiled( 33, 20, 413, 221 + (entries.Length * 24), 2624 );
|
||||
AddAlphaRegion( 33, 20, 413, 221 + (entries.Length * 24) );
|
||||
|
||||
AddImage( 20, 5, 10460 );
|
||||
AddImage( 430, 5, 10460 );
|
||||
AddImage( 20, 225 + (entries.Length * 24), 10460 );
|
||||
AddImage( 430, 225 + (entries.Length * 24), 10460 );
|
||||
|
||||
AddHtmlLocalized( 180, 25, 120, 20, 1045134, 0x7FFF, false, false ); // A large bulk order
|
||||
|
||||
AddHtmlLocalized( 40, 48, 350, 20, 1045135, 0x7FFF, false, false ); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized( 40, 72, 210, 20, 1045138, 0x7FFF, false, false ); // Amount to make:
|
||||
AddLabel( 250, 72, 1152, deed.AmountMax.ToString() );
|
||||
|
||||
AddHtmlLocalized( 40, 96, 120, 20, 1045137, 0x7FFF, false, false ); // Items requested:
|
||||
|
||||
int y = 120;
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i, y += 24 )
|
||||
AddHtmlLocalized( 40, y, 210, 20, entries[i].Details.Number, 0x7FFF, false, false );
|
||||
|
||||
if ( deed.RequireExceptional || deed.Material != BulkMaterialType.None )
|
||||
{
|
||||
AddHtmlLocalized( 40, y, 210, 20, 1045140, 0x7FFF, false, false ); // Special requirements to meet:
|
||||
y += 24;
|
||||
|
||||
if ( deed.RequireExceptional )
|
||||
{
|
||||
AddHtmlLocalized( 40, y, 350, 20, 1045141, 0x7FFF, false, false ); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if ( deed.Material != BulkMaterialType.None )
|
||||
{
|
||||
AddHtmlLocalized( 40, y, 350, 20, GetMaterialNumberFor( deed.Material ), 0x7FFF, false, false ); // All items must be made with x material.
|
||||
y += 24;
|
||||
}
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 40, 192 + (entries.Length * 24), 350, 20, 1045139, 0x7FFF, false, false ); // Do you want to accept this order?
|
||||
|
||||
AddButton( 100, 216 + (entries.Length * 24), 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 135, 216 + (entries.Length * 24), 120, 20, 1006044, 0x7FFF, false, false ); // Ok
|
||||
|
||||
AddButton( 275, 216 + (entries.Length * 24), 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 310, 216 + (entries.Length * 24), 120, 20, 1011012, 0x7FFF, false, false ); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 ) // Ok
|
||||
{
|
||||
if ( m_From.PlaceInBackpack( m_Deed ) )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1045150 ); // There is not enough room in your backpack for the deed.
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetMaterialNumberFor( BulkMaterialType material )
|
||||
{
|
||||
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
|
||||
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
|
||||
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
|
||||
return 1049348 + (int)(material - BulkMaterialType.Spined);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
100
Scripts/Engines/BulkOrders/LargeBODGump.cs
Normal file
100
Scripts/Engines/BulkOrders/LargeBODGump.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODGump : Gump
|
||||
{
|
||||
private LargeBOD m_Deed;
|
||||
private Mobile m_From;
|
||||
|
||||
public LargeBODGump( Mobile from, LargeBOD deed ) : base( 25, 25 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump( typeof( LargeBODGump ) );
|
||||
m_From.CloseGump( typeof( SmallBODGump ) );
|
||||
|
||||
LargeBulkEntry[] entries = deed.Entries;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 50, 10, 455, 236 + (entries.Length * 24), 5054 );
|
||||
|
||||
AddImageTiled( 58, 20, 438, 217 + (entries.Length * 24), 2624 );
|
||||
AddAlphaRegion( 58, 20, 438, 217 + (entries.Length * 24) );
|
||||
|
||||
AddImage( 45, 5, 10460 );
|
||||
AddImage( 480, 5, 10460 );
|
||||
AddImage( 45, 221 + (entries.Length * 24), 10460 );
|
||||
AddImage( 480, 221 + (entries.Length * 24), 10460 );
|
||||
|
||||
AddHtmlLocalized( 225, 25, 120, 20, 1045134, 0x7FFF, false, false ); // A large bulk order
|
||||
|
||||
AddHtmlLocalized( 75, 48, 250, 20, 1045138, 0x7FFF, false, false ); // Amount to make:
|
||||
AddLabel( 275, 48, 1152, deed.AmountMax.ToString() );
|
||||
|
||||
AddHtmlLocalized( 75, 72, 120, 20, 1045137, 0x7FFF, false, false ); // Items requested:
|
||||
AddHtmlLocalized( 275, 76, 200, 20, 1045153, 0x7FFF, false, false ); // Amount finished:
|
||||
|
||||
int y = 96;
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
LargeBulkEntry entry = entries[i];
|
||||
SmallBulkEntry details = entry.Details;
|
||||
|
||||
AddHtmlLocalized( 75, y, 210, 20, details.Number, 0x7FFF, false, false );
|
||||
AddLabel( 275, y, 0x480, entry.Amount.ToString() );
|
||||
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if ( deed.RequireExceptional || deed.Material != BulkMaterialType.None )
|
||||
{
|
||||
AddHtmlLocalized( 75, y, 200, 20, 1045140, 0x7FFF, false, false ); // Special requirements to meet:
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if ( deed.RequireExceptional )
|
||||
{
|
||||
AddHtmlLocalized( 75, y, 300, 20, 1045141, 0x7FFF, false, false ); // All items must be exceptional.
|
||||
y += 24;
|
||||
}
|
||||
|
||||
if ( deed.Material != BulkMaterialType.None )
|
||||
AddHtmlLocalized( 75, y, 300, 20, GetMaterialNumberFor( deed.Material ), 0x7FFF, false, false ); // All items must be made with x material.
|
||||
|
||||
AddButton( 125, 168 + (entries.Length * 24), 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 160, 168 + (entries.Length * 24), 300, 20, 1045155, 0x7FFF, false, false ); // Combine this deed with another deed.
|
||||
|
||||
AddButton( 125, 192 + (entries.Length * 24), 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 160, 192 + (entries.Length * 24), 120, 20, 1011441, 0x7FFF, false, false ); // EXIT
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Deed.Deleted || !m_Deed.IsChildOf( m_From.Backpack ) )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 2 ) // Combine
|
||||
{
|
||||
m_From.SendGump( new LargeBODGump( m_From, m_Deed ) );
|
||||
m_Deed.BeginCombine( m_From );
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetMaterialNumberFor( BulkMaterialType material )
|
||||
{
|
||||
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
|
||||
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
|
||||
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
|
||||
return 1049348 + (int)(material - BulkMaterialType.Spined);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Scripts/Engines/BulkOrders/LargeBODTarget.cs
Normal file
25
Scripts/Engines/BulkOrders/LargeBODTarget.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBODTarget : Target
|
||||
{
|
||||
private LargeBOD m_Deed;
|
||||
|
||||
public LargeBODTarget( LargeBOD deed ) : base( 18, false, TargetFlags.None )
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Deed.Deleted || !m_Deed.IsChildOf( from.Backpack ) )
|
||||
return;
|
||||
|
||||
m_Deed.EndCombine( from, targeted );
|
||||
}
|
||||
}
|
||||
}
|
||||
189
Scripts/Engines/BulkOrders/LargeBulkEntry.cs
Normal file
189
Scripts/Engines/BulkOrders/LargeBulkEntry.cs
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeBulkEntry
|
||||
{
|
||||
private LargeBOD m_Owner;
|
||||
private int m_Amount;
|
||||
private SmallBulkEntry m_Details;
|
||||
|
||||
public LargeBOD Owner{ get{ return m_Owner; } set{ m_Owner = value; } }
|
||||
public int Amount{ get{ return m_Amount; } set{ m_Amount = value; if ( m_Owner != null ) m_Owner.InvalidateProperties(); } }
|
||||
public SmallBulkEntry Details{ get{ return m_Details; } }
|
||||
|
||||
public static SmallBulkEntry[] LargeRing
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "largering" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargePlate
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "largeplate" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeChain
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "largechain" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeAxes
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "largeaxes" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeFencing
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "largefencing" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeMaces
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "largemaces" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargePolearms
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "largepolearms" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LargeSwords
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "largeswords" ); }
|
||||
}
|
||||
|
||||
|
||||
public static SmallBulkEntry[] BoneSet
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "boneset" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] Farmer
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "farmer" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] FemaleLeatherSet
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "femaleleatherset" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] FisherGirl
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "fishergirl" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] Gypsy
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "gypsy" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] HatSet
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "hatset" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] Jester
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "jester" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] Lady
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "lady" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] MaleLeatherSet
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "maleleatherset" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] Pirate
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "pirate" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] ShoeSet
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "shoeset" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] StuddedSet
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "studdedset" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] TownCrier
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "towncrier" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] Wizard
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "wizard" ); }
|
||||
}
|
||||
|
||||
|
||||
private static Hashtable m_Cache;
|
||||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
if ( m_Cache == null )
|
||||
m_Cache = new Hashtable();
|
||||
|
||||
Hashtable table = (Hashtable)m_Cache[type];
|
||||
|
||||
if ( table == null )
|
||||
m_Cache[type] = table = new Hashtable();
|
||||
|
||||
SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];
|
||||
|
||||
if ( entries == null )
|
||||
table[name] = entries = SmallBulkEntry.LoadEntries( type, name );
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static LargeBulkEntry[] ConvertEntries( LargeBOD owner, SmallBulkEntry[] small )
|
||||
{
|
||||
LargeBulkEntry[] large = new LargeBulkEntry[small.Length];
|
||||
|
||||
for ( int i = 0; i < small.Length; ++i )
|
||||
large[i] = new LargeBulkEntry( owner, small[i] );
|
||||
|
||||
return large;
|
||||
}
|
||||
|
||||
public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details )
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Details = details;
|
||||
}
|
||||
|
||||
public LargeBulkEntry( LargeBOD owner, GenericReader reader )
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Amount = reader.ReadInt();
|
||||
|
||||
Type realType = null;
|
||||
|
||||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
realType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( m_Details.Type == null ? null : m_Details.Type.FullName );
|
||||
writer.Write( m_Details.Number );
|
||||
writer.Write( m_Details.Graphic );
|
||||
}
|
||||
}
|
||||
}
|
||||
139
Scripts/Engines/BulkOrders/LargeSmithBOD.cs
Normal file
139
Scripts/Engines/BulkOrders/LargeSmithBOD.cs
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Mat = Server.Engines.BulkOrders.BulkMaterialType;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias( "Scripts.Engines.BulkOrders.LargeSmithBOD" )]
|
||||
public class LargeSmithBOD : LargeBOD
|
||||
{
|
||||
public static double[] m_BlacksmithMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeFame( this );
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeGold( this );
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public LargeSmithBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = true;
|
||||
|
||||
int rand = Utility.Random( 8 );
|
||||
|
||||
switch ( rand )
|
||||
{
|
||||
default:
|
||||
case 0: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargeRing ); break;
|
||||
case 1: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargePlate ); break;
|
||||
case 2: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargeChain ); break;
|
||||
case 3: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargeAxes ); break;
|
||||
case 4: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargeFencing ); break;
|
||||
case 5: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargeMaces ); break;
|
||||
case 6: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargePolearms ); break;
|
||||
case 7: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.LargeSwords ); break;
|
||||
}
|
||||
|
||||
if( rand > 2 && rand < 8 )
|
||||
useMaterials = false;
|
||||
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList( 10, 15, 20, 20 );
|
||||
bool reqExceptional = ( 0.825 > Utility.RandomDouble() );
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if ( useMaterials )
|
||||
material = GetRandomMaterial( BulkMaterialType.DullCopper, m_BlacksmithMaterialChances );
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeSmithBOD( int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries )
|
||||
{
|
||||
this.Hue = 0x44E;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public override ArrayList ComputeRewards( bool full )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
RewardGroup rewardGroup = SmithRewardCalculator.Instance.LookupRewards( SmithRewardCalculator.Instance.ComputePoints( this ) );
|
||||
|
||||
if ( rewardGroup != null )
|
||||
{
|
||||
if ( full )
|
||||
{
|
||||
for ( int i = 0; i < rewardGroup.Items.Length; ++i )
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if ( item != null )
|
||||
list.Add( item );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if ( rewardItem != null )
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if ( item != null )
|
||||
list.Add( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public LargeSmithBOD( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
134
Scripts/Engines/BulkOrders/LargeTailorBOD.cs
Normal file
134
Scripts/Engines/BulkOrders/LargeTailorBOD.cs
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Mat = Server.Engines.BulkOrders.BulkMaterialType;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class LargeTailorBOD : LargeBOD
|
||||
{
|
||||
public static double[] m_TailoringMaterialChances = new double[]
|
||||
{
|
||||
0.857421875, // None
|
||||
0.125000000, // Spined
|
||||
0.015625000, // Horned
|
||||
0.001953125 // Barbed
|
||||
};
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeFame( this );
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeGold( this );
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public LargeTailorBOD()
|
||||
{
|
||||
LargeBulkEntry[] entries;
|
||||
bool useMaterials = false;
|
||||
|
||||
switch ( Utility.Random( 14 ) )
|
||||
{
|
||||
default:
|
||||
case 0: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.Farmer ); break;
|
||||
case 1: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.FemaleLeatherSet ); useMaterials = true; break;
|
||||
case 2: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.FisherGirl ); break;
|
||||
case 3: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.Gypsy ); break;
|
||||
case 4: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.HatSet ); break;
|
||||
case 5: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.Jester ); break;
|
||||
case 6: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.Lady ); break;
|
||||
case 7: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.MaleLeatherSet ); useMaterials = true; break;
|
||||
case 8: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.Pirate ); break;
|
||||
case 9: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.ShoeSet ); break;
|
||||
case 10: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.StuddedSet ); useMaterials = true; break;
|
||||
case 11: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.TownCrier ); break;
|
||||
case 12: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.Wizard ); break;
|
||||
case 13: entries = LargeBulkEntry.ConvertEntries( this, LargeBulkEntry.BoneSet ); useMaterials = true; break;
|
||||
}
|
||||
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList( 10, 15, 20, 20 );
|
||||
bool reqExceptional = ( 0.825 > Utility.RandomDouble() );
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if ( useMaterials )
|
||||
material = GetRandomMaterial( BulkMaterialType.Spined, m_TailoringMaterialChances );
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
public LargeTailorBOD( int amountMax, bool reqExceptional, BulkMaterialType mat, LargeBulkEntry[] entries )
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.Entries = entries;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public override ArrayList ComputeRewards( bool full )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
RewardGroup rewardGroup = TailorRewardCalculator.Instance.LookupRewards( TailorRewardCalculator.Instance.ComputePoints( this ) );
|
||||
|
||||
if ( rewardGroup != null )
|
||||
{
|
||||
if ( full )
|
||||
{
|
||||
for ( int i = 0; i < rewardGroup.Items.Length; ++i )
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if ( item != null )
|
||||
list.Add( item );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if ( rewardItem != null )
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if ( item != null )
|
||||
list.Add( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public LargeTailorBOD( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
739
Scripts/Engines/BulkOrders/Rewards.cs
Normal file
739
Scripts/Engines/BulkOrders/Rewards.cs
Normal file
|
|
@ -0,0 +1,739 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public delegate Item ConstructCallback( int type );
|
||||
|
||||
public sealed class RewardType
|
||||
{
|
||||
private int m_Points;
|
||||
private Type[] m_Types;
|
||||
|
||||
public int Points{ get{ return m_Points; } }
|
||||
public Type[] Types{ get{ return m_Types; } }
|
||||
|
||||
public RewardType( int points, params Type[] types )
|
||||
{
|
||||
m_Points = points;
|
||||
m_Types = types;
|
||||
}
|
||||
|
||||
public bool Contains( Type type )
|
||||
{
|
||||
for ( int i = 0; i < m_Types.Length; ++i )
|
||||
{
|
||||
if ( m_Types[i] == type )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RewardItem
|
||||
{
|
||||
private int m_Weight;
|
||||
private ConstructCallback m_Constructor;
|
||||
private int m_Type;
|
||||
|
||||
public int Weight{ get{ return m_Weight; } }
|
||||
public ConstructCallback Constructor{ get{ return m_Constructor; } }
|
||||
public int Type{ get{ return m_Type; } }
|
||||
|
||||
public RewardItem( int weight, ConstructCallback constructor ) : this( weight, constructor, 0 )
|
||||
{
|
||||
}
|
||||
|
||||
public RewardItem( int weight, ConstructCallback constructor, int type )
|
||||
{
|
||||
m_Weight = weight;
|
||||
m_Constructor = constructor;
|
||||
m_Type = type;
|
||||
}
|
||||
|
||||
public Item Construct()
|
||||
{
|
||||
try{ return m_Constructor( m_Type ); }
|
||||
catch{ return null; }
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RewardGroup
|
||||
{
|
||||
private int m_Points;
|
||||
private RewardItem[] m_Items;
|
||||
|
||||
public int Points{ get{ return m_Points; } }
|
||||
public RewardItem[] Items{ get{ return m_Items; } }
|
||||
|
||||
public RewardGroup( int points, params RewardItem[] items )
|
||||
{
|
||||
m_Points = points;
|
||||
m_Items = items;
|
||||
}
|
||||
|
||||
public RewardItem AcquireItem()
|
||||
{
|
||||
if ( m_Items.Length == 0 )
|
||||
return null;
|
||||
else if ( m_Items.Length == 1 )
|
||||
return m_Items[0];
|
||||
|
||||
int totalWeight = 0;
|
||||
|
||||
for ( int i = 0; i < m_Items.Length; ++i )
|
||||
totalWeight += m_Items[i].Weight;
|
||||
|
||||
int randomWeight = Utility.Random( totalWeight );
|
||||
|
||||
for ( int i = 0; i < m_Items.Length; ++i )
|
||||
{
|
||||
RewardItem item = m_Items[i];
|
||||
|
||||
if ( randomWeight < item.Weight )
|
||||
return item;
|
||||
|
||||
randomWeight -= item.Weight;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class RewardCalculator
|
||||
{
|
||||
private RewardGroup[] m_Groups;
|
||||
|
||||
public RewardGroup[] Groups{ get{ return m_Groups; } set{ m_Groups = value; } }
|
||||
|
||||
public abstract int ComputePoints( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type );
|
||||
public abstract int ComputeGold( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type );
|
||||
|
||||
public virtual int ComputeFame( SmallBOD bod )
|
||||
{
|
||||
int points = ComputePoints( bod ) / 50;
|
||||
|
||||
return points * points;
|
||||
}
|
||||
|
||||
public virtual int ComputeFame( LargeBOD bod )
|
||||
{
|
||||
int points = ComputePoints( bod ) / 50;
|
||||
|
||||
return points * points;
|
||||
}
|
||||
|
||||
public virtual int ComputePoints( SmallBOD bod )
|
||||
{
|
||||
return ComputePoints( bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type );
|
||||
}
|
||||
|
||||
public virtual int ComputePoints( LargeBOD bod )
|
||||
{
|
||||
return ComputePoints( bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length, bod.Entries[0].Details.Type );
|
||||
}
|
||||
|
||||
public virtual int ComputeGold( SmallBOD bod )
|
||||
{
|
||||
return ComputeGold( bod.AmountMax, bod.RequireExceptional, bod.Material, 1, bod.Type );
|
||||
}
|
||||
|
||||
public virtual int ComputeGold( LargeBOD bod )
|
||||
{
|
||||
return ComputeGold( bod.AmountMax, bod.RequireExceptional, bod.Material, bod.Entries.Length, bod.Entries[0].Details.Type );
|
||||
}
|
||||
|
||||
public virtual RewardGroup LookupRewards( int points )
|
||||
{
|
||||
for ( int i = m_Groups.Length - 1; i >= 1; --i )
|
||||
{
|
||||
RewardGroup group = m_Groups[i];
|
||||
|
||||
if ( points >= group.Points )
|
||||
return group;
|
||||
}
|
||||
|
||||
return m_Groups[0];
|
||||
}
|
||||
|
||||
public virtual int LookupTypePoints( RewardType[] types, Type type )
|
||||
{
|
||||
for ( int i = 0; i < types.Length; ++i )
|
||||
{
|
||||
if ( types[i].Contains( type ) )
|
||||
return types[i].Points;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public RewardCalculator()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SmithRewardCalculator : RewardCalculator
|
||||
{
|
||||
#region Constructors
|
||||
private static readonly ConstructCallback SturdyShovel = new ConstructCallback( CreateSturdyShovel );
|
||||
private static readonly ConstructCallback SturdyPickaxe = new ConstructCallback( CreateSturdyPickaxe );
|
||||
private static readonly ConstructCallback MiningGloves = new ConstructCallback( CreateMiningGloves );
|
||||
private static readonly ConstructCallback GargoylesPickaxe = new ConstructCallback( CreateGargoylesPickaxe );
|
||||
private static readonly ConstructCallback ProspectorsTool = new ConstructCallback( CreateProspectorsTool );
|
||||
private static readonly ConstructCallback PowderOfTemperament = new ConstructCallback( CreatePowderOfTemperament );
|
||||
private static readonly ConstructCallback RunicHammer = new ConstructCallback( CreateRunicHammer );
|
||||
private static readonly ConstructCallback PowerScroll = new ConstructCallback( CreatePowerScroll );
|
||||
private static readonly ConstructCallback ColoredAnvil = new ConstructCallback( CreateColoredAnvil );
|
||||
private static readonly ConstructCallback AncientHammer = new ConstructCallback( CreateAncientHammer );
|
||||
|
||||
private static Item CreateSturdyShovel( int type )
|
||||
{
|
||||
return new SturdyShovel();
|
||||
}
|
||||
|
||||
private static Item CreateSturdyPickaxe( int type )
|
||||
{
|
||||
return new SturdyPickaxe();
|
||||
}
|
||||
|
||||
private static Item CreateMiningGloves( int type )
|
||||
{
|
||||
if ( type == 1 )
|
||||
return new LeatherGlovesOfMining( 1 );
|
||||
else if ( type == 3 )
|
||||
return new StuddedGlovesOfMining( 3 );
|
||||
else if ( type == 5 )
|
||||
return new RingmailGlovesOfMining( 5 );
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static Item CreateGargoylesPickaxe( int type )
|
||||
{
|
||||
return new GargoylesPickaxe();
|
||||
}
|
||||
|
||||
private static Item CreateProspectorsTool( int type )
|
||||
{
|
||||
return new ProspectorsTool();
|
||||
}
|
||||
|
||||
private static Item CreatePowderOfTemperament( int type )
|
||||
{
|
||||
return new PowderOfTemperament();
|
||||
}
|
||||
|
||||
private static Item CreateRunicHammer( int type )
|
||||
{
|
||||
if ( type >= 1 && type <= 8 )
|
||||
return new RunicHammer( CraftResource.Iron + type, Core.AOS ? ( 55 - (type*5) ) : 50 );
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static Item CreatePowerScroll( int type )
|
||||
{
|
||||
if ( type == 5 || type == 10 || type == 15 || type == 20 )
|
||||
return new PowerScroll( SkillName.Blacksmith, 100 + type );
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static Item CreateColoredAnvil( int type )
|
||||
{
|
||||
// Generate an anvil deed, not an actual anvil.
|
||||
//return new ColoredAnvilDeed();
|
||||
|
||||
return new ColoredAnvil();
|
||||
}
|
||||
|
||||
private static Item CreateAncientHammer( int type )
|
||||
{
|
||||
if ( type == 10 || type == 15 || type == 30 || type == 60 )
|
||||
return new AncientSmithyHammer( type );
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static readonly SmithRewardCalculator Instance = new SmithRewardCalculator();
|
||||
|
||||
private RewardType[] m_Types = new RewardType[]
|
||||
{
|
||||
// Armors
|
||||
new RewardType( 200, typeof( RingmailGloves ), typeof( RingmailChest ), typeof( RingmailArms ), typeof( RingmailLegs ) ),
|
||||
new RewardType( 300, typeof( ChainCoif ), typeof( ChainLegs ), typeof( ChainChest ) ),
|
||||
new RewardType( 400, typeof( PlateArms ), typeof( PlateLegs ), typeof( PlateHelm ), typeof( PlateGorget ), typeof( PlateGloves ), typeof( PlateChest ) ),
|
||||
|
||||
// Weapons
|
||||
new RewardType( 200, typeof( Bardiche ), typeof( Halberd ) ),
|
||||
new RewardType( 300, typeof( Dagger ), typeof( ShortSpear ), typeof( Spear ), typeof( WarFork ), typeof( Kryss ) ), //OSI put the dagger in there. Odd, ain't it.
|
||||
new RewardType( 350, typeof( Axe ), typeof( BattleAxe ), typeof( DoubleAxe ), typeof( ExecutionersAxe ), typeof( LargeBattleAxe ), typeof( TwoHandedAxe ) ),
|
||||
new RewardType( 350, typeof( Broadsword ), typeof( Cutlass ), typeof( Katana ), typeof( Longsword ), typeof( Scimitar ), typeof( ThinLongsword ), typeof( VikingSword ) ),
|
||||
new RewardType( 350, typeof( WarAxe ), typeof( HammerPick ), typeof( Mace ), typeof( Maul ), typeof( WarHammer ), typeof( WarMace ) )
|
||||
};
|
||||
|
||||
public override int ComputePoints( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type )
|
||||
{
|
||||
int points = 0;
|
||||
|
||||
if ( quantity == 10 )
|
||||
points += 10;
|
||||
else if ( quantity == 15 )
|
||||
points += 25;
|
||||
else if ( quantity == 20 )
|
||||
points += 50;
|
||||
|
||||
if ( exceptional )
|
||||
points += 200;
|
||||
|
||||
if ( itemCount > 1 )
|
||||
points += LookupTypePoints( m_Types, type );
|
||||
|
||||
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
|
||||
points += 200 + (50 * (material - BulkMaterialType.DullCopper));
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
private static int[][][] m_GoldTable = new int[][][]
|
||||
{
|
||||
new int[][] // 1-part (regular)
|
||||
{
|
||||
new int[]{ 150, 250, 250, 400, 400, 750, 750, 1200, 1200 },
|
||||
new int[]{ 225, 375, 375, 600, 600, 1125, 1125, 1800, 1800 },
|
||||
new int[]{ 300, 500, 750, 800, 1050, 1500, 2250, 2400, 4000 }
|
||||
},
|
||||
new int[][] // 1-part (exceptional)
|
||||
{
|
||||
new int[]{ 250, 400, 400, 750, 750, 1500, 1500, 3000, 3000 },
|
||||
new int[]{ 375, 600, 600, 1125, 1125, 2250, 2250, 4500, 4500 },
|
||||
new int[]{ 500, 800, 1200, 1500, 2500, 3000, 6000, 6000, 12000 }
|
||||
},
|
||||
new int[][] // Ringmail (regular)
|
||||
{
|
||||
new int[]{ 3000, 5000, 5000, 7500, 7500, 10000, 10000, 15000, 15000 },
|
||||
new int[]{ 4500, 7500, 7500, 11250, 11500, 15000, 15000, 22500, 22500 },
|
||||
new int[]{ 6000, 10000, 15000, 15000, 20000, 20000, 30000, 30000, 50000 }
|
||||
},
|
||||
new int[][] // Ringmail (exceptional)
|
||||
{
|
||||
new int[]{ 5000, 10000, 10000, 15000, 15000, 25000, 25000, 50000, 50000 },
|
||||
new int[]{ 7500, 15000, 15000, 22500, 22500, 37500, 37500, 75000, 75000 },
|
||||
new int[]{ 10000, 20000, 30000, 30000, 50000, 50000, 100000, 100000, 200000 }
|
||||
},
|
||||
new int[][] // Chainmail (regular)
|
||||
{
|
||||
new int[]{ 4000, 7500, 7500, 10000, 10000, 15000, 15000, 25000, 25000 },
|
||||
new int[]{ 6000, 11250, 11250, 15000, 15000, 22500, 22500, 37500, 37500 },
|
||||
new int[]{ 8000, 15000, 20000, 20000, 30000, 30000, 50000, 50000, 100000 }
|
||||
},
|
||||
new int[][] // Chainmail (exceptional)
|
||||
{
|
||||
new int[]{ 7500, 15000, 15000, 25000, 25000, 50000, 50000, 100000, 100000 },
|
||||
new int[]{ 11250, 22500, 22500, 37500, 37500, 75000, 75000, 150000, 150000 },
|
||||
new int[]{ 15000, 30000, 50000, 50000, 100000, 100000, 200000, 200000, 200000 }
|
||||
},
|
||||
new int[][] // Platemail (regular)
|
||||
{
|
||||
new int[]{ 5000, 10000, 10000, 15000, 15000, 25000, 25000, 50000, 50000 },
|
||||
new int[]{ 7500, 15000, 15000, 22500, 22500, 37500, 37500, 75000, 75000 },
|
||||
new int[]{ 10000, 20000, 30000, 30000, 50000, 50000, 100000, 100000, 200000 }
|
||||
},
|
||||
new int[][] // Platemail (exceptional)
|
||||
{
|
||||
new int[]{ 10000, 25000, 25000, 50000, 50000, 100000, 100000, 100000, 100000 },
|
||||
new int[]{ 15000, 37500, 37500, 75000, 75000, 150000, 150000, 150000, 150000 },
|
||||
new int[]{ 20000, 50000, 100000, 100000, 200000, 200000, 200000, 200000, 200000 }
|
||||
},
|
||||
new int[][] // 2-part weapons (regular)
|
||||
{
|
||||
new int[]{ 3000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 4500, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 6000, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
},
|
||||
new int[][] // 2-part weapons (exceptional)
|
||||
{
|
||||
new int[]{ 5000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 7500, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 10000, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
},
|
||||
new int[][] // 5-part weapons (regular)
|
||||
{
|
||||
new int[]{ 4000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 6000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 8000, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
},
|
||||
new int[][] // 5-part weapons (exceptional)
|
||||
{
|
||||
new int[]{ 7500, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 11250, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 15000, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
},
|
||||
new int[][] // 6-part weapons (regular)
|
||||
{
|
||||
new int[]{ 4000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 6000, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 10000, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
},
|
||||
new int[][] // 6-part weapons (exceptional)
|
||||
{
|
||||
new int[]{ 7500, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 11250, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
new int[]{ 15000, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
}
|
||||
};
|
||||
|
||||
private int ComputeType( Type type, int itemCount )
|
||||
{
|
||||
// Item count of 1 means it's a small BOD.
|
||||
if ( itemCount == 1 )
|
||||
return 0;
|
||||
|
||||
int typeIdx;
|
||||
|
||||
// Loop through the RewardTypes defined earlier and find the correct one.
|
||||
for ( typeIdx = 0; typeIdx < 7; ++typeIdx )
|
||||
{
|
||||
if ( m_Types[typeIdx].Contains( type ) )
|
||||
break;
|
||||
}
|
||||
|
||||
// Types 5, 6 and 7 are Large Weapon BODs with the same rewards.
|
||||
if ( typeIdx > 5 )
|
||||
typeIdx = 5;
|
||||
|
||||
return ( typeIdx + 1 ) * 2;
|
||||
}
|
||||
|
||||
public override int ComputeGold( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type )
|
||||
{
|
||||
int[][][] goldTable = m_GoldTable;
|
||||
|
||||
int typeIndex = ComputeType( type, itemCount );
|
||||
int quanIndex = ( quantity == 20 ? 2 : quantity == 15 ? 1 : 0 );
|
||||
int mtrlIndex = ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite ) ? 1 + (int)(material - BulkMaterialType.DullCopper) : 0;
|
||||
|
||||
if ( exceptional )
|
||||
typeIndex++;
|
||||
|
||||
int gold = goldTable[typeIndex][quanIndex][mtrlIndex];
|
||||
|
||||
int min = (gold * 9) / 10;
|
||||
int max = (gold * 10) / 9;
|
||||
|
||||
return Utility.RandomMinMax( min, max );
|
||||
}
|
||||
|
||||
public SmithRewardCalculator()
|
||||
{
|
||||
Groups = new RewardGroup[]
|
||||
{
|
||||
new RewardGroup( 0, new RewardItem( 1, SturdyShovel ) ),
|
||||
new RewardGroup( 25, new RewardItem( 1, SturdyPickaxe ) ),
|
||||
new RewardGroup( 50, new RewardItem( 45, SturdyShovel ), new RewardItem( 45, SturdyPickaxe ), new RewardItem( 10, MiningGloves, 1 ) ),
|
||||
new RewardGroup( 200, new RewardItem( 45, GargoylesPickaxe ), new RewardItem( 45, ProspectorsTool ), new RewardItem( 10, MiningGloves, 3 ) ),
|
||||
new RewardGroup( 400, new RewardItem( 2, GargoylesPickaxe ), new RewardItem( 2, ProspectorsTool ), new RewardItem( 1, PowderOfTemperament ) ),
|
||||
new RewardGroup( 450, new RewardItem( 9, PowderOfTemperament ), new RewardItem( 1, MiningGloves, 5 ) ),
|
||||
new RewardGroup( 500, new RewardItem( 1, RunicHammer, 1 ) ),
|
||||
new RewardGroup( 550, new RewardItem( 3, RunicHammer, 1 ), new RewardItem( 2, RunicHammer, 2 ) ),
|
||||
new RewardGroup( 600, new RewardItem( 1, RunicHammer, 2 ) ),
|
||||
new RewardGroup( 625, new RewardItem( 3, RunicHammer, 2 ), new RewardItem( 6, PowerScroll, 5 ), new RewardItem( 1, ColoredAnvil ) ),
|
||||
new RewardGroup( 650, new RewardItem( 1, RunicHammer, 3 ) ),
|
||||
new RewardGroup( 675, new RewardItem( 1, ColoredAnvil ), new RewardItem( 6, PowerScroll, 10 ), new RewardItem( 3, RunicHammer, 3 ) ),
|
||||
new RewardGroup( 700, new RewardItem( 1, RunicHammer, 4 ) ),
|
||||
new RewardGroup( 750, new RewardItem( 1, AncientHammer, 10 ) ),
|
||||
new RewardGroup( 800, new RewardItem( 1, PowerScroll, 15 ) ),
|
||||
new RewardGroup( 850, new RewardItem( 1, AncientHammer, 15 ) ),
|
||||
new RewardGroup( 900, new RewardItem( 1, PowerScroll, 20 ) ),
|
||||
new RewardGroup( 950, new RewardItem( 1, RunicHammer, 5 ) ),
|
||||
new RewardGroup( 1000, new RewardItem( 1, AncientHammer, 30 ) ),
|
||||
new RewardGroup( 1050, new RewardItem( 1, RunicHammer, 6 ) ),
|
||||
new RewardGroup( 1100, new RewardItem( 1, AncientHammer, 60 ) ),
|
||||
new RewardGroup( 1150, new RewardItem( 1, RunicHammer, 7 ) ),
|
||||
new RewardGroup( 1200, new RewardItem( 1, RunicHammer, 8 ) )
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class TailorRewardCalculator : RewardCalculator
|
||||
{
|
||||
#region Constructors
|
||||
private static readonly ConstructCallback Cloth = new ConstructCallback( CreateCloth );
|
||||
private static readonly ConstructCallback Sandals = new ConstructCallback( CreateSandals );
|
||||
private static readonly ConstructCallback StretchedHide = new ConstructCallback( CreateStretchedHide );
|
||||
private static readonly ConstructCallback RunicKit = new ConstructCallback( CreateRunicKit );
|
||||
private static readonly ConstructCallback Tapestry = new ConstructCallback( CreateTapestry );
|
||||
private static readonly ConstructCallback PowerScroll = new ConstructCallback( CreatePowerScroll );
|
||||
private static readonly ConstructCallback BearRug = new ConstructCallback( CreateBearRug );
|
||||
private static readonly ConstructCallback ClothingBlessDeed = new ConstructCallback( CreateCBD );
|
||||
|
||||
private static int[][] m_ClothHues = new int[][]
|
||||
{
|
||||
new int[]{ 0x483, 0x48C, 0x488, 0x48A },
|
||||
new int[]{ 0x495, 0x48B, 0x486, 0x485 },
|
||||
new int[]{ 0x48D, 0x490, 0x48E, 0x491 },
|
||||
new int[]{ 0x48F, 0x494, 0x484, 0x497 },
|
||||
new int[]{ 0x489, 0x47F, 0x482, 0x47E }
|
||||
};
|
||||
|
||||
private static Item CreateCloth( int type )
|
||||
{
|
||||
if ( type >= 0 && type < m_ClothHues.Length )
|
||||
{
|
||||
UncutCloth cloth = new UncutCloth( 100 );
|
||||
cloth.Hue = m_ClothHues[type][Utility.Random( m_ClothHues[type].Length )];
|
||||
return cloth;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static int[] m_SandalHues = new int[]
|
||||
{
|
||||
0x489, 0x47F, 0x482,
|
||||
0x47E, 0x48F, 0x494,
|
||||
0x484, 0x497
|
||||
};
|
||||
|
||||
private static Item CreateSandals( int type )
|
||||
{
|
||||
return new Sandals( m_SandalHues[Utility.Random( m_SandalHues.Length )] );
|
||||
}
|
||||
|
||||
private static Item CreateStretchedHide( int type )
|
||||
{
|
||||
switch ( Utility.Random( 4 ) )
|
||||
{
|
||||
default:
|
||||
case 0: return new SmallStretchedHideEastDeed();
|
||||
case 1: return new SmallStretchedHideSouthDeed();
|
||||
case 2: return new MediumStretchedHideEastDeed();
|
||||
case 3: return new MediumStretchedHideSouthDeed();
|
||||
}
|
||||
}
|
||||
|
||||
private static Item CreateTapestry( int type )
|
||||
{
|
||||
switch ( Utility.Random( 4 ) )
|
||||
{
|
||||
default:
|
||||
case 0: return new LightFlowerTapestryEastDeed();
|
||||
case 1: return new LightFlowerTapestrySouthDeed();
|
||||
case 2: return new DarkFlowerTapestryEastDeed();
|
||||
case 3: return new DarkFlowerTapestrySouthDeed();
|
||||
}
|
||||
}
|
||||
|
||||
private static Item CreateBearRug( int type )
|
||||
{
|
||||
switch ( Utility.Random( 4 ) )
|
||||
{
|
||||
default:
|
||||
case 0: return new BrownBearRugEastDeed();
|
||||
case 1: return new BrownBearRugSouthDeed();
|
||||
case 2: return new PolarBearRugEastDeed();
|
||||
case 3: return new PolarBearRugSouthDeed();
|
||||
}
|
||||
}
|
||||
|
||||
private static Item CreateRunicKit( int type )
|
||||
{
|
||||
if ( type >= 1 && type <= 3 )
|
||||
return new RunicSewingKit( CraftResource.RegularLeather + type, 60 - (type*15) );
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static Item CreatePowerScroll( int type )
|
||||
{
|
||||
if ( type == 5 || type == 10 || type == 15 || type == 20 )
|
||||
return new PowerScroll( SkillName.Tailoring, 100 + type );
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static Item CreateCBD( int type )
|
||||
{
|
||||
return new ClothingBlessDeed();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static readonly TailorRewardCalculator Instance = new TailorRewardCalculator();
|
||||
|
||||
public override int ComputePoints( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type )
|
||||
{
|
||||
int points = 0;
|
||||
|
||||
if ( quantity == 10 )
|
||||
points += 10;
|
||||
else if ( quantity == 15 )
|
||||
points += 25;
|
||||
else if ( quantity == 20 )
|
||||
points += 50;
|
||||
|
||||
if ( exceptional )
|
||||
points += 100;
|
||||
|
||||
if ( itemCount == 4 )
|
||||
points += 300;
|
||||
else if ( itemCount == 5 )
|
||||
points += 400;
|
||||
else if ( itemCount == 6 )
|
||||
points += 500;
|
||||
|
||||
if ( material == BulkMaterialType.Spined )
|
||||
points += 50;
|
||||
else if ( material == BulkMaterialType.Horned )
|
||||
points += 100;
|
||||
else if ( material == BulkMaterialType.Barbed )
|
||||
points += 150;
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
private static int[][][] m_AosGoldTable = new int[][][]
|
||||
{
|
||||
new int[][] // 1-part (regular)
|
||||
{
|
||||
new int[]{ 150, 150, 300, 300 },
|
||||
new int[]{ 225, 225, 450, 450 },
|
||||
new int[]{ 300, 400, 600, 750 }
|
||||
},
|
||||
new int[][] // 1-part (exceptional)
|
||||
{
|
||||
new int[]{ 300, 300, 600, 600 },
|
||||
new int[]{ 450, 450, 900, 900 },
|
||||
new int[]{ 600, 750, 1200, 1800 }
|
||||
},
|
||||
new int[][] // 4-part (regular)
|
||||
{
|
||||
new int[]{ 4000, 4000, 5000, 5000 },
|
||||
new int[]{ 6000, 6000, 7500, 7500 },
|
||||
new int[]{ 8000, 10000, 10000, 15000 }
|
||||
},
|
||||
new int[][] // 4-part (exceptional)
|
||||
{
|
||||
new int[]{ 5000, 5000, 7500, 7500 },
|
||||
new int[]{ 7500, 7500, 11250, 11250 },
|
||||
new int[]{ 10000, 15000, 15000, 20000 }
|
||||
},
|
||||
new int[][] // 5-part (regular)
|
||||
{
|
||||
new int[]{ 5000, 5000, 7500, 7500 },
|
||||
new int[]{ 7500, 7500, 11250, 11250 },
|
||||
new int[]{ 10000, 15000, 15000, 20000 }
|
||||
},
|
||||
new int[][] // 5-part (exceptional)
|
||||
{
|
||||
new int[]{ 7500, 7500, 10000, 10000 },
|
||||
new int[]{ 11250, 11250, 15000, 15000 },
|
||||
new int[]{ 15000, 20000, 20000, 30000 }
|
||||
},
|
||||
new int[][] // 6-part (regular)
|
||||
{
|
||||
new int[]{ 7500, 7500, 10000, 10000 },
|
||||
new int[]{ 11250, 11250, 15000, 15000 },
|
||||
new int[]{ 15000, 20000, 20000, 30000 }
|
||||
},
|
||||
new int[][] // 6-part (exceptional)
|
||||
{
|
||||
new int[]{ 10000, 10000, 15000, 15000 },
|
||||
new int[]{ 15000, 15000, 22500, 22500 },
|
||||
new int[]{ 20000, 30000, 30000, 50000 }
|
||||
}
|
||||
};
|
||||
|
||||
private static int[][][] m_OldGoldTable = new int[][][]
|
||||
{
|
||||
new int[][] // 1-part (regular)
|
||||
{
|
||||
new int[]{ 150, 150, 300, 300 },
|
||||
new int[]{ 225, 225, 450, 450 },
|
||||
new int[]{ 300, 400, 600, 750 }
|
||||
},
|
||||
new int[][] // 1-part (exceptional)
|
||||
{
|
||||
new int[]{ 300, 300, 600, 600 },
|
||||
new int[]{ 450, 450, 900, 900 },
|
||||
new int[]{ 600, 750, 1200, 1800 }
|
||||
},
|
||||
new int[][] // 4-part (regular)
|
||||
{
|
||||
new int[]{ 3000, 3000, 4000, 4000 },
|
||||
new int[]{ 4500, 4500, 6000, 6000 },
|
||||
new int[]{ 6000, 8000, 8000, 10000 }
|
||||
},
|
||||
new int[][] // 4-part (exceptional)
|
||||
{
|
||||
new int[]{ 4000, 4000, 5000, 5000 },
|
||||
new int[]{ 6000, 6000, 7500, 7500 },
|
||||
new int[]{ 8000, 10000, 10000, 15000 }
|
||||
},
|
||||
new int[][] // 5-part (regular)
|
||||
{
|
||||
new int[]{ 4000, 4000, 5000, 5000 },
|
||||
new int[]{ 6000, 6000, 7500, 7500 },
|
||||
new int[]{ 8000, 10000, 10000, 15000 }
|
||||
},
|
||||
new int[][] // 5-part (exceptional)
|
||||
{
|
||||
new int[]{ 5000, 5000, 7500, 7500 },
|
||||
new int[]{ 7500, 7500, 11250, 11250 },
|
||||
new int[]{ 10000, 15000, 15000, 20000 }
|
||||
},
|
||||
new int[][] // 6-part (regular)
|
||||
{
|
||||
new int[]{ 5000, 5000, 7500, 7500 },
|
||||
new int[]{ 7500, 7500, 11250, 11250 },
|
||||
new int[]{ 10000, 15000, 15000, 20000 }
|
||||
},
|
||||
new int[][] // 6-part (exceptional)
|
||||
{
|
||||
new int[]{ 7500, 7500, 10000, 10000 },
|
||||
new int[]{ 11250, 11250, 15000, 15000 },
|
||||
new int[]{ 15000, 20000, 20000, 30000 }
|
||||
}
|
||||
};
|
||||
|
||||
public override int ComputeGold( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type )
|
||||
{
|
||||
int[][][] goldTable = ( Core.AOS ? m_AosGoldTable : m_OldGoldTable );
|
||||
|
||||
int typeIndex = (( itemCount == 6 ? 3 : itemCount == 5 ? 2 : itemCount == 4 ? 1 : 0 ) * 2) + (exceptional ? 1 : 0);
|
||||
int quanIndex = ( quantity == 20 ? 2 : quantity == 15 ? 1 : 0 );
|
||||
int mtrlIndex = ( material == BulkMaterialType.Barbed ? 3 : material == BulkMaterialType.Horned ? 2 : material == BulkMaterialType.Spined ? 1 : 0 );
|
||||
|
||||
int gold = goldTable[typeIndex][quanIndex][mtrlIndex];
|
||||
|
||||
int min = (gold * 9) / 10;
|
||||
int max = (gold * 10) / 9;
|
||||
|
||||
return Utility.RandomMinMax( min, max );
|
||||
}
|
||||
|
||||
public TailorRewardCalculator()
|
||||
{
|
||||
Groups = new RewardGroup[]
|
||||
{
|
||||
new RewardGroup( 0, new RewardItem( 1, Cloth, 0 ) ),
|
||||
new RewardGroup( 50, new RewardItem( 1, Cloth, 1 ) ),
|
||||
new RewardGroup( 100, new RewardItem( 1, Cloth, 2 ) ),
|
||||
new RewardGroup( 150, new RewardItem( 9, Cloth, 3 ), new RewardItem( 1, Sandals ) ),
|
||||
new RewardGroup( 200, new RewardItem( 4, Cloth, 4 ), new RewardItem( 1, Sandals ) ),
|
||||
new RewardGroup( 300, new RewardItem( 1, StretchedHide ) ),
|
||||
new RewardGroup( 350, new RewardItem( 1, RunicKit, 1 ) ),
|
||||
new RewardGroup( 400, new RewardItem( 2, PowerScroll, 5 ), new RewardItem( 3, Tapestry ) ),
|
||||
new RewardGroup( 450, new RewardItem( 1, BearRug ) ),
|
||||
new RewardGroup( 500, new RewardItem( 1, PowerScroll, 10 ) ),
|
||||
new RewardGroup( 550, new RewardItem( 1, ClothingBlessDeed ) ),
|
||||
new RewardGroup( 575, new RewardItem( 1, PowerScroll, 15 ) ),
|
||||
new RewardGroup( 600, new RewardItem( 1, RunicKit, 2 ) ),
|
||||
new RewardGroup( 650, new RewardItem( 1, PowerScroll, 20 ) ),
|
||||
new RewardGroup( 700, new RewardItem( 1, RunicKit, 3 ) )
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
279
Scripts/Engines/BulkOrders/SmallBOD.cs
Normal file
279
Scripts/Engines/BulkOrders/SmallBOD.cs
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias( "Scripts.Engines.BulkOrders.SmallBOD" )]
|
||||
public abstract class SmallBOD : Item
|
||||
{
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int AmountCur{ get{ return m_AmountCur; } set{ m_AmountCur = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int AmountMax{ get{ return m_AmountMax; } set{ m_AmountMax = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Type Type{ get{ return m_Type; } set{ m_Type = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Number{ get{ return m_Number; } set{ m_Number = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Graphic{ get{ return m_Graphic; } set{ m_Graphic = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RequireExceptional{ get{ return m_RequireExceptional; } set{ m_RequireExceptional = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BulkMaterialType Material{ get{ return m_Material; } set{ m_Material = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Complete{ get{ return ( m_AmountCur == m_AmountMax ); } }
|
||||
|
||||
public override int LabelNumber{ get{ return 1045151; } } // a bulk order deed
|
||||
|
||||
[Constructable]
|
||||
public SmallBOD( int hue, int amountMax, Type type, int number, int graphic, bool requireExeptional, BulkMaterialType material ) : base( Core.AOS ? 0x2258 : 0x14EF )
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = hue; // Blacksmith: 0x44E; Tailoring: 0x483
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
}
|
||||
|
||||
public SmallBOD() : base( Core.AOS ? 0x2258 : 0x14EF )
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
public static BulkMaterialType GetRandomMaterial( BulkMaterialType start, double[] chances )
|
||||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for ( int i = 0; i < chances.Length; ++i )
|
||||
{
|
||||
if ( random < chances[i] )
|
||||
return ( i == 0 ? BulkMaterialType.None : start + (i - 1) );
|
||||
|
||||
random -= chances[i];
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1060654 ); // small bulk order
|
||||
|
||||
if ( m_RequireExceptional )
|
||||
list.Add( 1045141 ); // All items must be exceptional.
|
||||
|
||||
if ( m_Material != BulkMaterialType.None )
|
||||
list.Add( SmallBODGump.GetMaterialNumberFor( m_Material ) ); // All items must be made with x material.
|
||||
|
||||
list.Add( 1060656, m_AmountMax.ToString() ); // amount to make: ~1_val~
|
||||
list.Add( 1060658, "#{0}\t{1}", m_Number, m_AmountCur ); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) )
|
||||
from.SendGump( new SmallBODGump( from, this ) );
|
||||
else
|
||||
from.SendLocalizedMessage( 1045156 ); // You must have the deed in your backpack to use it.
|
||||
}
|
||||
|
||||
public void BeginCombine( Mobile from )
|
||||
{
|
||||
if ( m_AmountCur < m_AmountMax )
|
||||
from.Target = new SmallBODTarget( this );
|
||||
else
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
|
||||
public abstract ArrayList ComputeRewards( bool full );
|
||||
public abstract int ComputeGold();
|
||||
public abstract int ComputeFame();
|
||||
|
||||
public virtual void GetRewards( out Item reward, out int gold, out int fame )
|
||||
{
|
||||
reward = null;
|
||||
gold = ComputeGold();
|
||||
fame = ComputeFame();
|
||||
|
||||
ArrayList rewards = ComputeRewards( false );
|
||||
|
||||
if ( rewards.Count > 0 )
|
||||
{
|
||||
reward = (Item)rewards[Utility.Random( rewards.Count )];
|
||||
|
||||
for ( int i = 0; i < rewards.Count; ++i )
|
||||
{
|
||||
if ( rewards[i] != reward )
|
||||
((Item)rewards[i]).Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static BulkMaterialType GetMaterial( CraftResource resource )
|
||||
{
|
||||
switch ( resource )
|
||||
{
|
||||
case CraftResource.DullCopper: return BulkMaterialType.DullCopper;
|
||||
case CraftResource.ShadowIron: return BulkMaterialType.ShadowIron;
|
||||
case CraftResource.Copper: return BulkMaterialType.Copper;
|
||||
case CraftResource.Bronze: return BulkMaterialType.Bronze;
|
||||
case CraftResource.Gold: return BulkMaterialType.Gold;
|
||||
case CraftResource.Agapite: return BulkMaterialType.Agapite;
|
||||
case CraftResource.Verite: return BulkMaterialType.Verite;
|
||||
case CraftResource.Valorite: return BulkMaterialType.Valorite;
|
||||
case CraftResource.SpinedLeather: return BulkMaterialType.Spined;
|
||||
case CraftResource.HornedLeather: return BulkMaterialType.Horned;
|
||||
case CraftResource.BarbedLeather: return BulkMaterialType.Barbed;
|
||||
}
|
||||
|
||||
return BulkMaterialType.None;
|
||||
}
|
||||
|
||||
public void EndCombine( Mobile from, object o )
|
||||
{
|
||||
if ( o is Item && ((Item)o).IsChildOf( from.Backpack ) )
|
||||
{
|
||||
Type objectType = o.GetType();
|
||||
|
||||
if ( m_AmountCur >= m_AmountMax )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(o is BaseWeapon) && !(o is BaseArmor) && !(o is BaseClothing)) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045169 ); // The item is not in the request.
|
||||
}
|
||||
else
|
||||
{
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if ( o is BaseArmor )
|
||||
material = GetMaterial( ((BaseArmor)o).Resource );
|
||||
else if ( o is BaseClothing )
|
||||
material = GetMaterial( ((BaseClothing)o).Resource );
|
||||
|
||||
if ( m_Material >= BulkMaterialType.DullCopper && m_Material <= BulkMaterialType.Valorite && material != m_Material )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045168 ); // The item is not made from the requested ore.
|
||||
}
|
||||
else if ( m_Material >= BulkMaterialType.Spined && m_Material <= BulkMaterialType.Barbed && material != m_Material )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049352 ); // The item is not made from the requested leather type.
|
||||
}
|
||||
else
|
||||
{
|
||||
bool isExceptional = false;
|
||||
|
||||
if ( o is BaseWeapon )
|
||||
isExceptional = ( ((BaseWeapon)o).Quality == WeaponQuality.Exceptional );
|
||||
else if ( o is BaseArmor )
|
||||
isExceptional = ( ((BaseArmor)o).Quality == ArmorQuality.Exceptional );
|
||||
else if ( o is BaseClothing )
|
||||
isExceptional = ( ((BaseClothing)o).Quality == ClothingQuality.Exceptional );
|
||||
|
||||
if ( m_RequireExceptional && !isExceptional )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045167 ); // The item must be exceptional.
|
||||
}
|
||||
else
|
||||
{
|
||||
((Item)o).Delete();
|
||||
++AmountCur;
|
||||
|
||||
from.SendLocalizedMessage( 1045170 ); // The item has been combined with the deed.
|
||||
|
||||
from.SendGump( new SmallBODGump( from, this ) );
|
||||
|
||||
if ( m_AmountCur < m_AmountMax )
|
||||
BeginCombine( from );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 1045158 ); // You must have the item in your backpack to target it.
|
||||
}
|
||||
}
|
||||
|
||||
public SmallBOD( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_AmountCur );
|
||||
writer.Write( m_AmountMax );
|
||||
writer.Write( m_Type == null ? null : m_Type.FullName );
|
||||
writer.Write( m_Number );
|
||||
writer.Write( m_Graphic );
|
||||
writer.Write( m_RequireExceptional );
|
||||
writer.Write( (int) m_Material );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_AmountCur = reader.ReadInt();
|
||||
m_AmountMax = reader.ReadInt();
|
||||
|
||||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_Type = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_Number = reader.ReadInt();
|
||||
m_Graphic = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Weight == 0.0 )
|
||||
Weight = 1.0;
|
||||
|
||||
if ( Core.AOS && ItemID == 0x14EF )
|
||||
ItemID = 0x2258;
|
||||
|
||||
if ( Parent == null && Map == Map.Internal && Location == Point3D.Zero )
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
93
Scripts/Engines/BulkOrders/SmallBODAcceptGump.cs
Normal file
93
Scripts/Engines/BulkOrders/SmallBODAcceptGump.cs
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODAcceptGump : Gump
|
||||
{
|
||||
private SmallBOD m_Deed;
|
||||
private Mobile m_From;
|
||||
|
||||
public SmallBODAcceptGump( Mobile from, SmallBOD deed ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump( typeof( LargeBODAcceptGump ) );
|
||||
m_From.CloseGump( typeof( SmallBODAcceptGump ) );
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 25, 10, 430, 264, 5054 );
|
||||
|
||||
AddImageTiled( 33, 20, 413, 245, 2624 );
|
||||
AddAlphaRegion( 33, 20, 413, 245 );
|
||||
|
||||
AddImage( 20, 5, 10460 );
|
||||
AddImage( 430, 5, 10460 );
|
||||
AddImage( 20, 249, 10460 );
|
||||
AddImage( 430, 249, 10460 );
|
||||
|
||||
AddHtmlLocalized( 190, 25, 120, 20, 1045133, 0x7FFF, false, false ); // A bulk order
|
||||
AddHtmlLocalized( 40, 48, 350, 20, 1045135, 0x7FFF, false, false ); // Ah! Thanks for the goods! Would you help me out?
|
||||
|
||||
AddHtmlLocalized( 40, 72, 210, 20, 1045138, 0x7FFF, false, false ); // Amount to make:
|
||||
AddLabel( 250, 72, 1152, deed.AmountMax.ToString() );
|
||||
|
||||
AddHtmlLocalized( 40, 96, 120, 20, 1045136, 0x7FFF, false, false ); // Item requested:
|
||||
AddItem( 385, 96, deed.Graphic );
|
||||
AddHtmlLocalized( 40, 120, 210, 20, deed.Number, 0xFFFFFF, false, false );
|
||||
|
||||
if ( deed.RequireExceptional || deed.Material != BulkMaterialType.None )
|
||||
{
|
||||
AddHtmlLocalized( 40, 144, 210, 20, 1045140, 0x7FFF, false, false ); // Special requirements to meet:
|
||||
|
||||
if ( deed.RequireExceptional )
|
||||
AddHtmlLocalized( 40, 168, 350, 20, 1045141, 0x7FFF, false, false ); // All items must be exceptional.
|
||||
|
||||
if ( deed.Material != BulkMaterialType.None )
|
||||
AddHtmlLocalized( 40, deed.RequireExceptional ? 192 : 168, 350, 20, GetMaterialNumberFor( deed.Material ), 0x7FFF, false, false ); // All items must be made with x material.
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 40, 216, 350, 20, 1045139, 0x7FFF, false, false ); // Do you want to accept this order?
|
||||
|
||||
AddButton( 100, 240, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 135, 240, 120, 20, 1006044, 0x7FFF, false, false ); // Ok
|
||||
|
||||
AddButton( 275, 240, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 310, 240, 120, 20, 1011012, 0x7FFF, false, false ); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID == 1 ) // Ok
|
||||
{
|
||||
if ( m_From.PlaceInBackpack( m_Deed ) )
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage( 1045150 ); // There is not enough room in your backpack for the deed.
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetMaterialNumberFor( BulkMaterialType material )
|
||||
{
|
||||
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
|
||||
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
|
||||
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
|
||||
return 1049348 + (int)(material - BulkMaterialType.Spined);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
83
Scripts/Engines/BulkOrders/SmallBODGump.cs
Normal file
83
Scripts/Engines/BulkOrders/SmallBODGump.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODGump : Gump
|
||||
{
|
||||
private SmallBOD m_Deed;
|
||||
private Mobile m_From;
|
||||
|
||||
public SmallBODGump( Mobile from, SmallBOD deed ) : base( 25, 25 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Deed = deed;
|
||||
|
||||
m_From.CloseGump( typeof( LargeBODGump ) );
|
||||
m_From.CloseGump( typeof( SmallBODGump ) );
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 50, 10, 455, 260, 5054 );
|
||||
AddImageTiled( 58, 20, 438, 241, 2624 );
|
||||
AddAlphaRegion( 58, 20, 438, 241 );
|
||||
|
||||
AddImage( 45, 5, 10460 );
|
||||
AddImage( 480, 5, 10460 );
|
||||
AddImage( 45, 245, 10460 );
|
||||
AddImage( 480, 245, 10460 );
|
||||
|
||||
AddHtmlLocalized( 225, 25, 120, 20, 1045133, 0x7FFF, false, false ); // A bulk order
|
||||
|
||||
AddHtmlLocalized( 75, 48, 250, 20, 1045138, 0x7FFF, false, false ); // Amount to make:
|
||||
AddLabel( 275, 48, 1152, deed.AmountMax.ToString() );
|
||||
|
||||
AddHtmlLocalized( 275, 76, 200, 20, 1045153, 0x7FFF, false, false ); // Amount finished:
|
||||
AddHtmlLocalized( 75, 72, 120, 20, 1045136, 0x7FFF, false, false ); // Item requested:
|
||||
|
||||
AddItem( 410, 72, deed.Graphic );
|
||||
|
||||
AddHtmlLocalized( 75, 96, 210, 20, deed.Number, 0x7FFF, false, false );
|
||||
AddLabel( 275, 96, 0x480, deed.AmountCur.ToString() );
|
||||
|
||||
if ( deed.RequireExceptional || deed.Material != BulkMaterialType.None )
|
||||
AddHtmlLocalized( 75, 120, 200, 20, 1045140, 0x7FFF, false, false ); // Special requirements to meet:
|
||||
|
||||
if ( deed.RequireExceptional )
|
||||
AddHtmlLocalized( 75, 144, 300, 20, 1045141, 0x7FFF, false, false ); // All items must be exceptional.
|
||||
|
||||
if ( deed.Material != BulkMaterialType.None )
|
||||
AddHtmlLocalized( 75, deed.RequireExceptional ? 168 : 144, 300, 20, GetMaterialNumberFor( deed.Material ), 0x7FFF, false, false ); // All items must be made with x material.
|
||||
|
||||
AddButton( 125, 192, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 160, 192, 300, 20, 1045154, 0x7FFF, false, false ); // Combine this deed with the item requested.
|
||||
|
||||
AddButton( 125, 216, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 160, 216, 120, 20, 1011441, 0x7FFF, false, false ); // EXIT
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( m_Deed.Deleted || !m_Deed.IsChildOf( m_From.Backpack ) )
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 2 ) // Combine
|
||||
{
|
||||
m_From.SendGump( new SmallBODGump( m_From, m_Deed ) );
|
||||
m_Deed.BeginCombine( m_From );
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetMaterialNumberFor( BulkMaterialType material )
|
||||
{
|
||||
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
|
||||
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
|
||||
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
|
||||
return 1049348 + (int)(material - BulkMaterialType.Spined);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
25
Scripts/Engines/BulkOrders/SmallBODTarget.cs
Normal file
25
Scripts/Engines/BulkOrders/SmallBODTarget.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBODTarget : Target
|
||||
{
|
||||
private SmallBOD m_Deed;
|
||||
|
||||
public SmallBODTarget( SmallBOD deed ) : base( 18, false, TargetFlags.None )
|
||||
{
|
||||
m_Deed = deed;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( m_Deed.Deleted || !m_Deed.IsChildOf( from.Backpack ) )
|
||||
return;
|
||||
|
||||
m_Deed.EndCombine( from, targeted );
|
||||
}
|
||||
}
|
||||
}
|
||||
111
Scripts/Engines/BulkOrders/SmallBulkEntry.cs
Normal file
111
Scripts/Engines/BulkOrders/SmallBulkEntry.cs
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallBulkEntry
|
||||
{
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
|
||||
public Type Type{ get{ return m_Type; } }
|
||||
public int Number{ get{ return m_Number; } }
|
||||
public int Graphic{ get{ return m_Graphic; } }
|
||||
|
||||
public SmallBulkEntry( Type type, int number, int graphic )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithWeapons
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "weapons" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithArmor
|
||||
{
|
||||
get{ return GetEntries( "Blacksmith", "armor" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] TailorCloth
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "cloth" ); }
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] TailorLeather
|
||||
{
|
||||
get{ return GetEntries( "Tailoring", "leather" ); }
|
||||
}
|
||||
|
||||
private static Hashtable m_Cache;
|
||||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
if ( m_Cache == null )
|
||||
m_Cache = new Hashtable();
|
||||
|
||||
Hashtable table = (Hashtable)m_Cache[type];
|
||||
|
||||
if ( table == null )
|
||||
m_Cache[type] = table = new Hashtable();
|
||||
|
||||
SmallBulkEntry[] entries = (SmallBulkEntry[])table[name];
|
||||
|
||||
if ( entries == null )
|
||||
table[name] = entries = LoadEntries( type, name );
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries( string type, string name )
|
||||
{
|
||||
return LoadEntries( String.Format( "Data/Bulk Orders/{0}/{1}.cfg", type, name ) );
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries( string path )
|
||||
{
|
||||
path = Path.Combine( Core.BaseDirectory, path );
|
||||
|
||||
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
|
||||
|
||||
if ( File.Exists( path ) )
|
||||
{
|
||||
using ( StreamReader ip = new StreamReader( path ) )
|
||||
{
|
||||
string line;
|
||||
|
||||
while ( (line = ip.ReadLine()) != null )
|
||||
{
|
||||
if ( line.Length == 0 || line.StartsWith( "#" ) )
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
string[] split = line.Split( '\t' );
|
||||
|
||||
if ( split.Length >= 2 )
|
||||
{
|
||||
Type type = ScriptCompiler.FindTypeByName( split[0] );
|
||||
int graphic = Utility.ToInt32( split[split.Length - 1] );
|
||||
|
||||
if ( type != null && graphic > 0 )
|
||||
list.Add( new SmallBulkEntry( type, 1020000 + graphic, graphic ) );
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
244
Scripts/Engines/BulkOrders/SmallSmithBOD.cs
Normal file
244
Scripts/Engines/BulkOrders/SmallSmithBOD.cs
Normal file
|
|
@ -0,0 +1,244 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Engines.Craft;
|
||||
using Mat = Server.Engines.BulkOrders.BulkMaterialType;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
[TypeAlias( "Scripts.Engines.BulkOrders.SmallSmithBOD" )]
|
||||
public class SmallSmithBOD : SmallBOD
|
||||
{
|
||||
public static double[] m_BlacksmithMaterialChances = new double[]
|
||||
{
|
||||
0.501953125, // None
|
||||
0.250000000, // Dull Copper
|
||||
0.125000000, // Shadow Iron
|
||||
0.062500000, // Copper
|
||||
0.031250000, // Bronze
|
||||
0.015625000, // Gold
|
||||
0.007812500, // Agapite
|
||||
0.003906250, // Verite
|
||||
0.001953125 // Valorite
|
||||
};
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeFame( this );
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return SmithRewardCalculator.Instance.ComputeGold( this );
|
||||
}
|
||||
|
||||
public override ArrayList ComputeRewards( bool full )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
RewardGroup rewardGroup = SmithRewardCalculator.Instance.LookupRewards( SmithRewardCalculator.Instance.ComputePoints( this ) );
|
||||
|
||||
if ( rewardGroup != null )
|
||||
{
|
||||
if ( full )
|
||||
{
|
||||
for ( int i = 0; i < rewardGroup.Items.Length; ++i )
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if ( item != null )
|
||||
list.Add( item );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if ( rewardItem != null )
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if ( item != null )
|
||||
list.Add( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static SmallSmithBOD CreateRandomFor( Mobile m )
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if ( useMaterials = Utility.RandomBool() )
|
||||
entries = SmallBulkEntry.BlacksmithArmor;
|
||||
else
|
||||
entries = SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if ( entries.Length > 0 )
|
||||
{
|
||||
double theirSkill = m.Skills[SkillName.Blacksmith].Base;
|
||||
int amountMax;
|
||||
|
||||
if ( theirSkill >= 70.1 )
|
||||
amountMax = Utility.RandomList( 10, 15, 20, 20 );
|
||||
else if ( theirSkill >= 50.1 )
|
||||
amountMax = Utility.RandomList( 10, 15, 15, 20 );
|
||||
else
|
||||
amountMax = Utility.RandomList( 10, 10, 15, 20 );
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if ( useMaterials && theirSkill >= 70.1 )
|
||||
{
|
||||
for ( int i = 0; i < 20; ++i )
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial( BulkMaterialType.DullCopper, m_BlacksmithMaterialChances );
|
||||
double skillReq = 0.0;
|
||||
|
||||
switch ( check )
|
||||
{
|
||||
case BulkMaterialType.DullCopper: skillReq = 65.0; break;
|
||||
case BulkMaterialType.ShadowIron: skillReq = 70.0; break;
|
||||
case BulkMaterialType.Copper: skillReq = 75.0; break;
|
||||
case BulkMaterialType.Bronze: skillReq = 80.0; break;
|
||||
case BulkMaterialType.Gold: skillReq = 85.0; break;
|
||||
case BulkMaterialType.Agapite: skillReq = 90.0; break;
|
||||
case BulkMaterialType.Verite: skillReq = 95.0; break;
|
||||
case BulkMaterialType.Valorite: skillReq = 100.0; break;
|
||||
case BulkMaterialType.Spined: skillReq = 65.0; break;
|
||||
case BulkMaterialType.Horned: skillReq = 80.0; break;
|
||||
case BulkMaterialType.Barbed: skillReq = 99.0; break;
|
||||
}
|
||||
|
||||
if ( theirSkill >= skillReq )
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if ( theirSkill >= 70.1 )
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = ( excChance > Utility.RandomDouble() );
|
||||
|
||||
CraftSystem system = DefBlacksmithy.CraftSystem;
|
||||
|
||||
ArrayList validEntries = new ArrayList();
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor( entries[i].Type );
|
||||
|
||||
if ( item != null )
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance( m, null, system, false, ref allRequiredSkills );
|
||||
|
||||
if ( allRequiredSkills && chance >= 0.0 )
|
||||
{
|
||||
if ( reqExceptional )
|
||||
chance = item.GetExceptionalChance( system, chance, m );
|
||||
|
||||
if ( chance > 0.0 )
|
||||
validEntries.Add( entries[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( validEntries.Count > 0 )
|
||||
{
|
||||
SmallBulkEntry entry = (SmallBulkEntry)validEntries[Utility.Random( validEntries.Count )];
|
||||
return new SmallSmithBOD( entry, material, amountMax, reqExceptional );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private SmallSmithBOD( SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional )
|
||||
{
|
||||
this.Hue = 0x44E;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SmallSmithBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if ( useMaterials = Utility.RandomBool() )
|
||||
entries = SmallBulkEntry.BlacksmithArmor;
|
||||
else
|
||||
entries = SmallBulkEntry.BlacksmithWeapons;
|
||||
|
||||
if ( entries.Length > 0 )
|
||||
{
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList( 10, 15, 20 );
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if ( useMaterials )
|
||||
material = GetRandomMaterial( BulkMaterialType.DullCopper, m_BlacksmithMaterialChances );
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random( entries.Length )];
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallSmithBOD( int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat )
|
||||
{
|
||||
this.Hue = 0x44E;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public SmallSmithBOD( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
236
Scripts/Engines/BulkOrders/SmallTailorBOD.cs
Normal file
236
Scripts/Engines/BulkOrders/SmallTailorBOD.cs
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class SmallTailorBOD : SmallBOD
|
||||
{
|
||||
public static double[] m_TailoringMaterialChances = new double[]
|
||||
{
|
||||
0.857421875, // None
|
||||
0.125000000, // Spined
|
||||
0.015625000, // Horned
|
||||
0.001953125 // Barbed
|
||||
};
|
||||
|
||||
public override int ComputeFame()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeFame( this );
|
||||
}
|
||||
|
||||
public override int ComputeGold()
|
||||
{
|
||||
return TailorRewardCalculator.Instance.ComputeGold( this );
|
||||
}
|
||||
|
||||
public override ArrayList ComputeRewards( bool full )
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
|
||||
RewardGroup rewardGroup = TailorRewardCalculator.Instance.LookupRewards( TailorRewardCalculator.Instance.ComputePoints( this ) );
|
||||
|
||||
if ( rewardGroup != null )
|
||||
{
|
||||
if ( full )
|
||||
{
|
||||
for ( int i = 0; i < rewardGroup.Items.Length; ++i )
|
||||
{
|
||||
Item item = rewardGroup.Items[i].Construct();
|
||||
|
||||
if ( item != null )
|
||||
list.Add( item );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
RewardItem rewardItem = rewardGroup.AcquireItem();
|
||||
|
||||
if ( rewardItem != null )
|
||||
{
|
||||
Item item = rewardItem.Construct();
|
||||
|
||||
if ( item != null )
|
||||
list.Add( item );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public static SmallTailorBOD CreateRandomFor( Mobile m )
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
double theirSkill = m.Skills[SkillName.Tailoring].Base;
|
||||
if ( useMaterials = Utility.RandomBool() && theirSkill >= 6.2 ) // Ugly, but the easiest leather BOD is Leather Cap which requires at least 6.2 skill.
|
||||
entries = SmallBulkEntry.TailorLeather;
|
||||
else
|
||||
entries = SmallBulkEntry.TailorCloth;
|
||||
|
||||
if ( entries.Length > 0 )
|
||||
{
|
||||
int amountMax;
|
||||
|
||||
if ( theirSkill >= 70.1 )
|
||||
amountMax = Utility.RandomList( 10, 15, 20, 20 );
|
||||
else if ( theirSkill >= 50.1 )
|
||||
amountMax = Utility.RandomList( 10, 15, 15, 20 );
|
||||
else
|
||||
amountMax = Utility.RandomList( 10, 10, 15, 20 );
|
||||
|
||||
BulkMaterialType material = BulkMaterialType.None;
|
||||
|
||||
if ( useMaterials && theirSkill >= 70.1 )
|
||||
{
|
||||
for ( int i = 0; i < 20; ++i )
|
||||
{
|
||||
BulkMaterialType check = GetRandomMaterial( BulkMaterialType.Spined, m_TailoringMaterialChances );
|
||||
double skillReq = 0.0;
|
||||
|
||||
switch ( check )
|
||||
{
|
||||
case BulkMaterialType.DullCopper: skillReq = 65.0; break;
|
||||
case BulkMaterialType.Bronze: skillReq = 80.0; break;
|
||||
case BulkMaterialType.Gold: skillReq = 85.0; break;
|
||||
case BulkMaterialType.Agapite: skillReq = 90.0; break;
|
||||
case BulkMaterialType.Verite: skillReq = 95.0; break;
|
||||
case BulkMaterialType.Valorite: skillReq = 100.0; break;
|
||||
case BulkMaterialType.Spined: skillReq = 65.0; break;
|
||||
case BulkMaterialType.Horned: skillReq = 80.0; break;
|
||||
case BulkMaterialType.Barbed: skillReq = 99.0; break;
|
||||
}
|
||||
|
||||
if ( theirSkill >= skillReq )
|
||||
{
|
||||
material = check;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double excChance = 0.0;
|
||||
|
||||
if ( theirSkill >= 70.1 )
|
||||
excChance = (theirSkill + 80.0) / 200.0;
|
||||
|
||||
bool reqExceptional = ( excChance > Utility.RandomDouble() );
|
||||
|
||||
|
||||
CraftSystem system = DefTailoring.CraftSystem;
|
||||
|
||||
ArrayList validEntries = new ArrayList();
|
||||
|
||||
for ( int i = 0; i < entries.Length; ++i )
|
||||
{
|
||||
CraftItem item = system.CraftItems.SearchFor( entries[i].Type );
|
||||
|
||||
if ( item != null )
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance( m, null, system, false, ref allRequiredSkills );
|
||||
|
||||
if ( allRequiredSkills && chance >= 0.0 )
|
||||
{
|
||||
if ( reqExceptional )
|
||||
chance = item.GetExceptionalChance( system, chance, m );
|
||||
|
||||
if ( chance > 0.0 )
|
||||
validEntries.Add( entries[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( validEntries.Count > 0 )
|
||||
{
|
||||
SmallBulkEntry entry = (SmallBulkEntry)validEntries[Utility.Random( validEntries.Count )];
|
||||
return new SmallTailorBOD( entry, material, amountMax, reqExceptional );
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private SmallTailorBOD( SmallBulkEntry entry, BulkMaterialType material, int amountMax, bool reqExceptional )
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SmallTailorBOD()
|
||||
{
|
||||
SmallBulkEntry[] entries;
|
||||
bool useMaterials;
|
||||
|
||||
if ( useMaterials = Utility.RandomBool() )
|
||||
entries = SmallBulkEntry.TailorLeather;
|
||||
else
|
||||
entries = SmallBulkEntry.TailorCloth;
|
||||
|
||||
if ( entries.Length > 0 )
|
||||
{
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList( 10, 15, 20 );
|
||||
|
||||
BulkMaterialType material;
|
||||
|
||||
if ( useMaterials )
|
||||
material = GetRandomMaterial( BulkMaterialType.Spined, m_TailoringMaterialChances );
|
||||
else
|
||||
material = BulkMaterialType.None;
|
||||
|
||||
bool reqExceptional = Utility.RandomBool() || (material == BulkMaterialType.None);
|
||||
|
||||
SmallBulkEntry entry = entries[Utility.Random( entries.Length )];
|
||||
|
||||
this.Hue = hue;
|
||||
this.AmountMax = amountMax;
|
||||
this.Type = entry.Type;
|
||||
this.Number = entry.Number;
|
||||
this.Graphic = entry.Graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = material;
|
||||
}
|
||||
}
|
||||
|
||||
public SmallTailorBOD( int amountCur, int amountMax, Type type, int number, int graphic, bool reqExceptional, BulkMaterialType mat )
|
||||
{
|
||||
this.Hue = 0x483;
|
||||
this.AmountMax = amountMax;
|
||||
this.AmountCur = amountCur;
|
||||
this.Type = type;
|
||||
this.Number = number;
|
||||
this.Graphic = graphic;
|
||||
this.RequireExceptional = reqExceptional;
|
||||
this.Material = mat;
|
||||
}
|
||||
|
||||
public SmallTailorBOD( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
58
Scripts/Engines/CannedEvil/ChampionAltar.cs
Normal file
58
Scripts/Engines/CannedEvil/ChampionAltar.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.CannedEvil
|
||||
{
|
||||
public class ChampionAltar : PentagramAddon
|
||||
{
|
||||
private ChampionSpawn m_Spawn;
|
||||
|
||||
public ChampionAltar( ChampionSpawn spawn )
|
||||
{
|
||||
m_Spawn = spawn;
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if ( m_Spawn != null )
|
||||
m_Spawn.Delete();
|
||||
}
|
||||
|
||||
public ChampionAltar( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Spawn );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Spawn = reader.ReadItem() as ChampionSpawn;
|
||||
|
||||
if ( m_Spawn == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
89
Scripts/Engines/CannedEvil/ChampionPlatform.cs
Normal file
89
Scripts/Engines/CannedEvil/ChampionPlatform.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.CannedEvil
|
||||
{
|
||||
public class ChampionPlatform : BaseAddon
|
||||
{
|
||||
private ChampionSpawn m_Spawn;
|
||||
|
||||
public ChampionPlatform( ChampionSpawn spawn )
|
||||
{
|
||||
m_Spawn = spawn;
|
||||
|
||||
for ( int x = -2; x <= 2; ++x )
|
||||
for ( int y = -2; y <= 2; ++y )
|
||||
AddComponent( 0x750, x, y, -5 );
|
||||
|
||||
for ( int x = -1; x <= 1; ++x )
|
||||
for ( int y = -1; y <= 1; ++y )
|
||||
AddComponent( 0x750, x, y, 0 );
|
||||
|
||||
for ( int i = -1; i <= 1; ++i )
|
||||
{
|
||||
AddComponent( 0x751, i, 2, 0 );
|
||||
AddComponent( 0x752, 2, i, 0 );
|
||||
|
||||
AddComponent( 0x753, i, -2, 0 );
|
||||
AddComponent( 0x754, -2, i, 0 );
|
||||
}
|
||||
|
||||
AddComponent( 0x759, -2, -2, 0 );
|
||||
AddComponent( 0x75A, 2, 2, 0 );
|
||||
AddComponent( 0x75B, -2, 2, 0 );
|
||||
AddComponent( 0x75C, 2, -2, 0 );
|
||||
}
|
||||
|
||||
public void AddComponent( int id, int x, int y, int z )
|
||||
{
|
||||
AddonComponent ac = new AddonComponent( id );
|
||||
|
||||
ac.Hue = 0x497;
|
||||
|
||||
AddComponent( ac, x, y, z );
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if ( m_Spawn != null )
|
||||
m_Spawn.Delete();
|
||||
}
|
||||
|
||||
public ChampionPlatform( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Spawn );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Spawn = reader.ReadItem() as ChampionSpawn;
|
||||
|
||||
if ( m_Spawn == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
73
Scripts/Engines/CannedEvil/ChampionSkull.cs
Normal file
73
Scripts/Engines/CannedEvil/ChampionSkull.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Engines.CannedEvil;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class ChampionSkull : Item
|
||||
{
|
||||
private ChampionSkullType m_Type;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ChampionSkullType Type{ get{ return m_Type; } set{ m_Type = value; InvalidateProperties(); } }
|
||||
|
||||
public override int LabelNumber{ get{ return 1049479 + (int)m_Type; } }
|
||||
|
||||
[Constructable]
|
||||
public ChampionSkull( ChampionSkullType type ) : base( 0x1AE1 )
|
||||
{
|
||||
m_Type = type;
|
||||
LootType = LootType.Cursed;
|
||||
|
||||
// TODO: All hue values
|
||||
switch ( type )
|
||||
{
|
||||
case ChampionSkullType.Power: Hue = 0x159; break;
|
||||
case ChampionSkullType.Venom: Hue = 0x172; break;
|
||||
case ChampionSkullType.Greed: Hue = 0x1EE; break;
|
||||
case ChampionSkullType.Death: Hue = 0x025; break;
|
||||
case ChampionSkullType.Pain: Hue = 0x035; break;
|
||||
}
|
||||
}
|
||||
|
||||
public ChampionSkull( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (int) m_Type );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Type = (ChampionSkullType)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( version == 0 )
|
||||
{
|
||||
if ( LootType != LootType.Cursed )
|
||||
LootType = LootType.Cursed;
|
||||
|
||||
if ( Insured )
|
||||
Insured = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
173
Scripts/Engines/CannedEvil/ChampionSkullBrazier.cs
Normal file
173
Scripts/Engines/CannedEvil/ChampionSkullBrazier.cs
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Targeting;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.CannedEvil
|
||||
{
|
||||
public class ChampionSkullBrazier : AddonComponent
|
||||
{
|
||||
private ChampionSkullPlatform m_Platform;
|
||||
private ChampionSkullType m_Type;
|
||||
private Item m_Skull;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ChampionSkullPlatform Platform{ get{ return m_Platform; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ChampionSkullType Type{ get{ return m_Type; } set{ m_Type = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Skull{ get{ return m_Skull; } set{ m_Skull = value; if ( m_Platform != null ) m_Platform.Validate(); } }
|
||||
|
||||
public override int LabelNumber{ get{ return 1049489 + (int)m_Type; } }
|
||||
|
||||
public ChampionSkullBrazier( ChampionSkullPlatform platform, ChampionSkullType type ) : base( 0x19BB )
|
||||
{
|
||||
Hue = 0x455;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
m_Platform = platform;
|
||||
m_Type = type;
|
||||
}
|
||||
|
||||
public ChampionSkullBrazier( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_Platform != null )
|
||||
m_Platform.Validate();
|
||||
|
||||
BeginSacrifice( from );
|
||||
}
|
||||
|
||||
public void BeginSacrifice( Mobile from )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
|
||||
if ( m_Skull != null && m_Skull.Deleted )
|
||||
Skull = null;
|
||||
|
||||
if ( from.Map != this.Map || !from.InRange( GetWorldLocation(), 3 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
else if ( !Harrower.CanSpawn )
|
||||
{
|
||||
from.SendMessage( "The harrower has already been spawned." );
|
||||
}
|
||||
else if ( m_Skull == null )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049485 ); // What would you like to sacrifice?
|
||||
from.Target = new SacrificeTarget( this );
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1049487, "" ); // I already have my champions awakening skull!
|
||||
}
|
||||
}
|
||||
|
||||
public void EndSacrifice( Mobile from, ChampionSkull skull )
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
|
||||
if ( m_Skull != null && m_Skull.Deleted )
|
||||
Skull = null;
|
||||
|
||||
if ( from.Map != this.Map || !from.InRange( GetWorldLocation(), 3 ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
else if ( !Harrower.CanSpawn )
|
||||
{
|
||||
from.SendMessage( "The harrower has already been spawned." );
|
||||
}
|
||||
else if ( skull == null )
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1049488, "" ); // That is not my champions awakening skull!
|
||||
}
|
||||
else if ( m_Skull != null )
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1049487, "" ); // I already have my champions awakening skull!
|
||||
}
|
||||
else if ( !skull.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1049486 ); // You can only sacrifice items that are in your backpack!
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( skull.Type == this.Type )
|
||||
{
|
||||
skull.Movable = false;
|
||||
skull.MoveToWorld( GetWorldTop(), this.Map );
|
||||
|
||||
this.Skull = skull;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendLocalizedMessageTo( from, 1049488, "" ); // That is not my champions awakening skull!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SacrificeTarget : Target
|
||||
{
|
||||
private ChampionSkullBrazier m_Brazier;
|
||||
|
||||
public SacrificeTarget( ChampionSkullBrazier brazier ) : base( 12, false, TargetFlags.None )
|
||||
{
|
||||
m_Brazier = brazier;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
m_Brazier.EndSacrifice( from, targeted as ChampionSkull );
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (int) m_Type );
|
||||
writer.Write( m_Platform );
|
||||
writer.Write( m_Skull );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Type = (ChampionSkullType)reader.ReadInt();
|
||||
m_Platform = reader.ReadItem() as ChampionSkullPlatform;
|
||||
m_Skull = reader.ReadItem();
|
||||
|
||||
if ( m_Platform == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Hue == 0x497 )
|
||||
Hue = 0x455;
|
||||
|
||||
if ( Light != LightType.Circle300 )
|
||||
Light = LightType.Circle300;
|
||||
}
|
||||
}
|
||||
}
|
||||
131
Scripts/Engines/CannedEvil/ChampionSkullPlatform.cs
Normal file
131
Scripts/Engines/CannedEvil/ChampionSkullPlatform.cs
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.CannedEvil
|
||||
{
|
||||
public class ChampionSkullPlatform : BaseAddon
|
||||
{
|
||||
private ChampionSkullBrazier m_Power, m_Enlightenment, m_Venom, m_Pain, m_Greed, m_Death;
|
||||
|
||||
[Constructable]
|
||||
public ChampionSkullPlatform()
|
||||
{
|
||||
AddComponent( new AddonComponent( 0x71A ), -1, -1, -1 );
|
||||
AddComponent( new AddonComponent( 0x709 ), 0, -1, -1 );
|
||||
AddComponent( new AddonComponent( 0x709 ), 1, -1, -1 );
|
||||
AddComponent( new AddonComponent( 0x709 ), -1, 0, -1 );
|
||||
AddComponent( new AddonComponent( 0x709 ), 0, 0, -1 );
|
||||
AddComponent( new AddonComponent( 0x709 ), 1, 0, -1 );
|
||||
AddComponent( new AddonComponent( 0x709 ), -1, 1, -1 );
|
||||
AddComponent( new AddonComponent( 0x709 ), 0, 1, -1 );
|
||||
AddComponent( new AddonComponent( 0x71B ), 1, 1, -1 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x50F ), 0, -1, 4 );
|
||||
AddComponent( m_Power = new ChampionSkullBrazier( this, ChampionSkullType.Power ), 0, -1, 5 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x50F ), 1, -1, 4 );
|
||||
AddComponent( m_Enlightenment = new ChampionSkullBrazier( this, ChampionSkullType.Enlightenment ), 1, -1, 5 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x50F ), -1, 0, 4 );
|
||||
AddComponent( m_Venom = new ChampionSkullBrazier( this, ChampionSkullType.Venom ), -1, 0, 5 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x50F ), 1, 0, 4 );
|
||||
AddComponent( m_Pain = new ChampionSkullBrazier( this, ChampionSkullType.Pain ), 1, 0, 5 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x50F ), -1, 1, 4 );
|
||||
AddComponent( m_Greed = new ChampionSkullBrazier( this, ChampionSkullType.Greed ), -1, 1, 5 );
|
||||
|
||||
AddComponent( new AddonComponent( 0x50F ), 0, 1, 4 );
|
||||
AddComponent( m_Death = new ChampionSkullBrazier( this, ChampionSkullType.Death ), 0, 1, 5 );
|
||||
|
||||
AddonComponent comp = new LocalizedAddonComponent( 0x20D2, 1049495 );
|
||||
comp.Hue = 0x482;
|
||||
AddComponent( comp, 0, 0, 5 );
|
||||
|
||||
comp = new LocalizedAddonComponent( 0x0BCF, 1049496 );
|
||||
comp.Hue = 0x482;
|
||||
AddComponent( comp, 0, 2, -7 );
|
||||
|
||||
comp = new LocalizedAddonComponent( 0x0BD0, 1049497 );
|
||||
comp.Hue = 0x482;
|
||||
AddComponent( comp, 2, 0, -7 );
|
||||
}
|
||||
|
||||
public void Validate()
|
||||
{
|
||||
if ( Validate( m_Power ) && Validate( m_Enlightenment ) && Validate( m_Venom ) && Validate( m_Pain ) && Validate( m_Greed ) && Validate( m_Death ) )
|
||||
{
|
||||
Mobile harrower = Harrower.Spawn( new Point3D( X, Y, Z + 6 ), this.Map );
|
||||
|
||||
if ( harrower == null )
|
||||
return;
|
||||
|
||||
Clear( m_Power );
|
||||
Clear( m_Enlightenment );
|
||||
Clear( m_Venom );
|
||||
Clear( m_Pain );
|
||||
Clear( m_Greed );
|
||||
Clear( m_Death );
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear( ChampionSkullBrazier brazier )
|
||||
{
|
||||
if ( brazier != null )
|
||||
{
|
||||
Effects.SendBoltEffect( brazier );
|
||||
|
||||
if ( brazier.Skull != null )
|
||||
brazier.Skull.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Validate( ChampionSkullBrazier brazier )
|
||||
{
|
||||
return ( brazier != null && brazier.Skull != null && !brazier.Skull.Deleted );
|
||||
}
|
||||
|
||||
public ChampionSkullPlatform( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Power );
|
||||
writer.Write( m_Enlightenment );
|
||||
writer.Write( m_Venom );
|
||||
writer.Write( m_Pain );
|
||||
writer.Write( m_Greed );
|
||||
writer.Write( m_Death );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Power = reader.ReadItem() as ChampionSkullBrazier;
|
||||
m_Enlightenment = reader.ReadItem() as ChampionSkullBrazier;
|
||||
m_Venom = reader.ReadItem() as ChampionSkullBrazier;
|
||||
m_Pain = reader.ReadItem() as ChampionSkullBrazier;
|
||||
m_Greed = reader.ReadItem() as ChampionSkullBrazier;
|
||||
m_Death = reader.ReadItem() as ChampionSkullBrazier;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Scripts/Engines/CannedEvil/ChampionSkullType.cs
Normal file
15
Scripts/Engines/CannedEvil/ChampionSkullType.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Engines.CannedEvil
|
||||
{
|
||||
public enum ChampionSkullType
|
||||
{
|
||||
Power,
|
||||
Enlightenment,
|
||||
Venom,
|
||||
Pain,
|
||||
Greed,
|
||||
Death
|
||||
}
|
||||
}
|
||||
1076
Scripts/Engines/CannedEvil/ChampionSpawn.cs
Normal file
1076
Scripts/Engines/CannedEvil/ChampionSpawn.cs
Normal file
File diff suppressed because it is too large
Load diff
106
Scripts/Engines/CannedEvil/ChampionSpawnType.cs
Normal file
106
Scripts/Engines/CannedEvil/ChampionSpawnType.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.CannedEvil
|
||||
{
|
||||
public enum ChampionSpawnType
|
||||
{
|
||||
Abyss,
|
||||
Arachnid,
|
||||
ColdBlood,
|
||||
ForestLord,
|
||||
VerminHorde,
|
||||
UnholyTerror,
|
||||
SleepingDragon
|
||||
}
|
||||
|
||||
public class ChampionSpawnInfo
|
||||
{
|
||||
private string m_Name;
|
||||
private Type m_Champion;
|
||||
private Type[][] m_SpawnTypes;
|
||||
private string[] m_LevelNames;
|
||||
|
||||
public string Name { get { return m_Name; } }
|
||||
public Type Champion { get { return m_Champion; } }
|
||||
public Type[][] SpawnTypes { get { return m_SpawnTypes; } }
|
||||
public string[] LevelNames { get { return m_LevelNames; } }
|
||||
|
||||
public ChampionSpawnInfo( string name, Type champion, string[] levelNames, Type[][] spawnTypes )
|
||||
{
|
||||
m_Name = name;
|
||||
m_Champion = champion;
|
||||
m_LevelNames = levelNames;
|
||||
m_SpawnTypes = spawnTypes;
|
||||
}
|
||||
|
||||
public static ChampionSpawnInfo[] Table{ get { return m_Table; } }
|
||||
|
||||
private static readonly ChampionSpawnInfo[] m_Table = new ChampionSpawnInfo[]
|
||||
{
|
||||
new ChampionSpawnInfo( "Abyss", typeof( Semidar ), new string[]{ "Foe", "Assassin", "Conqueror" }, new Type[][] // Abyss
|
||||
{ // Abyss
|
||||
new Type[]{ typeof( StrongMongbat ), typeof( Imp ) }, // Level 1
|
||||
new Type[]{ typeof( Gargoyle ), typeof( Harpy ) }, // Level 2
|
||||
new Type[]{ typeof( FireGargoyle ), typeof( StoneGargoyle ) }, // Level 3
|
||||
new Type[]{ typeof( Daemon ), typeof( Succubus ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Arachnid", typeof( Mephitis ), new string[]{ "Bane", "Killer", "Vanquisher" }, new Type[][] // Arachnid
|
||||
{ // Arachnid
|
||||
new Type[]{ typeof( Scorpion ), typeof( GiantSpider ) }, // Level 1
|
||||
new Type[]{ typeof( TerathanDrone ), typeof( TerathanWarrior ) }, // Level 2
|
||||
new Type[]{ typeof( DreadSpider ), typeof( TerathanMatriarch ) }, // Level 3
|
||||
new Type[]{ typeof( PoisonElemental ), typeof( TerathanAvenger ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Cold Blood", typeof( Rikktor ), new string[]{ "Blight", "Slayer", "Destroyer" }, new Type[][] // Cold Blood
|
||||
{ // Cold Blood
|
||||
new Type[]{ typeof( Lizardman ), typeof( Snake ) }, // Level 1
|
||||
new Type[]{ typeof( LavaLizard ), typeof( OphidianWarrior ) }, // Level 2
|
||||
new Type[]{ typeof( Drake ), typeof( OphidianArchmage ) }, // Level 3
|
||||
new Type[]{ typeof( Dragon ), typeof( OphidianKnight ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Forest Lord", typeof( LordOaks ), new string[]{ "Enemy", "Curse", "Slaughterer" }, new Type[][] // Forest Lord
|
||||
{ // Forest Lord
|
||||
new Type[]{ typeof( Pixie ), typeof( ShadowWisp ) }, // Level 1
|
||||
new Type[]{ typeof( Kirin ), typeof( Wisp ) }, // Level 2
|
||||
new Type[]{ typeof( Centaur ), typeof( Unicorn ) }, // Level 3
|
||||
new Type[]{ typeof( EtherealWarrior ), typeof( SerpentineDragon ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Vermin Horde", typeof( Barracoon ), new string[]{ "Adversary", "Subjugator", "Eradicator" }, new Type[][] // Vermin Horde
|
||||
{ // Vermin Horde
|
||||
new Type[]{ typeof( GiantRat ), typeof( Slime ) }, // Level 1
|
||||
new Type[]{ typeof( DireWolf ), typeof( Ratman ) }, // Level 2
|
||||
new Type[]{ typeof( HellHound ), typeof( RatmanMage ) }, // Level 3
|
||||
new Type[]{ typeof( RatmanArcher ), typeof( SilverSerpent ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Unholy Terror", typeof( Neira ), new string[]{ "Scourge", "Punisher", "Nemesis" }, new Type[][] // Unholy Terror
|
||||
{ // Unholy Terror
|
||||
(Core.AOS ?
|
||||
new Type[]{ typeof( Bogle ), typeof( Ghoul ), typeof( Shade ), typeof( Spectre ), typeof( Wraith ) } // Level 1 (Pre-AoS)
|
||||
: new Type[]{ typeof( Ghoul ), typeof( Shade ), typeof( Spectre ), typeof( Wraith ) } ), // Level 1
|
||||
|
||||
new Type[]{ typeof( BoneMagi ), typeof( Mummy ), typeof( SkeletalMage ) }, // Level 2
|
||||
new Type[]{ typeof( BoneKnight ), typeof( Lich ), typeof( SkeletalKnight ) }, // Level 3
|
||||
new Type[]{ typeof( LichLord ), typeof( RottingCorpse ) } // Level 4
|
||||
} ),
|
||||
new ChampionSpawnInfo( "Sleeping Dragon", typeof( Serado ), new string[]{ "Rival", "Challenger", "Antagonist" } , new Type[][]
|
||||
{ // Unholy Terror
|
||||
new Type[]{ typeof( DeathwatchBeetleHatchling ), typeof( Lizardman ) },
|
||||
new Type[]{ typeof( DeathwatchBeetle ), typeof( Kappa ) },
|
||||
new Type[]{ typeof( LesserHiryu ), typeof( RevenantLion ) },
|
||||
new Type[]{ typeof( Hiryu ), typeof( Oni ) }
|
||||
} )
|
||||
};
|
||||
|
||||
public static ChampionSpawnInfo GetInfo( ChampionSpawnType type )
|
||||
{
|
||||
int v = (int)type;
|
||||
|
||||
if( v < 0 || v >= m_Table.Length )
|
||||
v = 0;
|
||||
|
||||
return m_Table[v];
|
||||
}
|
||||
}
|
||||
}
|
||||
59
Scripts/Engines/CannedEvil/HarrowerGate.cs
Normal file
59
Scripts/Engines/CannedEvil/HarrowerGate.cs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class HarrowerGate : Moongate
|
||||
{
|
||||
private Mobile m_Harrower;
|
||||
|
||||
public override int LabelNumber{ get{ return 1049498; } } // dark moongate
|
||||
|
||||
public HarrowerGate( Mobile harrower, Point3D loc, Map map, Point3D targLoc, Map targMap ) : base( targLoc, targMap )
|
||||
{
|
||||
m_Harrower = harrower;
|
||||
|
||||
Dispellable = false;
|
||||
ItemID = 0x1FD4;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
MoveToWorld( loc, map );
|
||||
}
|
||||
|
||||
public HarrowerGate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Harrower );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Harrower = reader.ReadMobile();
|
||||
|
||||
if ( m_Harrower == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Light != LightType.Circle300 )
|
||||
Light = LightType.Circle300;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Scripts/Engines/CannedEvil/RestartTimer.cs
Normal file
23
Scripts/Engines/CannedEvil/RestartTimer.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.CannedEvil
|
||||
{
|
||||
public class RestartTimer : Timer
|
||||
{
|
||||
private ChampionSpawn m_Spawn;
|
||||
|
||||
public RestartTimer( ChampionSpawn spawn, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
m_Spawn = spawn;
|
||||
Priority = TimerPriority.FiveSeconds;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Spawn.EndRestart();
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Scripts/Engines/CannedEvil/SliceTimer.cs
Normal file
23
Scripts/Engines/CannedEvil/SliceTimer.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.CannedEvil
|
||||
{
|
||||
public class SliceTimer : Timer
|
||||
{
|
||||
private ChampionSpawn m_Spawn;
|
||||
|
||||
public SliceTimer( ChampionSpawn spawn ) : base( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ) )
|
||||
{
|
||||
m_Spawn = spawn;
|
||||
Priority = TimerPriority.OneSecond;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Spawn.OnSlice();
|
||||
}
|
||||
}
|
||||
}
|
||||
106
Scripts/Engines/CannedEvil/StarRoomGate.cs
Normal file
106
Scripts/Engines/CannedEvil/StarRoomGate.cs
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class StarRoomGate : Moongate
|
||||
{
|
||||
private bool m_Decays;
|
||||
private DateTime m_DecayTime;
|
||||
private Timer m_Timer;
|
||||
|
||||
public override int LabelNumber{ get{ return 1049498; } } // dark moongate
|
||||
|
||||
[Constructable]
|
||||
public StarRoomGate() : this( false )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public StarRoomGate( bool decays, Point3D loc, Map map ) : this( decays )
|
||||
{
|
||||
MoveToWorld( loc, map );
|
||||
Effects.PlaySound( loc, map, 0x20E );
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public StarRoomGate( bool decays ) : base( new Point3D( 5143, 1774, 0 ), Map.Felucca )
|
||||
{
|
||||
Dispellable = false;
|
||||
ItemID = 0x1FD4;
|
||||
|
||||
if ( decays )
|
||||
{
|
||||
m_Decays = true;
|
||||
m_DecayTime = DateTime.Now + TimeSpan.FromMinutes( 2.0 );
|
||||
|
||||
m_Timer = new InternalTimer( this, m_DecayTime );
|
||||
m_Timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public StarRoomGate( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_Decays );
|
||||
|
||||
if ( m_Decays )
|
||||
writer.WriteDeltaTime( m_DecayTime );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Decays = reader.ReadBool();
|
||||
|
||||
if ( m_Decays )
|
||||
{
|
||||
m_DecayTime = reader.ReadDeltaTime();
|
||||
|
||||
m_Timer = new InternalTimer( this, m_DecayTime );
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Item m_Item;
|
||||
|
||||
public InternalTimer( Item item, DateTime end ) : base( end - DateTime.Now )
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
548
Scripts/Engines/Chat/Channel.cs
Normal file
548
Scripts/Engines/Chat/Channel.cs
Normal file
|
|
@ -0,0 +1,548 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
|
||||
namespace Server.Engines.Chat
|
||||
{
|
||||
public class Channel
|
||||
{
|
||||
private string m_Name;
|
||||
private string m_Password;
|
||||
private ArrayList m_Users, m_Banned, m_Moderators, m_Voices;
|
||||
private bool m_VoiceRestricted;
|
||||
private bool m_AlwaysAvailable;
|
||||
|
||||
public Channel( string name )
|
||||
{
|
||||
m_Name = name;
|
||||
|
||||
m_Users = new ArrayList();
|
||||
m_Banned = new ArrayList();
|
||||
m_Moderators = new ArrayList();
|
||||
m_Voices = new ArrayList();
|
||||
}
|
||||
|
||||
public Channel( string name, string password ) : this( name )
|
||||
{
|
||||
m_Password = password;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
set
|
||||
{
|
||||
SendCommand( ChatCommand.RemoveChannel, m_Name );
|
||||
m_Name = value;
|
||||
SendCommand( ChatCommand.AddChannel, m_Name );
|
||||
SendCommand( ChatCommand.JoinedChannel, m_Name );
|
||||
}
|
||||
}
|
||||
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Password;
|
||||
}
|
||||
set
|
||||
{
|
||||
string newValue = null;
|
||||
|
||||
if ( value != null )
|
||||
{
|
||||
newValue = value.Trim();
|
||||
|
||||
if ( newValue == null || newValue == String.Empty )
|
||||
newValue = null;
|
||||
}
|
||||
|
||||
m_Password = newValue;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains( ChatUser user )
|
||||
{
|
||||
return m_Users.Contains( user );
|
||||
}
|
||||
|
||||
public bool IsBanned( ChatUser user )
|
||||
{
|
||||
return m_Banned.Contains( user );
|
||||
}
|
||||
|
||||
public bool CanTalk( ChatUser user )
|
||||
{
|
||||
return ( !m_VoiceRestricted || m_Voices.Contains( user ) || m_Moderators.Contains( user ) );
|
||||
}
|
||||
|
||||
public bool IsModerator( ChatUser user )
|
||||
{
|
||||
return m_Moderators.Contains( user );
|
||||
}
|
||||
|
||||
public bool IsVoiced( ChatUser user )
|
||||
{
|
||||
return m_Voices.Contains( user );
|
||||
}
|
||||
|
||||
public bool ValidatePassword( string password )
|
||||
{
|
||||
return ( m_Password == null || Insensitive.Equals( m_Password, password ) );
|
||||
}
|
||||
|
||||
public bool ValidateModerator( ChatUser user )
|
||||
{
|
||||
if ( user != null && !IsModerator( user ) )
|
||||
{
|
||||
user.SendMessage( 29 ); // You must have operator status to do this.
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ValidateAccess( ChatUser from, ChatUser target )
|
||||
{
|
||||
if ( from != null && target != null && from.Mobile.AccessLevel < target.Mobile.AccessLevel )
|
||||
{
|
||||
from.Mobile.SendMessage( "Your access level is too low to do this." );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddUser( ChatUser user )
|
||||
{
|
||||
return AddUser( user, null );
|
||||
}
|
||||
|
||||
public bool AddUser( ChatUser user, string password )
|
||||
{
|
||||
if ( Contains( user ) )
|
||||
{
|
||||
user.SendMessage( 46, m_Name ); // You are already in the conference '%1'.
|
||||
return true;
|
||||
}
|
||||
else if ( IsBanned( user ) )
|
||||
{
|
||||
user.SendMessage( 64 ); // You have been banned from this conference.
|
||||
return false;
|
||||
}
|
||||
else if ( !ValidatePassword( password ) )
|
||||
{
|
||||
user.SendMessage( 34 ); // That is not the correct password.
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( user.CurrentChannel != null )
|
||||
user.CurrentChannel.RemoveUser( user ); // Remove them from their current channel first
|
||||
|
||||
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.JoinedChannel, m_Name );
|
||||
|
||||
SendCommand( ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
|
||||
m_Users.Add( user );
|
||||
user.CurrentChannel = this;
|
||||
|
||||
if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!m_AlwaysAvailable && m_Users.Count == 1) )
|
||||
AddModerator( user );
|
||||
|
||||
SendUsersTo( user );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveUser( ChatUser user )
|
||||
{
|
||||
if ( Contains( user ) )
|
||||
{
|
||||
m_Users.Remove( user );
|
||||
user.CurrentChannel = null;
|
||||
|
||||
if ( m_Moderators.Contains( user ) )
|
||||
m_Moderators.Remove( user );
|
||||
|
||||
if ( m_Voices.Contains( user ) )
|
||||
m_Voices.Remove( user );
|
||||
|
||||
SendCommand( ChatCommand.RemoveUserFromChannel, user, user.Username );
|
||||
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.LeaveChannel );
|
||||
|
||||
if ( m_Users.Count == 0 && !m_AlwaysAvailable )
|
||||
RemoveChannel( this );
|
||||
}
|
||||
}
|
||||
|
||||
public void AdBan( ChatUser user )
|
||||
{
|
||||
AddBan( user, null );
|
||||
}
|
||||
|
||||
public void AddBan( ChatUser user, ChatUser moderator )
|
||||
{
|
||||
if ( !ValidateModerator( moderator ) || !ValidateAccess( moderator, user ) )
|
||||
return;
|
||||
|
||||
if ( !m_Banned.Contains( user ) )
|
||||
m_Banned.Add( user );
|
||||
|
||||
Kick( user, moderator, true );
|
||||
}
|
||||
|
||||
public void RemoveBan( ChatUser user )
|
||||
{
|
||||
if ( m_Banned.Contains( user ) )
|
||||
m_Banned.Remove( user );
|
||||
}
|
||||
|
||||
public void Kick( ChatUser user )
|
||||
{
|
||||
Kick( user, null );
|
||||
}
|
||||
|
||||
public void Kick( ChatUser user, ChatUser moderator )
|
||||
{
|
||||
Kick( user, moderator, false );
|
||||
}
|
||||
|
||||
public void Kick( ChatUser user, ChatUser moderator, bool wasBanned )
|
||||
{
|
||||
if ( !ValidateModerator( moderator ) || !ValidateAccess( moderator, user ) )
|
||||
return;
|
||||
|
||||
if ( Contains( user ) )
|
||||
{
|
||||
if ( moderator != null )
|
||||
{
|
||||
if ( wasBanned )
|
||||
user.SendMessage( 63, moderator.Username ); // %1, a conference moderator, has banned you from the conference.
|
||||
else
|
||||
user.SendMessage( 45, moderator.Username ); // %1, a conference moderator, has kicked you out of the conference.
|
||||
}
|
||||
|
||||
RemoveUser( user );
|
||||
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
|
||||
SendMessage( 44, user.Username ) ; // %1 has been kicked out of the conference.
|
||||
}
|
||||
|
||||
if ( wasBanned && moderator != null )
|
||||
moderator.SendMessage( 62, user.Username ); // You are banning %1 from this conference.
|
||||
}
|
||||
|
||||
public bool VoiceRestricted
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_VoiceRestricted;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_VoiceRestricted = value;
|
||||
|
||||
if ( value )
|
||||
SendMessage( 56 ); // From now on, only moderators will have speaking privileges in this conference by default.
|
||||
else
|
||||
SendMessage( 55 ); // From now on, everyone in the conference will have speaking privileges by default.
|
||||
}
|
||||
}
|
||||
|
||||
public bool AlwaysAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_AlwaysAvailable;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_AlwaysAvailable = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void AddVoiced( ChatUser user )
|
||||
{
|
||||
AddVoiced( user, null );
|
||||
}
|
||||
|
||||
public void AddVoiced( ChatUser user, ChatUser moderator )
|
||||
{
|
||||
if ( !ValidateModerator( moderator ) )
|
||||
return;
|
||||
|
||||
if ( !IsBanned( user ) && !IsModerator( user ) && !IsVoiced( user ) )
|
||||
{
|
||||
m_Voices.Add( user );
|
||||
|
||||
if ( moderator != null )
|
||||
user.SendMessage( 54, moderator.Username ); // %1, a conference moderator, has granted you speaking priviledges in this conference.
|
||||
|
||||
SendMessage( 52, user, user.Username ); // %1 now has speaking privileges in this conference.
|
||||
SendCommand( ChatCommand.AddUserToChannel, user, user.GetColorCharacter() + user.Username );
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveVoiced( ChatUser user, ChatUser moderator )
|
||||
{
|
||||
if ( !ValidateModerator( moderator ) || !ValidateAccess( moderator, user ) )
|
||||
return;
|
||||
|
||||
if ( !IsModerator( user ) && IsVoiced( user ) )
|
||||
{
|
||||
m_Voices.Remove( user );
|
||||
|
||||
if ( moderator != null )
|
||||
user.SendMessage( 53, moderator.Username ); // %1, a conference moderator, has removed your speaking priviledges for this conference.
|
||||
|
||||
SendMessage( 51, user, user.Username ); // %1 no longer has speaking privileges in this conference.
|
||||
SendCommand( ChatCommand.AddUserToChannel, user, user.GetColorCharacter() + user.Username );
|
||||
}
|
||||
}
|
||||
|
||||
public void AddModerator( ChatUser user )
|
||||
{
|
||||
AddModerator( user, null );
|
||||
}
|
||||
|
||||
public void AddModerator( ChatUser user, ChatUser moderator )
|
||||
{
|
||||
if ( !ValidateModerator( moderator ) )
|
||||
return;
|
||||
|
||||
if ( IsBanned( user ) || IsModerator( user ) )
|
||||
return;
|
||||
|
||||
if ( IsVoiced( user ) )
|
||||
m_Voices.Remove( user );
|
||||
|
||||
m_Moderators.Add( user );
|
||||
|
||||
if ( moderator != null )
|
||||
user.SendMessage( 50, moderator.Username ); // %1 has made you a conference moderator.
|
||||
|
||||
SendMessage( 48, user, user.Username ); // %1 is now a conference moderator.
|
||||
SendCommand( ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
}
|
||||
|
||||
public void RemoveModerator( ChatUser user )
|
||||
{
|
||||
RemoveModerator( user, null );
|
||||
}
|
||||
|
||||
public void RemoveModerator( ChatUser user, ChatUser moderator )
|
||||
{
|
||||
if ( !ValidateModerator( moderator ) || !ValidateAccess( moderator, user ) )
|
||||
return;
|
||||
|
||||
if ( IsModerator( user ) )
|
||||
{
|
||||
m_Moderators.Remove( user );
|
||||
|
||||
if ( moderator != null )
|
||||
user.SendMessage( 49, moderator.Username ); // %1 has removed you from the list of conference moderators.
|
||||
|
||||
SendMessage( 47, user, user.Username ); // %1 is no longer a conference moderator.
|
||||
SendCommand( ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
}
|
||||
}
|
||||
|
||||
public void SendMessage( int number )
|
||||
{
|
||||
SendMessage( number, null, null, null );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, string param1 )
|
||||
{
|
||||
SendMessage( number, null, param1, null );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, string param1, string param2 )
|
||||
{
|
||||
SendMessage( number, null, param1, param2 );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, ChatUser initiator )
|
||||
{
|
||||
SendMessage( number, initiator, null, null );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, ChatUser initiator, string param1 )
|
||||
{
|
||||
SendMessage( number, initiator, param1, null );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, ChatUser initiator, string param1, string param2 )
|
||||
{
|
||||
for ( int i = 0; i < m_Users.Count; ++i )
|
||||
{
|
||||
ChatUser user = (ChatUser)m_Users[i];
|
||||
|
||||
if ( user == initiator )
|
||||
continue;
|
||||
|
||||
if ( user.CheckOnline() )
|
||||
user.SendMessage( number, param1, param2 );
|
||||
else if ( !Contains( user ) )
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
public void SendIgnorableMessage( int number, ChatUser from, string param1, string param2 )
|
||||
{
|
||||
for ( int i = 0; i < m_Users.Count; ++i )
|
||||
{
|
||||
ChatUser user = (ChatUser)m_Users[i];
|
||||
|
||||
if ( user.IsIgnored( from ) )
|
||||
continue;
|
||||
|
||||
if ( user.CheckOnline() )
|
||||
user.SendMessage( number, from.Mobile, param1, param2 );
|
||||
else if ( !Contains( user ) )
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
public void SendCommand( ChatCommand command )
|
||||
{
|
||||
SendCommand( command, null, null, null );
|
||||
}
|
||||
|
||||
public void SendCommand( ChatCommand command, string param1 )
|
||||
{
|
||||
SendCommand( command, null, param1, null );
|
||||
}
|
||||
|
||||
public void SendCommand( ChatCommand command, string param1, string param2 )
|
||||
{
|
||||
SendCommand( command, null, param1, param2 );
|
||||
}
|
||||
|
||||
public void SendCommand( ChatCommand command, ChatUser initiator )
|
||||
{
|
||||
SendCommand( command, initiator, null, null );
|
||||
}
|
||||
|
||||
public void SendCommand( ChatCommand command, ChatUser initiator, string param1 )
|
||||
{
|
||||
SendCommand( command, initiator, param1, null );
|
||||
}
|
||||
|
||||
public void SendCommand( ChatCommand command, ChatUser initiator, string param1, string param2 )
|
||||
{
|
||||
for ( int i = 0; i < m_Users.Count; ++i )
|
||||
{
|
||||
ChatUser user = (ChatUser)m_Users[i];
|
||||
|
||||
if ( user == initiator )
|
||||
continue;
|
||||
|
||||
if ( user.CheckOnline() )
|
||||
ChatSystem.SendCommandTo( user.Mobile, command, param1, param2 );
|
||||
else if ( !Contains( user ) )
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
public void SendUsersTo( ChatUser to )
|
||||
{
|
||||
for ( int i = 0; i < m_Users.Count; ++i )
|
||||
{
|
||||
ChatUser user = (ChatUser)m_Users[i];
|
||||
|
||||
ChatSystem.SendCommandTo( to.Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
}
|
||||
}
|
||||
|
||||
private static ArrayList m_Channels = new ArrayList();
|
||||
|
||||
public static ArrayList Channels
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Channels;
|
||||
}
|
||||
}
|
||||
|
||||
public static void SendChannelsTo( ChatUser user )
|
||||
{
|
||||
for ( int i = 0; i < m_Channels.Count; ++i )
|
||||
{
|
||||
Channel channel = (Channel)m_Channels[i];
|
||||
|
||||
if ( !channel.IsBanned( user ) )
|
||||
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.AddChannel, channel.Name, "0" );
|
||||
}
|
||||
}
|
||||
|
||||
public static Channel AddChannel( string name )
|
||||
{
|
||||
return AddChannel( name, null );
|
||||
}
|
||||
|
||||
public static Channel AddChannel( string name, string password )
|
||||
{
|
||||
Channel channel = FindChannelByName( name );
|
||||
|
||||
if ( channel == null )
|
||||
{
|
||||
channel = new Channel( name, password );
|
||||
m_Channels.Add( channel );
|
||||
}
|
||||
|
||||
ChatUser.GlobalSendCommand( ChatCommand.AddChannel, name, "0" ) ;
|
||||
|
||||
return channel;
|
||||
}
|
||||
|
||||
public static void RemoveChannel( string name )
|
||||
{
|
||||
RemoveChannel( FindChannelByName( name ) );
|
||||
}
|
||||
|
||||
public static void RemoveChannel( Channel channel )
|
||||
{
|
||||
if ( channel == null )
|
||||
return;
|
||||
|
||||
if ( m_Channels.Contains( channel ) && channel.m_Users.Count == 0 )
|
||||
{
|
||||
ChatUser.GlobalSendCommand( ChatCommand.RemoveChannel, channel.Name ) ;
|
||||
|
||||
channel.m_Moderators.Clear();
|
||||
channel.m_Voices.Clear();
|
||||
|
||||
m_Channels.Remove( channel );
|
||||
}
|
||||
}
|
||||
|
||||
public static Channel FindChannelByName( string name )
|
||||
{
|
||||
for ( int i = 0; i < m_Channels.Count; ++i )
|
||||
{
|
||||
Channel channel = (Channel)m_Channels[i];
|
||||
|
||||
if ( channel.m_Name == name )
|
||||
return channel;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
AddStaticChannel( "Newbie Help" );
|
||||
}
|
||||
|
||||
public static void AddStaticChannel( string name )
|
||||
{
|
||||
AddChannel( name ).AlwaysAvailable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
174
Scripts/Engines/Chat/Chat.cs
Normal file
174
Scripts/Engines/Chat/Chat.cs
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Misc;
|
||||
using Server.Network;
|
||||
using Server.Accounting;
|
||||
|
||||
namespace Server.Engines.Chat
|
||||
{
|
||||
public class ChatSystem
|
||||
{
|
||||
private static bool m_Enabled = true;
|
||||
|
||||
public static bool Enabled
|
||||
{
|
||||
get{ return m_Enabled; }
|
||||
set{ m_Enabled = value; }
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
PacketHandlers.Register( 0xB5, 0x40, true, new OnPacketReceive( OpenChatWindowRequest ) );
|
||||
PacketHandlers.Register( 0xB3, 0, true, new OnPacketReceive( ChatAction ) );
|
||||
}
|
||||
|
||||
public static void SendCommandTo( Mobile to, ChatCommand type )
|
||||
{
|
||||
SendCommandTo( to, type, null, null );
|
||||
}
|
||||
|
||||
public static void SendCommandTo( Mobile to, ChatCommand type, string param1 )
|
||||
{
|
||||
SendCommandTo( to, type, param1, null );
|
||||
}
|
||||
|
||||
public static void SendCommandTo( Mobile to, ChatCommand type, string param1, string param2 )
|
||||
{
|
||||
if ( to != null )
|
||||
to.Send( new ChatMessagePacket( null, (int)type + 20, param1, param2 ) );
|
||||
}
|
||||
|
||||
public static void OpenChatWindowRequest( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if ( !m_Enabled )
|
||||
{
|
||||
from.SendMessage( "The chat system has been disabled." );
|
||||
return;
|
||||
}
|
||||
|
||||
pvSrc.Seek( 2, System.IO.SeekOrigin.Begin );
|
||||
string chatName = pvSrc.ReadUnicodeStringSafe( ( 0x40 - 2 ) >> 1 ).Trim();
|
||||
|
||||
Account acct = state.Account as Account;
|
||||
|
||||
string accountChatName = null;
|
||||
|
||||
if ( acct != null )
|
||||
accountChatName = acct.GetTag( "ChatName" );
|
||||
|
||||
if ( accountChatName != null )
|
||||
accountChatName = accountChatName.Trim();
|
||||
|
||||
if ( accountChatName != null && accountChatName.Length > 0 )
|
||||
{
|
||||
if ( chatName.Length > 0 && chatName != accountChatName )
|
||||
from.SendMessage( "You cannot change chat nickname once it has been set." );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( chatName == null || chatName.Length == 0 )
|
||||
{
|
||||
SendCommandTo( from, ChatCommand.AskNewNickname );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( NameVerification.Validate( chatName, 2, 31, true, true, true, 0, NameVerification.SpaceDashPeriodQuote ) && chatName.ToLower().IndexOf( "system" ) == -1 )
|
||||
{
|
||||
// TODO: Optimize this search
|
||||
|
||||
foreach ( Account checkAccount in Accounts.GetAccounts() )
|
||||
{
|
||||
string existingName = checkAccount.GetTag( "ChatName" );
|
||||
|
||||
if ( existingName != null )
|
||||
{
|
||||
existingName = existingName.Trim();
|
||||
|
||||
if ( Insensitive.Equals( existingName, chatName ) )
|
||||
{
|
||||
from.SendMessage( "Nickname already in use." );
|
||||
SendCommandTo( from, ChatCommand.AskNewNickname );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
accountChatName = chatName;
|
||||
|
||||
if ( acct != null )
|
||||
acct.AddTag( "ChatName", chatName );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage( 501173 ); // That name is disallowed.
|
||||
SendCommandTo( from, ChatCommand.AskNewNickname );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SendCommandTo( from, ChatCommand.OpenChatWindow, accountChatName );
|
||||
ChatUser.AddChatUser( from );
|
||||
}
|
||||
|
||||
public static ChatUser SearchForUser( ChatUser from, string name )
|
||||
{
|
||||
ChatUser user = ChatUser.GetChatUser( name );
|
||||
|
||||
if ( user == null )
|
||||
from.SendMessage( 32, name ); // There is no player named '%1'.
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public static void ChatAction( NetState state, PacketReader pvSrc )
|
||||
{
|
||||
if ( !m_Enabled )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
Mobile from = state.Mobile;
|
||||
ChatUser user = ChatUser.GetChatUser( from );
|
||||
|
||||
if ( user == null )
|
||||
return;
|
||||
|
||||
string lang = pvSrc.ReadStringSafe( 4 );
|
||||
int actionID = pvSrc.ReadInt16();
|
||||
string param = pvSrc.ReadUnicodeString();
|
||||
|
||||
ChatActionHandler handler = ChatActionHandlers.GetHandler( actionID );
|
||||
|
||||
if ( handler != null )
|
||||
{
|
||||
Channel channel = user.CurrentChannel;
|
||||
|
||||
if ( handler.RequireConference && channel == null )
|
||||
{
|
||||
user.SendMessage( 31 ); /* You must be in a conference to do this.
|
||||
* To join a conference, select one from the Conference menu.
|
||||
*/
|
||||
}
|
||||
else if ( handler.RequireModerator && !user.IsModerator )
|
||||
{
|
||||
user.SendMessage( 29 ); // You must have operator status to do this.
|
||||
}
|
||||
else
|
||||
{
|
||||
handler.Callback( user, channel, param );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine( "Client: {0}: Unknown chat action 0x{1:X}: {2}", state, actionID, param );
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
Console.WriteLine( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
Scripts/Engines/Chat/ChatActionHandler.cs
Normal file
24
Scripts/Engines/Chat/ChatActionHandler.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Chat
|
||||
{
|
||||
public delegate void OnChatAction( ChatUser from, Channel channel, string param );
|
||||
|
||||
public class ChatActionHandler
|
||||
{
|
||||
private bool m_RequireModerator;
|
||||
private bool m_RequireConference;
|
||||
private OnChatAction m_Callback;
|
||||
|
||||
public bool RequireModerator{ get{ return m_RequireModerator; } }
|
||||
public bool RequireConference{ get{ return m_RequireConference; } }
|
||||
public OnChatAction Callback{ get{ return m_Callback; } }
|
||||
|
||||
public ChatActionHandler( bool requireModerator, bool requireConference, OnChatAction callback )
|
||||
{
|
||||
m_RequireModerator = requireModerator;
|
||||
m_RequireConference = requireConference;
|
||||
m_Callback = callback;
|
||||
}
|
||||
}
|
||||
}
|
||||
359
Scripts/Engines/Chat/ChatActionHandlers.cs
Normal file
359
Scripts/Engines/Chat/ChatActionHandlers.cs
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Chat
|
||||
{
|
||||
public class ChatActionHandlers
|
||||
{
|
||||
private static ChatActionHandler[] m_Handlers;
|
||||
|
||||
static ChatActionHandlers()
|
||||
{
|
||||
m_Handlers = new ChatActionHandler[0x100];
|
||||
|
||||
Register( 0x41, true, true, new OnChatAction( ChangeChannelPassword ) );
|
||||
|
||||
Register( 0x58, false, false, new OnChatAction( LeaveChat ) );
|
||||
|
||||
Register( 0x61, false, true, new OnChatAction( ChannelMessage ) );
|
||||
Register( 0x62, false, false, new OnChatAction( JoinChannel ) );
|
||||
Register( 0x63, false, false, new OnChatAction( JoinNewChannel ) );
|
||||
Register( 0x64, true, true, new OnChatAction( RenameChannel ) );
|
||||
Register( 0x65, false, false, new OnChatAction( PrivateMessage ) );
|
||||
Register( 0x66, false, false, new OnChatAction( AddIgnore ) );
|
||||
Register( 0x67, false, false, new OnChatAction( RemoveIgnore ) );
|
||||
Register( 0x68, false, false, new OnChatAction( ToggleIgnore ) );
|
||||
Register( 0x69, true, true, new OnChatAction( AddVoice ) );
|
||||
Register( 0x6A, true, true, new OnChatAction( RemoveVoice ) );
|
||||
Register( 0x6B, true, true, new OnChatAction( ToggleVoice ) );
|
||||
Register( 0x6C, true, true, new OnChatAction( AddModerator ) );
|
||||
Register( 0x6D, true, true, new OnChatAction( RemoveModerator ) );
|
||||
Register( 0x6E, true, true, new OnChatAction( ToggleModerator ) );
|
||||
Register( 0x6F, false, false, new OnChatAction( AllowPrivateMessages ) );
|
||||
Register( 0x70, false, false, new OnChatAction( DisallowPrivateMessages ) );
|
||||
Register( 0x71, false, false, new OnChatAction( TogglePrivateMessages ) );
|
||||
Register( 0x72, false, false, new OnChatAction( ShowCharacterName ) );
|
||||
Register( 0x73, false, false, new OnChatAction( HideCharacterName ) );
|
||||
Register( 0x74, false, false, new OnChatAction( ToggleCharacterName ) );
|
||||
Register( 0x75, false, false, new OnChatAction( QueryWhoIs ) );
|
||||
Register( 0x76, true, true, new OnChatAction( Kick ) );
|
||||
Register( 0x77, true, true, new OnChatAction( EnableDefaultVoice ) );
|
||||
Register( 0x78, true, true, new OnChatAction( DisableDefaultVoice ) );
|
||||
Register( 0x79, true, true, new OnChatAction( ToggleDefaultVoice ) );
|
||||
Register( 0x7A, false, true, new OnChatAction( EmoteMessage ) );
|
||||
}
|
||||
|
||||
public static void Register( int actionID, bool requireModerator, bool requireConference, OnChatAction callback )
|
||||
{
|
||||
if ( actionID >= 0 && actionID < m_Handlers.Length )
|
||||
m_Handlers[actionID] = new ChatActionHandler( requireModerator, requireConference, callback );
|
||||
}
|
||||
|
||||
public static ChatActionHandler GetHandler( int actionID )
|
||||
{
|
||||
if ( actionID >= 0 && actionID < m_Handlers.Length )
|
||||
return m_Handlers[actionID];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void ChannelMessage( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
if ( channel.CanTalk( from ) )
|
||||
channel.SendIgnorableMessage( 57, from, from.GetColorCharacter() + from.Username, param ); // %1: %2
|
||||
else
|
||||
from.SendMessage( 36 ); // The moderator of this conference has not given you speaking priviledges.
|
||||
}
|
||||
|
||||
public static void EmoteMessage( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
if ( channel.CanTalk( from ) )
|
||||
channel.SendIgnorableMessage( 58, from, from.GetColorCharacter() + from.Username, param ); // %1 %2
|
||||
else
|
||||
from.SendMessage( 36 ); // The moderator of this conference has not given you speaking priviledges.
|
||||
}
|
||||
|
||||
public static void PrivateMessage( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
int indexOf = param.IndexOf( ' ' );
|
||||
|
||||
string name = param.Substring( 0, indexOf );
|
||||
string text = param.Substring( indexOf + 1 );
|
||||
|
||||
ChatUser target = ChatSystem.SearchForUser( from, name );
|
||||
|
||||
if ( target == null )
|
||||
return;
|
||||
|
||||
if ( target.IsIgnored( from ) )
|
||||
from.SendMessage( 35, target.Username ); // %1 has chosen to ignore you. None of your messages to them will get through.
|
||||
else if ( target.IgnorePrivateMessage )
|
||||
from.SendMessage( 42, target.Username ); // %1 has chosen to not receive private messages at the moment.
|
||||
else
|
||||
target.SendMessage( 59, from.Mobile, from.GetColorCharacter() + from.Username, text ); // [%1]: %2
|
||||
}
|
||||
|
||||
public static void LeaveChat( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser.RemoveChatUser( from );
|
||||
}
|
||||
|
||||
public static void ChangeChannelPassword( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
channel.Password = param;
|
||||
from.SendMessage( 60 ); // The password to the conference has been changed.
|
||||
}
|
||||
|
||||
public static void AllowPrivateMessages( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
from.IgnorePrivateMessage = false;
|
||||
from.SendMessage( 37 ); // You can now receive private messages.
|
||||
}
|
||||
|
||||
public static void DisallowPrivateMessages( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
from.IgnorePrivateMessage = true;
|
||||
from.SendMessage( 38 ); /* You will no longer receive private messages.
|
||||
* Those who send you a message will be notified that you are blocking incoming messages.
|
||||
*/
|
||||
}
|
||||
|
||||
public static void TogglePrivateMessages( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
from.IgnorePrivateMessage = !from.IgnorePrivateMessage;
|
||||
from.SendMessage( from.IgnorePrivateMessage ? 38 : 37 ); // See above for messages
|
||||
}
|
||||
|
||||
public static void ShowCharacterName( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
from.Anonymous = false;
|
||||
from.SendMessage( 39 ); // You are now showing your character name to any players who inquire with the whois command.
|
||||
}
|
||||
|
||||
public static void HideCharacterName( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
from.Anonymous = true;
|
||||
from.SendMessage( 40 ); // You are no longer showing your character name to any players who inquire with the whois command.
|
||||
}
|
||||
|
||||
public static void ToggleCharacterName( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
from.Anonymous = !from.Anonymous;
|
||||
from.SendMessage( from.Anonymous ? 40 : 39 ); // See above for messages
|
||||
}
|
||||
|
||||
public static void JoinChannel( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
string name;
|
||||
string password = null;
|
||||
|
||||
int start = param.IndexOf( '\"' );
|
||||
|
||||
if ( start >= 0 )
|
||||
{
|
||||
int end = param.IndexOf( '\"', ++start );
|
||||
|
||||
if ( end >= 0 )
|
||||
{
|
||||
name = param.Substring( start, end - start );
|
||||
password = param.Substring( ++end );
|
||||
}
|
||||
else
|
||||
{
|
||||
name = param.Substring( start );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int indexOf = param.IndexOf( ' ' );
|
||||
|
||||
if ( indexOf >= 0 )
|
||||
{
|
||||
name = param.Substring( 0, indexOf++ );
|
||||
password = param.Substring( indexOf );
|
||||
}
|
||||
else
|
||||
{
|
||||
name = param;
|
||||
}
|
||||
}
|
||||
|
||||
if ( password != null )
|
||||
password = password.Trim();
|
||||
|
||||
if ( password != null && password.Length == 0 )
|
||||
password = null;
|
||||
|
||||
Channel joined = Channel.FindChannelByName( name );
|
||||
|
||||
if ( joined == null )
|
||||
from.SendMessage( 33, name ); // There is no conference named '%1'.
|
||||
else
|
||||
joined.AddUser( from, password );
|
||||
}
|
||||
|
||||
public static void JoinNewChannel( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
if ( (param = param.Trim()).Length == 0 )
|
||||
return;
|
||||
|
||||
string name;
|
||||
string password = null;
|
||||
|
||||
int start = param.IndexOf( '{' );
|
||||
|
||||
if ( start >= 0 )
|
||||
{
|
||||
name = param.Substring( 0, start++ );
|
||||
|
||||
int end = param.IndexOf( '}', start );
|
||||
|
||||
if ( end >= start )
|
||||
password = param.Substring( start, end - start );
|
||||
}
|
||||
else
|
||||
{
|
||||
name = param;
|
||||
}
|
||||
|
||||
if ( password != null )
|
||||
password = password.Trim();
|
||||
|
||||
if ( password != null && password.Length == 0 )
|
||||
password = null;
|
||||
|
||||
Channel.AddChannel( name, password ).AddUser( from, password );
|
||||
}
|
||||
|
||||
public static void AddIgnore( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target == null )
|
||||
return;
|
||||
|
||||
from.AddIgnored( target );
|
||||
}
|
||||
|
||||
public static void RemoveIgnore( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target == null )
|
||||
return;
|
||||
|
||||
from.RemoveIgnored( target );
|
||||
}
|
||||
|
||||
public static void ToggleIgnore( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target == null )
|
||||
return;
|
||||
|
||||
if ( from.IsIgnored( target ) )
|
||||
from.RemoveIgnored( target );
|
||||
else
|
||||
from.AddIgnored( target );
|
||||
}
|
||||
|
||||
public static void AddVoice( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target != null )
|
||||
channel.AddVoiced( target, from );
|
||||
}
|
||||
|
||||
public static void RemoveVoice( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target != null )
|
||||
channel.RemoveVoiced( target, from );
|
||||
}
|
||||
|
||||
public static void ToggleVoice( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target == null )
|
||||
return;
|
||||
|
||||
if ( channel.IsVoiced( target ) )
|
||||
channel.RemoveVoiced( target, from );
|
||||
else
|
||||
channel.AddVoiced( target, from );
|
||||
}
|
||||
|
||||
public static void AddModerator( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target != null )
|
||||
channel.AddModerator( target, from );
|
||||
}
|
||||
|
||||
public static void RemoveModerator( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target != null )
|
||||
channel.RemoveModerator( target, from );
|
||||
}
|
||||
|
||||
public static void ToggleModerator( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target == null )
|
||||
return;
|
||||
|
||||
if ( channel.IsModerator( target ) )
|
||||
channel.RemoveModerator( target, from );
|
||||
else
|
||||
channel.AddModerator( target, from );
|
||||
}
|
||||
|
||||
public static void RenameChannel( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
channel.Name = param;
|
||||
}
|
||||
|
||||
public static void QueryWhoIs( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target == null )
|
||||
return;
|
||||
|
||||
if ( target.Anonymous )
|
||||
from.SendMessage( 41, target.Username ); // %1 is remaining anonymous.
|
||||
else
|
||||
from.SendMessage( 43, target.Username, target.Mobile.Name ); // %2 is known in the lands of Britannia as %2.
|
||||
}
|
||||
|
||||
public static void Kick( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
ChatUser target = ChatSystem.SearchForUser( from, param );
|
||||
|
||||
if ( target != null )
|
||||
channel.Kick( target, from );
|
||||
}
|
||||
|
||||
public static void EnableDefaultVoice( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
channel.VoiceRestricted = false;
|
||||
}
|
||||
|
||||
public static void DisableDefaultVoice( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
channel.VoiceRestricted = true;
|
||||
}
|
||||
|
||||
public static void ToggleDefaultVoice( ChatUser from, Channel channel, string param )
|
||||
{
|
||||
channel.VoiceRestricted = !channel.VoiceRestricted;
|
||||
}
|
||||
}
|
||||
}
|
||||
44
Scripts/Engines/Chat/ChatCommand.cs
Normal file
44
Scripts/Engines/Chat/ChatCommand.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Chat
|
||||
{
|
||||
public enum ChatCommand
|
||||
{
|
||||
/// <summary>
|
||||
/// Add a channel to top list.
|
||||
/// </summary>
|
||||
AddChannel = 0x3E8,
|
||||
/// <summary>
|
||||
/// Remove channel from top list.
|
||||
/// </summary>
|
||||
RemoveChannel = 0x3E9,
|
||||
/// <summary>
|
||||
/// Queries for a new chat nickname.
|
||||
/// </summary>
|
||||
AskNewNickname = 0x3EB,
|
||||
/// <summary>
|
||||
/// Closes the chat window.
|
||||
/// </summary>
|
||||
CloseChatWindow = 0x3EC,
|
||||
/// <summary>
|
||||
/// Opens the chat window.
|
||||
/// </summary>
|
||||
OpenChatWindow = 0x3ED,
|
||||
/// <summary>
|
||||
/// Add a user to current channel.
|
||||
/// </summary>
|
||||
AddUserToChannel = 0x3EE,
|
||||
/// <summary>
|
||||
/// Remove a user from current channel.
|
||||
/// </summary>
|
||||
RemoveUserFromChannel = 0x3EF,
|
||||
/// <summary>
|
||||
/// Send a message putting generic conference name at top when player leaves a channel.
|
||||
/// </summary>
|
||||
LeaveChannel = 0x3F0,
|
||||
/// <summary>
|
||||
/// Send a message putting Channel name at top and telling player he joined the channel.
|
||||
/// </summary>
|
||||
JoinedChannel = 0x3F1
|
||||
}
|
||||
}
|
||||
321
Scripts/Engines/Chat/ChatUser.cs
Normal file
321
Scripts/Engines/Chat/ChatUser.cs
Normal file
|
|
@ -0,0 +1,321 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Accounting;
|
||||
|
||||
namespace Server.Engines.Chat
|
||||
{
|
||||
public class ChatUser
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Channel m_Channel;
|
||||
private bool m_Anonymous;
|
||||
private bool m_IgnorePrivateMessage;
|
||||
private ArrayList m_Ignored, m_Ignoring;
|
||||
|
||||
public ChatUser( Mobile m )
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Ignored = new ArrayList();
|
||||
m_Ignoring = new ArrayList();
|
||||
}
|
||||
|
||||
public Mobile Mobile
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Mobile;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList Ignored
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Ignored;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList Ignoring
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Ignoring;
|
||||
}
|
||||
}
|
||||
|
||||
public string Username
|
||||
{
|
||||
get
|
||||
{
|
||||
Account acct = m_Mobile.Account as Account;
|
||||
|
||||
if ( acct != null )
|
||||
return acct.GetTag( "ChatName" );
|
||||
|
||||
return null;
|
||||
}
|
||||
set
|
||||
{
|
||||
Account acct = m_Mobile.Account as Account;
|
||||
|
||||
if ( acct != null )
|
||||
acct.SetTag( "ChatName", value );
|
||||
}
|
||||
}
|
||||
|
||||
public Channel CurrentChannel
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Channel;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Channel = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsOnline
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( m_Mobile.NetState != null );
|
||||
}
|
||||
}
|
||||
|
||||
public bool Anonymous
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Anonymous;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Anonymous = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IgnorePrivateMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_IgnorePrivateMessage;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_IgnorePrivateMessage = value;
|
||||
}
|
||||
}
|
||||
|
||||
public const char NormalColorCharacter = '0';
|
||||
public const char ModeratorColorCharacter = '1';
|
||||
public const char VoicedColorCharacter = '2';
|
||||
|
||||
public char GetColorCharacter()
|
||||
{
|
||||
if ( m_Channel != null && m_Channel.IsModerator( this ) )
|
||||
return ModeratorColorCharacter;
|
||||
|
||||
if ( m_Channel != null && m_Channel.IsVoiced( this ) )
|
||||
return VoicedColorCharacter;
|
||||
|
||||
return NormalColorCharacter;
|
||||
}
|
||||
|
||||
public bool CheckOnline()
|
||||
{
|
||||
if ( IsOnline )
|
||||
return true;
|
||||
|
||||
RemoveChatUser( this );
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SendMessage( int number )
|
||||
{
|
||||
SendMessage( number, null, null );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, string param1 )
|
||||
{
|
||||
SendMessage( number, param1, null );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, string param1, string param2 )
|
||||
{
|
||||
if ( m_Mobile.NetState != null )
|
||||
m_Mobile.Send( new ChatMessagePacket( m_Mobile, number, param1, param2 ) );
|
||||
}
|
||||
|
||||
public void SendMessage( int number, Mobile from, string param1, string param2 )
|
||||
{
|
||||
if ( m_Mobile.NetState != null )
|
||||
m_Mobile.Send( new ChatMessagePacket( from, number, param1, param2 ) );
|
||||
}
|
||||
|
||||
public bool IsIgnored( ChatUser check )
|
||||
{
|
||||
return m_Ignored.Contains( check );
|
||||
}
|
||||
|
||||
public bool IsModerator
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( m_Channel != null && m_Channel.IsModerator( this ) );
|
||||
}
|
||||
}
|
||||
|
||||
public void AddIgnored( ChatUser user )
|
||||
{
|
||||
if ( IsIgnored( user ) )
|
||||
{
|
||||
SendMessage( 22, user.Username ); // You are already ignoring %1.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Ignored.Add( user );
|
||||
user.m_Ignoring.Add( this );
|
||||
|
||||
SendMessage( 23, user.Username ); // You are now ignoring %1.
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveIgnored( ChatUser user )
|
||||
{
|
||||
if ( IsIgnored( user ) )
|
||||
{
|
||||
m_Ignored.Remove( user );
|
||||
user.m_Ignoring.Remove( this );
|
||||
|
||||
SendMessage( 24, user.Username ); // You are no longer ignoring %1.
|
||||
|
||||
if ( m_Ignored.Count == 0 )
|
||||
SendMessage( 26 ); // You are no longer ignoring anyone.
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage( 25, user.Username ); // You are not ignoring %1.
|
||||
}
|
||||
}
|
||||
|
||||
private static ArrayList m_Users = new ArrayList();
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
|
||||
public static ChatUser AddChatUser( Mobile from )
|
||||
{
|
||||
ChatUser user = GetChatUser( from );
|
||||
|
||||
if ( user == null )
|
||||
{
|
||||
user = new ChatUser( from );
|
||||
|
||||
m_Users.Add( user );
|
||||
m_Table[from] = user;
|
||||
|
||||
Channel.SendChannelsTo( user );
|
||||
|
||||
ArrayList list = Channel.Channels;
|
||||
|
||||
for ( int i = 0; i < list.Count; ++i )
|
||||
{
|
||||
Channel c = (Channel)list[i];
|
||||
|
||||
if ( c.AddUser( user ) )
|
||||
break;
|
||||
}
|
||||
|
||||
//ChatSystem.SendCommandTo( user.m_Mobile, ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public static void RemoveChatUser( ChatUser user )
|
||||
{
|
||||
if ( user == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < user.m_Ignoring.Count; ++i )
|
||||
((ChatUser)user.m_Ignoring[i]).RemoveIgnored( user );
|
||||
|
||||
if ( m_Users.Contains( user ) )
|
||||
{
|
||||
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.CloseChatWindow );
|
||||
|
||||
if ( user.m_Channel != null )
|
||||
user.m_Channel.RemoveUser( user );
|
||||
|
||||
m_Users.Remove( user );
|
||||
m_Table.Remove( user.m_Mobile );
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveChatUser( Mobile from )
|
||||
{
|
||||
ChatUser user = GetChatUser( from );
|
||||
|
||||
RemoveChatUser( user );
|
||||
}
|
||||
|
||||
public static ChatUser GetChatUser( Mobile from )
|
||||
{
|
||||
return (ChatUser)m_Table[from];
|
||||
}
|
||||
|
||||
public static ChatUser GetChatUser( string username )
|
||||
{
|
||||
for ( int i = 0; i < m_Users.Count; ++i )
|
||||
{
|
||||
ChatUser user = (ChatUser)m_Users[i];
|
||||
|
||||
if ( user.Username == username )
|
||||
return user;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand( ChatCommand command )
|
||||
{
|
||||
GlobalSendCommand( command, null, null, null );
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand( ChatCommand command, string param1 )
|
||||
{
|
||||
GlobalSendCommand( command, null, param1, null );
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand( ChatCommand command, string param1, string param2 )
|
||||
{
|
||||
GlobalSendCommand( command, null, param1, param2 );
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand( ChatCommand command, ChatUser initiator )
|
||||
{
|
||||
GlobalSendCommand( command, initiator, null, null );
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand( ChatCommand command, ChatUser initiator, string param1 )
|
||||
{
|
||||
GlobalSendCommand( command, initiator, param1, null );
|
||||
}
|
||||
|
||||
public static void GlobalSendCommand( ChatCommand command, ChatUser initiator, string param1, string param2 )
|
||||
{
|
||||
for ( int i = 0; i < m_Users.Count; ++i )
|
||||
{
|
||||
ChatUser user = (ChatUser)m_Users[i];
|
||||
|
||||
if ( user == initiator )
|
||||
continue;
|
||||
|
||||
if ( user.CheckOnline() )
|
||||
ChatSystem.SendCommandTo( user.m_Mobile, command, param1, param2 );
|
||||
else if ( !m_Users.Contains( i ) )
|
||||
--i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Scripts/Engines/Chat/Chatold.cs
Normal file
20
Scripts/Engines/Chat/Chatold.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Chat
|
||||
{
|
||||
public class ChatSystem
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
EventSink.ChatRequest += new ChatRequestEventHandler( EventSink_ChatRequest );
|
||||
}
|
||||
|
||||
private static void EventSink_ChatRequest( ChatRequestEventArgs e )
|
||||
{
|
||||
e.Mobile.SendMessage( "Chat is not currently supported." );
|
||||
}
|
||||
}
|
||||
}
|
||||
30
Scripts/Engines/Chat/Packets.cs
Normal file
30
Scripts/Engines/Chat/Packets.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Engines.Chat
|
||||
{
|
||||
public sealed class ChatMessagePacket : Packet
|
||||
{
|
||||
public ChatMessagePacket( Mobile who, int number, string param1, string param2 ) : base( 0xB2 )
|
||||
{
|
||||
if ( param1 == null )
|
||||
param1 = String.Empty;
|
||||
|
||||
if ( param2 == null )
|
||||
param2 = String.Empty;
|
||||
|
||||
EnsureCapacity( 13 + ((param1.Length + param2.Length) * 2) );
|
||||
|
||||
m_Stream.Write( (ushort) (number - 20) );
|
||||
|
||||
if ( who != null )
|
||||
m_Stream.WriteAsciiFixed( who.Language, 4 );
|
||||
else
|
||||
m_Stream.Write( (int) 0 );
|
||||
|
||||
m_Stream.WriteBigUniNull( param1 );
|
||||
m_Stream.WriteBigUniNull( param2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
58
Scripts/Engines/Craft/Core/CraftContext.cs
Normal file
58
Scripts/Engines/Craft/Core/CraftContext.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public enum CraftMarkOption
|
||||
{
|
||||
MarkItem,
|
||||
DoNotMark,
|
||||
PromptForMark
|
||||
}
|
||||
|
||||
public class CraftContext
|
||||
{
|
||||
private ArrayList m_Items;
|
||||
private int m_LastResourceIndex;
|
||||
private int m_LastResourceIndex2;
|
||||
private int m_LastGroupIndex;
|
||||
private bool m_DoNotColor;
|
||||
private CraftMarkOption m_MarkOption;
|
||||
|
||||
public ArrayList Items{ get{ return m_Items; } }
|
||||
public int LastResourceIndex{ get{ return m_LastResourceIndex; } set{ m_LastResourceIndex = value; } }
|
||||
public int LastResourceIndex2{ get{ return m_LastResourceIndex2; } set{ m_LastResourceIndex2 = value; } }
|
||||
public int LastGroupIndex{ get{ return m_LastGroupIndex; } set{ m_LastGroupIndex = value; } }
|
||||
public bool DoNotColor{ get{ return m_DoNotColor; } set{ m_DoNotColor = value; } }
|
||||
public CraftMarkOption MarkOption{ get{ return m_MarkOption; } set{ m_MarkOption = value; } }
|
||||
|
||||
public CraftContext()
|
||||
{
|
||||
m_Items = new ArrayList();
|
||||
m_LastResourceIndex = -1;
|
||||
m_LastResourceIndex2 = -1;
|
||||
m_LastGroupIndex = -1;
|
||||
}
|
||||
|
||||
public CraftItem LastMade
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Items.Count > 0 )
|
||||
return (CraftItem)m_Items[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMade( CraftItem item )
|
||||
{
|
||||
m_Items.Remove( item );
|
||||
|
||||
if ( m_Items.Count == 10 )
|
||||
m_Items.RemoveAt( 9 );
|
||||
|
||||
m_Items.Insert( 0, item );
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Scripts/Engines/Craft/Core/CraftGroup.cs
Normal file
39
Scripts/Engines/Craft/Core/CraftGroup.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftGroup
|
||||
{
|
||||
private CraftItemCol m_arCraftItem;
|
||||
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
|
||||
public CraftGroup( TextDefinition groupName )
|
||||
{
|
||||
m_NameNumber = groupName;
|
||||
m_NameString = groupName;
|
||||
m_arCraftItem = new CraftItemCol();
|
||||
}
|
||||
|
||||
public void AddCraftItem( CraftItem craftItem )
|
||||
{
|
||||
m_arCraftItem.Add( craftItem );
|
||||
}
|
||||
|
||||
public CraftItemCol CraftItems
|
||||
{
|
||||
get { return m_arCraftItem; }
|
||||
}
|
||||
|
||||
public string NameString
|
||||
{
|
||||
get { return m_NameString; }
|
||||
}
|
||||
|
||||
public int NameNumber
|
||||
{
|
||||
get { return m_NameNumber; }
|
||||
}
|
||||
}
|
||||
}
|
||||
48
Scripts/Engines/Craft/Core/CraftGroupCol.cs
Normal file
48
Scripts/Engines/Craft/Core/CraftGroupCol.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftGroupCol : System.Collections.CollectionBase
|
||||
{
|
||||
public CraftGroupCol()
|
||||
{
|
||||
}
|
||||
|
||||
public int Add( CraftGroup craftGroup )
|
||||
{
|
||||
return List.Add( craftGroup );
|
||||
}
|
||||
|
||||
public void Remove( int index )
|
||||
{
|
||||
if ( index > Count - 1 || index < 0 )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt( index );
|
||||
}
|
||||
}
|
||||
|
||||
public CraftGroup GetAt( int index )
|
||||
{
|
||||
return ( CraftGroup ) List[index];
|
||||
}
|
||||
|
||||
public int SearchFor( TextDefinition groupName )
|
||||
{
|
||||
for ( int i = 0; i < List.Count; i++ )
|
||||
{
|
||||
CraftGroup craftGroup = (CraftGroup)List[i];
|
||||
|
||||
int nameNumber = craftGroup.NameNumber;
|
||||
string nameString = craftGroup.NameString;
|
||||
|
||||
if ( ( nameNumber != 0 && nameNumber == groupName.Number ) || ( nameString != null && nameString == groupName.String ) )
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
582
Scripts/Engines/Craft/Core/CraftGump.cs
Normal file
582
Scripts/Engines/Craft/Core/CraftGump.cs
Normal file
|
|
@ -0,0 +1,582 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private CraftSystem m_CraftSystem;
|
||||
private BaseTool m_Tool;
|
||||
|
||||
private CraftPage m_Page;
|
||||
|
||||
private const int LabelHue = 0x480;
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private const int FontColor = 0xFFFFFF;
|
||||
|
||||
private enum CraftPage
|
||||
{
|
||||
None,
|
||||
PickResource,
|
||||
PickResource2
|
||||
}
|
||||
|
||||
/*public CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool ): this( from, craftSystem, -1, -1, tool, null )
|
||||
{
|
||||
}*/
|
||||
|
||||
public CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool, object notice ) : this( from, craftSystem, tool, notice, CraftPage.None )
|
||||
{
|
||||
}
|
||||
|
||||
private CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page ) : base( 40, 40 )
|
||||
{
|
||||
m_From = from;
|
||||
m_CraftSystem = craftSystem;
|
||||
m_Tool = tool;
|
||||
m_Page = page;
|
||||
|
||||
CraftContext context = craftSystem.GetContext( from );
|
||||
|
||||
from.CloseGump( typeof( CraftGump ) );
|
||||
from.CloseGump( typeof( CraftGumpItem ) );
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 530, 437, 5054 );
|
||||
AddImageTiled( 10, 10, 510, 22, 2624 );
|
||||
AddImageTiled( 10, 292, 150, 45, 2624 );
|
||||
AddImageTiled( 165, 292, 355, 45, 2624 );
|
||||
AddImageTiled( 10, 342, 510, 85, 2624 );
|
||||
AddImageTiled( 10, 37, 200, 250, 2624 );
|
||||
AddImageTiled( 215, 37, 305, 250, 2624 );
|
||||
AddAlphaRegion( 10, 10, 510, 417 );
|
||||
|
||||
if ( craftSystem.GumpTitleNumber > 0 )
|
||||
AddHtmlLocalized( 10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false );
|
||||
else
|
||||
AddHtml( 10, 12, 510, 20, craftSystem.GumpTitleString, false, false );
|
||||
|
||||
AddHtmlLocalized( 10, 37, 200, 22, 1044010, LabelColor, false, false ); // <CENTER>CATEGORIES</CENTER>
|
||||
AddHtmlLocalized( 215, 37, 305, 22, 1044011, LabelColor, false, false ); // <CENTER>SELECTIONS</CENTER>
|
||||
AddHtmlLocalized( 10, 302, 150, 25, 1044012, LabelColor, false, false ); // <CENTER>NOTICES</CENTER>
|
||||
|
||||
AddButton( 15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, 405, 150, 18, 1011441, LabelColor, false, false ); // EXIT
|
||||
|
||||
AddButton( 270, 402, 4005, 4007, GetButtonID( 6, 2 ), GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 305, 405, 150, 18, 1044013, LabelColor, false, false ); // MAKE LAST
|
||||
|
||||
// Mark option
|
||||
if ( craftSystem.MarkOption )
|
||||
{
|
||||
AddButton( 270, 362, 4005, 4007, GetButtonID( 6, 6 ), GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false ); // MARK ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Resmelt option
|
||||
if ( craftSystem.Resmelt )
|
||||
{
|
||||
AddButton( 15, 342, 4005, 4007, GetButtonID( 6, 1 ), GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, 345, 150, 18, 1044259, LabelColor, false, false ); // SMELT ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Repair option
|
||||
if ( craftSystem.Repair )
|
||||
{
|
||||
AddButton( 270, 342, 4005, 4007, GetButtonID( 6, 5 ), GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 305, 345, 150, 18, 1044260, LabelColor, false, false ); // REPAIR ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Enhance option
|
||||
if ( craftSystem.CanEnhance )
|
||||
{
|
||||
AddButton( 270, 382, 4005, 4007, GetButtonID( 6, 8 ), GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 305, 385, 150, 18, 1061001, LabelColor, false, false ); // ENHANCE ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
if ( notice is int && (int)notice > 0 )
|
||||
AddHtmlLocalized( 170, 295, 350, 40, (int)notice, LabelColor, false, false );
|
||||
else if ( notice is string )
|
||||
AddHtml( 170, 295, 350, 40, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice ), false, false );
|
||||
|
||||
// If the system has more than one resource
|
||||
if ( craftSystem.CraftSubRes.Init )
|
||||
{
|
||||
string nameString = craftSystem.CraftSubRes.NameString;
|
||||
int nameNumber = craftSystem.CraftSubRes.NameNumber;
|
||||
|
||||
int resIndex = ( context == null ? -1 : context.LastResourceIndex );
|
||||
|
||||
if ( resIndex > -1 )
|
||||
{
|
||||
CraftSubRes subResource = craftSystem.CraftSubRes.GetAt( resIndex );
|
||||
|
||||
nameString = subResource.NameString;
|
||||
nameNumber = subResource.NameNumber;
|
||||
}
|
||||
|
||||
AddButton( 15, 362, 4005, 4007, GetButtonID( 6, 0 ), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( nameNumber > 0 )
|
||||
AddHtmlLocalized( 50, 365, 250, 18, nameNumber, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 50, 362, LabelHue, nameString );
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// For dragon scales
|
||||
if ( craftSystem.CraftSubRes2.Init )
|
||||
{
|
||||
string nameString = craftSystem.CraftSubRes2.NameString;
|
||||
int nameNumber = craftSystem.CraftSubRes2.NameNumber;
|
||||
|
||||
int resIndex = ( context == null ? -1 : context.LastResourceIndex2 );
|
||||
|
||||
if ( resIndex > -1 )
|
||||
{
|
||||
CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt( resIndex );
|
||||
|
||||
nameString = subResource.NameString;
|
||||
nameNumber = subResource.NameNumber;
|
||||
}
|
||||
|
||||
AddButton( 15, 382, 4005, 4007, GetButtonID( 6, 7 ), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( nameNumber > 0 )
|
||||
AddHtmlLocalized( 50, 385, 250, 18, nameNumber, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 50, 385, LabelHue, nameString );
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
CreateGroupList();
|
||||
|
||||
if ( page == CraftPage.PickResource )
|
||||
CreateResList( false );
|
||||
else if ( page == CraftPage.PickResource2 )
|
||||
CreateResList( true );
|
||||
else if ( context != null && context.LastGroupIndex > -1 )
|
||||
CreateItemList( context.LastGroupIndex );
|
||||
}
|
||||
|
||||
public void CreateResList( bool opt )
|
||||
{
|
||||
CraftSubResCol res = ( opt ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
|
||||
|
||||
for ( int i = 0; i < res.Count; ++i )
|
||||
{
|
||||
int index = i % 10;
|
||||
|
||||
CraftSubRes subResource = res.GetAt( i );
|
||||
|
||||
if ( index == 0 )
|
||||
{
|
||||
if ( i > 0 )
|
||||
AddButton( 485, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1 );
|
||||
|
||||
AddPage( (i / 10) + 1 );
|
||||
|
||||
if ( i > 0 )
|
||||
AddButton( 455, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10 );
|
||||
|
||||
CraftContext context = m_CraftSystem.GetContext( m_From );
|
||||
|
||||
AddButton( 220, 260, 4005, 4007, GetButtonID( 6, 4 ), GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false );
|
||||
}
|
||||
|
||||
AddButton( 220, 60 + (index * 20), 4005, 4007, GetButtonID( 5, i ), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( subResource.NameNumber > 0 )
|
||||
AddHtmlLocalized( 255, 63 + (index * 20), 250, 18, subResource.NameNumber, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 255, 60 + (index * 20), LabelHue, subResource.NameString );
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateMakeLastList()
|
||||
{
|
||||
CraftContext context = m_CraftSystem.GetContext( m_From );
|
||||
|
||||
if ( context == null )
|
||||
return;
|
||||
|
||||
ArrayList items = context.Items;
|
||||
|
||||
if ( items.Count > 0 )
|
||||
{
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
int index = i % 10;
|
||||
|
||||
CraftItem craftItem = (CraftItem)items[i];
|
||||
|
||||
if ( index == 0 )
|
||||
{
|
||||
if ( i > 0 )
|
||||
{
|
||||
AddButton( 370, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1 );
|
||||
AddHtmlLocalized( 405, 263, 100, 18, 1044045, LabelColor, false, false ); // NEXT PAGE
|
||||
}
|
||||
|
||||
AddPage( (i / 10) + 1 );
|
||||
|
||||
if ( i > 0 )
|
||||
{
|
||||
AddButton( 220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10 );
|
||||
AddHtmlLocalized( 255, 263, 100, 18, 1044044, LabelColor, false, false ); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
AddButton( 220, 60 + (index * 20), 4005, 4007, GetButtonID( 3, i ), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( craftItem.NameNumber > 0 )
|
||||
AddHtmlLocalized( 255, 63 + (index * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 255, 60 + (index * 20), LabelHue, craftItem.NameString );
|
||||
|
||||
AddButton( 480, 60 + (index * 20), 4011, 4012, GetButtonID( 4, i ), GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE: This is not as OSI; it is an intentional difference
|
||||
|
||||
AddHtmlLocalized( 230, 62, 200, 22, 1044165, LabelColor, false, false ); // You haven't made anything yet.
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateItemList( int selectedGroup )
|
||||
{
|
||||
if ( selectedGroup == 501 ) // 501 : Last 10
|
||||
{
|
||||
CreateMakeLastList();
|
||||
return;
|
||||
}
|
||||
|
||||
CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
|
||||
CraftGroup craftGroup = craftGroupCol.GetAt( selectedGroup );
|
||||
CraftItemCol craftItemCol = craftGroup.CraftItems;
|
||||
|
||||
for ( int i = 0; i < craftItemCol.Count; ++i )
|
||||
{
|
||||
int index = i % 10;
|
||||
|
||||
CraftItem craftItem = craftItemCol.GetAt( i );
|
||||
|
||||
if ( index == 0 )
|
||||
{
|
||||
if ( i > 0 )
|
||||
{
|
||||
AddButton( 370, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1 );
|
||||
AddHtmlLocalized( 405, 263, 100, 18, 1044045, LabelColor, false, false ); // NEXT PAGE
|
||||
}
|
||||
|
||||
AddPage( (i / 10) + 1 );
|
||||
|
||||
if ( i > 0 )
|
||||
{
|
||||
AddButton( 220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10 );
|
||||
AddHtmlLocalized( 255, 263, 100, 18, 1044044, LabelColor, false, false ); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
AddButton( 220, 60 + (index * 20), 4005, 4007, GetButtonID( 1, i ), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( craftItem.NameNumber > 0 )
|
||||
AddHtmlLocalized( 255, 63 + (index * 20), 220, 18, craftItem.NameNumber, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 255, 60 + (index * 20), LabelHue, craftItem.NameString );
|
||||
|
||||
AddButton( 480, 60 + (index * 20), 4011, 4012, GetButtonID( 2, i ), GumpButtonType.Reply, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public int CreateGroupList()
|
||||
{
|
||||
CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
|
||||
|
||||
AddButton( 15, 60, 4005, 4007, GetButtonID( 6, 3 ), GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, 63, 150, 18, 1044014, LabelColor, false, false ); // LAST TEN
|
||||
|
||||
for ( int i = 0; i < craftGroupCol.Count; i++ )
|
||||
{
|
||||
CraftGroup craftGroup = craftGroupCol.GetAt( i );
|
||||
|
||||
AddButton( 15, 80 + (i * 20), 4005, 4007, GetButtonID( 0, i ), GumpButtonType.Reply, 0 );
|
||||
|
||||
if ( craftGroup.NameNumber > 0 )
|
||||
AddHtmlLocalized( 50, 83 + (i * 20), 150, 18, craftGroup.NameNumber, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 50, 80 + (i * 20), LabelHue, craftGroup.NameString );
|
||||
}
|
||||
|
||||
return craftGroupCol.Count;
|
||||
}
|
||||
|
||||
public static int GetButtonID( int type, int index )
|
||||
{
|
||||
return 1 + type + (index * 7);
|
||||
}
|
||||
|
||||
public void CraftItem( CraftItem item )
|
||||
{
|
||||
int num = m_CraftSystem.CanCraft( m_From, m_Tool, item.ItemType );
|
||||
|
||||
if ( num > 0 )
|
||||
{
|
||||
m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, num ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Type type = null;
|
||||
|
||||
CraftContext context = m_CraftSystem.GetContext( m_From );
|
||||
|
||||
if ( context != null )
|
||||
{
|
||||
CraftSubResCol res = ( item.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
|
||||
int resIndex = ( item.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex );
|
||||
|
||||
if ( resIndex >= 0 && resIndex < res.Count )
|
||||
type = res.GetAt( resIndex ).ItemType;
|
||||
}
|
||||
|
||||
m_CraftSystem.CreateItem( m_From, item.ItemType, type, m_Tool, item );
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( info.ButtonID <= 0 )
|
||||
return; // Canceled
|
||||
|
||||
int buttonID = info.ButtonID - 1;
|
||||
int type = buttonID % 7;
|
||||
int index = buttonID / 7;
|
||||
|
||||
CraftSystem system = m_CraftSystem;
|
||||
CraftGroupCol groups = system.CraftGroups;
|
||||
CraftContext context = system.GetContext( m_From );
|
||||
|
||||
switch ( type )
|
||||
{
|
||||
case 0: // Show group
|
||||
{
|
||||
if ( context == null )
|
||||
break;
|
||||
|
||||
if ( index >= 0 && index < groups.Count )
|
||||
{
|
||||
context.LastGroupIndex = index;
|
||||
m_From.SendGump( new CraftGump( m_From, system, m_Tool, null ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Create item
|
||||
{
|
||||
if ( context == null )
|
||||
break;
|
||||
|
||||
int groupIndex = context.LastGroupIndex;
|
||||
|
||||
if ( groupIndex >= 0 && groupIndex < groups.Count )
|
||||
{
|
||||
CraftGroup group = groups.GetAt( groupIndex );
|
||||
|
||||
if ( index >= 0 && index < group.CraftItems.Count )
|
||||
CraftItem( group.CraftItems.GetAt( index ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Item details
|
||||
{
|
||||
if ( context == null )
|
||||
break;
|
||||
|
||||
int groupIndex = context.LastGroupIndex;
|
||||
|
||||
if ( groupIndex >= 0 && groupIndex < groups.Count )
|
||||
{
|
||||
CraftGroup group = groups.GetAt( groupIndex );
|
||||
|
||||
if ( index >= 0 && index < group.CraftItems.Count )
|
||||
m_From.SendGump( new CraftGumpItem( m_From, system, group.CraftItems.GetAt( index ), m_Tool ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Create item (last 10)
|
||||
{
|
||||
if ( context == null )
|
||||
break;
|
||||
|
||||
ArrayList lastTen = context.Items;
|
||||
|
||||
if ( index >= 0 && index < lastTen.Count )
|
||||
CraftItem( (CraftItem)lastTen[index] );
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Item details (last 10)
|
||||
{
|
||||
if ( context == null )
|
||||
break;
|
||||
|
||||
ArrayList lastTen = context.Items;
|
||||
|
||||
if ( index >= 0 && index < lastTen.Count )
|
||||
m_From.SendGump( new CraftGumpItem( m_From, system, (CraftItem)lastTen[index], m_Tool ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: // Resource selected
|
||||
{
|
||||
if ( m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count )
|
||||
{
|
||||
int groupIndex = ( context == null ? -1 : context.LastGroupIndex );
|
||||
|
||||
CraftSubRes res = system.CraftSubRes.GetAt( index );
|
||||
|
||||
if ( m_From.Skills[system.MainSkill].Base < res.RequiredSkill )
|
||||
{
|
||||
m_From.SendGump( new CraftGump( m_From, system, m_Tool, res.Message ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( context != null )
|
||||
context.LastResourceIndex = index;
|
||||
|
||||
m_From.SendGump( new CraftGump( m_From, system, m_Tool, null ) );
|
||||
}
|
||||
}
|
||||
else if ( m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count )
|
||||
{
|
||||
int groupIndex = ( context == null ? -1 : context.LastGroupIndex );
|
||||
|
||||
CraftSubRes res = system.CraftSubRes2.GetAt( index );
|
||||
|
||||
if ( m_From.Skills[system.MainSkill].Base < res.RequiredSkill )
|
||||
{
|
||||
m_From.SendGump( new CraftGump( m_From, system, m_Tool, res.Message ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( context != null )
|
||||
context.LastResourceIndex2 = index;
|
||||
|
||||
m_From.SendGump( new CraftGump( m_From, system, m_Tool, null ) );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: // Misc. buttons
|
||||
{
|
||||
switch ( index )
|
||||
{
|
||||
case 0: // Resource selection
|
||||
{
|
||||
if ( system.CraftSubRes.Init )
|
||||
m_From.SendGump( new CraftGump( m_From, system, m_Tool, null, CraftPage.PickResource ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Smelt item
|
||||
{
|
||||
if ( system.Resmelt )
|
||||
Resmelt.Do( m_From, system, m_Tool );
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Make last
|
||||
{
|
||||
if ( context == null )
|
||||
break;
|
||||
|
||||
CraftItem item = context.LastMade;
|
||||
|
||||
if ( item != null )
|
||||
CraftItem( item );
|
||||
else
|
||||
m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, 1044165, m_Page ) ); // You haven't made anything yet.
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Last 10
|
||||
{
|
||||
if ( context == null )
|
||||
break;
|
||||
|
||||
context.LastGroupIndex = 501;
|
||||
m_From.SendGump( new CraftGump( m_From, system, m_Tool, null ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: // Toggle use resource hue
|
||||
{
|
||||
if ( context == null )
|
||||
break;
|
||||
|
||||
context.DoNotColor = !context.DoNotColor;
|
||||
|
||||
m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, null, m_Page ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: // Repair item
|
||||
{
|
||||
if ( system.Repair )
|
||||
Repair.Do( m_From, system, m_Tool );
|
||||
|
||||
break;
|
||||
}
|
||||
case 6: // Toggle mark option
|
||||
{
|
||||
if ( context == null || !system.MarkOption )
|
||||
break;
|
||||
|
||||
switch ( context.MarkOption )
|
||||
{
|
||||
case CraftMarkOption.MarkItem: context.MarkOption = CraftMarkOption.DoNotMark; break;
|
||||
case CraftMarkOption.DoNotMark: context.MarkOption = CraftMarkOption.PromptForMark; break;
|
||||
case CraftMarkOption.PromptForMark: context.MarkOption = CraftMarkOption.MarkItem; break;
|
||||
}
|
||||
|
||||
m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, null, m_Page ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 7: // Resource selection 2
|
||||
{
|
||||
if ( system.CraftSubRes2.Init )
|
||||
m_From.SendGump( new CraftGump( m_From, system, m_Tool, null, CraftPage.PickResource2 ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case 8: // Enhance item
|
||||
{
|
||||
if ( system.CanEnhance )
|
||||
Enhance.BeginTarget( m_From, system, m_Tool );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
287
Scripts/Engines/Craft/Core/CraftGumpItem.cs
Normal file
287
Scripts/Engines/Craft/Core/CraftGumpItem.cs
Normal file
|
|
@ -0,0 +1,287 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftGumpItem : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private CraftSystem m_CraftSystem;
|
||||
private CraftItem m_CraftItem;
|
||||
private BaseTool m_Tool;
|
||||
|
||||
private const int LabelHue = 0x480; // 0x384
|
||||
private const int RedLabelHue = 0x20;
|
||||
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private const int RedLabelColor = 0x6400;
|
||||
|
||||
private const int GreyLabelColor = 0x3DEF;
|
||||
|
||||
private int m_OtherCount;
|
||||
|
||||
public CraftGumpItem( Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool ) : base( 40, 40 )
|
||||
{
|
||||
m_From = from;
|
||||
m_CraftSystem = craftSystem;
|
||||
m_CraftItem = craftItem;
|
||||
m_Tool = tool;
|
||||
|
||||
from.CloseGump( typeof( CraftGump ) );
|
||||
from.CloseGump( typeof( CraftGumpItem ) );
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 530, 417, 5054 );
|
||||
AddImageTiled( 10, 10, 510, 22, 2624 );
|
||||
AddImageTiled( 10, 37, 150, 148, 2624 );
|
||||
AddImageTiled( 165, 37, 355, 90, 2624 );
|
||||
AddImageTiled( 10, 190, 155, 22, 2624 );
|
||||
AddImageTiled( 10, 217, 150, 53, 2624 );
|
||||
AddImageTiled( 165, 132, 355, 80, 2624 );
|
||||
AddImageTiled( 10, 275, 155, 22, 2624 );
|
||||
AddImageTiled( 10, 302, 150, 53, 2624 );
|
||||
AddImageTiled( 165, 217, 355, 80, 2624 );
|
||||
AddImageTiled( 10, 360, 155, 22, 2624 );
|
||||
AddImageTiled( 165, 302, 355, 80, 2624 );
|
||||
AddImageTiled( 10, 387, 510, 22, 2624 );
|
||||
AddAlphaRegion( 10, 10, 510, 399 );
|
||||
|
||||
AddHtmlLocalized( 170, 40, 150, 20, 1044053, LabelColor, false, false ); // ITEM
|
||||
AddHtmlLocalized( 10, 192, 150, 22, 1044054, LabelColor, false, false ); // <CENTER>SKILLS</CENTER>
|
||||
AddHtmlLocalized( 10, 277, 150, 22, 1044055, LabelColor, false, false ); // <CENTER>MATERIALS</CENTER>
|
||||
AddHtmlLocalized( 10, 362, 150, 22, 1044056, LabelColor, false, false ); // <CENTER>OTHER</CENTER>
|
||||
|
||||
if ( craftSystem.GumpTitleNumber > 0 )
|
||||
AddHtmlLocalized( 10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false );
|
||||
else
|
||||
AddHtml( 10, 12, 510, 20, craftSystem.GumpTitleString, false, false );
|
||||
|
||||
AddButton( 15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, 390, 150, 18, 1044150, LabelColor, false, false ); // BACK
|
||||
|
||||
bool needsRecipe = ( craftItem.Recipe != null && from is PlayerMobile && !((PlayerMobile)from).HasRecipe( craftItem.Recipe ) );
|
||||
|
||||
if( needsRecipe )
|
||||
{
|
||||
AddButton( 270, 387, 4005, 4007, 0, GumpButtonType.Page, 0 );
|
||||
AddHtmlLocalized( 305, 390, 150, 18, 1044151, GreyLabelColor, false, false ); // MAKE NOW
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton( 270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 305, 390, 150, 18, 1044151, LabelColor, false, false ); // MAKE NOW
|
||||
}
|
||||
|
||||
if ( craftItem.NameNumber > 0 )
|
||||
AddHtmlLocalized( 330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 330, 40, LabelHue, craftItem.NameString );
|
||||
|
||||
if ( craftItem.UseAllRes )
|
||||
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1048176, LabelColor, false, false ); // Makes as many as possible at once
|
||||
|
||||
DrawItem();
|
||||
DrawSkill();
|
||||
DrawRessource();
|
||||
|
||||
/*
|
||||
if( craftItem.RequiresSE )
|
||||
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1063363, LabelColor, false, false ); //* Requires the "Samurai Empire" expansion
|
||||
* */
|
||||
|
||||
if( craftItem.RequiredExpansion != Expansion.None )
|
||||
{
|
||||
bool supportsEx = (from.NetState != null && from.NetState.SupportsExpansion( craftItem.RequiredExpansion ));
|
||||
TextDefinition.AddHtmlText( this, 170, 302 + (m_OtherCount++ * 20), 310, 18, RequiredExpansionMessage( craftItem.RequiredExpansion ), false, false, supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue );
|
||||
}
|
||||
|
||||
if( needsRecipe )
|
||||
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1073620, RedLabelColor, false, false ); // You have not learned this recipe.
|
||||
|
||||
}
|
||||
|
||||
private TextDefinition RequiredExpansionMessage( Expansion expansion )
|
||||
{
|
||||
switch( expansion )
|
||||
{
|
||||
case Expansion.SE:
|
||||
return 1063363; // * Requires the "Samurai Empire" expansion
|
||||
case Expansion.ML:
|
||||
return 1072651; // * Requires the "Mondain's Legacy" expansion
|
||||
default:
|
||||
return String.Format( "* Requires the \"{0}\" expansion", ExpansionInfo.GetInfo( expansion ).Name );
|
||||
}
|
||||
}
|
||||
|
||||
private bool m_ShowExceptionalChance;
|
||||
|
||||
public void DrawItem()
|
||||
{
|
||||
Type type = m_CraftItem.ItemType;
|
||||
|
||||
AddItem( 20, 50, CraftItem.ItemIDOf( type ) );
|
||||
|
||||
if ( m_CraftItem.IsMarkable( type ) )
|
||||
{
|
||||
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1044059, LabelColor, false, false ); // This item may hold its maker's mark
|
||||
m_ShowExceptionalChance = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawSkill()
|
||||
{
|
||||
for ( int i = 0; i < m_CraftItem.Skills.Count; i++ )
|
||||
{
|
||||
CraftSkill skill = m_CraftItem.Skills.GetAt( i );
|
||||
double minSkill = skill.MinSkill, maxSkill = skill.MaxSkill;
|
||||
|
||||
if ( minSkill < 0 )
|
||||
minSkill = 0;
|
||||
|
||||
AddHtmlLocalized( 170, 132 + (i * 20), 200, 18, 1044060 + (int)skill.SkillToMake, LabelColor, false, false );
|
||||
AddLabel( 430, 132 + (i * 20), LabelHue, String.Format( "{0:F1}", minSkill ) );
|
||||
}
|
||||
|
||||
CraftSubResCol res = ( m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
|
||||
int resIndex = -1;
|
||||
|
||||
CraftContext context = m_CraftSystem.GetContext( m_From );
|
||||
|
||||
if ( context != null )
|
||||
resIndex = ( m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex );
|
||||
|
||||
bool allRequiredSkills = true;
|
||||
double chance = m_CraftItem.GetSuccessChance( m_From, resIndex > -1 ? res.GetAt( resIndex ).ItemType : null, m_CraftSystem, false, ref allRequiredSkills );
|
||||
double excepChance = m_CraftItem.GetExceptionalChance( m_CraftSystem, chance, m_From );
|
||||
|
||||
if ( chance < 0.0 )
|
||||
chance = 0.0;
|
||||
else if ( chance > 1.0 )
|
||||
chance = 1.0;
|
||||
|
||||
AddHtmlLocalized( 170, 80, 250, 18, 1044057, LabelColor, false, false ); // Success Chance:
|
||||
AddLabel( 430, 80, LabelHue, String.Format( "{0:F1}%", chance * 100 ) );
|
||||
|
||||
if ( m_ShowExceptionalChance )
|
||||
{
|
||||
if( excepChance < 0.0 )
|
||||
excepChance = 0.0;
|
||||
else if( excepChance > 1.0 )
|
||||
excepChance = 1.0;
|
||||
|
||||
AddHtmlLocalized( 170, 100, 250, 18, 1044058, 32767, false, false ); // Exceptional Chance:
|
||||
AddLabel( 430, 100, LabelHue, String.Format( "{0:F1}%", excepChance * 100 ) );
|
||||
}
|
||||
}
|
||||
|
||||
private static Type typeofBlankScroll = typeof( BlankScroll );
|
||||
private static Type typeofSpellScroll = typeof( SpellScroll );
|
||||
|
||||
public void DrawRessource()
|
||||
{
|
||||
bool retainedColor = false;
|
||||
|
||||
CraftContext context = m_CraftSystem.GetContext( m_From );
|
||||
|
||||
CraftSubResCol res = ( m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
|
||||
int resIndex = -1;
|
||||
|
||||
if ( context != null )
|
||||
resIndex = ( m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex );
|
||||
|
||||
bool cropScroll = ( m_CraftItem.Ressources.Count > 1 )
|
||||
&& m_CraftItem.Ressources.GetAt( m_CraftItem.Ressources.Count - 1 ).ItemType == typeofBlankScroll
|
||||
&& typeofSpellScroll.IsAssignableFrom( m_CraftItem.ItemType );
|
||||
|
||||
for ( int i = 0; i < m_CraftItem.Ressources.Count - (cropScroll ? 1 : 0) && i < 4; i++ )
|
||||
{
|
||||
Type type;
|
||||
string nameString;
|
||||
int nameNumber;
|
||||
|
||||
CraftRes craftResource = m_CraftItem.Ressources.GetAt( i );
|
||||
|
||||
type = craftResource.ItemType;
|
||||
nameString = craftResource.NameString;
|
||||
nameNumber = craftResource.NameNumber;
|
||||
|
||||
// Resource Mutation
|
||||
if ( type == res.ResType && resIndex > -1 )
|
||||
{
|
||||
CraftSubRes subResource = res.GetAt( resIndex );
|
||||
|
||||
type = subResource.ItemType;
|
||||
|
||||
nameString = subResource.NameString;
|
||||
nameNumber = subResource.GenericNameNumber;
|
||||
|
||||
if ( nameNumber <= 0 )
|
||||
nameNumber = subResource.NameNumber;
|
||||
}
|
||||
// ******************
|
||||
|
||||
if ( !retainedColor && m_CraftItem.RetainsColorFrom( m_CraftSystem, type ) )
|
||||
{
|
||||
retainedColor = true;
|
||||
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 310, 18, 1044152, LabelColor, false, false ); // * The item retains the color of this material
|
||||
AddLabel( 500, 219 + (i * 20), LabelHue, "*" );
|
||||
}
|
||||
|
||||
if ( nameNumber > 0 )
|
||||
AddHtmlLocalized( 170, 219 + (i * 20), 310, 18, nameNumber, LabelColor, false, false );
|
||||
else
|
||||
AddLabel( 170, 219 + (i * 20), LabelHue, nameString );
|
||||
|
||||
AddLabel( 430, 219 + (i * 20), LabelHue, craftResource.Amount.ToString() );
|
||||
}
|
||||
|
||||
if ( m_CraftItem.NameNumber == 1041267 ) // runebook
|
||||
{
|
||||
AddHtmlLocalized( 170, 219 + (m_CraftItem.Ressources.Count * 20), 310, 18, 1044447, LabelColor, false, false );
|
||||
AddLabel( 430, 219 + (m_CraftItem.Ressources.Count * 20), LabelHue, "1" );
|
||||
}
|
||||
|
||||
if ( cropScroll )
|
||||
AddHtmlLocalized( 170, 302 + (m_OtherCount++ * 20), 360, 18, 1044379, LabelColor, false, false ); // Inscribing scrolls also requires a blank scroll and mana.
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
// Back Button
|
||||
if ( info.ButtonID == 0 )
|
||||
{
|
||||
CraftGump craftGump = new CraftGump( m_From, m_CraftSystem, m_Tool, null );
|
||||
m_From.SendGump( craftGump );
|
||||
}
|
||||
else // Make Button
|
||||
{
|
||||
int num = m_CraftSystem.CanCraft( m_From, m_Tool, m_CraftItem.ItemType );
|
||||
|
||||
if ( num > 0 )
|
||||
{
|
||||
m_From.SendGump( new CraftGump( m_From, m_CraftSystem, m_Tool, num ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Type type = null;
|
||||
|
||||
CraftContext context = m_CraftSystem.GetContext( m_From );
|
||||
|
||||
if ( context != null )
|
||||
{
|
||||
CraftSubResCol res = ( m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes );
|
||||
int resIndex = ( m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex );
|
||||
|
||||
if ( resIndex > -1 )
|
||||
type = res.GetAt( resIndex ).ItemType;
|
||||
}
|
||||
|
||||
m_CraftSystem.CreateItem( m_From, m_CraftItem.ItemType, type, m_Tool, m_CraftItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1309
Scripts/Engines/Craft/Core/CraftItem.cs
Normal file
1309
Scripts/Engines/Craft/Core/CraftItem.cs
Normal file
File diff suppressed because it is too large
Load diff
58
Scripts/Engines/Craft/Core/CraftItemCol.cs
Normal file
58
Scripts/Engines/Craft/Core/CraftItemCol.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftItemCol : System.Collections.CollectionBase
|
||||
{
|
||||
public CraftItemCol()
|
||||
{
|
||||
}
|
||||
|
||||
public int Add( CraftItem craftItem )
|
||||
{
|
||||
return List.Add( craftItem );
|
||||
}
|
||||
|
||||
public void Remove( int index )
|
||||
{
|
||||
if ( index > Count - 1 || index < 0 )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt( index );
|
||||
}
|
||||
}
|
||||
|
||||
public CraftItem GetAt( int index )
|
||||
{
|
||||
return ( CraftItem ) List[index];
|
||||
}
|
||||
|
||||
public CraftItem SearchForSubclass( Type type )
|
||||
{
|
||||
for ( int i = 0; i < List.Count; i++ )
|
||||
{
|
||||
CraftItem craftItem = ( CraftItem )List[i];
|
||||
|
||||
if ( craftItem.ItemType == type || type.IsSubclassOf( craftItem.ItemType ) )
|
||||
return craftItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public CraftItem SearchFor( Type type )
|
||||
{
|
||||
for ( int i = 0; i < List.Count; i++ )
|
||||
{
|
||||
CraftItem craftItem = ( CraftItem )List[i];
|
||||
if ( craftItem.ItemType == type )
|
||||
{
|
||||
return craftItem;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Scripts/Engines/Craft/Core/CraftItemIDAttribute.cs
Normal file
18
Scripts/Engines/Craft/Core/CraftItemIDAttribute.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class CraftItemIDAttribute : Attribute
|
||||
{
|
||||
private int m_ItemID;
|
||||
|
||||
public int ItemID{ get{ return m_ItemID; } }
|
||||
|
||||
public CraftItemIDAttribute( int itemID )
|
||||
{
|
||||
m_ItemID = itemID;
|
||||
}
|
||||
}
|
||||
}
|
||||
71
Scripts/Engines/Craft/Core/CraftRes.cs
Normal file
71
Scripts/Engines/Craft/Core/CraftRes.cs
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftRes
|
||||
{
|
||||
private Type m_Type;
|
||||
private int m_Amount;
|
||||
|
||||
private string m_MessageString;
|
||||
private int m_MessageNumber;
|
||||
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
|
||||
public CraftRes( Type type, int amount )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Amount = amount;
|
||||
}
|
||||
|
||||
public CraftRes( Type type, TextDefinition name, int amount, TextDefinition message ): this ( type, amount )
|
||||
{
|
||||
m_NameNumber = name;
|
||||
m_MessageNumber = message;
|
||||
|
||||
m_NameString = name;
|
||||
m_MessageString = message;
|
||||
}
|
||||
|
||||
public void SendMessage( Mobile from )
|
||||
{
|
||||
if ( m_MessageNumber > 0 )
|
||||
from.SendLocalizedMessage( m_MessageNumber );
|
||||
else if ( m_MessageString != null && m_MessageString != String.Empty )
|
||||
from.SendMessage( m_MessageString );
|
||||
else
|
||||
from.SendLocalizedMessage( 502925 ); // You don't have the resources required to make that item.
|
||||
}
|
||||
|
||||
public Type ItemType
|
||||
{
|
||||
get { return m_Type; }
|
||||
}
|
||||
|
||||
public string MessageString
|
||||
{
|
||||
get { return m_MessageString; }
|
||||
}
|
||||
|
||||
public int MessageNumber
|
||||
{
|
||||
get { return m_MessageNumber; }
|
||||
}
|
||||
|
||||
public string NameString
|
||||
{
|
||||
get { return m_NameString; }
|
||||
}
|
||||
|
||||
public int NameNumber
|
||||
{
|
||||
get { return m_NameNumber; }
|
||||
}
|
||||
|
||||
public int Amount
|
||||
{
|
||||
get { return m_Amount; }
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Scripts/Engines/Craft/Core/CraftResCol.cs
Normal file
32
Scripts/Engines/Craft/Core/CraftResCol.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftResCol : System.Collections.CollectionBase
|
||||
{
|
||||
public CraftResCol()
|
||||
{
|
||||
}
|
||||
|
||||
public void Add( CraftRes craftRes )
|
||||
{
|
||||
List.Add( craftRes );
|
||||
}
|
||||
|
||||
public void Remove( int index )
|
||||
{
|
||||
if ( index > Count - 1 || index < 0 )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt( index );
|
||||
}
|
||||
}
|
||||
|
||||
public CraftRes GetAt( int index )
|
||||
{
|
||||
return ( CraftRes ) List[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Scripts/Engines/Craft/Core/CraftSkill.cs
Normal file
33
Scripts/Engines/Craft/Core/CraftSkill.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftSkill
|
||||
{
|
||||
private SkillName m_SkillToMake;
|
||||
private double m_MinSkill;
|
||||
private double m_MaxSkill;
|
||||
|
||||
public CraftSkill( SkillName skillToMake, double minSkill, double maxSkill )
|
||||
{
|
||||
m_SkillToMake = skillToMake;
|
||||
m_MinSkill = minSkill;
|
||||
m_MaxSkill = maxSkill;
|
||||
}
|
||||
|
||||
public SkillName SkillToMake
|
||||
{
|
||||
get { return m_SkillToMake; }
|
||||
}
|
||||
|
||||
public double MinSkill
|
||||
{
|
||||
get { return m_MinSkill; }
|
||||
}
|
||||
|
||||
public double MaxSkill
|
||||
{
|
||||
get { return m_MaxSkill; }
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Scripts/Engines/Craft/Core/CraftSkillCol.cs
Normal file
32
Scripts/Engines/Craft/Core/CraftSkillCol.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftSkillCol : System.Collections.CollectionBase
|
||||
{
|
||||
public CraftSkillCol()
|
||||
{
|
||||
}
|
||||
|
||||
public void Add( CraftSkill craftSkill )
|
||||
{
|
||||
List.Add( craftSkill );
|
||||
}
|
||||
|
||||
public void Remove( int index )
|
||||
{
|
||||
if ( index > Count - 1 || index < 0 )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt( index );
|
||||
}
|
||||
}
|
||||
|
||||
public CraftSkill GetAt( int index )
|
||||
{
|
||||
return ( CraftSkill ) List[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
58
Scripts/Engines/Craft/Core/CraftSubRes.cs
Normal file
58
Scripts/Engines/Craft/Core/CraftSubRes.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftSubRes
|
||||
{
|
||||
private Type m_Type;
|
||||
private double m_ReqSkill;
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
private int m_GenericNameNumber;
|
||||
private object m_Message;
|
||||
|
||||
public CraftSubRes( Type type, TextDefinition name, double reqSkill, object message ) : this( type, name, reqSkill, 0, message )
|
||||
{
|
||||
}
|
||||
|
||||
public CraftSubRes( Type type, TextDefinition name, double reqSkill, int genericNameNumber, object message )
|
||||
{
|
||||
m_Type = type;
|
||||
m_NameNumber = name;
|
||||
m_NameString = name;
|
||||
m_ReqSkill = reqSkill;
|
||||
m_GenericNameNumber = genericNameNumber;
|
||||
m_Message = message;
|
||||
}
|
||||
|
||||
public Type ItemType
|
||||
{
|
||||
get { return m_Type; }
|
||||
}
|
||||
|
||||
public string NameString
|
||||
{
|
||||
get { return m_NameString; }
|
||||
}
|
||||
|
||||
public int NameNumber
|
||||
{
|
||||
get { return m_NameNumber; }
|
||||
}
|
||||
|
||||
public int GenericNameNumber
|
||||
{
|
||||
get { return m_GenericNameNumber; }
|
||||
}
|
||||
|
||||
public object Message
|
||||
{
|
||||
get { return m_Message; }
|
||||
}
|
||||
|
||||
public double RequiredSkill
|
||||
{
|
||||
get { return m_ReqSkill; }
|
||||
}
|
||||
}
|
||||
}
|
||||
75
Scripts/Engines/Craft/Core/CraftSubResCol.cs
Normal file
75
Scripts/Engines/Craft/Core/CraftSubResCol.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class CraftSubResCol : System.Collections.CollectionBase
|
||||
{
|
||||
private Type m_Type;
|
||||
private string m_NameString;
|
||||
private int m_NameNumber;
|
||||
private bool m_Init;
|
||||
|
||||
public bool Init
|
||||
{
|
||||
get { return m_Init; }
|
||||
set { m_Init = value; }
|
||||
}
|
||||
|
||||
public Type ResType
|
||||
{
|
||||
get { return m_Type; }
|
||||
set { m_Type = value; }
|
||||
}
|
||||
|
||||
public string NameString
|
||||
{
|
||||
get { return m_NameString; }
|
||||
set { m_NameString = value; }
|
||||
}
|
||||
|
||||
public int NameNumber
|
||||
{
|
||||
get { return m_NameNumber; }
|
||||
set { m_NameNumber = value; }
|
||||
}
|
||||
|
||||
public CraftSubResCol()
|
||||
{
|
||||
m_Init = false;
|
||||
}
|
||||
|
||||
public void Add( CraftSubRes craftSubRes )
|
||||
{
|
||||
List.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void Remove( int index )
|
||||
{
|
||||
if ( index > Count - 1 || index < 0 )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
List.RemoveAt( index );
|
||||
}
|
||||
}
|
||||
|
||||
public CraftSubRes GetAt( int index )
|
||||
{
|
||||
return ( CraftSubRes ) List[index];
|
||||
}
|
||||
|
||||
public CraftSubRes SearchFor( Type type )
|
||||
{
|
||||
for ( int i = 0; i < List.Count; i++ )
|
||||
{
|
||||
CraftSubRes craftSubRes = ( CraftSubRes )List[i];
|
||||
if ( craftSubRes.ItemType == type )
|
||||
{
|
||||
return craftSubRes;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
337
Scripts/Engines/Craft/Core/CraftSystem.cs
Normal file
337
Scripts/Engines/Craft/Core/CraftSystem.cs
Normal file
|
|
@ -0,0 +1,337 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public enum CraftECA
|
||||
{
|
||||
ChanceMinusSixty,
|
||||
FiftyPercentChanceMinusTenPercent,
|
||||
ChanceMinusSixtyToFourtyFive
|
||||
}
|
||||
|
||||
public abstract class CraftSystem
|
||||
{
|
||||
private int m_MinCraftEffect;
|
||||
private int m_MaxCraftEffect;
|
||||
private double m_Delay;
|
||||
private bool m_Resmelt;
|
||||
private bool m_Repair;
|
||||
private bool m_MarkOption;
|
||||
private bool m_CanEnhance;
|
||||
|
||||
private CraftItemCol m_CraftItems;
|
||||
private CraftGroupCol m_CraftGroups;
|
||||
private CraftSubResCol m_CraftSubRes;
|
||||
private CraftSubResCol m_CraftSubRes2;
|
||||
|
||||
public int MinCraftEffect { get { return m_MinCraftEffect; } }
|
||||
public int MaxCraftEffect { get { return m_MaxCraftEffect; } }
|
||||
public double Delay { get { return m_Delay; } }
|
||||
|
||||
public CraftItemCol CraftItems{ get { return m_CraftItems; } }
|
||||
public CraftGroupCol CraftGroups{ get { return m_CraftGroups; } }
|
||||
public CraftSubResCol CraftSubRes{ get { return m_CraftSubRes; } }
|
||||
public CraftSubResCol CraftSubRes2{ get { return m_CraftSubRes2; } }
|
||||
|
||||
public abstract SkillName MainSkill{ get; }
|
||||
|
||||
public virtual int GumpTitleNumber{ get{ return 0; } }
|
||||
public virtual string GumpTitleString{ get{ return ""; } }
|
||||
|
||||
public virtual CraftECA ECA{ get{ return CraftECA.ChanceMinusSixty; } }
|
||||
|
||||
private Hashtable m_ContextTable = new Hashtable();
|
||||
|
||||
public abstract double GetChanceAtMin( CraftItem item );
|
||||
|
||||
public virtual bool RetainsColorFrom( CraftItem item, Type type )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public CraftContext GetContext( Mobile m )
|
||||
{
|
||||
if ( m == null )
|
||||
return null;
|
||||
|
||||
if ( m.Deleted )
|
||||
{
|
||||
m_ContextTable.Remove( m );
|
||||
return null;
|
||||
}
|
||||
|
||||
CraftContext c = (CraftContext)m_ContextTable[m];
|
||||
|
||||
if ( c == null )
|
||||
m_ContextTable[m] = c = new CraftContext();
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public void OnMade( Mobile m, CraftItem item )
|
||||
{
|
||||
CraftContext c = GetContext( m );
|
||||
|
||||
if ( c != null )
|
||||
c.OnMade( item );
|
||||
}
|
||||
|
||||
public bool Resmelt
|
||||
{
|
||||
get { return m_Resmelt; }
|
||||
set { m_Resmelt = value; }
|
||||
}
|
||||
|
||||
public bool Repair
|
||||
{
|
||||
get{ return m_Repair; }
|
||||
set{ m_Repair = value; }
|
||||
}
|
||||
|
||||
public bool MarkOption
|
||||
{
|
||||
get{ return m_MarkOption; }
|
||||
set{ m_MarkOption = value; }
|
||||
}
|
||||
|
||||
public bool CanEnhance
|
||||
{
|
||||
get{ return m_CanEnhance; }
|
||||
set{ m_CanEnhance = value; }
|
||||
}
|
||||
|
||||
public CraftSystem( int minCraftEffect, int maxCraftEffect, double delay )
|
||||
{
|
||||
m_MinCraftEffect = minCraftEffect;
|
||||
m_MaxCraftEffect = maxCraftEffect;
|
||||
m_Delay = delay;
|
||||
|
||||
m_CraftItems = new CraftItemCol();
|
||||
m_CraftGroups = new CraftGroupCol();
|
||||
m_CraftSubRes = new CraftSubResCol();
|
||||
m_CraftSubRes2 = new CraftSubResCol();
|
||||
|
||||
InitCraftList();
|
||||
}
|
||||
|
||||
public virtual bool ConsumeOnFailure( Mobile from, Type resourceType, CraftItem craftItem )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void CreateItem( Mobile from, Type type, Type typeRes, BaseTool tool, CraftItem realCraftItem )
|
||||
{
|
||||
// Verify if the type is in the list of the craftable item
|
||||
CraftItem craftItem = m_CraftItems.SearchFor( type );
|
||||
if ( craftItem != null )
|
||||
{
|
||||
// The item is in the list, try to create it
|
||||
// Test code: items like sextant parts can be crafted either directly from ingots, or from different parts
|
||||
realCraftItem.Craft( from, this, typeRes, tool );
|
||||
//craftItem.Craft( from, this, typeRes, tool );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int AddCraft( Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount )
|
||||
{
|
||||
return AddCraft( typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, "" );
|
||||
}
|
||||
|
||||
public int AddCraft( Type typeItem, TextDefinition group, TextDefinition name, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount, TextDefinition message )
|
||||
{
|
||||
return AddCraft( typeItem, group, name, MainSkill, minSkill, maxSkill, typeRes, nameRes, amount, message );
|
||||
}
|
||||
|
||||
public int AddCraft( Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount )
|
||||
{
|
||||
return AddCraft( typeItem, group, name, skillToMake, minSkill, maxSkill, typeRes, nameRes, amount, "" );
|
||||
}
|
||||
|
||||
public int AddCraft( Type typeItem, TextDefinition group, TextDefinition name, SkillName skillToMake, double minSkill, double maxSkill, Type typeRes, TextDefinition nameRes, int amount, TextDefinition message )
|
||||
{
|
||||
CraftItem craftItem = new CraftItem( typeItem, group, name );
|
||||
craftItem.AddRes( typeRes, nameRes, amount, message );
|
||||
craftItem.AddSkill( skillToMake, minSkill, maxSkill );
|
||||
|
||||
DoGroup( group, craftItem );
|
||||
return m_CraftItems.Add( craftItem );
|
||||
}
|
||||
|
||||
|
||||
private void DoGroup( TextDefinition groupName, CraftItem craftItem )
|
||||
{
|
||||
int index = m_CraftGroups.SearchFor( groupName );
|
||||
|
||||
if ( index == -1)
|
||||
{
|
||||
CraftGroup craftGroup = new CraftGroup( groupName );
|
||||
craftGroup.AddCraftItem( craftItem );
|
||||
m_CraftGroups.Add( craftGroup );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_CraftGroups.GetAt( index ).AddCraftItem( craftItem );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetManaReq( int index, int mana )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.Mana = mana;
|
||||
}
|
||||
|
||||
public void SetStamReq( int index, int stam )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.Stam = stam;
|
||||
}
|
||||
|
||||
public void SetHitsReq( int index, int hits )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.Hits = hits;
|
||||
}
|
||||
|
||||
public void SetUseAllRes( int index, bool useAll )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.UseAllRes = useAll;
|
||||
}
|
||||
|
||||
public void SetNeedHeat( int index, bool needHeat )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.NeedHeat = needHeat;
|
||||
}
|
||||
|
||||
public void SetNeedOven( int index, bool needOven )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.NeedOven = needOven;
|
||||
}
|
||||
|
||||
public void SetNeedMill( int index, bool needMill )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.NeedMill = needMill;
|
||||
}
|
||||
|
||||
public void SetNeededExpansion( int index, Expansion expansion )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.RequiredExpansion = expansion;
|
||||
}
|
||||
|
||||
public void AddRes( int index, Type type, TextDefinition name, int amount )
|
||||
{
|
||||
AddRes( index, type, name, amount, "" );
|
||||
}
|
||||
|
||||
public void AddRes( int index, Type type, TextDefinition name, int amount, TextDefinition message )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.AddRes( type, name, amount, message );
|
||||
}
|
||||
|
||||
public void AddSkill( int index, SkillName skillToMake, double minSkill, double maxSkill )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt(index);
|
||||
craftItem.AddSkill(skillToMake, minSkill, maxSkill);
|
||||
}
|
||||
|
||||
public void SetUseSubRes2( int index, bool val )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt(index);
|
||||
craftItem.UseSubRes2 = val;
|
||||
}
|
||||
|
||||
public void AddRecipe( int index, int id )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.AddRecipe( id, this );
|
||||
}
|
||||
|
||||
public void ForceNonExceptional( int index )
|
||||
{
|
||||
CraftItem craftItem = m_CraftItems.GetAt( index );
|
||||
craftItem.ForceNonExceptional = true;
|
||||
}
|
||||
|
||||
|
||||
public void SetSubRes( Type type, string name )
|
||||
{
|
||||
m_CraftSubRes.ResType = type;
|
||||
m_CraftSubRes.NameString = name;
|
||||
m_CraftSubRes.Init = true;
|
||||
}
|
||||
|
||||
public void SetSubRes( Type type, int name )
|
||||
{
|
||||
m_CraftSubRes.ResType = type;
|
||||
m_CraftSubRes.NameNumber = name;
|
||||
m_CraftSubRes.Init = true;
|
||||
}
|
||||
|
||||
public void AddSubRes( Type type, int name, double reqSkill, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message );
|
||||
m_CraftSubRes.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void AddSubRes( Type type, int name, double reqSkill, int genericName, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, genericName, message );
|
||||
m_CraftSubRes.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void AddSubRes( Type type, string name, double reqSkill, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message );
|
||||
m_CraftSubRes.Add( craftSubRes );
|
||||
}
|
||||
|
||||
|
||||
public void SetSubRes2( Type type, string name )
|
||||
{
|
||||
m_CraftSubRes2.ResType = type;
|
||||
m_CraftSubRes2.NameString = name;
|
||||
m_CraftSubRes2.Init = true;
|
||||
}
|
||||
|
||||
public void SetSubRes2( Type type, int name )
|
||||
{
|
||||
m_CraftSubRes2.ResType = type;
|
||||
m_CraftSubRes2.NameNumber = name;
|
||||
m_CraftSubRes2.Init = true;
|
||||
}
|
||||
|
||||
public void AddSubRes2( Type type, int name, double reqSkill, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message );
|
||||
m_CraftSubRes2.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void AddSubRes2( Type type, int name, double reqSkill, int genericName, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, genericName, message );
|
||||
m_CraftSubRes2.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public void AddSubRes2( Type type, string name, double reqSkill, object message )
|
||||
{
|
||||
CraftSubRes craftSubRes = new CraftSubRes( type, name, reqSkill, message );
|
||||
m_CraftSubRes2.Add( craftSubRes );
|
||||
}
|
||||
|
||||
public abstract void InitCraftList();
|
||||
|
||||
public abstract void PlayCraftEffect( Mobile from );
|
||||
public abstract int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item );
|
||||
|
||||
public abstract int CanCraft( Mobile from, BaseTool tool, Type itemType );
|
||||
}
|
||||
}
|
||||
36
Scripts/Engines/Craft/Core/CustomCraft.cs
Normal file
36
Scripts/Engines/Craft/Core/CustomCraft.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public abstract class CustomCraft
|
||||
{
|
||||
private Mobile m_From;
|
||||
private CraftItem m_CraftItem;
|
||||
private CraftSystem m_CraftSystem;
|
||||
private Type m_TypeRes;
|
||||
private BaseTool m_Tool;
|
||||
private int m_Quality;
|
||||
|
||||
public Mobile From{ get{ return m_From; } }
|
||||
public CraftItem CraftItem{ get{ return m_CraftItem; } }
|
||||
public CraftSystem CraftSystem{ get{ return m_CraftSystem; } }
|
||||
public Type TypeRes{ get{ return m_TypeRes; } }
|
||||
public BaseTool Tool{ get{ return m_Tool; } }
|
||||
public int Quality{ get{ return m_Quality; } }
|
||||
|
||||
public CustomCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality )
|
||||
{
|
||||
m_From = from;
|
||||
m_CraftItem = craftItem;
|
||||
m_CraftSystem = craftSystem;
|
||||
m_TypeRes = typeRes;
|
||||
m_Tool = tool;
|
||||
m_Quality = quality;
|
||||
}
|
||||
|
||||
public abstract void EndCraftAction();
|
||||
public abstract Item CompleteCraft( out int message );
|
||||
}
|
||||
}
|
||||
313
Scripts/Engines/Craft/Core/Enhance.cs
Normal file
313
Scripts/Engines/Craft/Core/Enhance.cs
Normal file
|
|
@ -0,0 +1,313 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public enum EnhanceResult
|
||||
{
|
||||
NotInBackpack,
|
||||
BadItem,
|
||||
BadResource,
|
||||
AlreadyEnhanced,
|
||||
Success,
|
||||
Failure,
|
||||
Broken,
|
||||
NoResources,
|
||||
NoSkill
|
||||
}
|
||||
|
||||
public class Enhance
|
||||
{
|
||||
public static EnhanceResult Invoke( Mobile from, CraftSystem craftSystem, BaseTool tool, Item item, CraftResource resource, Type resType, ref object resMessage )
|
||||
{
|
||||
if ( item == null )
|
||||
return EnhanceResult.BadItem;
|
||||
|
||||
if ( !item.IsChildOf( from.Backpack ) )
|
||||
return EnhanceResult.NotInBackpack;
|
||||
|
||||
if ( !(item is BaseArmor) && !(item is BaseWeapon) )
|
||||
return EnhanceResult.BadItem;
|
||||
|
||||
if ( CraftResources.IsStandard( resource ) )
|
||||
return EnhanceResult.BadResource;
|
||||
|
||||
CraftItem craftItem = craftSystem.CraftItems.SearchFor( item.GetType() );
|
||||
|
||||
if ( craftItem == null || craftItem.Ressources.Count == 0 )
|
||||
return EnhanceResult.BadItem;
|
||||
|
||||
int quality = 0;
|
||||
bool allRequiredSkills = false;
|
||||
|
||||
if ( !craftItem.CheckSkills( from, resType, craftSystem, ref quality, ref allRequiredSkills, false ) )
|
||||
return EnhanceResult.NoSkill;
|
||||
|
||||
CraftResourceInfo info = CraftResources.GetInfo( resource );
|
||||
|
||||
if ( info == null || info.ResourceTypes.Length == 0 )
|
||||
return EnhanceResult.BadResource;
|
||||
|
||||
CraftAttributeInfo attributes = info.AttributeInfo;
|
||||
|
||||
if ( attributes == null )
|
||||
return EnhanceResult.BadResource;
|
||||
|
||||
int resHue = 0, maxAmount = 0;
|
||||
|
||||
if ( !craftItem.ConsumeRes( from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref resMessage ) )
|
||||
return EnhanceResult.NoResources;
|
||||
|
||||
if ( craftSystem is DefBlacksmithy )
|
||||
{
|
||||
AncientSmithyHammer hammer = from.FindItemOnLayer( Layer.OneHanded ) as AncientSmithyHammer;
|
||||
if ( hammer != null )
|
||||
{
|
||||
hammer.UsesRemaining--;
|
||||
if ( hammer.UsesRemaining < 1 )
|
||||
hammer.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
int phys = 0, fire = 0, cold = 0, pois = 0, nrgy = 0;
|
||||
int dura = 0, luck = 0, lreq = 0, dinc = 0;
|
||||
int baseChance = 0;
|
||||
|
||||
bool physBonus = false;
|
||||
bool fireBonus = false;
|
||||
bool coldBonus = false;
|
||||
bool nrgyBonus = false;
|
||||
bool poisBonus = false;
|
||||
bool duraBonus = false;
|
||||
bool luckBonus = false;
|
||||
bool lreqBonus = false;
|
||||
bool dincBonus = false;
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
if ( !CraftResources.IsStandard( weapon.Resource ) )
|
||||
return EnhanceResult.AlreadyEnhanced;
|
||||
|
||||
baseChance = 20;
|
||||
|
||||
dura = weapon.MaxHitPoints;
|
||||
luck = weapon.Attributes.Luck;
|
||||
lreq = weapon.WeaponAttributes.LowerStatReq;
|
||||
dinc = weapon.Attributes.WeaponDamage;
|
||||
|
||||
fireBonus = ( attributes.WeaponFireDamage > 0 );
|
||||
coldBonus = ( attributes.WeaponColdDamage > 0 );
|
||||
nrgyBonus = ( attributes.WeaponEnergyDamage > 0 );
|
||||
poisBonus = ( attributes.WeaponPoisonDamage > 0 );
|
||||
|
||||
duraBonus = ( attributes.WeaponDurability > 0 );
|
||||
luckBonus = ( attributes.WeaponLuck > 0 );
|
||||
lreqBonus = ( attributes.WeaponLowerRequirements > 0 );
|
||||
dincBonus = ( dinc > 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
if ( !CraftResources.IsStandard( armor.Resource ) )
|
||||
return EnhanceResult.AlreadyEnhanced;
|
||||
|
||||
baseChance = 20;
|
||||
|
||||
phys = armor.PhysicalResistance;
|
||||
fire = armor.FireResistance;
|
||||
cold = armor.ColdResistance;
|
||||
pois = armor.PoisonResistance;
|
||||
nrgy = armor.EnergyResistance;
|
||||
|
||||
dura = armor.MaxHitPoints;
|
||||
luck = armor.Attributes.Luck;
|
||||
lreq = armor.ArmorAttributes.LowerStatReq;
|
||||
|
||||
physBonus = ( attributes.ArmorPhysicalResist > 0 );
|
||||
fireBonus = ( attributes.ArmorFireResist > 0 );
|
||||
coldBonus = ( attributes.ArmorColdResist > 0 );
|
||||
nrgyBonus = ( attributes.ArmorEnergyResist > 0 );
|
||||
poisBonus = ( attributes.ArmorPoisonResist > 0 );
|
||||
|
||||
duraBonus = ( attributes.ArmorDurability > 0 );
|
||||
luckBonus = ( attributes.ArmorLuck > 0 );
|
||||
lreqBonus = ( attributes.ArmorLowerRequirements > 0 );
|
||||
dincBonus = false;
|
||||
}
|
||||
|
||||
int skill = from.Skills[craftSystem.MainSkill].Fixed / 10;
|
||||
|
||||
if ( skill >= 100 )
|
||||
baseChance -= (skill - 90) / 10;
|
||||
|
||||
EnhanceResult res = EnhanceResult.Success;
|
||||
|
||||
if ( physBonus )
|
||||
CheckResult( ref res, baseChance + phys );
|
||||
|
||||
if ( fireBonus )
|
||||
CheckResult( ref res, baseChance + fire );
|
||||
|
||||
if ( coldBonus )
|
||||
CheckResult( ref res, baseChance + cold );
|
||||
|
||||
if ( nrgyBonus )
|
||||
CheckResult( ref res, baseChance + nrgy );
|
||||
|
||||
if ( poisBonus )
|
||||
CheckResult( ref res, baseChance + pois );
|
||||
|
||||
if ( duraBonus )
|
||||
CheckResult( ref res, baseChance + (dura / 40) );
|
||||
|
||||
if ( luckBonus )
|
||||
CheckResult( ref res, baseChance + 10 + (luck / 2) );
|
||||
|
||||
if ( lreqBonus )
|
||||
CheckResult( ref res, baseChance + (lreq / 4) );
|
||||
|
||||
if ( dincBonus )
|
||||
CheckResult( ref res, baseChance + (dinc / 4) );
|
||||
|
||||
switch ( res )
|
||||
{
|
||||
case EnhanceResult.Broken:
|
||||
{
|
||||
if ( !craftItem.ConsumeRes( from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage ) )
|
||||
return EnhanceResult.NoResources;
|
||||
|
||||
item.Delete();
|
||||
break;
|
||||
}
|
||||
case EnhanceResult.Success:
|
||||
{
|
||||
if ( !craftItem.ConsumeRes( from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref resMessage ) )
|
||||
return EnhanceResult.NoResources;
|
||||
|
||||
if( item is BaseWeapon )
|
||||
{
|
||||
BaseWeapon w = (BaseWeapon)item;
|
||||
|
||||
w.Resource = resource;
|
||||
|
||||
int hue = w.GetElementalDamageHue();
|
||||
if( hue > 0 )
|
||||
w.Hue = hue;
|
||||
}
|
||||
else if( item is BaseArmor ) //Sanity
|
||||
{
|
||||
((BaseArmor)item).Resource = resource;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case EnhanceResult.Failure:
|
||||
{
|
||||
if ( !craftItem.ConsumeRes( from, resType, craftSystem, ref resHue, ref maxAmount, ConsumeType.Half, ref resMessage ) )
|
||||
return EnhanceResult.NoResources;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void CheckResult( ref EnhanceResult res, int chance )
|
||||
{
|
||||
if ( res != EnhanceResult.Success )
|
||||
return; // we've already failed..
|
||||
|
||||
int random = Utility.Random( 100 );
|
||||
|
||||
if ( 10 > random )
|
||||
res = EnhanceResult.Failure;
|
||||
else if ( chance > random )
|
||||
res = EnhanceResult.Broken;
|
||||
}
|
||||
|
||||
public static void BeginTarget( Mobile from, CraftSystem craftSystem, BaseTool tool )
|
||||
{
|
||||
CraftContext context = craftSystem.GetContext( from );
|
||||
|
||||
if ( context == null )
|
||||
return;
|
||||
|
||||
int lastRes = context.LastResourceIndex;
|
||||
CraftSubResCol subRes = craftSystem.CraftSubRes;
|
||||
|
||||
if ( lastRes >= 0 && lastRes < subRes.Count )
|
||||
{
|
||||
CraftSubRes res = subRes.GetAt( lastRes );
|
||||
|
||||
if ( from.Skills[craftSystem.MainSkill].Value < res.RequiredSkill )
|
||||
{
|
||||
from.SendGump( new CraftGump( from, craftSystem, tool, res.Message ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
CraftResource resource = CraftResources.GetFromType( res.ItemType );
|
||||
|
||||
if ( resource != CraftResource.None )
|
||||
{
|
||||
from.Target = new InternalTarget( craftSystem, tool, res.ItemType, resource );
|
||||
from.SendLocalizedMessage( 1061004 ); // Target an item to enhance with the properties of your selected material.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new CraftGump( from, craftSystem, tool, 1061010 ) ); // You must select a special material in order to enhance an item with its properties.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new CraftGump( from, craftSystem, tool, 1061010 ) ); // You must select a special material in order to enhance an item with its properties.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private CraftSystem m_CraftSystem;
|
||||
private BaseTool m_Tool;
|
||||
private Type m_ResourceType;
|
||||
private CraftResource m_Resource;
|
||||
|
||||
public InternalTarget( CraftSystem craftSystem, BaseTool tool, Type resourceType, CraftResource resource ) : base ( 2, false, TargetFlags.None )
|
||||
{
|
||||
m_CraftSystem = craftSystem;
|
||||
m_Tool = tool;
|
||||
m_ResourceType = resourceType;
|
||||
m_Resource = resource;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Item )
|
||||
{
|
||||
object message = null;
|
||||
EnhanceResult res = Enhance.Invoke( from, m_CraftSystem, m_Tool, (Item)targeted, m_Resource, m_ResourceType, ref message );
|
||||
|
||||
switch ( res )
|
||||
{
|
||||
case EnhanceResult.NotInBackpack: message = 1061005; break; // The item must be in your backpack to enhance it.
|
||||
case EnhanceResult.AlreadyEnhanced: message = 1061012; break; // This item is already enhanced with the properties of a special material.
|
||||
case EnhanceResult.BadItem: message = 1061011; break; // You cannot enhance this type of item with the properties of the selected special material.
|
||||
case EnhanceResult.BadResource: message = 1061010; break; // You must select a special material in order to enhance an item with its properties.
|
||||
case EnhanceResult.Broken: message = 1061080; break; // You attempt to enhance the item, but fail catastrophically. The item is lost.
|
||||
case EnhanceResult.Failure: message = 1061082; break; // You attempt to enhance the item, but fail. Some material is lost in the process.
|
||||
case EnhanceResult.Success: message = 1061008; break; // You enhance the item with the properties of the special material.
|
||||
case EnhanceResult.NoSkill: message = 1044153; break; // You don't have the required skills to attempt this item.
|
||||
}
|
||||
|
||||
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, message ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
54
Scripts/Engines/Craft/Core/QueryMakersMarkGump.cs
Normal file
54
Scripts/Engines/Craft/Core/QueryMakersMarkGump.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class QueryMakersMarkGump : Gump
|
||||
{
|
||||
private int m_Quality;
|
||||
private Mobile m_From;
|
||||
private CraftItem m_CraftItem;
|
||||
private CraftSystem m_CraftSystem;
|
||||
private Type m_TypeRes;
|
||||
private BaseTool m_Tool;
|
||||
|
||||
public QueryMakersMarkGump( int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool ) : base( 100, 200 )
|
||||
{
|
||||
from.CloseGump( typeof( QueryMakersMarkGump ) );
|
||||
|
||||
m_Quality = quality;
|
||||
m_From = from;
|
||||
m_CraftItem = craftItem;
|
||||
m_CraftSystem = craftSystem;
|
||||
m_TypeRes = typeRes;
|
||||
m_Tool = tool;
|
||||
|
||||
AddPage( 0 );
|
||||
|
||||
AddBackground( 0, 0, 220, 170, 5054 );
|
||||
AddBackground( 10, 10, 200, 150, 3000 );
|
||||
|
||||
AddHtmlLocalized( 20, 20, 180, 80, 1018317, false, false ); // Do you wish to place your maker's mark on this item?
|
||||
|
||||
AddHtmlLocalized( 55, 100, 140, 25, 1011011, false, false ); // CONTINUE
|
||||
AddButton( 20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
|
||||
AddHtmlLocalized( 55, 125, 140, 25, 1011012, false, false ); // CANCEL
|
||||
AddButton( 20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
}
|
||||
|
||||
public override void OnResponse( Server.Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
bool makersMark = ( info.ButtonID == 1 );
|
||||
|
||||
if ( makersMark )
|
||||
m_From.SendLocalizedMessage( 501808 ); // You mark the item.
|
||||
else
|
||||
m_From.SendLocalizedMessage( 501809 ); // Cancelled mark.
|
||||
|
||||
m_CraftItem.CompleteCraft( m_Quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
123
Scripts/Engines/Craft/Core/Recipes.cs
Normal file
123
Scripts/Engines/Craft/Core/Recipes.cs
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class Recipe
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "LearnAllRecipes", AccessLevel.GameMaster, new CommandEventHandler( LearnAllRecipes_OnCommand ) );
|
||||
CommandSystem.Register( "ForgetAllRecipes", AccessLevel.GameMaster, new CommandEventHandler( ForgetAllRecipes_OnCommand ) );
|
||||
}
|
||||
|
||||
[Usage( "LearnAllRecipes" )]
|
||||
[Description( "Teaches a player all available recipes." )]
|
||||
private static void LearnAllRecipes_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
m.SendMessage( "Target a player to teach them all of the recipies." );
|
||||
|
||||
m.BeginTarget( -1, false, Server.Targeting.TargetFlags.None, new TargetCallback(
|
||||
delegate( Mobile from, object targeted )
|
||||
{
|
||||
if( targeted is PlayerMobile )
|
||||
{
|
||||
foreach( KeyValuePair<int, Recipe> kvp in m_Recipes )
|
||||
((PlayerMobile)targeted).AcquireRecipe( kvp.Key );
|
||||
|
||||
m.SendMessage( "You teach them all of the recipies." );
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage( "That is not a player!" );
|
||||
}
|
||||
}
|
||||
) );
|
||||
}
|
||||
|
||||
[Usage( "ForgetAllRecipes" )]
|
||||
[Description( "Makes a player forget all the recipies they've learned." )]
|
||||
private static void ForgetAllRecipes_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
m.SendMessage( "Target a player to have them forget all of the recipies they've learned." );
|
||||
|
||||
m.BeginTarget( -1, false, Server.Targeting.TargetFlags.None, new TargetCallback(
|
||||
delegate( Mobile from, object targeted )
|
||||
{
|
||||
if( targeted is PlayerMobile )
|
||||
{
|
||||
foreach( KeyValuePair<int, Recipe> kvp in m_Recipes )
|
||||
((PlayerMobile)targeted).AcquireRecipe( kvp.Key );
|
||||
|
||||
m.SendMessage( "They forget all their recipies." );
|
||||
}
|
||||
else
|
||||
{
|
||||
m.SendMessage( "That is not a player!" );
|
||||
}
|
||||
}
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
private static Dictionary<int, Recipe> m_Recipes = new Dictionary<int, Recipe>();
|
||||
|
||||
public static Dictionary<int, Recipe> Recipes { get { return m_Recipes; } }
|
||||
|
||||
private static int m_LargestRecipeID;
|
||||
public static int LargestRecipeID{ get{ return m_LargestRecipeID; } }
|
||||
|
||||
private CraftSystem m_System;
|
||||
|
||||
public CraftSystem CraftSystem
|
||||
{
|
||||
get { return m_System; }
|
||||
set { m_System = value; }
|
||||
}
|
||||
|
||||
private CraftItem m_CraftItem;
|
||||
|
||||
public CraftItem CraftItem
|
||||
{
|
||||
get { return m_CraftItem; }
|
||||
set { m_CraftItem = value; }
|
||||
}
|
||||
|
||||
private int m_ID;
|
||||
|
||||
public int ID
|
||||
{
|
||||
get { return m_ID; }
|
||||
}
|
||||
|
||||
private TextDefinition m_TD;
|
||||
public TextDefinition TextDefinition
|
||||
{
|
||||
get
|
||||
{
|
||||
if( m_TD == null )
|
||||
m_TD = new TextDefinition( m_CraftItem.NameNumber, m_CraftItem.NameString );
|
||||
|
||||
return m_TD;
|
||||
}
|
||||
}
|
||||
|
||||
public Recipe( int id, CraftSystem system, CraftItem item )
|
||||
{
|
||||
m_ID = id;
|
||||
m_System = system;
|
||||
m_CraftItem = item;
|
||||
|
||||
if( m_Recipes.ContainsKey( id ) )
|
||||
throw new Exception( "Attempting to create recipe with preexisting ID." );
|
||||
|
||||
m_Recipes.Add( id, this );
|
||||
m_LargestRecipeID = Math.Max( id, m_LargestRecipeID );
|
||||
}
|
||||
}
|
||||
}
|
||||
423
Scripts/Engines/Craft/Core/Repair.cs
Normal file
423
Scripts/Engines/Craft/Core/Repair.cs
Normal file
|
|
@ -0,0 +1,423 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class Repair
|
||||
{
|
||||
public Repair()
|
||||
{
|
||||
}
|
||||
|
||||
public static void Do( Mobile from, CraftSystem craftSystem, BaseTool tool )
|
||||
{
|
||||
from.Target = new InternalTarget( craftSystem, tool );
|
||||
from.SendLocalizedMessage( 1044276 ); // Target an item to repair.
|
||||
}
|
||||
|
||||
public static void Do( Mobile from, CraftSystem craftSystem, RepairDeed deed )
|
||||
{
|
||||
from.Target = new InternalTarget( craftSystem, deed );
|
||||
from.SendLocalizedMessage( 1044276 ); // Target an item to repair.
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private CraftSystem m_CraftSystem;
|
||||
private BaseTool m_Tool;
|
||||
private RepairDeed m_Deed;
|
||||
|
||||
public InternalTarget( CraftSystem craftSystem, BaseTool tool ) : base ( 2, false, TargetFlags.None )
|
||||
{
|
||||
m_CraftSystem = craftSystem;
|
||||
m_Tool = tool;
|
||||
}
|
||||
|
||||
public InternalTarget( CraftSystem craftSystem, RepairDeed deed ) : base( 2, false, TargetFlags.None )
|
||||
{
|
||||
m_CraftSystem = craftSystem;
|
||||
m_Deed = deed;
|
||||
}
|
||||
|
||||
private static void EndGolemRepair( object state )
|
||||
{
|
||||
((Mobile)state).EndAction( typeof( Golem ) );
|
||||
}
|
||||
|
||||
private int GetWeakenChance( Mobile mob, SkillName skill, int curHits, int maxHits )
|
||||
{
|
||||
// 40% - (1% per hp lost) - (1% per 10 craft skill)
|
||||
return (40 + (maxHits - curHits)) - (int)(((m_Deed != null)? m_Deed.SkillLevel : mob.Skills[skill].Value) / 10);
|
||||
}
|
||||
|
||||
private bool CheckWeaken( Mobile mob, SkillName skill, int curHits, int maxHits )
|
||||
{
|
||||
return ( GetWeakenChance( mob, skill, curHits, maxHits ) > Utility.Random( 100 ) );
|
||||
}
|
||||
|
||||
private int GetRepairDifficulty( int curHits, int maxHits )
|
||||
{
|
||||
return (((maxHits - curHits) * 1250) / Math.Max( maxHits, 1 )) - 250;
|
||||
}
|
||||
|
||||
private bool CheckRepairDifficulty( Mobile mob, SkillName skill, int curHits, int maxHits )
|
||||
{
|
||||
double difficulty = GetRepairDifficulty( curHits, maxHits ) * 0.1;
|
||||
|
||||
|
||||
if( m_Deed != null )
|
||||
{
|
||||
double value = m_Deed.SkillLevel;
|
||||
double minSkill = difficulty - 25.0;
|
||||
double maxSkill = difficulty + 25;
|
||||
|
||||
if( value < minSkill )
|
||||
return false; // Too difficult
|
||||
else if( value >= maxSkill )
|
||||
return true; // No challenge
|
||||
|
||||
double chance = (value - minSkill) / (maxSkill - minSkill);
|
||||
|
||||
return (chance >= Utility.RandomDouble());
|
||||
}
|
||||
else
|
||||
{
|
||||
return mob.CheckSkill( skill, difficulty - 25.0, difficulty + 25.0 );
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckDeed( Mobile from )
|
||||
{
|
||||
if( m_Deed != null )
|
||||
{
|
||||
return m_Deed.Check( from );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsSpecialWeapon( BaseWeapon weapon )
|
||||
{
|
||||
// Weapons repairable but not craftable
|
||||
|
||||
if ( m_CraftSystem is DefTinkering )
|
||||
{
|
||||
return ( weapon is Cleaver )
|
||||
|| ( weapon is Hatchet )
|
||||
|| ( weapon is Pickaxe )
|
||||
|| ( weapon is ButcherKnife )
|
||||
|| ( weapon is SkinningKnife );
|
||||
}
|
||||
else if ( m_CraftSystem is DefCarpentry )
|
||||
{
|
||||
return ( weapon is Club )
|
||||
|| ( weapon is BlackStaff )
|
||||
|| ( weapon is MagicWand );
|
||||
}
|
||||
else if ( m_CraftSystem is DefBlacksmithy )
|
||||
{
|
||||
return ( weapon is Pitchfork );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
int number;
|
||||
|
||||
if( !CheckDeed( from ) )
|
||||
return;
|
||||
|
||||
|
||||
bool usingDeed = (m_Deed != null);
|
||||
bool toDelete = false;
|
||||
|
||||
//TODO: Make a IRepairable
|
||||
|
||||
if ( m_CraftSystem is DefTinkering && targeted is Golem )
|
||||
{
|
||||
Golem g = (Golem)targeted;
|
||||
int damage = g.HitsMax - g.Hits;
|
||||
|
||||
if ( g.IsDeadBondedPet )
|
||||
{
|
||||
number = 500426; // You can't repair that.
|
||||
}
|
||||
else if ( damage <= 0 )
|
||||
{
|
||||
number = 500423; // That is already in full repair.
|
||||
}
|
||||
else
|
||||
{
|
||||
double skillValue = (usingDeed)? m_Deed.SkillLevel : from.Skills[SkillName.Tinkering].Value;
|
||||
|
||||
if ( skillValue < 60.0 )
|
||||
{
|
||||
number = 1044153; // You don't have the required skills to attempt this item. //TODO: How does OSI handle this with deeds with golems?
|
||||
}
|
||||
else if ( !from.CanBeginAction( typeof( Golem ) ) )
|
||||
{
|
||||
number = 501789; // You must wait before trying again.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( damage > (int)(skillValue * 0.3) )
|
||||
damage = (int)(skillValue * 0.3);
|
||||
|
||||
damage += 30;
|
||||
|
||||
if ( !from.CheckSkill( SkillName.Tinkering, 0.0, 100.0 ) )
|
||||
damage /= 2;
|
||||
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if ( pack != null )
|
||||
{
|
||||
int v = pack.ConsumeUpTo( typeof( IronIngot ), (damage+4)/5 );
|
||||
|
||||
if ( v > 0 )
|
||||
{
|
||||
g.Hits += v*5;
|
||||
|
||||
number = 1044279; // You repair the item.
|
||||
toDelete = true;
|
||||
|
||||
from.BeginAction( typeof( Golem ) );
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 12.0 ), new TimerStateCallback( EndGolemRepair ), from );
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 1044037; // You do not have sufficient metal to make that.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 1044037; // You do not have sufficient metal to make that.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( targeted is BaseWeapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)targeted;
|
||||
SkillName skill = m_CraftSystem.MainSkill;
|
||||
int toWeaken = 0;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
toWeaken = 1;
|
||||
}
|
||||
else if ( skill != SkillName.Tailoring )
|
||||
{
|
||||
double skillLevel = (usingDeed)? m_Deed.SkillLevel : from.Skills[skill].Base;
|
||||
|
||||
if ( skillLevel >= 90.0 )
|
||||
toWeaken = 1;
|
||||
else if ( skillLevel >= 70.0 )
|
||||
toWeaken = 2;
|
||||
else
|
||||
toWeaken = 3;
|
||||
}
|
||||
|
||||
if ( m_CraftSystem.CraftItems.SearchForSubclass( weapon.GetType() ) == null && !IsSpecialWeapon( weapon ) )
|
||||
{
|
||||
number = (usingDeed)? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
|
||||
}
|
||||
else if ( !weapon.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
number = 1044275; // The item must be in your backpack to repair it.
|
||||
}
|
||||
else if ( weapon.MaxHitPoints <= 0 || weapon.HitPoints == weapon.MaxHitPoints )
|
||||
{
|
||||
number = 1044281; // That item is in full repair
|
||||
}
|
||||
else if ( weapon.MaxHitPoints <= toWeaken )
|
||||
{
|
||||
number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( CheckWeaken( from, skill, weapon.HitPoints, weapon.MaxHitPoints ) )
|
||||
{
|
||||
weapon.MaxHitPoints -= toWeaken;
|
||||
weapon.HitPoints = Math.Max( 0, weapon.HitPoints - toWeaken );
|
||||
}
|
||||
|
||||
if ( CheckRepairDifficulty( from, skill, weapon.HitPoints, weapon.MaxHitPoints ) )
|
||||
{
|
||||
number = 1044279; // You repair the item.
|
||||
m_CraftSystem.PlayCraftEffect( from );
|
||||
weapon.HitPoints = weapon.MaxHitPoints;
|
||||
}
|
||||
else
|
||||
{
|
||||
number = (usingDeed)? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed]
|
||||
m_CraftSystem.PlayCraftEffect( from );
|
||||
}
|
||||
|
||||
toDelete = true;
|
||||
}
|
||||
}
|
||||
else if ( targeted is BaseArmor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)targeted;
|
||||
SkillName skill = m_CraftSystem.MainSkill;
|
||||
int toWeaken = 0;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
toWeaken = 1;
|
||||
}
|
||||
else if ( skill != SkillName.Tailoring )
|
||||
{
|
||||
double skillLevel = (usingDeed)? m_Deed.SkillLevel : from.Skills[skill].Base;
|
||||
|
||||
if ( skillLevel >= 90.0 )
|
||||
toWeaken = 1;
|
||||
else if ( skillLevel >= 70.0 )
|
||||
toWeaken = 2;
|
||||
else
|
||||
toWeaken = 3;
|
||||
}
|
||||
|
||||
if ( m_CraftSystem.CraftItems.SearchForSubclass( armor.GetType() ) == null )
|
||||
{
|
||||
number = (usingDeed)? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
|
||||
}
|
||||
else if ( !armor.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
number = 1044275; // The item must be in your backpack to repair it.
|
||||
}
|
||||
else if ( armor.MaxHitPoints <= 0 || armor.HitPoints == armor.MaxHitPoints )
|
||||
{
|
||||
number = 1044281; // That item is in full repair
|
||||
}
|
||||
else if ( armor.MaxHitPoints <= toWeaken )
|
||||
{
|
||||
number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( CheckWeaken( from, skill, armor.HitPoints, armor.MaxHitPoints ) )
|
||||
{
|
||||
armor.MaxHitPoints -= toWeaken;
|
||||
armor.HitPoints = Math.Max( 0, armor.HitPoints - toWeaken );
|
||||
}
|
||||
|
||||
if ( CheckRepairDifficulty( from, skill, armor.HitPoints, armor.MaxHitPoints ) )
|
||||
{
|
||||
number = 1044279; // You repair the item.
|
||||
m_CraftSystem.PlayCraftEffect( from );
|
||||
armor.HitPoints = armor.MaxHitPoints;
|
||||
}
|
||||
else
|
||||
{
|
||||
number = (usingDeed)? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed]
|
||||
m_CraftSystem.PlayCraftEffect( from );
|
||||
}
|
||||
|
||||
toDelete = true;
|
||||
}
|
||||
}
|
||||
else if ( targeted is BaseClothing )
|
||||
{
|
||||
BaseClothing clothing = (BaseClothing)targeted;
|
||||
SkillName skill = m_CraftSystem.MainSkill;
|
||||
int toWeaken = 0;
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
toWeaken = 1;
|
||||
}
|
||||
else if ( skill != SkillName.Tailoring )
|
||||
{
|
||||
double skillLevel = (usingDeed) ? m_Deed.SkillLevel : from.Skills[skill].Base;
|
||||
|
||||
if ( skillLevel >= 90.0 )
|
||||
toWeaken = 1;
|
||||
else if ( skillLevel >= 70.0 )
|
||||
toWeaken = 2;
|
||||
else
|
||||
toWeaken = 3;
|
||||
}
|
||||
|
||||
if ( m_CraftSystem.CraftItems.SearchForSubclass( clothing.GetType() ) == null )
|
||||
{
|
||||
number = (usingDeed) ? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
|
||||
}
|
||||
else if ( !clothing.IsChildOf( from.Backpack ) )
|
||||
{
|
||||
number = 1044275; // The item must be in your backpack to repair it.
|
||||
}
|
||||
else if ( clothing.MaxHitPoints <= 0 || clothing.HitPoints == clothing.MaxHitPoints )
|
||||
{
|
||||
number = 1044281; // That item is in full repair
|
||||
}
|
||||
else if ( clothing.MaxHitPoints <= toWeaken )
|
||||
{
|
||||
number = 1044278; // That item has been repaired many times, and will break if repairs are attempted again.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( CheckWeaken( from, skill, clothing.HitPoints, clothing.MaxHitPoints ) )
|
||||
{
|
||||
clothing.MaxHitPoints -= toWeaken;
|
||||
clothing.HitPoints = Math.Max( 0, clothing.HitPoints - toWeaken );
|
||||
}
|
||||
|
||||
if ( CheckRepairDifficulty( from, skill, clothing.HitPoints, clothing.MaxHitPoints ) )
|
||||
{
|
||||
number = 1044279; // You repair the item.
|
||||
m_CraftSystem.PlayCraftEffect( from );
|
||||
clothing.HitPoints = clothing.MaxHitPoints;
|
||||
}
|
||||
else
|
||||
{
|
||||
number = (usingDeed) ? 1061137 : 1044280; // You fail to repair the item. [And the contract is destroyed]
|
||||
m_CraftSystem.PlayCraftEffect( from );
|
||||
}
|
||||
|
||||
toDelete = true;
|
||||
}
|
||||
}
|
||||
else if( !usingDeed && targeted is BlankScroll )
|
||||
{
|
||||
SkillName skill = m_CraftSystem.MainSkill;
|
||||
|
||||
if( from.Skills[skill].Value >= 50.0 )
|
||||
{
|
||||
((BlankScroll)targeted).Consume( 1 );
|
||||
RepairDeed deed = new RepairDeed( RepairDeed.GetTypeFor( m_CraftSystem ), from.Skills[skill].Value, from );
|
||||
from.AddToBackpack( deed );
|
||||
|
||||
number = 500442; // You create the item and put it in your backpack.
|
||||
}
|
||||
else
|
||||
number = 1047005; // You must be at least apprentice level to create a repair service contract.
|
||||
}
|
||||
else if ( targeted is Item )
|
||||
{
|
||||
number = (usingDeed)? 1061136 : 1044277; // That item cannot be repaired. // You cannot repair that item with this type of repair contract.
|
||||
}
|
||||
else
|
||||
{
|
||||
number = 500426; // You can't repair that.
|
||||
}
|
||||
|
||||
if( !usingDeed )
|
||||
{
|
||||
CraftContext context = m_CraftSystem.GetContext( from );
|
||||
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, number ) );
|
||||
}
|
||||
else if( toDelete )
|
||||
{
|
||||
m_Deed.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
121
Scripts/Engines/Craft/Core/Resmelt.cs
Normal file
121
Scripts/Engines/Craft/Core/Resmelt.cs
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Targeting;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class Resmelt
|
||||
{
|
||||
public Resmelt()
|
||||
{
|
||||
}
|
||||
|
||||
public static void Do( Mobile from, CraftSystem craftSystem, BaseTool tool )
|
||||
{
|
||||
int num = craftSystem.CanCraft( from, tool, null );
|
||||
|
||||
if ( num > 0 )
|
||||
{
|
||||
from.SendGump( new CraftGump( from, craftSystem, tool, num ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.Target = new InternalTarget( craftSystem, tool );
|
||||
from.SendLocalizedMessage( 1044273 ); // Target an item to recycle.
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private CraftSystem m_CraftSystem;
|
||||
private BaseTool m_Tool;
|
||||
|
||||
public InternalTarget( CraftSystem craftSystem, BaseTool tool ) : base ( 2, false, TargetFlags.None )
|
||||
{
|
||||
m_CraftSystem = craftSystem;
|
||||
m_Tool = tool;
|
||||
}
|
||||
|
||||
private bool Resmelt( Mobile from, Item item, CraftResource resource )
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( CraftResources.GetType( resource ) != CraftResourceType.Metal )
|
||||
return false;
|
||||
|
||||
CraftResourceInfo info = CraftResources.GetInfo( resource );
|
||||
|
||||
if ( info == null || info.ResourceTypes.Length == 0 )
|
||||
return false;
|
||||
|
||||
CraftItem craftItem = m_CraftSystem.CraftItems.SearchFor( item.GetType() );
|
||||
|
||||
if ( craftItem == null || craftItem.Ressources.Count == 0 )
|
||||
return false;
|
||||
|
||||
CraftRes craftResource = craftItem.Ressources.GetAt( 0 );
|
||||
|
||||
if ( craftResource.Amount < 2 )
|
||||
return false; // Not enough metal to resmelt
|
||||
|
||||
Type resourceType = info.ResourceTypes[0];
|
||||
Item ingot = (Item)Activator.CreateInstance( resourceType );
|
||||
|
||||
if ( item is DragonBardingDeed || (item is BaseArmor && ((BaseArmor)item).PlayerConstructed) || (item is BaseWeapon && ((BaseWeapon)item).PlayerConstructed) || (item is BaseClothing && ((BaseClothing)item).PlayerConstructed) )
|
||||
ingot.Amount = craftResource.Amount / 2;
|
||||
else
|
||||
ingot.Amount = 1;
|
||||
|
||||
item.Delete();
|
||||
from.AddToBackpack( ingot );
|
||||
|
||||
from.PlaySound( 0x2A );
|
||||
from.PlaySound( 0x240 );
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
int num = m_CraftSystem.CanCraft( from, m_Tool, null );
|
||||
|
||||
if ( num > 0 )
|
||||
{
|
||||
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, num ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
bool success = false;
|
||||
bool isStoreBought = false;
|
||||
|
||||
if ( targeted is BaseArmor )
|
||||
{
|
||||
success = Resmelt( from, (BaseArmor)targeted, ((BaseArmor)targeted).Resource );
|
||||
isStoreBought = !((BaseArmor)targeted).PlayerConstructed;
|
||||
}
|
||||
else if ( targeted is BaseWeapon )
|
||||
{
|
||||
success = Resmelt( from, (BaseWeapon)targeted, ((BaseWeapon)targeted).Resource );
|
||||
isStoreBought = !((BaseWeapon)targeted).PlayerConstructed;
|
||||
}
|
||||
else if ( targeted is DragonBardingDeed )
|
||||
{
|
||||
success = Resmelt( from, (DragonBardingDeed)targeted, ((DragonBardingDeed)targeted).Resource );
|
||||
isStoreBought = false;
|
||||
}
|
||||
|
||||
if ( success )
|
||||
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, isStoreBought ? 500418 : 1044270 ) ); // You melt the item down into ingots.
|
||||
else
|
||||
from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1044272 ) ); // You can't melt that down into ingots.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
165
Scripts/Engines/Craft/DefAlchemy.cs
Normal file
165
Scripts/Engines/Craft/DefAlchemy.cs
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefAlchemy : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Alchemy; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044001; } // <CENTER>ALCHEMY MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefAlchemy();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.0; // 0%
|
||||
}
|
||||
|
||||
private DefAlchemy() : base( 1, 1, 1.25 )// base( 1, 1, 3.1 )
|
||||
{
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
from.PlaySound( 0x242 );
|
||||
}
|
||||
|
||||
private static Type typeofPotion = typeof( BasePotion );
|
||||
|
||||
public static bool IsPotion( Type type )
|
||||
{
|
||||
return typeofPotion.IsAssignableFrom( type );
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( IsPotion( item.ItemType ) )
|
||||
{
|
||||
from.AddToBackpack( new Bottle() );
|
||||
return 500287; // You fail to create a useful potion.
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.PlaySound( 0x240 ); // Sound of a filling bottle
|
||||
|
||||
if ( IsPotion( item.ItemType ) )
|
||||
{
|
||||
if ( quality == -1 )
|
||||
return 1048136; // You create the potion and pour it into a keg.
|
||||
else
|
||||
return 500279; // You pour the potion into a bottle...
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
// Refresh Potion
|
||||
index = AddCraft( typeof( RefreshPotion ), 1044530, 1044538, -25, 25.0, typeof( BlackPearl ), 1044353, 1, 1044361 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( TotalRefreshPotion ), 1044530, 1044539, 25.0, 75.0, typeof( BlackPearl ), 1044353, 5, 1044361 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
|
||||
// Agility Potion
|
||||
index = AddCraft( typeof( AgilityPotion ), 1044531, 1044540, 15.0, 65.0, typeof( Bloodmoss ), 1044354, 1, 1044362 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( GreaterAgilityPotion ), 1044531, 1044541, 35.0, 85.0, typeof( Bloodmoss ), 1044354, 3, 1044362 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
|
||||
// Nightsight Potion
|
||||
index = AddCraft( typeof( NightSightPotion ), 1044532, 1044542, -25.0, 25.0, typeof( SpidersSilk ), 1044360, 1, 1044368 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
|
||||
// Heal Potion
|
||||
index = AddCraft( typeof( LesserHealPotion ), 1044533, 1044543, -25.0, 25.0, typeof( Ginseng ), 1044356, 1, 1044364 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( HealPotion ), 1044533, 1044544, 15.0, 65.0, typeof( Ginseng ), 1044356, 3, 1044364 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( GreaterHealPotion ), 1044533, 1044545, 55.0, 105.0, typeof( Ginseng ), 1044356, 7, 1044364 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
|
||||
// Strength Potion
|
||||
index = AddCraft( typeof( StrengthPotion ), 1044534, 1044546, 25.0, 75.0, typeof( MandrakeRoot ), 1044357, 2, 1044365 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( GreaterStrengthPotion ), 1044534, 1044547, 45.0, 95.0, typeof( MandrakeRoot ), 1044357, 5, 1044365 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
|
||||
// Poison Potion
|
||||
index = AddCraft( typeof( LesserPoisonPotion ), 1044535, 1044548, -5.0, 45.0, typeof( Nightshade ), 1044358, 1, 1044366 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( PoisonPotion ), 1044535, 1044549, 15.0, 65.0, typeof( Nightshade ), 1044358, 2, 1044366 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( GreaterPoisonPotion ), 1044535, 1044550, 55.0, 105.0, typeof( Nightshade ), 1044358, 4, 1044366 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( DeadlyPoisonPotion ), 1044535, 1044551, 90.0, 140.0, typeof( Nightshade ), 1044358, 8, 1044366 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
|
||||
// Cure Potion
|
||||
index = AddCraft( typeof( LesserCurePotion ), 1044536, 1044552, -10.0, 40.0, typeof( Garlic ), 1044355, 1, 1044363 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( CurePotion ), 1044536, 1044553, 25.0, 75.0, typeof( Garlic ), 1044355, 3, 1044363 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( GreaterCurePotion ), 1044536, 1044554, 65.0, 115.0, typeof( Garlic ), 1044355, 6, 1044363 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
|
||||
// Explosion Potion
|
||||
index = AddCraft( typeof( LesserExplosionPotion ), 1044537, 1044555, 5.0, 55.0, typeof( SulfurousAsh ), 1044359, 3, 1044367 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( ExplosionPotion ), 1044537, 1044556, 35.0, 85.0, typeof( SulfurousAsh ), 1044359, 5, 1044367 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
index = AddCraft( typeof( GreaterExplosionPotion ), 1044537, 1044557, 65.0, 115.0, typeof( SulfurousAsh ), 1044359, 10, 1044367 );
|
||||
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( SmokeBomb ), 1044537, 1030248, 90.0, 120.0, typeof( Eggs ), 1044477, 1, 1044253 );
|
||||
AddRes( index, typeof ( Ginseng ), 1044356, 3, 1044364 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
547
Scripts/Engines/Craft/DefBlacksmithy.cs
Normal file
547
Scripts/Engines/Craft/DefBlacksmithy.cs
Normal file
|
|
@ -0,0 +1,547 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefBlacksmithy : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Blacksmith; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044002; } // <CENTER>BLACKSMITHY MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefBlacksmithy();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override CraftECA ECA{ get{ return CraftECA.ChanceMinusSixtyToFourtyFive; } }
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.0; // 0%
|
||||
}
|
||||
|
||||
private DefBlacksmithy() : base( 1, 1, 1.25 )// base( 1, 2, 1.7 )
|
||||
{
|
||||
/*
|
||||
|
||||
base( MinCraftEffect, MaxCraftEffect, Delay )
|
||||
|
||||
MinCraftEffect : The minimum number of time the mobile will play the craft effect
|
||||
MaxCraftEffect : The maximum number of time the mobile will play the craft effect
|
||||
Delay : The delay between each craft effect
|
||||
|
||||
Example: (3, 6, 1.7) would make the mobile do the PlayCraftEffect override
|
||||
function between 3 and 6 time, with a 1.7 second delay each time.
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
private static Type typeofAnvil = typeof( AnvilAttribute );
|
||||
private static Type typeofForge = typeof( ForgeAttribute );
|
||||
|
||||
public static void CheckAnvilAndForge( Mobile from, int range, out bool anvil, out bool forge )
|
||||
{
|
||||
anvil = false;
|
||||
forge = false;
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
if ( map == null )
|
||||
return;
|
||||
|
||||
IPooledEnumerable eable = map.GetItemsInRange( from.Location, range );
|
||||
|
||||
foreach ( Item item in eable )
|
||||
{
|
||||
Type type = item.GetType();
|
||||
|
||||
bool isAnvil = ( type.IsDefined( typeofAnvil, false ) || item.ItemID == 4015 || item.ItemID == 4016 || item.ItemID == 0x2DD5 || item.ItemID == 0x2DD6 );
|
||||
bool isForge = ( type.IsDefined( typeofForge, false ) || item.ItemID == 4017 || (item.ItemID >= 6522 && item.ItemID <= 6569) || item.ItemID == 0x2DD8 );
|
||||
|
||||
if ( isAnvil || isForge )
|
||||
{
|
||||
if ( (from.Z + 16) < item.Z || (item.Z + 16) < from.Z || !from.InLOS( item ) )
|
||||
continue;
|
||||
|
||||
anvil = anvil || isAnvil;
|
||||
forge = forge || isForge;
|
||||
|
||||
if ( anvil && forge )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
||||
for ( int x = -range; (!anvil || !forge) && x <= range; ++x )
|
||||
{
|
||||
for ( int y = -range; (!anvil || !forge) && y <= range; ++y )
|
||||
{
|
||||
Tile[] tiles = map.Tiles.GetStaticTiles( from.X+x, from.Y+y, true );
|
||||
|
||||
for ( int i = 0; (!anvil || !forge) && i < tiles.Length; ++i )
|
||||
{
|
||||
int id = tiles[i].ID & 0x3FFF;
|
||||
|
||||
bool isAnvil = ( id == 4015 || id == 4016 || id == 0x2DD5 || id == 0x2DD6 );
|
||||
bool isForge = ( id == 4017 || (id >= 6522 && id <= 6569) || id == 0x2DD8 );
|
||||
|
||||
if ( isAnvil || isForge )
|
||||
{
|
||||
if ( (from.Z + 16) < tiles[i].Z || (tiles[i].Z + 16) < from.Z || !from.InLOS( new Point3D( from.X+x, from.Y+y, tiles[i].Z + (tiles[i].Height/2) + 1 ) ) )
|
||||
continue;
|
||||
|
||||
anvil = anvil || isAnvil;
|
||||
forge = forge || isForge;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckTool( tool, from ) )
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
bool anvil, forge;
|
||||
CheckAnvilAndForge( from, 2, out anvil, out forge );
|
||||
|
||||
if ( anvil && forge )
|
||||
return 0;
|
||||
|
||||
return 1044267; // You must be near an anvil and a forge to smith items.
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
// no animation, instant sound
|
||||
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
|
||||
// from.Animate( 9, 5, 1, true, false, 0 );
|
||||
//new InternalTimer( from ).Start();
|
||||
|
||||
from.PlaySound( 0x2A );
|
||||
}
|
||||
|
||||
// Delay to synchronize the sound with the hit on the anvil
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
|
||||
public InternalTimer( Mobile from ) : base( TimeSpan.FromSeconds( 0.7 ) )
|
||||
{
|
||||
m_From = from;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_From.PlaySound( 0x2A );
|
||||
}
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
/*
|
||||
Synthax for a SIMPLE craft item
|
||||
AddCraft( ObjectType, Group, MinSkill, MaxSkill, RessourceType, Amount, Message )
|
||||
|
||||
ObjectType : The type of the object you want to add to the build list.
|
||||
Group : The group in wich the object will be showed in the craft menu.
|
||||
MinSkill : The minimum of skill value
|
||||
MaxSkill : The maximum of skill value
|
||||
RessourceType : The type of the ressource the mobile need to create the item
|
||||
Amount : The amount of the RessourceType it need to create the item
|
||||
Message : String or Int for Localized. The message that will be sent to the mobile, if the specified ressource is missing.
|
||||
|
||||
Synthax for a COMPLEXE craft item. A complexe item is an item that need either more than
|
||||
only one skill, or more than only one ressource.
|
||||
|
||||
Coming soon....
|
||||
*/
|
||||
|
||||
#region Ringmail
|
||||
AddCraft( typeof( RingmailGloves ), 1011076, 1025099, 12.0, 62.0, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddCraft( typeof( RingmailLegs ), 1011076, 1025104, 19.4, 69.4, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
AddCraft( typeof( RingmailArms ), 1011076, 1025103, 16.9, 66.9, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
AddCraft( typeof( RingmailChest ), 1011076, 1025100, 21.9, 71.9, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
#endregion
|
||||
|
||||
#region Chainmail
|
||||
AddCraft( typeof( ChainCoif ), 1011077, 1025051, 14.5, 64.5, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddCraft( typeof( ChainLegs ), 1011077, 1025054, 36.7, 86.7, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
AddCraft( typeof( ChainChest ), 1011077, 1025055, 39.1, 89.1, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
#endregion
|
||||
|
||||
int index = -1;
|
||||
|
||||
#region Platemail
|
||||
AddCraft( typeof( PlateArms ), 1011078, 1025136, 66.3, 116.3, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
AddCraft( typeof( PlateGloves ), 1011078, 1025140, 58.9, 108.9, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
AddCraft( typeof( PlateGorget ), 1011078, 1025139, 56.4, 106.4, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddCraft( typeof( PlateLegs ), 1011078, 1025137, 68.8, 118.8, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
AddCraft( typeof( PlateChest ), 1011078, 1046431, 75.0, 125.0, typeof( IronIngot ), 1044036, 25, 1044037 );
|
||||
AddCraft( typeof( FemalePlateChest ), 1011078, 1046430, 44.1, 94.1, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
|
||||
if ( Core.AOS ) // exact pre-aos functionality unknown
|
||||
AddCraft( typeof( DragonBardingDeed ), 1011078, 1053012, 72.5, 122.5, typeof( IronIngot ), 1044036, 750, 1044037 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
|
||||
index = AddCraft( typeof( PlateMempo ), 1011078, 1030180, 80.0, 130.0, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( PlateDo ), 1011078, 1030184, 80.0, 130.0, typeof( IronIngot ), 1044036, 28, 1044037 ); //Double check skill
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( PlateHiroSode ), 1011078, 1030187, 80.0, 130.0, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( PlateSuneate ), 1011078, 1030195, 65.0, 115.0, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( PlateHaidate ), 1011078, 1030200, 65.0, 115.0, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Helmets
|
||||
AddCraft( typeof( Bascinet ), 1011079, 1025132, 8.3, 58.3, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
AddCraft( typeof( CloseHelm ), 1011079, 1025128, 37.9, 87.9, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
AddCraft( typeof( Helmet ), 1011079, 1025130, 37.9, 87.9, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
AddCraft( typeof( NorseHelm ), 1011079, 1025134, 37.9, 87.9, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
AddCraft( typeof( PlateHelm ), 1011079, 1025138, 62.6, 112.6, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( ChainHatsuburi ), 1011079, 1030175, 30.0, 80.0, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( PlateHatsuburi ), 1011079, 1030176, 45.0, 95.0, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( HeavyPlateJingasa ), 1011079, 1030178, 45.0, 95.0, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( LightPlateJingasa ), 1011079, 1030188, 45.0, 95.0, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( SmallPlateJingasa ), 1011079, 1030191, 45.0, 95.0, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( DecorativePlateKabuto ), 1011079, 1030179, 90.0, 140.0, typeof( IronIngot ), 1044036, 25, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( PlateBattleKabuto ), 1011079, 1030192, 90.0, 140.0, typeof( IronIngot ), 1044036, 25, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( StandardPlateKabuto ), 1011079, 1030196, 90.0, 140.0, typeof( IronIngot ), 1044036, 25, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
if( Core.ML )
|
||||
{
|
||||
index = AddCraft( typeof( Circlet ), 1011079, 1032645, 62.1, 112.1, typeof( IronIngot ), 1044036, 6, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( RoyalCirclet ), 1011079, 1032646, 70.0, 120.0, typeof( IronIngot ), 1044036, 6, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( GemmedCirclet ), 1011079, 1032647, 75.0, 125.0, typeof( IronIngot ), 1044036, 6, 1044037 );
|
||||
AddRes( index, typeof( Tourmaline ), 1044237, 1, 1044240 );
|
||||
AddRes( index, typeof( Amethyst ), 1044236, 1, 1044240 );
|
||||
AddRes( index, typeof( BlueDiamond ), 1032696, 1, 1044240 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Shields
|
||||
AddCraft( typeof( Buckler ), 1011080, 1027027, -25.0, 25.0, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddCraft( typeof( BronzeShield ), 1011080, 1027026, -15.2, 34.8, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
AddCraft( typeof( HeaterShield ), 1011080, 1027030, 24.3, 74.3, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
AddCraft( typeof( MetalShield ), 1011080, 1027035, -10.2, 39.8, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
AddCraft( typeof( MetalKiteShield ), 1011080, 1027028, 4.6, 54.6, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
AddCraft( typeof( WoodenKiteShield ), 1011080, 1027032, -15.2, 34.8, typeof( IronIngot ), 1044036, 8, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
AddCraft( typeof( ChaosShield ), 1011080, 1027107, 85.0, 135.0, typeof( IronIngot ), 1044036, 25, 1044037 );
|
||||
AddCraft( typeof( OrderShield ), 1011080, 1027108, 85.0, 135.0, typeof( IronIngot ), 1044036, 25, 1044037 );
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Bladed
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( BoneHarvester ), 1011081, 1029915, 33.0, 83.0, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
|
||||
AddCraft( typeof( Broadsword ), 1011081, 1023934, 35.4, 85.4, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( CrescentBlade ), 1011081, 1029921, 45.0, 95.0, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
|
||||
AddCraft( typeof( Cutlass ), 1011081, 1025185, 24.3, 74.3, typeof( IronIngot ), 1044036, 8, 1044037 );
|
||||
AddCraft( typeof( Dagger ), 1011081, 1023921, -0.4, 49.6, typeof( IronIngot ), 1044036, 3, 1044037 );
|
||||
AddCraft( typeof( Katana ),1011081, 1025119, 44.1, 94.1, typeof( IronIngot ), 1044036, 8, 1044037 );
|
||||
AddCraft( typeof( Kryss ), 1011081, 1025121, 36.7, 86.7, typeof( IronIngot ), 1044036, 8, 1044037 );
|
||||
AddCraft( typeof( Longsword ), 1011081, 1023937, 28.0, 78.0, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
AddCraft( typeof( Scimitar ), 1011081, 1025046, 31.7, 81.7, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddCraft( typeof( VikingSword ), 1011081, 1025049, 24.3, 74.3, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
|
||||
index = AddCraft( typeof( NoDachi ), 1011081, 1030221, 75.0, 125.0, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( Wakizashi ), 1011081, 1030223, 50.0, 100.0, typeof( IronIngot ), 1044036, 8, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( Lajatang ), 1011081, 1030226, 80.0, 130.0, typeof( IronIngot ), 1044036, 25, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( Daisho ), 1011081, 1030228, 60.0, 110.0, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( Tekagi ), 1011081, 1030230, 55.0, 105.0, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( Shuriken ), 1011081, 1030231, 45.0, 95.0, typeof( IronIngot ), 1044036, 5, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( Kama ), 1011081, 1030232, 40.0, 90.0, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( Sai ), 1011081, 1030234, 50.0, 100.0, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
if( Core.ML )
|
||||
{
|
||||
index = AddCraft( typeof( RadiantScimitar ), 1011081, 1031571, 75.0, 125.0, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( WarCleaver ), 1011081, 1031567, 70.0, 120.0, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( ElvenSpellblade ), 1011081, 1031564, 70.0, 120.0, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( AssassinSpike ), 1011081, 1031564, 70.0, 120.0, typeof( IronIngot ), 1044036, 9, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( Leafblade ), 1011081, 1031565, 70.0, 120.0, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( RuneBlade ), 1011081, 1031570, 70.0, 120.0, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( ElvenMachete ), 1011081, 1031573, 70.0, 120.0, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( RuneCarvingKnife ), 1011081, 1072915, 70.0, 120.0, typeof( IronIngot ), 1044036, 9, 1044037 );
|
||||
AddRes( index, typeof( DreadHornMane ), 1032682, 1, 1053098 );
|
||||
AddRes( index, typeof( Putrefication ), 1032678, 10, 1053098 );
|
||||
AddRes( index, typeof( Muculent ), 1032678, 10, 1053098 );
|
||||
AddRecipe( index, 0 );
|
||||
ForceNonExceptional( index );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( ColdForgedBlade ), 1011081, 1072916, 70.0, 120.0, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
AddRes( index, typeof( GrizzledBones ), 1032684, 1, 1053098 );
|
||||
AddRes( index, typeof( Taint ), 1032684, 10, 1053098 );
|
||||
AddRes( index, typeof( Blight ), 1032675, 10, 1053098 );
|
||||
AddRecipe( index, 1 );
|
||||
ForceNonExceptional( index );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( OverseerSunderedBlade ), 1011081, 1072920, 70.0, 120.0, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
AddRes( index, typeof( GrizzledBones ), 1032684, 1, 1053098 );
|
||||
AddRes( index, typeof( Blight ), 1032675, 10, 1053098 );
|
||||
AddRes( index, typeof( Scourge ), 1032677, 10, 1053098 );
|
||||
AddRecipe( index, 2 );
|
||||
ForceNonExceptional( index );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
index = AddCraft( typeof( LuminousRuneBlade ), 1011081, 1072922, 70.0, 120.0, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
AddRes( index, typeof( GrizzledBones ), 1032684, 1, 1053098 );
|
||||
AddRes( index, typeof( Corruption ), 1032676, 10, 1053098 );
|
||||
AddRes( index, typeof( Putrefication ), 1032678, 10, 1053098 );
|
||||
AddRecipe( index, 3 );
|
||||
ForceNonExceptional( index );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
|
||||
/* //TODO: true spellblade;
|
||||
index = AddCraft( typeof( ), 1011081, 1072920, 70.0, 120.0, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
AddRes( index, typeof( GrizzledBones ), 1032684, 1, 1053098 );
|
||||
AddRes( index, typeof( Blight ), 1032675, 10, 1053098 );
|
||||
AddRes( index, typeof( Scourge ), 1032677, 10, 1053098 );
|
||||
AddRecipe( index, 4 );
|
||||
ForceNonExceptional( index );
|
||||
SetNeededExpansion( index, Expansion.ML );
|
||||
* */
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Axes
|
||||
AddCraft( typeof( Axe ), 1011082, 1023913, 34.2, 84.2, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
AddCraft( typeof( BattleAxe ), 1011082, 1023911, 30.5, 80.5, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
AddCraft( typeof( DoubleAxe ), 1011082, 1023915, 29.3, 79.3, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
AddCraft( typeof( ExecutionersAxe ), 1011082, 1023909, 34.2, 84.2, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
AddCraft( typeof( LargeBattleAxe ), 1011082, 1025115, 28.0, 78.0, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
AddCraft( typeof( TwoHandedAxe ), 1011082, 1025187, 33.0, 83.0, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
AddCraft( typeof( WarAxe ), 1011082, 1025040, 39.1, 89.1, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
#endregion
|
||||
|
||||
#region Pole Arms
|
||||
|
||||
AddCraft( typeof( Bardiche ), 1011083, 1023917, 31.7, 81.7, typeof( IronIngot ), 1044036, 18, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( BladedStaff ), 1011083, 1029917, 40.0, 90.0, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( DoubleBladedStaff ), 1011083, 1029919, 45.0, 95.0, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
|
||||
AddCraft( typeof( Halberd ), 1011083, 1025183, 39.1, 89.1, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( Lance ), 1011083, 1029920, 48.0, 98.0, typeof( IronIngot ), 1044036, 20, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( Pike ), 1011083, 1029918, 47.0, 97.0, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
|
||||
AddCraft( typeof( ShortSpear ), 1011083, 1025123, 45.3, 95.3, typeof( IronIngot ), 1044036, 6, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( Scythe ), 1011083, 1029914, 39.0, 89.0, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
|
||||
AddCraft( typeof( Spear ), 1011083, 1023938, 49.0, 99.0, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
AddCraft( typeof( WarFork ), 1011083, 1025125, 42.9, 92.9, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
|
||||
// Not craftable (is this an AOS change ??)
|
||||
//AddCraft( typeof( Pitchfork ), 1011083, 1023720, 36.1, 86.1, typeof( IronIngot ), 1044036, 12, 1044037 );
|
||||
#endregion
|
||||
|
||||
#region Bashing
|
||||
AddCraft( typeof( HammerPick ), 1011084, 1025181, 34.2, 84.2, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
AddCraft( typeof( Mace ), 1011084, 1023932, 14.5, 64.5, typeof( IronIngot ), 1044036, 6, 1044037 );
|
||||
AddCraft( typeof( Maul ), 1011084, 1025179, 19.4, 69.4, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( Scepter ), 1011084, 1029916, 21.4, 71.4, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
|
||||
AddCraft( typeof( WarMace ), 1011084, 1025127, 28.0, 78.0, typeof( IronIngot ), 1044036, 14, 1044037 );
|
||||
AddCraft( typeof( WarHammer ), 1011084, 1025177, 34.2, 84.2, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( Tessen ), 1011084, 1030222, 85.0, 135.0, typeof( IronIngot ), 1044036, 16, 1044037 );
|
||||
AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Dragon Scale Armor
|
||||
index = AddCraft( typeof( DragonGloves ), 1053114, 1029795, 68.9, 118.9, typeof( RedScales ), 1060883, 16, 1060884 );
|
||||
SetUseSubRes2( index, true );
|
||||
|
||||
index = AddCraft( typeof( DragonHelm ), 1053114, 1029797, 72.6, 122.6, typeof( RedScales ), 1060883, 20, 1060884 );
|
||||
SetUseSubRes2( index, true );
|
||||
|
||||
index = AddCraft( typeof( DragonLegs ), 1053114, 1029799, 78.8, 128.8, typeof( RedScales ), 1060883, 28, 1060884 );
|
||||
SetUseSubRes2( index, true );
|
||||
|
||||
index = AddCraft( typeof( DragonArms ), 1053114, 1029815, 76.3, 126.3, typeof( RedScales ), 1060883, 24, 1060884 );
|
||||
SetUseSubRes2( index, true );
|
||||
|
||||
index = AddCraft( typeof( DragonChest ), 1053114, 1029793, 85.0, 135.0, typeof( RedScales ), 1060883, 36, 1060884 );
|
||||
SetUseSubRes2( index, true );
|
||||
#endregion
|
||||
|
||||
// Set the overridable material
|
||||
SetSubRes( typeof( IronIngot ), 1044022 );
|
||||
|
||||
// Add every material you want the player to be able to choose from
|
||||
// This will override the overridable material
|
||||
AddSubRes( typeof( IronIngot ), 1044022, 00.0, 1044036, 1044267 );
|
||||
AddSubRes( typeof( DullCopperIngot ), 1044023, 65.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( ShadowIronIngot ), 1044024, 70.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( CopperIngot ), 1044025, 75.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( BronzeIngot ), 1044026, 80.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( GoldIngot ), 1044027, 85.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( AgapiteIngot ), 1044028, 90.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( VeriteIngot ), 1044029, 95.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( ValoriteIngot ), 1044030, 99.0, 1044036, 1044268 );
|
||||
|
||||
SetSubRes2( typeof( RedScales ), 1060875 );
|
||||
|
||||
AddSubRes2( typeof( RedScales ), 1060875, 0.0, 1053137, 1044268 );
|
||||
AddSubRes2( typeof( YellowScales ), 1060876, 0.0, 1053137, 1044268 );
|
||||
AddSubRes2( typeof( BlackScales ), 1060877, 0.0, 1053137, 1044268 );
|
||||
AddSubRes2( typeof( GreenScales ), 1060878, 0.0, 1053137, 1044268 );
|
||||
AddSubRes2( typeof( WhiteScales ), 1060879, 0.0, 1053137, 1044268 );
|
||||
AddSubRes2( typeof( BlueScales ), 1060880, 0.0, 1053137, 1044268 );
|
||||
|
||||
Resmelt = true;
|
||||
Repair = true;
|
||||
MarkOption = true;
|
||||
CanEnhance = Core.AOS;
|
||||
}
|
||||
}
|
||||
|
||||
public class ForgeAttribute : Attribute
|
||||
{
|
||||
public ForgeAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class AnvilAttribute : Attribute
|
||||
{
|
||||
public AnvilAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
133
Scripts/Engines/Craft/DefBowFletching.cs
Normal file
133
Scripts/Engines/Craft/DefBowFletching.cs
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefBowFletching : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Fletching; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044006; } // <CENTER>BOWCRAFT AND FLETCHING MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefBowFletching();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.5; // 50%
|
||||
}
|
||||
|
||||
private DefBowFletching() : base( 1, 1, 1.25 )// base( 1, 2, 1.7 )
|
||||
{
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
// no animation
|
||||
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
|
||||
// from.Animate( 33, 5, 1, true, false, 0 );
|
||||
|
||||
from.PlaySound( 0x55 );
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override CraftECA ECA{ get{ return CraftECA.FiftyPercentChanceMinusTenPercent; } }
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
// Materials
|
||||
AddCraft( typeof( Kindling ), 1044457, 1023553, 0.0, 00.0, typeof( Log ), 1044041, 1, 1044351 );
|
||||
|
||||
index = AddCraft( typeof( Shaft ), 1044457, 1027124, 0.0, 40.0, typeof( Log ), 1044041, 1, 1044351 );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
// Ammunition
|
||||
index = AddCraft( typeof( Arrow ), 1044565, 1023903, 0.0, 40.0, typeof( Shaft ), 1044560, 1, 1044561 );
|
||||
AddRes( index, typeof( Feather ), 1044562, 1, 1044563 );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
index = AddCraft( typeof( Bolt ), 1044565, 1027163, 0.0, 40.0, typeof( Shaft ), 1044560, 1, 1044561 );
|
||||
AddRes( index, typeof( Feather ), 1044562, 1, 1044563 );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( FukiyaDarts ), 1044565, 1030246, 50.0, 90.0, typeof( Log ), 1044041, 1, 1044351 );
|
||||
SetUseAllRes( index, true );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
// Weapons
|
||||
AddCraft( typeof( Bow ), 1044566, 1025042, 30.0, 70.0, typeof( Log ), 1044041, 7, 1044351 );
|
||||
AddCraft( typeof( Crossbow ), 1044566, 1023919, 60.0, 100.0, typeof( Log ), 1044041, 7, 1044351 );
|
||||
AddCraft( typeof( HeavyCrossbow ), 1044566, 1025117, 80.0, 120.0, typeof( Log ), 1044041, 10, 1044351 );
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
AddCraft( typeof( CompositeBow ), 1044566, 1029922, 70.0, 110.0, typeof( Log ), 1044041, 7, 1044351 );
|
||||
AddCraft( typeof( RepeatingCrossbow ), 1044566, 1029923, 90.0, 130.0, typeof( Log ), 1044041, 10, 1044351 );
|
||||
}
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( Yumi ), 1044566, 1030224, 90.0, 130.0, typeof( Log ), 1044041, 10, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
MarkOption = true;
|
||||
Repair = Core.AOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
345
Scripts/Engines/Craft/DefCarpentry.cs
Normal file
345
Scripts/Engines/Craft/DefCarpentry.cs
Normal file
|
|
@ -0,0 +1,345 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefCarpentry : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Carpentry; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044004; } // <CENTER>CARPENTRY MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefCarpentry();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.5; // 50%
|
||||
}
|
||||
|
||||
private DefCarpentry() : base( 1, 1, 1.25 )// base( 1, 1, 3.0 )
|
||||
{
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
// no animation
|
||||
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
|
||||
// from.Animate( 9, 5, 1, true, false, 0 );
|
||||
|
||||
from.PlaySound( 0x23D );
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
// Other Items
|
||||
index = AddCraft( typeof( Board ), 1044294, 1027127, 0.0, 0.0, typeof( Log ), 1044466, 1, 1044465 );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
AddCraft( typeof( BarrelStaves ), 1044294, 1027857, 00.0, 25.0, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddCraft( typeof( BarrelLid ), 1044294, 1027608, 11.0, 36.0, typeof( Log ), 1044041, 4, 1044351 );
|
||||
AddCraft( typeof( ShortMusicStand ), 1044294, 1044313, 78.9, 103.9, typeof( Log ), 1044041, 15, 1044351 );
|
||||
AddCraft( typeof( TallMusicStand ), 1044294, 1044315, 81.5, 106.5, typeof( Log ), 1044041, 20, 1044351 );
|
||||
AddCraft( typeof( Easle ), 1044294, 1044317, 86.8, 111.8, typeof( Log ), 1044041, 20, 1044351 );
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( RedHangingLantern ), 1044294, 1029412, 65.0, 90.0, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddRes( index, typeof( BlankScroll ), 1044377, 10, 1044378 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( WhiteHangingLantern ), 1044294, 1029416, 65.0, 90.0, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddRes( index, typeof( BlankScroll ), 1044377, 10, 1044378 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( ShojiScreen ), 1044294, 1029423, 80.0, 105.0, typeof( Log ), 1044041, 75, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( BambooScreen ), 1044294, 1029428, 80.0, 105.0, typeof( Log ), 1044041, 75, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
// Furniture
|
||||
AddCraft( typeof( FootStool ), 1044291, 1022910, 11.0, 36.0, typeof( Log ), 1044041, 9, 1044351 );
|
||||
AddCraft( typeof( Stool ), 1044291, 1022602, 11.0, 36.0, typeof( Log ), 1044041, 9, 1044351 );
|
||||
AddCraft( typeof( BambooChair ), 1044291, 1044300, 21.0, 46.0, typeof( Log ), 1044041, 13, 1044351 );
|
||||
AddCraft( typeof( WoodenChair ), 1044291, 1044301, 21.0, 46.0, typeof( Log ), 1044041, 13, 1044351 );
|
||||
AddCraft( typeof( FancyWoodenChairCushion ), 1044291, 1044302, 42.1, 67.1, typeof( Log ), 1044041, 15, 1044351 );
|
||||
AddCraft( typeof( WoodenChairCushion ), 1044291, 1044303, 42.1, 67.1, typeof( Log ), 1044041, 13, 1044351 );
|
||||
AddCraft( typeof( WoodenBench ), 1044291, 1022860, 52.6, 77.6, typeof( Log ), 1044041, 17, 1044351 );
|
||||
AddCraft( typeof( WoodenThrone ), 1044291, 1044304, 52.6, 77.6, typeof( Log ), 1044041, 17, 1044351 );
|
||||
AddCraft( typeof( Throne ), 1044291, 1044305, 73.6, 98.6, typeof( Log ), 1044041, 19, 1044351 );
|
||||
AddCraft( typeof( Nightstand ), 1044291, 1044306, 42.1, 67.1, typeof( Log ), 1044041, 17, 1044351 );
|
||||
AddCraft( typeof( WritingTable ), 1044291, 1022890, 63.1, 88.1, typeof( Log ), 1044041, 17, 1044351 );
|
||||
AddCraft( typeof( YewWoodTable ), 1044291, 1044307, 63.1, 88.1, typeof( Log ), 1044041, 23, 1044351 );
|
||||
AddCraft( typeof( LargeTable ), 1044291, 1044308, 84.2, 109.2, typeof( Log ), 1044041, 27, 1044351 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( ElegantLowTable ), 1044291, 1030265, 80.0, 105.0, typeof( Log ), 1044041, 35, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( PlainLowTable ), 1044291, 1030266, 80.0, 105.0, typeof( Log ), 1044041, 35, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
// Containers
|
||||
AddCraft( typeof( WoodenBox ), 1044292, 1023709, 21.0, 46.0, typeof( Log ), 1044041, 10, 1044351 );
|
||||
AddCraft( typeof( SmallCrate ), 1044292, 1044309, 10.0, 35.0, typeof( Log ), 1044041, 8 , 1044351 );
|
||||
AddCraft( typeof( MediumCrate ), 1044292, 1044310, 31.0, 56.0, typeof( Log ), 1044041, 15, 1044351 );
|
||||
AddCraft( typeof( LargeCrate ), 1044292, 1044311, 47.3, 72.3, typeof( Log ), 1044041, 18, 1044351 );
|
||||
AddCraft( typeof( WoodenChest ), 1044292, 1023650, 73.6, 98.6, typeof( Log ), 1044041, 20, 1044351 );
|
||||
AddCraft( typeof( EmptyBookcase ), 1044292, 1022718, 31.5, 56.5, typeof( Log ), 1044041, 25, 1044351 );
|
||||
AddCraft( typeof( FancyArmoire ), 1044292, 1044312, 84.2, 109.2, typeof( Log ), 1044041, 35, 1044351 );
|
||||
AddCraft( typeof( Armoire ), 1044292, 1022643, 84.2, 109.2, typeof( Log ), 1044041, 35, 1044351 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( PlainWoodenChest ), 1044292, 1030251, 90.0, 115.0, typeof( Log ), 1044041, 30, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( OrnateWoodenChest ), 1044292, 1030253, 90.0, 115.0, typeof( Log ), 1044041, 30, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( GildedWoodenChest ), 1044292, 1030255, 90.0, 115.0, typeof( Log ), 1044041, 30, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( WoodenFootLocker ), 1044292, 1030257, 90.0, 115.0, typeof( Log ), 1044041, 30, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( FinishedWoodenChest ),1044292, 1030259, 90.0, 115.0, typeof( Log ), 1044041, 30, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( TallCabinet ), 1044292, 1030261, 90.0, 115.0, typeof( Log ), 1044041, 35, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( ShortCabinet ), 1044292, 1030263, 90.0, 115.0, typeof( Log ), 1044041, 35, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( RedArmoire ), 1044292, 1030328, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( ElegantArmoire ), 1044292, 1030330, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( MapleArmoire ), 1044292, 1030328, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( CherryArmoire ), 1044292, 1030328, 90.0, 115.0, typeof( Log ), 1044041, 40, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
index = AddCraft( typeof( Keg ), 1044292, 1023711, 57.8, 82.8, typeof( BarrelStaves ), 1044288, 3, 1044253 );
|
||||
AddRes( index, typeof( BarrelHoops ), 1044289, 1, 1044253 );
|
||||
AddRes( index, typeof( BarrelLid ), 1044251, 1, 1044253 );
|
||||
|
||||
// Staves and Shields
|
||||
AddCraft( typeof( ShepherdsCrook ), 1044295, 1023713, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 );
|
||||
AddCraft( typeof( QuarterStaff ), 1044295, 1023721, 73.6, 98.6, typeof( Log ), 1044041, 6, 1044351 );
|
||||
AddCraft( typeof( GnarledStaff ), 1044295, 1025112, 78.9, 103.9, typeof( Log ), 1044041, 7, 1044351 );
|
||||
AddCraft( typeof( WoodenShield ), 1044295, 1027034, 52.6, 77.6, typeof( Log ), 1044041, 9, 1044351 );
|
||||
|
||||
index = AddCraft( typeof( FishingPole ), Core.AOS ? 1044294 : 1044295, 1023519, 68.4, 93.4, typeof( Log ), 1044041, 5, 1044351 ); //This is in the categor of Other during AoS
|
||||
AddSkill( index, SkillName.Tailoring, 40.0, 45.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 5, 1044287 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( Bokuto ), 1044295, 1030227, 70.0, 95.0, typeof( Log ), 1044041, 6, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( Fukiya ), 1044295, 1030229, 60.0, 85.0, typeof( Log ), 1044041, 6, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( Tetsubo ), 1044295, 1030225, 85.0, 110.0, typeof( Log ), 1044041, 8, 1044351 );
|
||||
AddSkill( index, SkillName.Tinkering, 40.0, 45.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 5, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
// Instruments
|
||||
index = AddCraft( typeof( LapHarp ), 1044293, 1023762, 63.1, 88.1, typeof( Log ), 1044041, 20, 1044351 );
|
||||
AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
|
||||
index = AddCraft( typeof( Harp ), 1044293, 1023761, 78.9, 103.9, typeof( Log ), 1044041, 35, 1044351 );
|
||||
AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 15, 1044287 );
|
||||
|
||||
index = AddCraft( typeof( Drums ), 1044293, 1023740, 57.8, 82.8, typeof( Log ), 1044041, 20, 1044351 );
|
||||
AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
|
||||
index = AddCraft( typeof( Lute ), 1044293, 1023763, 68.4, 93.4, typeof( Log ), 1044041, 25, 1044351 );
|
||||
AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
|
||||
index = AddCraft( typeof( Tambourine ), 1044293, 1023741, 57.8, 82.8, typeof( Log ), 1044041, 15, 1044351 );
|
||||
AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
|
||||
index = AddCraft( typeof( TambourineTassel ), 1044293, 1044320, 57.8, 82.8, typeof( Log ), 1044041, 15, 1044351 );
|
||||
AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 15, 1044287 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( BambooFlute ), 1044293, 1030247, 80.0, 105.0, typeof( Log ), 1044041, 15, 1044351 );
|
||||
AddSkill( index, SkillName.Musicianship, 45.0, 50.0 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
// Misc
|
||||
index = AddCraft( typeof( SmallBedSouthDeed ), 1044290, 1044321, 94.7, 113.1, typeof( Log ), 1044041, 100, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 );
|
||||
index = AddCraft( typeof( SmallBedEastDeed ), 1044290, 1044322, 94.7, 113.1, typeof( Log ), 1044041, 100, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 100, 1044287 );
|
||||
index = AddCraft( typeof( LargeBedSouthDeed ), 1044290,1044323, 94.7, 113.1, typeof( Log ), 1044041, 150, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 150, 1044287 );
|
||||
index = AddCraft( typeof( LargeBedEastDeed ), 1044290, 1044324, 94.7, 113.1, typeof( Log ), 1044041, 150, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 75.0, 80.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 150, 1044287 );
|
||||
AddCraft( typeof( DartBoardSouthDeed ), 1044290, 1044325, 15.7, 40.7, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddCraft( typeof( DartBoardEastDeed ), 1044290, 1044326, 15.7, 40.7, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddCraft( typeof( BallotBoxDeed ), 1044290, 1044327, 47.3, 72.3, typeof( Log ), 1044041, 5, 1044351 );
|
||||
index = AddCraft( typeof( PentagramDeed ), 1044290, 1044328, 100.0, 125.0, typeof( Log ), 1044041, 100, 1044351 );
|
||||
AddSkill( index, SkillName.Magery, 75.0, 80.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 40, 1044037 );
|
||||
index = AddCraft( typeof( AbbatoirDeed ), 1044290, 1044329, 100.0, 125.0, typeof( Log ), 1044041, 100, 1044351 );
|
||||
AddSkill( index, SkillName.Magery, 50.0, 55.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 40, 1044037 );
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
AddCraft( typeof( PlayerBBEast ), 1044290, 1062420, 85.0, 110.0, typeof( Log ), 1044041, 50, 1044351 );
|
||||
AddCraft( typeof( PlayerBBSouth ), 1044290, 1062421, 85.0, 110.0, typeof( Log ), 1044041, 50, 1044351 );
|
||||
}
|
||||
|
||||
// Blacksmithy
|
||||
index = AddCraft( typeof( SmallForgeDeed ), 1044296, 1044330, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 75, 1044037 );
|
||||
index = AddCraft( typeof( LargeForgeEastDeed ), 1044296, 1044331, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 );
|
||||
index = AddCraft( typeof( LargeForgeSouthDeed ), 1044296, 1044332, 78.9, 103.9, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddSkill( index, SkillName.Blacksmith, 80.0, 85.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 100, 1044037 );
|
||||
index = AddCraft( typeof( AnvilEastDeed ), 1044296, 1044333, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 );
|
||||
index = AddCraft( typeof( AnvilSouthDeed ), 1044296, 1044334, 73.6, 98.6, typeof( Log ), 1044041, 5, 1044351 );
|
||||
AddSkill( index, SkillName.Blacksmith, 75.0, 80.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 150, 1044037 );
|
||||
|
||||
// Training
|
||||
index = AddCraft( typeof( TrainingDummyEastDeed ), 1044297, 1044335, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
|
||||
index = AddCraft( typeof( TrainingDummySouthDeed ), 1044297, 1044336, 68.4, 93.4, typeof( Log ), 1044041, 55, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
|
||||
index = AddCraft( typeof( PickpocketDipEastDeed ), 1044297, 1044337, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
|
||||
index = AddCraft( typeof( PickpocketDipSouthDeed ), 1044297, 1044338, 73.6, 98.6, typeof( Log ), 1044041, 65, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 50.0, 55.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 60, 1044287 );
|
||||
|
||||
// Tailoring
|
||||
index = AddCraft( typeof( Dressform ), 1044298, 1044339, 63.1, 88.1, typeof( Log ), 1044041, 25, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
index = AddCraft( typeof( SpinningwheelEastDeed ), 1044298, 1044341, 73.6, 98.6, typeof( Log ), 1044041, 75, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
index = AddCraft( typeof( SpinningwheelSouthDeed ), 1044298, 1044342, 73.6, 98.6, typeof( Log ), 1044041, 75, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
index = AddCraft( typeof( LoomEastDeed ), 1044298, 1044343, 84.2, 109.2, typeof( Log ), 1044041, 85, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
index = AddCraft( typeof( LoomSouthDeed ), 1044298, 1044344, 84.2, 109.2, typeof( Log ), 1044041, 85, 1044351 );
|
||||
AddSkill( index, SkillName.Tailoring, 65.0, 70.0 );
|
||||
AddRes( index, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
|
||||
// Cooking
|
||||
index = AddCraft( typeof( StoneOvenEastDeed ), 1044299, 1044345, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 );
|
||||
AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 125, 1044037 );
|
||||
index = AddCraft( typeof( StoneOvenSouthDeed ), 1044299, 1044346, 68.4, 93.4, typeof( Log ), 1044041, 85, 1044351 );
|
||||
AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 125, 1044037 );
|
||||
index = AddCraft( typeof( FlourMillEastDeed ), 1044299, 1044347, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
|
||||
AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 50, 1044037 );
|
||||
index = AddCraft( typeof( FlourMillSouthDeed ), 1044299, 1044348, 94.7, 119.7, typeof( Log ), 1044041, 100, 1044351 );
|
||||
AddSkill( index, SkillName.Tinkering, 50.0, 55.0 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 50, 1044037 );
|
||||
AddCraft( typeof( WaterTroughEastDeed ), 1044299, 1044349, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 );
|
||||
AddCraft( typeof( WaterTroughSouthDeed ), 1044299, 1044350, 94.7, 119.7, typeof( Log ), 1044041, 150, 1044351 );
|
||||
|
||||
MarkOption = true;
|
||||
Repair = Core.AOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
88
Scripts/Engines/Craft/DefCartography.cs
Normal file
88
Scripts/Engines/Craft/DefCartography.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefCartography : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Cartography; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044008; } // <CENTER>CARTOGRAPHY MENU</CENTER>
|
||||
}
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.0; // 0%
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefCartography();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
private DefCartography() : base( 1, 1, 1.25 )// base( 1, 1, 3.0 )
|
||||
{
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
from.PlaySound( 0x249 );
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
AddCraft( typeof( LocalMap ), 1044448, 1015230, 10.0, 70.0, typeof( BlankMap ), 1044449, 1, 1044450 );
|
||||
AddCraft( typeof( CityMap ), 1044448, 1015231, 25.0, 85.0, typeof( BlankMap ), 1044449, 1, 1044450 );
|
||||
AddCraft( typeof( SeaChart ), 1044448, 1015232, 35.0, 95.0, typeof( BlankMap ), 1044449, 1, 1044450 );
|
||||
AddCraft( typeof( WorldMap ), 1044448, 1015233, 39.5, 99.5, typeof( BlankMap ), 1044449, 1, 1044450 );
|
||||
}
|
||||
}
|
||||
}
|
||||
247
Scripts/Engines/Craft/DefCooking.cs
Normal file
247
Scripts/Engines/Craft/DefCooking.cs
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefCooking : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Cooking; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044003; } // <CENTER>COOKING MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefCooking();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override CraftECA ECA{ get{ return CraftECA.ChanceMinusSixtyToFourtyFive; } }
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.0; // 0%
|
||||
}
|
||||
|
||||
private DefCooking() : base( 1, 1, 1.25 )// base( 1, 1, 1.5 )
|
||||
{
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
/* Begin Ingredients */
|
||||
index = AddCraft( typeof( SackFlour ), 1044495, 1024153, 0.0, 100.0, typeof( WheatSheaf ), 1044489, 2, 1044490 );
|
||||
SetNeedMill( index, true );
|
||||
|
||||
index = AddCraft( typeof( Dough ), 1044495, 1024157, 0.0, 100.0, typeof( SackFlour ), 1044468, 1, 1044253 );
|
||||
AddRes( index, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( SweetDough ), 1044495, 1041340, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( JarHoney ), 1044472, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( CakeMix ), 1044495, 1041002, 0.0, 100.0, typeof( SackFlour ), 1044468, 1, 1044253 );
|
||||
AddRes( index, typeof( SweetDough ), 1044475, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( CookieMix ), 1044495, 1024159, 0.0, 100.0, typeof( JarHoney ), 1044472, 1, 1044253 );
|
||||
AddRes( index, typeof( SweetDough ), 1044475, 1, 1044253 );
|
||||
/* End Ingredients */
|
||||
|
||||
/* Begin Preparations */
|
||||
index = AddCraft( typeof( UnbakedQuiche ), 1044496, 1041339, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( Eggs ), 1044477, 1, 1044253 );
|
||||
|
||||
// TODO: This must also support chicken and lamb legs
|
||||
index = AddCraft( typeof( UnbakedMeatPie ), 1044496, 1041338, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( RawRibs ), 1044482, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( UncookedSausagePizza ), 1044496, 1041337, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( Sausage ), 1044483, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( UncookedCheesePizza ), 1044496, 1041341, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( CheeseWheel ), 1044486, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( UnbakedFruitPie ), 1044496, 1041334, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( Pear ), 1044481, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( UnbakedPeachCobbler ), 1044496, 1041335, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( Peach ), 1044480, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( UnbakedApplePie ), 1044496, 1041336, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( Apple ), 1044479, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( UnbakedPumpkinPie ), 1044496, 1041342, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
AddRes( index, typeof( Pumpkin ), 1044484, 1, 1044253 );
|
||||
|
||||
if ( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( GreenTea ), 1044496, 1030315, 80.0, 130.0, typeof( GreenTeaBasket ), 1030316, 1, 1044253 );
|
||||
AddRes( index, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( WasabiClumps ), 1044496, 1029451, 70.0, 120.0, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
AddRes( index, typeof( WoodenBowlOfPeas ), 1025633, 3, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( SushiRolls ), 1044496, 1030303, 90.0, 120.0, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
AddRes( index, typeof( RawFishSteak ), 1044476, 10, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( SushiPlatter ), 1044496, 1030305, 90.0, 120.0, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
AddRes( index, typeof( RawFishSteak ), 1044476, 10, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
index = AddCraft( typeof( TribalPaint ), 1044496, 1040000, 80.0, 80.0, typeof( SackFlour ), 1044468, 1, 1044253 );
|
||||
AddRes( index, typeof( TribalBerry ), 1046460, 1, 1044253 );
|
||||
|
||||
if ( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( EggBomb ), 1044496, 1030249, 90.0, 120.0, typeof( Eggs ), 1044477, 1, 1044253 );
|
||||
AddRes( index, typeof( SackFlour ), 1044468, 3, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
/* End Preparations */
|
||||
|
||||
/* Begin Baking */
|
||||
index = AddCraft( typeof( BreadLoaf ), 1044497, 1024156, 0.0, 100.0, typeof( Dough ), 1044469, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( Cookies ), 1044497, 1025643, 0.0, 100.0, typeof( CookieMix ), 1044474, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( Cake ), 1044497, 1022537, 0.0, 100.0, typeof( CakeMix ), 1044471, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( Muffins ), 1044497, 1022539, 0.0, 100.0, typeof( SweetDough ), 1044475, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( Quiche ), 1044497, 1041345, 0.0, 100.0, typeof( UnbakedQuiche ), 1044518, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( MeatPie ), 1044497, 1041347, 0.0, 100.0, typeof( UnbakedMeatPie ), 1044519, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( SausagePizza ), 1044497, 1044517, 0.0, 100.0, typeof( UncookedSausagePizza ), 1044520, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( CheesePizza ), 1044497, 1044516, 0.0, 100.0, typeof( UncookedCheesePizza ), 1044521, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( FruitPie ), 1044497, 1041346, 0.0, 100.0, typeof( UnbakedFruitPie ), 1044522, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( PeachCobbler ), 1044497, 1041344, 0.0, 100.0, typeof( UnbakedPeachCobbler ), 1044523, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( ApplePie ), 1044497, 1041343, 0.0, 100.0, typeof( UnbakedApplePie ), 1044524, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( PumpkinPie ), 1044497, 1041348, 0.0, 100.0, typeof( UnbakedPumpkinPie ), 1046461, 1, 1044253 );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
if ( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( MisoSoup ), 1044497, 1030317, 60.0, 110.0, typeof( RawFishSteak ), 1044476, 1, 1044253 );
|
||||
AddRes( index, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( WhiteMisoSoup ), 1044497, 1030318, 60.0, 110.0, typeof( RawFishSteak ), 1044476, 1, 1044253 );
|
||||
AddRes( index, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( RedMisoSoup ), 1044497, 1030319, 60.0, 110.0, typeof( RawFishSteak ), 1044476, 1, 1044253 );
|
||||
AddRes( index, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
SetNeedOven( index, true );
|
||||
|
||||
index = AddCraft( typeof( AwaseMisoSoup ), 1044497, 1030320, 60.0, 110.0, typeof( RawFishSteak ), 1044476, 1, 1044253 );
|
||||
AddRes( index, typeof( BaseBeverage ), 1046458, 1, 1044253 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
SetNeedOven( index, true );
|
||||
}
|
||||
/* End Baking */
|
||||
|
||||
/* Begin Barbecue */
|
||||
index = AddCraft( typeof( CookedBird ), 1044498, 1022487, 0.0, 100.0, typeof( RawBird ), 1044470, 1, 1044253 );
|
||||
SetNeedHeat( index, true );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
index = AddCraft( typeof( ChickenLeg ), 1044498, 1025640, 0.0, 100.0, typeof( RawChickenLeg ), 1044473, 1, 1044253 );
|
||||
SetNeedHeat( index, true );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
index = AddCraft( typeof( FishSteak ), 1044498, 1022427, 0.0, 100.0, typeof( RawFishSteak ), 1044476, 1, 1044253 );
|
||||
SetNeedHeat( index, true );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
index = AddCraft( typeof( FriedEggs ), 1044498, 1022486, 0.0, 100.0, typeof( Eggs ), 1044477, 1, 1044253 );
|
||||
SetNeedHeat( index, true );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
index = AddCraft( typeof( LambLeg ), 1044498, 1025642, 0.0, 100.0, typeof( RawLambLeg ), 1044478, 1, 1044253 );
|
||||
SetNeedHeat( index, true );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
index = AddCraft( typeof( Ribs ), 1044498, 1022546, 0.0, 100.0, typeof( RawRibs ), 1044485, 1, 1044253 );
|
||||
SetNeedHeat( index, true );
|
||||
SetUseAllRes( index, true );
|
||||
/* End Barbecue */
|
||||
}
|
||||
}
|
||||
}
|
||||
133
Scripts/Engines/Craft/DefGlassblowing.cs
Normal file
133
Scripts/Engines/Craft/DefGlassblowing.cs
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefGlassblowing : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get{ return SkillName.Alchemy; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get{ return 1044622; } // <CENTER>Glassblowing MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefGlassblowing();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.0; // 0%
|
||||
}
|
||||
|
||||
private DefGlassblowing() : base( 1, 1, 1.25 )// base( 1, 2, 1.7 )
|
||||
{
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckTool( tool, from ) )
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
else if ( !(from is PlayerMobile && ((PlayerMobile)from).Glassblowing && from.Skills[SkillName.Alchemy].Base >= 100.0) )
|
||||
return 1044634; // You havent learned glassblowing.
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
bool anvil, forge;
|
||||
|
||||
DefBlacksmithy.CheckAnvilAndForge( from, 2, out anvil, out forge );
|
||||
|
||||
if ( forge )
|
||||
return 0;
|
||||
|
||||
return 1044628; // You must be near a forge to blow glass.
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
from.PlaySound( 0x2B ); // bellows
|
||||
|
||||
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
|
||||
// from.Animate( 9, 5, 1, true, false, 0 );
|
||||
|
||||
//new InternalTimer( from ).Start();
|
||||
}
|
||||
|
||||
// Delay to synchronize the sound with the hit on the anvil
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
|
||||
public InternalTimer( Mobile from ) : base( TimeSpan.FromSeconds( 0.7 ) )
|
||||
{
|
||||
m_From = from;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_From.PlaySound( 0x2A );
|
||||
}
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.PlaySound( 0x41 ); // glass breaking
|
||||
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
int index = AddCraft( typeof( Bottle ), 1044050, 1023854, 52.5, 102.5, typeof( Sand ), 1044625, 1, 1044627 );
|
||||
SetUseAllRes( index, true );
|
||||
|
||||
AddCraft( typeof( SmallFlask ), 1044050, 1044610, 52.5, 102.5, typeof( Sand ), 1044625, 2, 1044627 );
|
||||
AddCraft( typeof( MediumFlask ), 1044050, 1044611, 52.5, 102.5, typeof( Sand ), 1044625, 3, 1044627 );
|
||||
AddCraft( typeof( CurvedFlask ), 1044050, 1044612, 55.0, 105.0, typeof( Sand ), 1044625, 2, 1044627 );
|
||||
AddCraft( typeof( LongFlask ), 1044050, 1044613, 57.5, 107.5, typeof( Sand ), 1044625, 4, 1044627 );
|
||||
AddCraft( typeof( LargeFlask ), 1044050, 1044623, 60.0, 110.0, typeof( Sand ), 1044625, 5, 1044627 );
|
||||
AddCraft( typeof( AniSmallBlueFlask ), 1044050, 1044614, 60.0, 110.0, typeof( Sand ), 1044625, 5, 1044627 );
|
||||
AddCraft( typeof( AniLargeVioletFlask ), 1044050, 1044615, 60.0, 110.0, typeof( Sand ), 1044625, 5, 1044627 );
|
||||
AddCraft( typeof( AniRedRibbedFlask ), 1044050, 1044624, 60.0, 110.0, typeof( Sand ), 1044625, 7, 1044627 );
|
||||
AddCraft( typeof( EmptyVialsWRack ), 1044050, 1044616, 65.0, 115.0, typeof( Sand ), 1044625, 8, 1044627 );
|
||||
AddCraft( typeof( FullVialsWRack ), 1044050, 1044617, 65.0, 115.0, typeof( Sand ), 1044625, 9, 1044627 );
|
||||
AddCraft( typeof( SpinningHourglass ), 1044050, 1044618, 75.0, 125.0, typeof( Sand ), 1044625, 10, 1044627 );
|
||||
}
|
||||
}
|
||||
}
|
||||
308
Scripts/Engines/Craft/DefInscription.cs
Normal file
308
Scripts/Engines/Craft/DefInscription.cs
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefInscription : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Inscribe; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044009; } // <CENTER>INSCRIPTION MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefInscription();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.0; // 0%
|
||||
}
|
||||
|
||||
private DefInscription() : base( 1, 1, 1.25 )// base( 1, 1, 3.0 )
|
||||
{
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type typeItem )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
if ( typeItem != null )
|
||||
{
|
||||
object o = Activator.CreateInstance( typeItem );
|
||||
|
||||
if ( o is SpellScroll )
|
||||
{
|
||||
SpellScroll scroll = (SpellScroll)o;
|
||||
Spellbook book = Spellbook.Find( from, scroll.SpellID );
|
||||
|
||||
bool hasSpell = ( book != null && book.HasSpell( scroll.SpellID ) );
|
||||
|
||||
scroll.Delete();
|
||||
|
||||
return ( hasSpell ? 0 : 1042404 ); // null : You don't have that spell!
|
||||
}
|
||||
else if ( o is Item )
|
||||
{
|
||||
((Item)o).Delete();
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
from.PlaySound( 0x249 );
|
||||
}
|
||||
|
||||
private static Type typeofSpellScroll = typeof( SpellScroll );
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( !typeofSpellScroll.IsAssignableFrom( item.ItemType ) ) // not a scroll
|
||||
{
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( failed )
|
||||
return 501630; // You fail to inscribe the scroll, and the scroll is ruined.
|
||||
else
|
||||
return 501629; // You inscribe the spell and put the scroll in your backpack.
|
||||
}
|
||||
}
|
||||
|
||||
private int m_Circle, m_Mana;
|
||||
|
||||
private enum Reg{ BlackPearl, Bloodmoss, Garlic, Ginseng, MandrakeRoot, Nightshade, SulfurousAsh, SpidersSilk }
|
||||
|
||||
private Type[] m_RegTypes = new Type[]
|
||||
{
|
||||
typeof( BlackPearl ),
|
||||
typeof( Bloodmoss ),
|
||||
typeof( Garlic ),
|
||||
typeof( Ginseng ),
|
||||
typeof( MandrakeRoot ),
|
||||
typeof( Nightshade ),
|
||||
typeof( SulfurousAsh ),
|
||||
typeof( SpidersSilk )
|
||||
};
|
||||
|
||||
private int m_Index;
|
||||
|
||||
private void AddSpell( Type type, params Reg[] regs )
|
||||
{
|
||||
double minSkill, maxSkill;
|
||||
|
||||
switch ( m_Circle )
|
||||
{
|
||||
default:
|
||||
case 0: minSkill = -25.0; maxSkill = 25.0; break;
|
||||
case 1: minSkill = -10.8; maxSkill = 39.2; break;
|
||||
case 2: minSkill = 03.5; maxSkill = 53.5; break;
|
||||
case 3: minSkill = 17.8; maxSkill = 67.8; break;
|
||||
case 4: minSkill = 32.1; maxSkill = 82.1; break;
|
||||
case 5: minSkill = 46.4; maxSkill = 96.4; break;
|
||||
case 6: minSkill = 60.7; maxSkill = 110.7; break;
|
||||
case 7: minSkill = 75.0; maxSkill = 125.0; break;
|
||||
}
|
||||
|
||||
int index = AddCraft( type, 1044369 + m_Circle, 1044381 + m_Index++, minSkill, maxSkill, m_RegTypes[(int)regs[0]], 1044353 + (int)regs[0], 1, 1044361 + (int)regs[0] );
|
||||
|
||||
for ( int i = 1; i < regs.Length; ++i )
|
||||
AddRes( index, m_RegTypes[(int)regs[i]], 1044353 + (int)regs[i], 1, 1044361 + (int)regs[i] );
|
||||
|
||||
AddRes( index, typeof( BlankScroll ), 1044377, 1, 1044378 );
|
||||
|
||||
SetManaReq( index, m_Mana );
|
||||
}
|
||||
|
||||
private void AddNecroSpell( int spell, int mana, double minSkill, Type type, params Type[] regs )
|
||||
{
|
||||
int index = AddCraft( type, 1061677, 1060509 + spell, minSkill, minSkill + 1.0, regs[0], 1020000 + CraftItem.ItemIDOf( regs[0] ), 1, 501627 ); //Yes, on OSI it's only 1.0 skill diff'. Don't blame me, blame OSI.
|
||||
|
||||
for ( int i = 1; i < regs.Length; ++i )
|
||||
AddRes( index, regs[i], 1020000 + CraftItem.ItemIDOf( regs[i] ), 1, 501627 );
|
||||
|
||||
AddRes( index, typeof( BlankScroll ), 1044377, 1, 1044378 );
|
||||
|
||||
SetManaReq( index, mana );
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
m_Circle = 0;
|
||||
m_Mana = 4;
|
||||
|
||||
AddSpell( typeof( ReactiveArmorScroll ), Reg.Garlic, Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( ClumsyScroll ), Reg.Bloodmoss, Reg.Nightshade );
|
||||
AddSpell( typeof( CreateFoodScroll ), Reg.Garlic, Reg.Ginseng, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( FeeblemindScroll ), Reg.Nightshade, Reg.Ginseng );
|
||||
AddSpell( typeof( HealScroll ), Reg.Garlic, Reg.Ginseng, Reg.SpidersSilk );
|
||||
AddSpell( typeof( MagicArrowScroll ), Reg.SulfurousAsh );
|
||||
AddSpell( typeof( NightSightScroll ), Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( WeakenScroll ), Reg.Garlic, Reg.Nightshade );
|
||||
|
||||
m_Circle = 1;
|
||||
m_Mana = 6;
|
||||
|
||||
AddSpell( typeof( AgilityScroll ), Reg.Bloodmoss, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( CunningScroll ), Reg.Nightshade, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( CureScroll ), Reg.Garlic, Reg.Ginseng );
|
||||
AddSpell( typeof( HarmScroll ), Reg.Nightshade, Reg.SpidersSilk );
|
||||
AddSpell( typeof( MagicTrapScroll ), Reg.Garlic, Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( MagicUnTrapScroll ), Reg.Bloodmoss, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( ProtectionScroll ), Reg.Garlic, Reg.Ginseng, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( StrengthScroll ), Reg.Nightshade, Reg.MandrakeRoot );
|
||||
|
||||
m_Circle = 2;
|
||||
m_Mana = 9;
|
||||
|
||||
AddSpell( typeof( BlessScroll ), Reg.Garlic, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( FireballScroll ), Reg.BlackPearl );
|
||||
AddSpell( typeof( MagicLockScroll ), Reg.Bloodmoss, Reg.Garlic, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( PoisonScroll ), Reg.Nightshade );
|
||||
AddSpell( typeof( TelekinisisScroll ), Reg.Garlic, Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( TeleportScroll ), Reg.Bloodmoss, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( UnlockScroll ), Reg.Bloodmoss, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( WallOfStoneScroll ), Reg.Bloodmoss, Reg.Garlic );
|
||||
|
||||
m_Circle = 3;
|
||||
m_Mana = 11;
|
||||
|
||||
AddSpell( typeof( ArchCureScroll ), Reg.Garlic, Reg.Ginseng, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( ArchProtectionScroll ), Reg.Garlic, Reg.Ginseng, Reg.MandrakeRoot, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( CurseScroll ), Reg.Garlic, Reg.Nightshade, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( FireFieldScroll ), Reg.BlackPearl, Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( GreaterHealScroll ), Reg.Garlic, Reg.SpidersSilk, Reg.MandrakeRoot, Reg.Ginseng );
|
||||
AddSpell( typeof( LightningScroll ), Reg.MandrakeRoot, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( ManaDrainScroll ), Reg.BlackPearl, Reg.SpidersSilk, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( RecallScroll ), Reg.BlackPearl, Reg.Bloodmoss, Reg.MandrakeRoot );
|
||||
|
||||
m_Circle = 4;
|
||||
m_Mana = 14;
|
||||
|
||||
AddSpell( typeof( BladeSpiritsScroll ), Reg.BlackPearl, Reg.Nightshade, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( DispelFieldScroll ), Reg.BlackPearl, Reg.Garlic, Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( IncognitoScroll ), Reg.Bloodmoss, Reg.Garlic, Reg.Nightshade );
|
||||
AddSpell( typeof( MagicReflectScroll ), Reg.Garlic, Reg.MandrakeRoot, Reg.SpidersSilk );
|
||||
AddSpell( typeof( MindBlastScroll ), Reg.BlackPearl, Reg.MandrakeRoot, Reg.Nightshade, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( ParalyzeScroll ), Reg.Garlic, Reg.MandrakeRoot, Reg.SpidersSilk );
|
||||
AddSpell( typeof( PoisonFieldScroll ), Reg.BlackPearl, Reg.Nightshade, Reg.SpidersSilk );
|
||||
AddSpell( typeof( SummonCreatureScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SpidersSilk );
|
||||
|
||||
m_Circle = 5;
|
||||
m_Mana = 20;
|
||||
|
||||
AddSpell( typeof( DispelScroll ), Reg.Garlic, Reg.MandrakeRoot, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( EnergyBoltScroll ), Reg.BlackPearl, Reg.Nightshade );
|
||||
AddSpell( typeof( ExplosionScroll ), Reg.Bloodmoss, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( InvisibilityScroll ), Reg.Bloodmoss, Reg.Nightshade );
|
||||
AddSpell( typeof( MarkScroll ), Reg.Bloodmoss, Reg.BlackPearl, Reg.MandrakeRoot );
|
||||
AddSpell( typeof( MassCurseScroll ), Reg.Garlic, Reg.MandrakeRoot, Reg.Nightshade, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( ParalyzeFieldScroll ), Reg.BlackPearl, Reg.Ginseng, Reg.SpidersSilk );
|
||||
AddSpell( typeof( RevealScroll ), Reg.Bloodmoss, Reg.SulfurousAsh );
|
||||
|
||||
m_Circle = 6;
|
||||
m_Mana = 40;
|
||||
|
||||
AddSpell( typeof( ChainLightningScroll ), Reg.BlackPearl, Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( EnergyFieldScroll ), Reg.BlackPearl, Reg.MandrakeRoot, Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( FlamestrikeScroll ), Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( GateTravelScroll ), Reg.BlackPearl, Reg.MandrakeRoot, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( ManaVampireScroll ), Reg.BlackPearl, Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SpidersSilk );
|
||||
AddSpell( typeof( MassDispelScroll ), Reg.BlackPearl, Reg.Garlic, Reg.MandrakeRoot, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( MeteorSwarmScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SulfurousAsh, Reg.SpidersSilk );
|
||||
AddSpell( typeof( PolymorphScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SpidersSilk );
|
||||
|
||||
m_Circle = 7;
|
||||
m_Mana = 50;
|
||||
|
||||
AddSpell( typeof( EarthquakeScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.Ginseng, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( EnergyVortexScroll ), Reg.BlackPearl, Reg.Bloodmoss, Reg.MandrakeRoot, Reg.Nightshade );
|
||||
AddSpell( typeof( ResurrectionScroll ), Reg.Bloodmoss, Reg.Garlic, Reg.Ginseng );
|
||||
AddSpell( typeof( SummonAirElementalScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SpidersSilk );
|
||||
AddSpell( typeof( SummonDaemonScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( SummonEarthElementalScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SpidersSilk );
|
||||
AddSpell( typeof( SummonFireElementalScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SpidersSilk, Reg.SulfurousAsh );
|
||||
AddSpell( typeof( SummonWaterElementalScroll ), Reg.Bloodmoss, Reg.MandrakeRoot, Reg.SpidersSilk );
|
||||
|
||||
if ( Core.SE )
|
||||
{
|
||||
AddNecroSpell( 0, 23, 39.6, typeof( AnimateDeadScroll ), Reagent.GraveDust, Reagent.DaemonBlood );
|
||||
AddNecroSpell( 1, 13, 19.6, typeof( BloodOathScroll ), Reagent.DaemonBlood );
|
||||
AddNecroSpell( 2, 11, 19.6, typeof( CorpseSkinScroll ), Reagent.BatWing, Reagent.GraveDust );
|
||||
AddNecroSpell( 3, 7, 19.6, typeof( CurseWeaponScroll ), Reagent.PigIron );
|
||||
AddNecroSpell( 4, 11, 19.6, typeof( EvilOmenScroll ), Reagent.BatWing, Reagent.NoxCrystal );
|
||||
AddNecroSpell( 5, 11, 39.6, typeof( HorrificBeastScroll ), Reagent.BatWing, Reagent.DaemonBlood );
|
||||
AddNecroSpell( 6, 23, 69.6, typeof( LichFormScroll ), Reagent.GraveDust, Reagent.DaemonBlood, Reagent.NoxCrystal );
|
||||
AddNecroSpell( 7, 17, 29.6, typeof( MindRotScroll ), Reagent.BatWing, Reagent.DaemonBlood, Reagent.PigIron );
|
||||
AddNecroSpell( 8, 5, 19.6, typeof( PainSpikeScroll ), Reagent.GraveDust, Reagent.PigIron );
|
||||
AddNecroSpell( 9, 17, 49.6, typeof( PoisonStrikeScroll ), Reagent.NoxCrystal );
|
||||
AddNecroSpell( 10, 29, 64.6, typeof( StrangleScroll ), Reagent.DaemonBlood, Reagent.NoxCrystal );
|
||||
AddNecroSpell( 11, 17, 29.6, typeof( SummonFamiliarScroll ), Reagent.BatWing, Reagent.GraveDust, Reagent.DaemonBlood );
|
||||
AddNecroSpell( 12, 23, 98.6, typeof( VampiricEmbraceScroll ), Reagent.BatWing, Reagent.NoxCrystal, Reagent.PigIron );
|
||||
AddNecroSpell( 13, 41, 79.6, typeof( VengefulSpiritScroll ), Reagent.BatWing, Reagent.GraveDust, Reagent.PigIron );
|
||||
AddNecroSpell( 14, 23, 59.6, typeof( WitherScroll ), Reagent.GraveDust, Reagent.NoxCrystal, Reagent.PigIron );
|
||||
AddNecroSpell( 15, 17, 79.6, typeof( WraithFormScroll ), Reagent.NoxCrystal, Reagent.PigIron );
|
||||
AddNecroSpell( 16, 40, 79.6, typeof( ExorcismScroll ), Reagent.NoxCrystal, Reagent.GraveDust );
|
||||
}
|
||||
|
||||
// Runebook
|
||||
int index = AddCraft( typeof( Runebook ), 1044294, 1041267, 45.0, 95.0, typeof( BlankScroll ), 1044377, 8, 1044378 );
|
||||
AddRes( index, typeof( RecallScroll ), 1044445, 1, 1044253 );
|
||||
AddRes( index, typeof( GateTravelScroll ), 1044446, 1, 1044253 );
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
// Bulk order book
|
||||
AddCraft( typeof( Engines.BulkOrders.BulkOrderBook ), 1044294, 1028793, 65.0, 115.0, typeof( BlankScroll ), 1044377, 10, 1044378 );
|
||||
}
|
||||
|
||||
if ( Core.SE )
|
||||
AddCraft( typeof( Spellbook ), 1044294, 1023834, 50.0, 150.0, typeof( BlankScroll ), 1044377, 10, 1044378 );
|
||||
|
||||
MarkOption = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
150
Scripts/Engines/Craft/DefMasonry.cs
Normal file
150
Scripts/Engines/Craft/DefMasonry.cs
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefMasonry : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get{ return SkillName.Carpentry; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get{ return 1044500; } // <CENTER>MASONRY MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefMasonry();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.0; // 0%
|
||||
}
|
||||
|
||||
private DefMasonry() : base( 1, 1, 1.25 )// base( 1, 2, 1.7 )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool RetainsColorFrom( CraftItem item, Type type )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckTool( tool, from ) )
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
else if ( !(from is PlayerMobile && ((PlayerMobile)from).Masonry && from.Skills[SkillName.Carpentry].Base >= 100.0) )
|
||||
return 1044633; // You havent learned stonecraft.
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
// no effects
|
||||
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
|
||||
// from.Animate( 9, 5, 1, true, false, 0 );
|
||||
//new InternalTimer( from ).Start();
|
||||
}
|
||||
|
||||
// Delay to synchronize the sound with the hit on the anvil
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private Mobile m_From;
|
||||
|
||||
public InternalTimer( Mobile from ) : base( TimeSpan.FromSeconds( 0.7 ) )
|
||||
{
|
||||
m_From = from;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_From.PlaySound( 0x23D );
|
||||
}
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
// Decorations
|
||||
AddCraft( typeof( Vase ), 1044501, 1022888, 52.5, 102.5, typeof( Granite ), 1044514, 1, 1044513 );
|
||||
AddCraft( typeof( LargeVase ), 1044501, 1022887, 52.5, 102.5, typeof( Granite ), 1044514, 3, 1044513 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
int index = AddCraft( typeof( SmallUrn ), 1044501, 1029244, 82.0, 132.0, typeof( Granite ), 1044514, 3, 1044513 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( SmallTowerSculpture ), 1044501, 1029242, 82.0, 132.0, typeof( Granite ), 1044514, 3, 1044513 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
// Furniture
|
||||
AddCraft( typeof( StoneChair ), 1044502, 1024635, 55.0, 105.0, typeof( Granite ), 1044514, 4, 1044513 );
|
||||
AddCraft( typeof( MediumStoneTableEastDeed ), 1044502, 1044508, 65.0, 115.0, typeof( Granite ), 1044514, 6, 1044513 );
|
||||
AddCraft( typeof( MediumStoneTableSouthDeed ), 1044502, 1044509, 65.0, 115.0, typeof( Granite ), 1044514, 6, 1044513 );
|
||||
AddCraft( typeof( LargeStoneTableEastDeed ), 1044502, 1044511, 75.0, 125.0, typeof( Granite ), 1044514, 9, 1044513 );
|
||||
AddCraft( typeof( LargeStoneTableSouthDeed ), 1044502, 1044512, 75.0, 125.0, typeof( Granite ), 1044514, 9, 1044513 );
|
||||
|
||||
// Statues
|
||||
AddCraft( typeof( StatueSouth ), 1044503, 1044505, 60.0, 120.0, typeof( Granite ), 1044514, 3, 1044513 );
|
||||
AddCraft( typeof( StatueNorth ), 1044503, 1044506, 60.0, 120.0, typeof( Granite ), 1044514, 3, 1044513 );
|
||||
AddCraft( typeof( StatueEast ), 1044503, 1044507, 60.0, 120.0, typeof( Granite ), 1044514, 3, 1044513 );
|
||||
AddCraft( typeof( StatuePegasus ), 1044503, 1044510, 70.0, 130.0, typeof( Granite ), 1044514, 4, 1044513 );
|
||||
|
||||
SetSubRes( typeof( Granite ), 1044525 );
|
||||
|
||||
AddSubRes( typeof( Granite ), 1044525, 00.0, 1044514, 1044526 );
|
||||
AddSubRes( typeof( DullCopperGranite ), 1044023, 65.0, 1044514, 1044527 );
|
||||
AddSubRes( typeof( ShadowIronGranite ), 1044024, 70.0, 1044514, 1044527 );
|
||||
AddSubRes( typeof( CopperGranite ), 1044025, 75.0, 1044514, 1044527 );
|
||||
AddSubRes( typeof( BronzeGranite ), 1044026, 80.0, 1044514, 1044527 );
|
||||
AddSubRes( typeof( GoldGranite ), 1044027, 85.0, 1044514, 1044527 );
|
||||
AddSubRes( typeof( AgapiteGranite ), 1044028, 90.0, 1044514, 1044527 );
|
||||
AddSubRes( typeof( VeriteGranite ), 1044029, 95.0, 1044514, 1044527 );
|
||||
AddSubRes( typeof( ValoriteGranite ), 1044030, 99.0, 1044514, 1044527 );
|
||||
}
|
||||
}
|
||||
}
|
||||
324
Scripts/Engines/Craft/DefTailoring.cs
Normal file
324
Scripts/Engines/Craft/DefTailoring.cs
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefTailoring : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Tailoring; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044005; } // <CENTER>TAILORING MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefTailoring();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
public override CraftECA ECA{ get{ return CraftECA.ChanceMinusSixtyToFourtyFive; } }
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
return 0.5; // 50%
|
||||
}
|
||||
|
||||
private DefTailoring() : base( 1, 1, 1.25 )// base( 1, 1, 4.5 )
|
||||
{
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
from.PlaySound( 0x248 );
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
#region Hats
|
||||
AddCraft( typeof( SkullCap ), 1011375, 1025444, 0.0, 25.0, typeof( Cloth ), 1044286, 2, 1044287 );
|
||||
AddCraft( typeof( Bandana ), 1011375, 1025440, 0.0, 25.0, typeof( Cloth ), 1044286, 2, 1044287 );
|
||||
AddCraft( typeof( FloppyHat ), 1011375, 1025907, 6.2, 31.2, typeof( Cloth ), 1044286, 11, 1044287 );
|
||||
AddCraft( typeof( Cap ), 1011375, 1025909, -18.8, 6.2, typeof( Cloth ), 1044286, 11, 1044287 );
|
||||
AddCraft( typeof( WideBrimHat ), 1011375, 1025908, 6.2, 31.2, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
AddCraft( typeof( StrawHat ), 1011375, 1025911, 6.2, 31.2, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
AddCraft( typeof( TallStrawHat ), 1011375, 1025910, 6.7, 31.7, typeof( Cloth ), 1044286, 13, 1044287 );
|
||||
AddCraft( typeof( WizardsHat ), 1011375, 1025912, 7.2, 32.2, typeof( Cloth ), 1044286, 15, 1044287 );
|
||||
AddCraft( typeof( Bonnet ), 1011375, 1025913, 6.2, 31.2, typeof( Cloth ), 1044286, 11, 1044287 );
|
||||
AddCraft( typeof( FeatheredHat ), 1011375, 1025914, 6.2, 31.2, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
AddCraft( typeof( TricorneHat ), 1011375, 1025915, 6.2, 31.2, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
AddCraft( typeof( JesterHat ), 1011375, 1025916, 7.2, 32.2, typeof( Cloth ), 1044286, 15, 1044287 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( FlowerGarland ), 1011375, 1028965, 10.0, 35.0, typeof( Cloth ), 1044286, 5, 1044287 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( ClothNinjaHood ), 1011375, 1030202, 80.0, 105.0, typeof( Cloth ), 1044286, 13, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( Kasa ), 1011375, 1030211, 60.0, 85.0, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Shirts
|
||||
AddCraft( typeof( Doublet ), 1015269, 1028059, 0, 25.0, typeof( Cloth ), 1044286, 8, 1044287 );
|
||||
AddCraft( typeof( Shirt ), 1015269, 1025399, 20.7, 45.7, typeof( Cloth ), 1044286, 8, 1044287 );
|
||||
AddCraft( typeof( FancyShirt ), 1015269, 1027933, 24.8, 49.8, typeof( Cloth ), 1044286, 8, 1044287 );
|
||||
AddCraft( typeof( Tunic ), 1015269, 1028097, 00.0, 25.0, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
AddCraft( typeof( Surcoat ), 1015269, 1028189, 8.2, 33.2, typeof( Cloth ), 1044286, 14, 1044287 );
|
||||
AddCraft( typeof( PlainDress ), 1015269, 1027937, 12.4, 37.4, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
AddCraft( typeof( FancyDress ), 1015269, 1027935, 33.1, 58.1, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
AddCraft( typeof( Cloak ), 1015269, 1025397, 41.4, 66.4, typeof( Cloth ), 1044286, 14, 1044287 );
|
||||
AddCraft( typeof( Robe ), 1015269, 1027939, 53.9, 78.9, typeof( Cloth ), 1044286, 16, 1044287 );
|
||||
AddCraft( typeof( JesterSuit ), 1015269, 1028095, 8.2, 33.2, typeof( Cloth ), 1044286, 24, 1044287 );
|
||||
|
||||
if ( Core.AOS )
|
||||
{
|
||||
AddCraft( typeof( FurCape ), 1015269, 1028969, 35.0, 60.0, typeof( Cloth ), 1044286, 13, 1044287 );
|
||||
AddCraft( typeof( GildedDress ), 1015269, 1028973, 37.5, 62.5, typeof( Cloth ), 1044286, 16, 1044287 );
|
||||
AddCraft( typeof( FormalShirt ), 1015269, 1028975, 26.0, 51.0, typeof( Cloth ), 1044286, 16, 1044287 );
|
||||
}
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( ClothNinjaJacket ), 1015269, 1030207, 75.0, 100.0, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( Kamishimo ), 1015269, 1030212, 75.0, 100.0, typeof( Cloth ), 1044286, 15, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( HakamaShita ), 1015269, 1030215, 40.0, 65.0, typeof( Cloth ), 1044286, 14, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( MaleKimono ), 1015269, 1030189, 50.0, 75.0, typeof( Cloth ), 1044286, 16, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( FemaleKimono ), 1015269, 1030190, 50.0, 75.0, typeof( Cloth ), 1044286, 16, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( JinBaori ), 1015269, 1030220, 30.0, 55.0, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
// Pants
|
||||
#endregion
|
||||
|
||||
#region Pants
|
||||
AddCraft( typeof( ShortPants ), 1015279, 1025422, 24.8, 49.8, typeof( Cloth ), 1044286, 6, 1044287 );
|
||||
AddCraft( typeof( LongPants ), 1015279, 1025433, 24.8, 49.8, typeof( Cloth ), 1044286, 8, 1044287 );
|
||||
AddCraft( typeof( Kilt ), 1015279, 1025431, 20.7, 45.7, typeof( Cloth ), 1044286, 8, 1044287 );
|
||||
AddCraft( typeof( Skirt ), 1015279, 1025398, 29.0, 54.0, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( FurSarong ), 1015279, 1028971, 35.0, 60.0, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( Hakama ), 1015279, 1030213, 50.0, 75.0, typeof( Cloth ), 1044286, 16, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( TattsukeHakama ), 1015279, 1030214, 50.0, 75.0, typeof( Cloth ), 1044286, 16, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
AddCraft( typeof( BodySash ), 1015283, 1025441, 4.1, 29.1, typeof( Cloth ), 1044286, 4, 1044287 );
|
||||
AddCraft( typeof( HalfApron ), 1015283, 1025435, 20.7, 45.7, typeof( Cloth ), 1044286, 6, 1044287 );
|
||||
AddCraft( typeof( FullApron ), 1015283, 1025437, 29.0, 54.0, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( Obi ), 1015283, 1030219, 20.0, 45.0, typeof( Cloth ), 1044286, 6, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
AddCraft( typeof( OilCloth ), 1015283, 1041498, 74.6, 99.6, typeof( Cloth ), 1044286, 1, 1044287 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( GozaMatEastDeed ), 1015283, 1030404, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( GozaMatSouthDeed ), 1015283, 1030405, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( SquareGozaMatEastDeed ), 1015283, 1030407, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( SquareGozaMatSouthDeed ), 1015283, 1030406, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( BrocadeGozaMatEastDeed ), 1015283, 1030408, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( BrocadeGozaMatSouthDeed ), 1015283, 1030409, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( BrocadeSquareGozaMatEastDeed ), 1015283, 1030411, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( BrocadeSquareGozaMatSouthDeed ), 1015283, 1030410, 55.0, 80.0, typeof( Cloth ), 1044286, 25, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Footwear
|
||||
if ( Core.AOS )
|
||||
AddCraft( typeof( FurBoots ), 1015288, 1028967, 50.0, 75.0, typeof( Cloth ), 1044286, 12, 1044287 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( NinjaTabi ), 1015288, 1030210, 70.0, 95.0, typeof( Cloth ), 1044286, 10, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( SamuraiTabi ), 1015288, 1030209, 20.0, 45.0, typeof( Cloth ), 1044286, 6, 1044287 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
AddCraft( typeof( Sandals ), 1015288, 1025901, 12.4, 37.4, typeof( Leather ), 1044462, 4, 1044463 );
|
||||
AddCraft( typeof( Shoes ), 1015288, 1025904, 16.5, 41.5, typeof( Leather ), 1044462, 6, 1044463 );
|
||||
AddCraft( typeof( Boots ), 1015288, 1025899, 33.1, 58.1, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
AddCraft( typeof( ThighBoots ), 1015288, 1025906, 41.4, 66.4, typeof( Leather ), 1044462, 10, 1044463 );
|
||||
#endregion
|
||||
|
||||
#region Leather Armor
|
||||
|
||||
AddCraft( typeof( LeatherGorget ), 1015293, 1025063, 53.9, 78.9, typeof( Leather ), 1044462, 4, 1044463 );
|
||||
AddCraft( typeof( LeatherCap ), 1015293, 1027609, 6.2, 31.2, typeof( Leather ), 1044462, 2, 1044463 );
|
||||
AddCraft( typeof( LeatherGloves ), 1015293, 1025062, 51.8, 76.8, typeof( Leather ), 1044462, 3, 1044463 );
|
||||
AddCraft( typeof( LeatherArms ), 1015293, 1025061, 53.9, 78.9, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
AddCraft( typeof( LeatherLegs ), 1015293, 1025067, 66.3, 91.3, typeof( Leather ), 1044462, 10, 1044463 );
|
||||
AddCraft( typeof( LeatherChest ), 1015293, 1025068, 70.5, 95.5, typeof( Leather ), 1044462, 12, 1044463 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( LeatherJingasa ), 1015293, 1030177, 45.0, 70.0, typeof( Leather ), 1044462, 4, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherMempo ), 1015293, 1030181, 80.0, 105.0, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherDo ), 1015293, 1030182, 75.0, 100.0, typeof( Leather ), 1044462, 12, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherHiroSode ), 1015293, 1030185, 55.0, 80.0, typeof( Leather ), 1044462, 5, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherSuneate ), 1015293, 1030193, 68.0, 93.0, typeof( Leather ), 1044462, 12, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherHaidate ), 1015293, 1030197, 68.0, 93.0, typeof( Leather ), 1044462, 12, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherNinjaPants ), 1015293, 1030204, 80.0, 105.0, typeof( Leather ), 1044462, 13, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherNinjaJacket ), 1015293, 1030206, 85.0, 110.0, typeof( Leather ), 1044462, 13, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherNinjaBelt ), 1015293, 1030203, 50.0, 75.0, typeof( Leather ), 1044462, 15, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherNinjaMitts ), 1015293, 1030205, 65.0, 90.0, typeof( Leather ), 1044462, 12, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( LeatherNinjaHood ), 1015293, 1030201, 90.0, 115.0, typeof( Leather ), 1044462, 14, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Studded Armor
|
||||
AddCraft( typeof( StuddedGorget ), 1015300, 1025078, 78.8, 103.8, typeof( Leather ), 1044462, 6, 1044463 );
|
||||
AddCraft( typeof( StuddedGloves ), 1015300, 1025077, 82.9, 107.9, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
AddCraft( typeof( StuddedArms ), 1015300, 1025076, 87.1, 112.1, typeof( Leather ), 1044462, 10, 1044463 );
|
||||
AddCraft( typeof( StuddedLegs ), 1015300, 1025082, 91.2, 116.2, typeof( Leather ), 1044462, 12, 1044463 );
|
||||
AddCraft( typeof( StuddedChest ), 1015300, 1025083, 94.0, 119.0, typeof( Leather ), 1044462, 14, 1044463 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( StuddedMempo ), 1015300, 1030216, 80.0, 105.0, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( StuddedDo ), 1015300, 1030183, 95.0, 120.0, typeof( Leather ), 1044462, 14, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( StuddedHiroSode ), 1015300, 1030186, 85.0, 110.0, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( StuddedSuneate ), 1015300, 1030194, 92.0, 117.0, typeof( Leather ), 1044462, 14, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
index = AddCraft( typeof( StuddedHaidate ), 1015300, 1030198, 92.0, 117.0, typeof( Leather ), 1044462, 14, 1044463 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Female Armor
|
||||
AddCraft( typeof( LeatherShorts ), 1015306, 1027168, 62.2, 87.2, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
AddCraft( typeof( LeatherSkirt ), 1015306, 1027176, 58.0, 83.0, typeof( Leather ), 1044462, 6, 1044463 );
|
||||
AddCraft( typeof( LeatherBustierArms ), 1015306, 1027178, 58.0, 83.0, typeof( Leather ), 1044462, 6, 1044463 );
|
||||
AddCraft( typeof( StuddedBustierArms ), 1015306, 1027180, 82.9, 107.9, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
AddCraft( typeof( FemaleLeatherChest ), 1015306, 1027174, 62.2, 87.2, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
AddCraft( typeof( FemaleStuddedChest ), 1015306, 1027170, 87.1, 112.1, typeof( Leather ), 1044462, 10, 1044463 );
|
||||
#endregion
|
||||
|
||||
#region Bone Armor
|
||||
index = AddCraft( typeof( BoneHelm ), 1049149, 1025206, 85.0, 110.0, typeof( Leather ), 1044462, 4, 1044463 );
|
||||
AddRes( index, typeof( Bone ), 1049064, 2, 1049063 );
|
||||
|
||||
index = AddCraft( typeof( BoneGloves ), 1049149, 1025205, 89.0, 114.0, typeof( Leather ), 1044462, 6, 1044463 );
|
||||
AddRes( index, typeof( Bone ), 1049064, 2, 1049063 );
|
||||
|
||||
index = AddCraft( typeof( BoneArms ), 1049149, 1025203, 92.0, 117.0, typeof( Leather ), 1044462, 8, 1044463 );
|
||||
AddRes( index, typeof( Bone ), 1049064, 4, 1049063 );
|
||||
|
||||
index = AddCraft( typeof( BoneLegs ), 1049149, 1025202, 95.0, 120.0, typeof( Leather ), 1044462, 10, 1044463 );
|
||||
AddRes( index, typeof( Bone ), 1049064, 6, 1049063 );
|
||||
|
||||
index = AddCraft( typeof( BoneChest ), 1049149, 1025199, 96.0, 121.0, typeof( Leather ), 1044462, 12, 1044463 );
|
||||
AddRes( index, typeof( Bone ), 1049064, 10, 1049063 );
|
||||
#endregion
|
||||
|
||||
// Set the overridable material
|
||||
SetSubRes( typeof( Leather ), 1049150 );
|
||||
|
||||
// Add every material you want the player to be able to choose from
|
||||
// This will override the overridable material
|
||||
AddSubRes( typeof( Leather ), 1049150, 00.0, 1044462, 1049311 );
|
||||
AddSubRes( typeof( SpinedLeather ), 1049151, 65.0, 1044462, 1049311 );
|
||||
AddSubRes( typeof( HornedLeather ), 1049152, 80.0, 1044462, 1049311 );
|
||||
AddSubRes( typeof( BarbedLeather ), 1049153, 99.0, 1044462, 1049311 );
|
||||
|
||||
MarkOption = true;
|
||||
Repair = Core.AOS;
|
||||
CanEnhance = Core.AOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
493
Scripts/Engines/Craft/DefTinkering.cs
Normal file
493
Scripts/Engines/Craft/DefTinkering.cs
Normal file
|
|
@ -0,0 +1,493 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Factions;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Engines.Craft
|
||||
{
|
||||
public class DefTinkering : CraftSystem
|
||||
{
|
||||
public override SkillName MainSkill
|
||||
{
|
||||
get { return SkillName.Tinkering; }
|
||||
}
|
||||
|
||||
public override int GumpTitleNumber
|
||||
{
|
||||
get { return 1044007; } // <CENTER>TINKERING MENU</CENTER>
|
||||
}
|
||||
|
||||
private static CraftSystem m_CraftSystem;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_CraftSystem == null )
|
||||
m_CraftSystem = new DefTinkering();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
|
||||
private DefTinkering() : base( 1, 1, 1.25 )// base( 1, 1, 3.0 )
|
||||
{
|
||||
}
|
||||
|
||||
public override double GetChanceAtMin( CraftItem item )
|
||||
{
|
||||
if ( item.NameNumber == 1044258 || item.NameNumber == 1046445 ) // potion keg and faction trap removal kit
|
||||
return 0.5; // 50%
|
||||
|
||||
return 0.0; // 0%
|
||||
}
|
||||
|
||||
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
|
||||
{
|
||||
if( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
|
||||
return 1044038; // You have worn out your tool!
|
||||
else if ( !BaseTool.CheckAccessible( tool, from ) )
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
else if ( itemType != null && ( itemType.IsSubclassOf( typeof( BaseFactionTrapDeed ) ) || itemType == typeof( FactionTrapRemovalKit ) ) && Faction.Find( from ) == null )
|
||||
return 1044573; // You have to be in a faction to do that.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect( Mobile from )
|
||||
{
|
||||
// no sound
|
||||
//from.PlaySound( 0x241 );
|
||||
}
|
||||
|
||||
private static Type[] m_TinkerColorables = new Type[]
|
||||
{
|
||||
typeof( ForkLeft ), typeof( ForkRight ),
|
||||
typeof( SpoonLeft ), typeof( SpoonRight ),
|
||||
typeof( KnifeLeft ), typeof( KnifeRight ),
|
||||
typeof( Plate ),
|
||||
typeof( Goblet ), typeof( PewterMug ),
|
||||
typeof( KeyRing ),
|
||||
typeof( Candelabra ), typeof( Scales ),
|
||||
typeof( Key ), typeof( Globe ),
|
||||
typeof( Spyglass ), typeof( Lantern ),
|
||||
typeof( HeatingStand )
|
||||
};
|
||||
|
||||
public override bool RetainsColorFrom( CraftItem item, Type type )
|
||||
{
|
||||
if ( !type.IsSubclassOf( typeof( BaseIngot ) ) )
|
||||
return false;
|
||||
|
||||
type = item.ItemType;
|
||||
|
||||
bool contains = false;
|
||||
|
||||
for ( int i = 0; !contains && i < m_TinkerColorables.Length; ++i )
|
||||
contains = ( m_TinkerColorables[i] == type );
|
||||
|
||||
return contains;
|
||||
}
|
||||
|
||||
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool toolBroken, int quality, bool makersMark, CraftItem item )
|
||||
{
|
||||
if ( toolBroken )
|
||||
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
|
||||
|
||||
if ( failed )
|
||||
{
|
||||
if ( lostMaterial )
|
||||
return 1044043; // You failed to create the item, and some of your materials are lost.
|
||||
else
|
||||
return 1044157; // You failed to create the item, but no materials were lost.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( quality == 0 )
|
||||
return 502785; // You were barely able to make this item. It's quality is below average.
|
||||
else if ( makersMark && quality == 2 )
|
||||
return 1044156; // You create an exceptional quality item and affix your maker's mark.
|
||||
else if ( quality == 2 )
|
||||
return 1044155; // You create an exceptional quality item.
|
||||
else
|
||||
return 1044154; // You create the item.
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ConsumeOnFailure( Mobile from, Type resourceType, CraftItem craftItem )
|
||||
{
|
||||
if ( resourceType == typeof( Silver ) )
|
||||
return false;
|
||||
|
||||
return base.ConsumeOnFailure( from, resourceType, craftItem );
|
||||
}
|
||||
|
||||
public void AddJewelrySet( GemType gemType, Type itemType )
|
||||
{
|
||||
int offset = (int)gemType - 1;
|
||||
|
||||
int index = AddCraft( typeof( GoldRing ), 1044049, 1044176 + offset, 40.0, 90.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddRes( index, itemType, 1044231 + offset, 1, 1044240 );
|
||||
|
||||
index = AddCraft( typeof( SilverBeadNecklace ), 1044049, 1044185 + offset, 40.0, 90.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddRes( index, itemType, 1044231 + offset, 1, 1044240 );
|
||||
|
||||
index = AddCraft( typeof( GoldNecklace ), 1044049, 1044194 + offset, 40.0, 90.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddRes( index, itemType, 1044231 + offset, 1, 1044240 );
|
||||
|
||||
index = AddCraft( typeof( GoldEarrings ), 1044049, 1044203 + offset, 40.0, 90.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddRes( index, itemType, 1044231 + offset, 1, 1044240 );
|
||||
|
||||
index = AddCraft( typeof( GoldBeadNecklace ), 1044049, 1044212 + offset, 40.0, 90.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddRes( index, itemType, 1044231 + offset, 1, 1044240 );
|
||||
|
||||
index = AddCraft( typeof( GoldBracelet ), 1044049, 1044221 + offset, 40.0, 90.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddRes( index, itemType, 1044231 + offset, 1, 1044240 );
|
||||
}
|
||||
|
||||
public override void InitCraftList()
|
||||
{
|
||||
int index = -1;
|
||||
|
||||
#region Wooden Items
|
||||
AddCraft( typeof( JointingPlane ), 1044042, 1024144, 0.0, 50.0, typeof( Log ), 1044041, 4, 1044351 );
|
||||
AddCraft( typeof( MouldingPlane ), 1044042, 1024140, 0.0, 50.0, typeof( Log ), 1044041, 4, 1044351 );
|
||||
AddCraft( typeof( SmoothingPlane ), 1044042, 1024146, 0.0, 50.0, typeof( Log ), 1044041, 4, 1044351 );
|
||||
AddCraft( typeof( ClockFrame ), 1044042, 1024173, 0.0, 50.0, typeof( Log ), 1044041, 6, 1044351 );
|
||||
AddCraft( typeof( Axle ), 1044042, 1024187, -25.0, 25.0, typeof( Log ), 1044041, 2, 1044351 );
|
||||
AddCraft( typeof( RollingPin ), 1044042, 1024163, 0.0, 50.0, typeof( Log ), 1044041, 5, 1044351 );
|
||||
|
||||
if( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( Nunchaku ), 1044042, 1030158, 70.0, 120.0, typeof( IronIngot ), 1044036, 3, 1044037 );
|
||||
AddRes( index, typeof( Log ), 1044041, 8, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Tools
|
||||
AddCraft( typeof( Scissors ), 1044046, 1023998, 5.0, 55.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( MortarPestle ), 1044046, 1023739, 20.0, 70.0, typeof( IronIngot ), 1044036, 3, 1044037 );
|
||||
AddCraft( typeof( Scorp ), 1044046, 1024327, 30.0, 80.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( TinkerTools ), 1044046, 1044164, 10.0, 60.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( Hatchet ), 1044046, 1023907, 30.0, 80.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( DrawKnife ), 1044046, 1024324, 30.0, 80.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( SewingKit ), 1044046, 1023997, 10.0, 70.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( Saw ), 1044046, 1024148, 30.0, 80.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( DovetailSaw ), 1044046, 1024136, 30.0, 80.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( Froe ), 1044046, 1024325, 30.0, 80.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( Shovel ), 1044046, 1023898, 40.0, 90.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( Hammer ), 1044046, 1024138, 30.0, 80.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( Tongs ), 1044046, 1024028, 35.0, 85.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( SmithHammer ), 1044046, 1025091, 40.0, 90.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( SledgeHammer ), 1044046, 1024021, 40.0, 90.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( Inshave ), 1044046, 1024326, 30.0, 80.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( Pickaxe ), 1044046, 1023718, 40.0, 90.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( Lockpick ), 1044046, 1025371, 45.0, 95.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( Skillet ), 1044046, 1044567, 30.0, 80.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( FlourSifter ), 1044046, 1024158, 50.0, 100.0, typeof( IronIngot ), 1044036, 3, 1044037 );
|
||||
AddCraft( typeof( FletcherTools ), 1044046, 1044166, 35.0, 85.0, typeof( IronIngot ), 1044036, 3, 1044037 );
|
||||
AddCraft( typeof( MapmakersPen ), 1044046, 1044167, 25.0, 75.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( ScribesPen ), 1044046, 1044168, 25.0, 75.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
#endregion
|
||||
|
||||
#region Parts
|
||||
AddCraft( typeof( Gears ), 1044047, 1024179, 5.0, 55.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( ClockParts ), 1044047, 1024175, 25.0, 75.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( BarrelTap ), 1044047, 1024100, 35.0, 85.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( Springs ), 1044047, 1024189, 5.0, 55.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( SextantParts ), 1044047, 1024185, 30.0, 80.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( BarrelHoops ), 1044047, 1024321, -15.0, 35.0, typeof( IronIngot ), 1044036, 5, 1044037 );
|
||||
AddCraft( typeof( Hinge ), 1044047, 1024181, 5.0, 55.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( BolaBall ), 1044047, 1023699, 45.0, 95.0, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
#endregion
|
||||
|
||||
#region Utensils
|
||||
AddCraft( typeof( ButcherKnife ), 1044048, 1025110, 25.0, 75.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( SpoonLeft ), 1044048, 1044158, 0.0, 50.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( SpoonRight ), 1044048, 1044159, 0.0, 50.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( Plate ), 1044048, 1022519, 0.0, 50.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( ForkLeft ), 1044048, 1044160, 0.0, 50.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( ForkRight ), 1044048, 1044161, 0.0, 50.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( Cleaver ), 1044048, 1023778, 20.0, 70.0, typeof( IronIngot ), 1044036, 3, 1044037 );
|
||||
AddCraft( typeof( KnifeLeft ), 1044048, 1044162, 0.0, 50.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( KnifeRight ), 1044048, 1044163, 0.0, 50.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddCraft( typeof( Goblet ), 1044048, 1022458, 10.0, 60.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( PewterMug ), 1044048, 1024097, 10.0, 60.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( SkinningKnife ), 1044048, 1023781, 25.0, 75.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
AddCraft( typeof( KeyRing ), 1044050, 1024113, 10.0, 60.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( Candelabra ), 1044050, 1022599, 55.0, 105.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( Scales ), 1044050, 1026225, 60.0, 110.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( Key ), 1044050, 1024112, 20.0, 70.0, typeof( IronIngot ), 1044036, 3, 1044037 );
|
||||
AddCraft( typeof( Globe ), 1044050, 1024167, 55.0, 105.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( Spyglass ), 1044050, 1025365, 60.0, 110.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
AddCraft( typeof( Lantern ), 1044050, 1022597, 30.0, 80.0, typeof( IronIngot ), 1044036, 2, 1044037 );
|
||||
AddCraft( typeof( HeatingStand ), 1044050, 1026217, 60.0, 110.0, typeof( IronIngot ), 1044036, 4, 1044037 );
|
||||
|
||||
if ( Core.SE )
|
||||
{
|
||||
index = AddCraft( typeof( ShojiLantern ), 1044050, 1029404, 65.0, 115.0, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddRes( index, typeof( Log ), 1044041, 5, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( PaperLantern ), 1044050, 1029406, 65.0, 115.0, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddRes( index, typeof( Log ), 1044041, 5, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( RoundPaperLantern ), 1044050, 1029418, 65.0, 115.0, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddRes( index, typeof( Log ), 1044041, 5, 1044351 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( WindChimes ), 1044050, 1030290, 80.0, 130.0, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
index = AddCraft( typeof( FancyWindChimes ), 1044050, 1030291, 80.0, 130.0, typeof( IronIngot ), 1044036, 15, 1044037 );
|
||||
SetNeededExpansion( index, Expansion.SE );
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Jewelry
|
||||
AddJewelrySet( GemType.StarSapphire, typeof( StarSapphire ) );
|
||||
AddJewelrySet( GemType.Emerald, typeof( Emerald ) );
|
||||
AddJewelrySet( GemType.Sapphire, typeof( Sapphire ) );
|
||||
AddJewelrySet( GemType.Ruby, typeof( Ruby ) );
|
||||
AddJewelrySet( GemType.Citrine, typeof( Citrine ) );
|
||||
AddJewelrySet( GemType.Amethyst, typeof( Amethyst ) );
|
||||
AddJewelrySet( GemType.Tourmaline, typeof( Tourmaline ) );
|
||||
AddJewelrySet( GemType.Amber, typeof( Amber ) );
|
||||
AddJewelrySet( GemType.Diamond, typeof( Diamond ) );
|
||||
#endregion
|
||||
|
||||
#region Multi-Component Items
|
||||
index = AddCraft( typeof( AxleGears ), 1044051, 1024177, 0.0, 0.0, typeof( Axle ), 1044169, 1, 1044253 );
|
||||
AddRes( index, typeof( Gears ), 1044254, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( ClockParts ), 1044051, 1024175, 0.0, 0.0, typeof( AxleGears ), 1044170, 1, 1044253 );
|
||||
AddRes( index, typeof( Springs ), 1044171, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( SextantParts ), 1044051, 1024185, 0.0, 0.0, typeof( AxleGears ), 1044170, 1, 1044253 );
|
||||
AddRes( index, typeof( Hinge ), 1044172, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( ClockRight ), 1044051, 1044257, 0.0, 0.0, typeof( ClockFrame ), 1044174, 1, 1044253 );
|
||||
AddRes( index, typeof( ClockParts ), 1044173, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( ClockLeft ), 1044051, 1044256, 0.0, 0.0, typeof( ClockFrame ), 1044174, 1, 1044253 );
|
||||
AddRes( index, typeof( ClockParts ), 1044173, 1, 1044253 );
|
||||
|
||||
AddCraft( typeof( Sextant ), 1044051, 1024183, 0.0, 0.0, typeof( SextantParts ), 1044175, 1, 1044253 );
|
||||
|
||||
index = AddCraft( typeof( Bola ), 1044051, 1046441, 60.0, 80.0, typeof( BolaBall ), 1046440, 4, 1042613 );
|
||||
AddRes( index, typeof( Leather ), 1044462, 3, 1044463 );
|
||||
|
||||
index = AddCraft( typeof( PotionKeg ), 1044051, 1044258, 75.0, 100.0, typeof( Keg ), 1044255, 1, 1044253 );
|
||||
AddRes( index, typeof( Bottle ), 1044250, 10, 1044253 );
|
||||
AddRes( index, typeof( BarrelLid ), 1044251, 1, 1044253 );
|
||||
AddRes( index, typeof( BarrelTap ), 1044252, 1, 1044253 );
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Traps
|
||||
// Dart Trap
|
||||
index = AddCraft( typeof( DartTrapCraft ), 1044052, 1024396, 30.0, 80.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddRes( index, typeof( Bolt ), 1044570, 1, 1044253 );
|
||||
|
||||
// Poison Trap
|
||||
index = AddCraft( typeof( PoisonTrapCraft ), 1044052, 1044593, 30.0, 80.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddRes( index, typeof( BasePoisonPotion ), 1044571, 1, 1044253 );
|
||||
|
||||
// Explosion Trap
|
||||
index = AddCraft( typeof( ExplosionTrapCraft ), 1044052, 1044597, 55.0, 105.0, typeof( IronIngot ), 1044036, 1, 1044037 );
|
||||
AddRes( index, typeof( BaseExplosionPotion ), 1044569, 1, 1044253 );
|
||||
|
||||
// Faction Gas Trap
|
||||
index = AddCraft( typeof( FactionGasTrapDeed ), 1044052, 1044598, 65.0, 115.0, typeof( Silver ), 1044572, Core.AOS ? 250 : 1000, 1044253 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddRes( index, typeof( BasePoisonPotion ), 1044571, 1, 1044253 );
|
||||
|
||||
// Faction explosion Trap
|
||||
index = AddCraft( typeof( FactionExplosionTrapDeed ), 1044052, 1044599, 65.0, 115.0, typeof( Silver ), 1044572, Core.AOS ? 250 : 1000, 1044253 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddRes( index, typeof( BaseExplosionPotion ), 1044569, 1, 1044253 );
|
||||
|
||||
// Faction Saw Trap
|
||||
index = AddCraft( typeof( FactionSawTrapDeed ), 1044052, 1044600, 65.0, 115.0, typeof( Silver ), 1044572, Core.AOS ? 250 : 1000, 1044253 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddRes( index, typeof( Gears ), 1044254, 1, 1044253 );
|
||||
|
||||
// Faction Spike Trap
|
||||
index = AddCraft( typeof( FactionSpikeTrapDeed ), 1044052, 1044601, 65.0, 115.0, typeof( Silver ), 1044572, Core.AOS ? 250 : 1000, 1044253 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
AddRes( index, typeof( Springs ), 1044171, 1, 1044253 );
|
||||
|
||||
// Faction trap removal kit
|
||||
index = AddCraft( typeof( FactionTrapRemovalKit ), 1044052, 1046445, 90.0, 115.0, typeof( Silver ), 1044572, 500, 1044253 );
|
||||
AddRes( index, typeof( IronIngot ), 1044036, 10, 1044037 );
|
||||
#endregion
|
||||
|
||||
// Set the overridable material
|
||||
SetSubRes( typeof( IronIngot ), 1044022 );
|
||||
|
||||
// Add every material you want the player to be able to choose from
|
||||
// This will override the overridable material
|
||||
AddSubRes( typeof( IronIngot ), 1044022, 00.0, 1044036, 1044267 );
|
||||
AddSubRes( typeof( DullCopperIngot ), 1044023, 65.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( ShadowIronIngot ), 1044024, 70.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( CopperIngot ), 1044025, 75.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( BronzeIngot ), 1044026, 80.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( GoldIngot ), 1044027, 85.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( AgapiteIngot ), 1044028, 90.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( VeriteIngot ), 1044029, 95.0, 1044036, 1044268 );
|
||||
AddSubRes( typeof( ValoriteIngot ), 1044030, 99.0, 1044036, 1044268 );
|
||||
|
||||
MarkOption = true;
|
||||
Repair = true;
|
||||
CanEnhance = Core.AOS;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class TrapCraft : CustomCraft
|
||||
{
|
||||
private LockableContainer m_Container;
|
||||
|
||||
public LockableContainer Container{ get{ return m_Container; } }
|
||||
|
||||
public abstract TrapType TrapType{ get; }
|
||||
|
||||
public TrapCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality ) : base( from, craftItem, craftSystem, typeRes, tool, quality )
|
||||
{
|
||||
}
|
||||
|
||||
private int Verify( LockableContainer container )
|
||||
{
|
||||
if ( container == null || container.KeyValue == 0 )
|
||||
return 1005638; // You can only trap lockable chests.
|
||||
if ( From.Map != container.Map || !From.InRange( container.GetWorldLocation(), 2 ) )
|
||||
return 500446; // That is too far away.
|
||||
if ( !container.Movable )
|
||||
return 502944; // You cannot trap this item because it is locked down.
|
||||
if ( !container.IsAccessibleTo( From ) )
|
||||
return 502946; // That belongs to someone else.
|
||||
if ( container.Locked )
|
||||
return 502943; // You can only trap an unlocked object.
|
||||
if ( container.TrapType != TrapType.None )
|
||||
return 502945; // You can only place one trap on an object at a time.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private bool Acquire( object target, out int message )
|
||||
{
|
||||
LockableContainer container = target as LockableContainer;
|
||||
|
||||
message = Verify( container );
|
||||
|
||||
if ( message > 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Container = container;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void EndCraftAction()
|
||||
{
|
||||
From.SendLocalizedMessage( 502921 ); // What would you like to set a trap on?
|
||||
From.Target = new ContainerTarget( this );
|
||||
}
|
||||
|
||||
private class ContainerTarget : Target
|
||||
{
|
||||
private TrapCraft m_TrapCraft;
|
||||
|
||||
public ContainerTarget( TrapCraft trapCraft ) : base( -1, false, TargetFlags.None )
|
||||
{
|
||||
m_TrapCraft = trapCraft;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
int message;
|
||||
|
||||
if ( m_TrapCraft.Acquire( targeted, out message ) )
|
||||
m_TrapCraft.CraftItem.CompleteCraft( m_TrapCraft.Quality, false, m_TrapCraft.From, m_TrapCraft.CraftSystem, m_TrapCraft.TypeRes, m_TrapCraft.Tool, m_TrapCraft );
|
||||
else
|
||||
Failure( message );
|
||||
}
|
||||
|
||||
protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType )
|
||||
{
|
||||
if ( cancelType == TargetCancelType.Canceled )
|
||||
Failure( 0 );
|
||||
}
|
||||
|
||||
private void Failure( int message )
|
||||
{
|
||||
Mobile from = m_TrapCraft.From;
|
||||
BaseTool tool = m_TrapCraft.Tool;
|
||||
|
||||
if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
|
||||
from.SendGump( new CraftGump( from, m_TrapCraft.CraftSystem, tool, message ) );
|
||||
else if ( message > 0 )
|
||||
from.SendLocalizedMessage( message );
|
||||
}
|
||||
}
|
||||
|
||||
public override Item CompleteCraft( out int message )
|
||||
{
|
||||
message = Verify( this.Container );
|
||||
|
||||
if ( message == 0 )
|
||||
{
|
||||
int trapLevel = (int)(From.Skills.Tinkering.Value / 10);
|
||||
|
||||
Container.TrapType = this.TrapType;
|
||||
Container.TrapPower = trapLevel * 9;
|
||||
Container.TrapLevel = trapLevel;
|
||||
Container.TrapOnLockpick = true;
|
||||
|
||||
message = 1005639; // Trap is disabled until you lock the chest.
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
[CraftItemID( 0x1BFC )]
|
||||
public class DartTrapCraft : TrapCraft
|
||||
{
|
||||
public override TrapType TrapType{ get{ return TrapType.DartTrap; } }
|
||||
|
||||
public DartTrapCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality ) : base( from, craftItem, craftSystem, typeRes, tool, quality )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[CraftItemID( 0x113E )]
|
||||
public class PoisonTrapCraft : TrapCraft
|
||||
{
|
||||
public override TrapType TrapType{ get{ return TrapType.PoisonTrap; } }
|
||||
|
||||
public PoisonTrapCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality ) : base( from, craftItem, craftSystem, typeRes, tool, quality )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
[CraftItemID( 0x370C )]
|
||||
public class ExplosionTrapCraft : TrapCraft
|
||||
{
|
||||
public override TrapType TrapType{ get{ return TrapType.ExplosionTrap; } }
|
||||
|
||||
public ExplosionTrapCraft( Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool, int quality ) : base( from, craftItem, craftSystem, typeRes, tool, quality )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
719
Scripts/Engines/Doom/GauntletSpawner.cs
Normal file
719
Scripts/Engines/Doom/GauntletSpawner.cs
Normal file
|
|
@ -0,0 +1,719 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using Server;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Engines.Doom
|
||||
{
|
||||
public enum GauntletSpawnerState
|
||||
{
|
||||
InSequence,
|
||||
InProgress,
|
||||
Completed
|
||||
}
|
||||
|
||||
public class GauntletSpawner : Item
|
||||
{
|
||||
public const int PlayersPerSpawn = 5;
|
||||
|
||||
public const int InSequenceItemHue = 0x000;
|
||||
public const int InProgressItemHue = 0x676;
|
||||
public const int CompletedItemHue = 0x455;
|
||||
|
||||
private GauntletSpawnerState m_State;
|
||||
|
||||
private string m_TypeName;
|
||||
private BaseDoor m_Door;
|
||||
private BaseAddon m_Addon;
|
||||
private GauntletSpawner m_Sequence;
|
||||
private ArrayList m_Creatures;
|
||||
|
||||
private Rectangle2D m_RegionBounds;
|
||||
private ArrayList m_Traps;
|
||||
|
||||
private Region m_Region;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TypeName
|
||||
{
|
||||
get{ return m_TypeName; }
|
||||
set{ m_TypeName = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BaseDoor Door
|
||||
{
|
||||
get{ return m_Door; }
|
||||
set{ m_Door = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BaseAddon Addon
|
||||
{
|
||||
get{ return m_Addon; }
|
||||
set{ m_Addon = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public GauntletSpawner Sequence
|
||||
{
|
||||
get{ return m_Sequence; }
|
||||
set{ m_Sequence = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool HasCompleted
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Creatures.Count == 0 )
|
||||
return false;
|
||||
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
{
|
||||
Mobile mob = (Mobile)m_Creatures[i];
|
||||
|
||||
if ( !mob.Deleted )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Rectangle2D RegionBounds
|
||||
{
|
||||
get{ return m_RegionBounds; }
|
||||
set{ m_RegionBounds = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public GauntletSpawnerState State
|
||||
{
|
||||
get{ return m_State; }
|
||||
set
|
||||
{
|
||||
if ( m_State == value )
|
||||
return;
|
||||
|
||||
m_State = value;
|
||||
|
||||
int hue = 0;
|
||||
bool lockDoors = ( m_State == GauntletSpawnerState.InProgress );
|
||||
|
||||
switch ( m_State )
|
||||
{
|
||||
case GauntletSpawnerState.InSequence: hue = InSequenceItemHue; break;
|
||||
case GauntletSpawnerState.InProgress: hue = InProgressItemHue; break;
|
||||
case GauntletSpawnerState.Completed: hue = CompletedItemHue; break;
|
||||
}
|
||||
|
||||
if ( m_Door != null )
|
||||
{
|
||||
m_Door.Hue = hue;
|
||||
m_Door.Locked = lockDoors;
|
||||
|
||||
if ( lockDoors )
|
||||
{
|
||||
m_Door.KeyValue = Key.RandomValue();
|
||||
m_Door.Open = false;
|
||||
}
|
||||
|
||||
if ( m_Door.Link != null )
|
||||
{
|
||||
m_Door.Link.Hue = hue;
|
||||
m_Door.Link.Locked = lockDoors;
|
||||
|
||||
if ( lockDoors )
|
||||
{
|
||||
m_Door.Link.KeyValue = Key.RandomValue();
|
||||
m_Door.Open = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Addon != null )
|
||||
m_Addon.Hue = hue;
|
||||
|
||||
if ( m_State == GauntletSpawnerState.InProgress )
|
||||
{
|
||||
CreateRegion();
|
||||
FullSpawn();
|
||||
|
||||
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), new TimerCallback( Slice ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearCreatures();
|
||||
ClearTraps();
|
||||
DestroyRegion();
|
||||
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
public ArrayList Creatures
|
||||
{
|
||||
get{ return m_Creatures; }
|
||||
set{ m_Creatures = value; }
|
||||
}
|
||||
|
||||
public ArrayList Traps
|
||||
{
|
||||
get{ return m_Traps; }
|
||||
set{ m_Traps = value; }
|
||||
}
|
||||
|
||||
public Region Region
|
||||
{
|
||||
get{ return m_Region; }
|
||||
set{ m_Region = value; }
|
||||
}
|
||||
|
||||
public virtual void CreateRegion()
|
||||
{
|
||||
if ( m_Region != null )
|
||||
return;
|
||||
|
||||
Map map = this.Map;
|
||||
|
||||
if ( map == null || map == Map.Internal )
|
||||
return;
|
||||
|
||||
m_Region = new GauntletRegion( this, map );
|
||||
}
|
||||
|
||||
public virtual void DestroyRegion()
|
||||
{
|
||||
if ( m_Region != null )
|
||||
m_Region.Unregister();
|
||||
|
||||
m_Region = null;
|
||||
}
|
||||
|
||||
public virtual int ComputeTrapCount()
|
||||
{
|
||||
int area = m_RegionBounds.Width * m_RegionBounds.Height;
|
||||
|
||||
return area / 100;
|
||||
}
|
||||
|
||||
public virtual void ClearTraps()
|
||||
{
|
||||
for ( int i = 0; i < m_Traps.Count; ++i )
|
||||
((Item)m_Traps[i]).Delete();
|
||||
|
||||
m_Traps.Clear();
|
||||
}
|
||||
|
||||
public virtual void SpawnTrap()
|
||||
{
|
||||
Map map = this.Map;
|
||||
|
||||
if ( map == null )
|
||||
return;
|
||||
|
||||
Item trap = null;
|
||||
|
||||
int random = Utility.Random( 100 );
|
||||
|
||||
if ( 22 > random )
|
||||
trap = new SawTrap( Utility.RandomBool() ? SawTrapType.WestFloor : SawTrapType.NorthFloor );
|
||||
else if ( 44 > random )
|
||||
trap = new SpikeTrap( Utility.RandomBool() ? SpikeTrapType.WestFloor : SpikeTrapType.NorthFloor );
|
||||
else if ( 66 > random )
|
||||
trap = new GasTrap( Utility.RandomBool() ? GasTrapType.NorthWall : GasTrapType.WestWall );
|
||||
else if ( 88 > random )
|
||||
trap = new FireColumnTrap();
|
||||
else
|
||||
trap = new MushroomTrap();
|
||||
|
||||
if ( trap == null )
|
||||
return;
|
||||
|
||||
if ( trap is FireColumnTrap || trap is MushroomTrap )
|
||||
trap.Hue = 0x451;
|
||||
|
||||
// try 10 times to find a valid location
|
||||
for ( int i = 0; i < 10; ++i )
|
||||
{
|
||||
int x = Utility.Random( m_RegionBounds.X, m_RegionBounds.Width );
|
||||
int y = Utility.Random( m_RegionBounds.Y, m_RegionBounds.Height );
|
||||
int z = this.Z;
|
||||
|
||||
if ( !map.CanFit( x, y, z, 16, false, false ) )
|
||||
z = map.GetAverageZ( x, y );
|
||||
|
||||
if ( !map.CanFit( x, y, z, 16, false, false ) )
|
||||
continue;
|
||||
|
||||
trap.MoveToWorld( new Point3D( x, y, z ), map );
|
||||
m_Traps.Add( trap );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
trap.Delete();
|
||||
}
|
||||
|
||||
public virtual int ComputeSpawnCount()
|
||||
{
|
||||
int playerCount = 0;
|
||||
|
||||
Map map = this.Map;
|
||||
|
||||
if ( map != null )
|
||||
{
|
||||
Point3D loc = GetWorldLocation();
|
||||
|
||||
/*
|
||||
Sector sec = map.GetSector( loc );
|
||||
ArrayList regions = sec.Regions;
|
||||
|
||||
for ( int i = 0; playerCount == 0 && i < regions.Count; ++i )
|
||||
{
|
||||
Region reg = (Region)regions[i];
|
||||
|
||||
if ( reg != null && reg != m_Region && reg.Contains( loc ) )
|
||||
playerCount = reg.GetPlayerCount();
|
||||
}
|
||||
*/
|
||||
|
||||
Region reg = Region.Find( loc, map ).GetRegion( "Doom Gauntlet" );
|
||||
|
||||
if ( reg != null )
|
||||
playerCount = reg.GetPlayerCount();
|
||||
}
|
||||
|
||||
if ( playerCount == 0 && m_Region != null )
|
||||
playerCount = m_Region.GetPlayerCount();
|
||||
|
||||
int count = (playerCount + PlayersPerSpawn - 1) / PlayersPerSpawn;
|
||||
|
||||
if ( count < 1 )
|
||||
count = 1;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public virtual void ClearCreatures()
|
||||
{
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
((Mobile)m_Creatures[i]).Delete();
|
||||
|
||||
m_Creatures.Clear();
|
||||
}
|
||||
|
||||
public virtual void FullSpawn()
|
||||
{
|
||||
ClearCreatures();
|
||||
|
||||
int count = ComputeSpawnCount();
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
Spawn();
|
||||
|
||||
ClearTraps();
|
||||
|
||||
count = ComputeTrapCount();
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
SpawnTrap();
|
||||
}
|
||||
|
||||
public virtual void Spawn()
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( m_TypeName == null )
|
||||
return;
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName( m_TypeName, true );
|
||||
|
||||
if ( type == null )
|
||||
return;
|
||||
|
||||
object obj = Activator.CreateInstance( type );
|
||||
|
||||
if ( obj == null )
|
||||
return;
|
||||
|
||||
if ( obj is Item )
|
||||
{
|
||||
((Item)obj).Delete();
|
||||
}
|
||||
else if ( obj is Mobile )
|
||||
{
|
||||
Mobile mob = (Mobile)obj;
|
||||
|
||||
mob.MoveToWorld( GetWorldLocation(), this.Map );
|
||||
|
||||
m_Creatures.Add( mob );
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RecurseReset()
|
||||
{
|
||||
if ( m_State != GauntletSpawnerState.InSequence )
|
||||
{
|
||||
State = GauntletSpawnerState.InSequence;
|
||||
|
||||
if ( m_Sequence != null && !m_Sequence.Deleted )
|
||||
m_Sequence.RecurseReset();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Slice()
|
||||
{
|
||||
if ( m_State != GauntletSpawnerState.InProgress )
|
||||
return;
|
||||
|
||||
int count = ComputeSpawnCount();
|
||||
|
||||
for ( int i = m_Creatures.Count; i < count; ++i )
|
||||
Spawn();
|
||||
|
||||
if ( HasCompleted )
|
||||
{
|
||||
State = GauntletSpawnerState.Completed;
|
||||
|
||||
if ( m_Sequence != null && !m_Sequence.Deleted )
|
||||
{
|
||||
if ( m_Sequence.State == GauntletSpawnerState.Completed )
|
||||
RecurseReset();
|
||||
|
||||
m_Sequence.State = GauntletSpawnerState.InProgress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "doom spawner"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GauntletSpawner() : this( null )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GauntletSpawner( string typeName ) : base( 0x36FE )
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_TypeName = typeName;
|
||||
m_Creatures = new ArrayList();
|
||||
m_Traps = new ArrayList();
|
||||
}
|
||||
|
||||
public GauntletSpawner( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_RegionBounds );
|
||||
|
||||
writer.WriteItemList( m_Traps, false );
|
||||
|
||||
writer.WriteMobileList( m_Creatures, false );
|
||||
|
||||
writer.Write( m_TypeName );
|
||||
writer.Write( m_Door );
|
||||
writer.Write( m_Addon );
|
||||
writer.Write( m_Sequence );
|
||||
|
||||
writer.Write( (int) m_State );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_RegionBounds = reader.ReadRect2D();
|
||||
m_Traps = reader.ReadItemList();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( version < 1 )
|
||||
{
|
||||
m_Traps = new ArrayList();
|
||||
m_RegionBounds = new Rectangle2D( X - 40, Y - 40, 80, 80 );
|
||||
}
|
||||
|
||||
m_Creatures = reader.ReadMobileList();
|
||||
|
||||
m_TypeName = reader.ReadString();
|
||||
m_Door = reader.ReadItem() as BaseDoor;
|
||||
m_Addon = reader.ReadItem() as BaseAddon;
|
||||
m_Sequence = reader.ReadItem() as GauntletSpawner;
|
||||
|
||||
State = (GauntletSpawnerState)reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
CommandSystem.Register( "GenGauntlet", AccessLevel.Administrator, new CommandEventHandler( GenGauntlet_OnCommand ) );
|
||||
}
|
||||
|
||||
public static void CreateTeleporter( int xFrom, int yFrom, int xTo, int yTo )
|
||||
{
|
||||
Static telePad = new Static( 0x1822 );
|
||||
Teleporter teleItem = new Teleporter( new Point3D( xTo, yTo, -1 ), Map.Malas, false );
|
||||
|
||||
telePad.Hue = 0x482;
|
||||
telePad.MoveToWorld( new Point3D( xFrom, yFrom, -1 ), Map.Malas );
|
||||
|
||||
teleItem.MoveToWorld( new Point3D( xFrom, yFrom, -1 ), Map.Malas );
|
||||
|
||||
teleItem.SourceEffect = true;
|
||||
teleItem.DestEffect = true;
|
||||
teleItem.SoundID = 0x1FE;
|
||||
}
|
||||
|
||||
public static BaseDoor CreateDoorSet( int xDoor, int yDoor, bool doorEastToWest, int hue )
|
||||
{
|
||||
BaseDoor hiDoor = new MetalDoor( doorEastToWest ? DoorFacing.NorthCCW : DoorFacing.WestCW );
|
||||
BaseDoor loDoor = new MetalDoor( doorEastToWest ? DoorFacing.SouthCW : DoorFacing.EastCCW );
|
||||
|
||||
hiDoor.MoveToWorld( new Point3D( xDoor, yDoor, -1 ), Map.Malas );
|
||||
loDoor.MoveToWorld( new Point3D( xDoor + (doorEastToWest ? 0 : 1), yDoor + (doorEastToWest ? 1 : 0), -1 ), Map.Malas );
|
||||
|
||||
hiDoor.Link = loDoor;
|
||||
loDoor.Link = hiDoor;
|
||||
|
||||
hiDoor.Hue = hue;
|
||||
loDoor.Hue = hue;
|
||||
|
||||
return hiDoor;
|
||||
}
|
||||
|
||||
public static GauntletSpawner CreateSpawner( string typeName, int xSpawner, int ySpawner, int xDoor, int yDoor, int xPentagram, int yPentagram, bool doorEastToWest, int xStart, int yStart, int xWidth, int yHeight )
|
||||
{
|
||||
GauntletSpawner spawner = new GauntletSpawner( typeName );
|
||||
|
||||
spawner.MoveToWorld( new Point3D( xSpawner, ySpawner, -1 ), Map.Malas );
|
||||
|
||||
if ( xDoor > 0 && yDoor > 0 )
|
||||
spawner.Door = CreateDoorSet( xDoor, yDoor, doorEastToWest, 0 );
|
||||
|
||||
spawner.RegionBounds = new Rectangle2D( xStart, yStart, xWidth, yHeight );
|
||||
|
||||
if ( xPentagram > 0 && yPentagram > 0 )
|
||||
{
|
||||
PentagramAddon pentagram = new PentagramAddon();
|
||||
|
||||
pentagram.MoveToWorld( new Point3D( xPentagram, yPentagram, -1 ), Map.Malas );
|
||||
|
||||
spawner.Addon = pentagram;
|
||||
}
|
||||
|
||||
return spawner;
|
||||
}
|
||||
|
||||
public static void CreatePricedHealer( int price, int x, int y )
|
||||
{
|
||||
PricedHealer healer = new PricedHealer( price );
|
||||
|
||||
healer.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );
|
||||
|
||||
healer.Home = healer.Location;
|
||||
healer.RangeHome = 5;
|
||||
}
|
||||
|
||||
public static void CreateMorphItem( int x, int y, int inactiveItemID, int activeItemID, int range, int hue )
|
||||
{
|
||||
MorphItem item = new MorphItem( inactiveItemID, activeItemID, range );
|
||||
|
||||
item.Hue = hue;
|
||||
item.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );
|
||||
}
|
||||
|
||||
public static void CreateVarietyDealer( int x, int y )
|
||||
{
|
||||
VarietyDealer dealer = new VarietyDealer();
|
||||
|
||||
/* Begin outfit */
|
||||
dealer.Name = "Nix";
|
||||
dealer.Title = "the Variety Dealer";
|
||||
|
||||
dealer.Body = 400;
|
||||
dealer.Female = false;
|
||||
dealer.Hue = 0x8835;
|
||||
|
||||
ArrayList items = new ArrayList( dealer.Items );
|
||||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
Item item = (Item)items[i];
|
||||
|
||||
if ( item.Layer != Layer.ShopBuy && item.Layer != Layer.ShopResale && item.Layer != Layer.ShopSell )
|
||||
item.Delete();
|
||||
}
|
||||
|
||||
dealer.HairItemID = 0x2049; // Pig Tails
|
||||
dealer.HairHue = 0x482;
|
||||
|
||||
dealer.FacialHairItemID = 0x203E;
|
||||
dealer.FacialHairHue = 0x482;
|
||||
|
||||
dealer.AddItem( new FloppyHat( 1 ) );
|
||||
dealer.AddItem( new Robe( 1 ) );
|
||||
|
||||
dealer.AddItem( new LanternOfSouls() );
|
||||
|
||||
dealer.AddItem( new Sandals( 0x482 ) );
|
||||
/* End outfit */
|
||||
|
||||
dealer.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );
|
||||
|
||||
dealer.Home = dealer.Location;
|
||||
dealer.RangeHome = 2;
|
||||
}
|
||||
|
||||
public static void GenGauntlet_OnCommand( CommandEventArgs e )
|
||||
{
|
||||
/* Begin healer room */
|
||||
CreatePricedHealer( 5000, 387, 400 );
|
||||
CreateTeleporter( 390, 407, 394, 405 );
|
||||
|
||||
BaseDoor healerDoor = CreateDoorSet( 393, 404, true, 0x44E );
|
||||
|
||||
healerDoor.Locked = true;
|
||||
healerDoor.KeyValue = Key.RandomValue();
|
||||
|
||||
if ( healerDoor.Link != null )
|
||||
{
|
||||
healerDoor.Link.Locked = true;
|
||||
healerDoor.Link.KeyValue = Key.RandomValue();
|
||||
}
|
||||
/* End healer room */
|
||||
|
||||
/* Begin supply room */
|
||||
CreateMorphItem( 433, 371, 0x29F, 0x116, 3, 0x44E );
|
||||
CreateMorphItem( 433, 372, 0x29F, 0x115, 3, 0x44E );
|
||||
|
||||
CreateVarietyDealer( 492, 369 );
|
||||
|
||||
for ( int x = 434; x <= 478; ++x )
|
||||
{
|
||||
for ( int y = 371; y <= 372; ++y )
|
||||
{
|
||||
Static item = new Static( 0x524 );
|
||||
|
||||
item.Hue = 1;
|
||||
item.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );
|
||||
}
|
||||
}
|
||||
/* End supply room */
|
||||
|
||||
/* Begin gauntlet cycle */
|
||||
CreateTeleporter( 471, 428, 474, 428 );
|
||||
CreateTeleporter( 462, 494, 462, 498 );
|
||||
CreateTeleporter( 403, 502, 399, 506 );
|
||||
CreateTeleporter( 357, 476, 356, 480 );
|
||||
CreateTeleporter( 361, 433, 357, 434 );
|
||||
|
||||
GauntletSpawner sp1 = CreateSpawner( "DarknightCreeper", 491, 456, 473, 432, 417, 426, true, 473, 412, 39, 60 );
|
||||
GauntletSpawner sp2 = CreateSpawner( "FleshRenderer", 482, 520, 468, 496, 426, 422, false, 448, 496, 56, 48 );
|
||||
GauntletSpawner sp3 = CreateSpawner( "Impaler", 406, 538, 408, 504, 432, 430, false, 376, 504, 64, 48 );
|
||||
GauntletSpawner sp4 = CreateSpawner( "ShadowKnight", 335, 512, 360, 478, 424, 439, false, 300, 478, 72, 64 );
|
||||
GauntletSpawner sp5 = CreateSpawner( "AbysmalHorror", 326, 433, 360, 429, 416, 435, true, 300, 408, 60, 56 );
|
||||
GauntletSpawner sp6 = CreateSpawner( "DemonKnight", 423, 430, 0, 0, 423, 430, true, 392, 392, 72, 96 );
|
||||
|
||||
sp1.Sequence = sp2;
|
||||
sp2.Sequence = sp3;
|
||||
sp3.Sequence = sp4;
|
||||
sp4.Sequence = sp5;
|
||||
sp5.Sequence = sp6;
|
||||
sp6.Sequence = sp1;
|
||||
|
||||
sp1.State = GauntletSpawnerState.InProgress;
|
||||
/* End gauntlet cycle */
|
||||
|
||||
/* Begin exit gate */
|
||||
ConfirmationMoongate gate = new ConfirmationMoongate();
|
||||
|
||||
gate.Dispellable = false;
|
||||
|
||||
gate.Target = new Point3D( 2350, 1270, -85 );
|
||||
gate.TargetMap = Map.Malas;
|
||||
|
||||
gate.GumpWidth = 420;
|
||||
gate.GumpHeight = 280;
|
||||
|
||||
gate.MessageColor = 0x7F00;
|
||||
gate.MessageNumber = 1062109; // You are about to exit Dungeon Doom. Do you wish to continue?
|
||||
|
||||
gate.TitleColor = 0x7800;
|
||||
gate.TitleNumber = 1062108; // Please verify...
|
||||
|
||||
gate.Hue = 0x44E;
|
||||
|
||||
gate.MoveToWorld( new Point3D( 433, 326, 4 ), Map.Malas );
|
||||
/* End exit gate */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class GauntletRegion : BaseRegion
|
||||
{
|
||||
private GauntletSpawner m_Spawner;
|
||||
|
||||
public GauntletRegion( GauntletSpawner spawner, Map map )
|
||||
: base( null, map, Region.Find( spawner.Location, spawner.Map ), spawner.RegionBounds )
|
||||
{
|
||||
m_Spawner = spawner;
|
||||
|
||||
GoLocation = spawner.Location;
|
||||
|
||||
Register();
|
||||
}
|
||||
|
||||
public override void AlterLightLevel( Mobile m, ref int global, ref int personal )
|
||||
{
|
||||
global = 12;
|
||||
}
|
||||
|
||||
public override void OnEnter( Mobile m )
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnExit( Mobile m )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
252
Scripts/Engines/Ethics/Core/Ethic.cs
Normal file
252
Scripts/Engines/Ethics/Core/Ethic.cs
Normal file
|
|
@ -0,0 +1,252 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Ethics
|
||||
{
|
||||
public abstract class Ethic
|
||||
{
|
||||
public static readonly bool Enabled = false;
|
||||
|
||||
public static Ethic Find( Item item )
|
||||
{
|
||||
if ( ( item.SavedFlags & 0x100 ) != 0 )
|
||||
{
|
||||
if ( item.Hue == Hero.Definition.PrimaryHue )
|
||||
return Hero;
|
||||
|
||||
item.SavedFlags &= ~0x100;
|
||||
}
|
||||
|
||||
if ( ( item.SavedFlags & 0x200 ) != 0 )
|
||||
{
|
||||
if ( item.Hue == Evil.Definition.PrimaryHue )
|
||||
return Evil;
|
||||
|
||||
item.SavedFlags &= ~0x200;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool CheckTrade( Mobile from, Mobile to, Mobile newOwner, Item item )
|
||||
{
|
||||
Ethic itemEthic = Find( item );
|
||||
|
||||
if ( itemEthic == null || Find( newOwner ) == itemEthic )
|
||||
return true;
|
||||
|
||||
if ( itemEthic == Hero )
|
||||
( from == newOwner ? to : from ).SendMessage( "Only heros may receive this item." );
|
||||
else if ( itemEthic == Evil )
|
||||
( from == newOwner ? to : from ).SendMessage( "Only the evil may receive this item." );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CheckEquip( Mobile from, Item item )
|
||||
{
|
||||
Ethic itemEthic = Find( item );
|
||||
|
||||
if ( itemEthic == null || Find( from ) == itemEthic )
|
||||
return true;
|
||||
|
||||
if ( itemEthic == Hero )
|
||||
from.SendMessage( "Only heros may wear this item." );
|
||||
else if ( itemEthic == Evil )
|
||||
from.SendMessage( "Only the evil may wear this item." );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsImbued( Item item )
|
||||
{
|
||||
return IsImbued( item, false );
|
||||
}
|
||||
|
||||
public static bool IsImbued( Item item, bool recurse )
|
||||
{
|
||||
if ( Find( item ) != null )
|
||||
return true;
|
||||
|
||||
if ( recurse )
|
||||
{
|
||||
foreach ( Item child in item.Items )
|
||||
{
|
||||
if ( IsImbued( child, true ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
if( Enabled )
|
||||
EventSink.Speech += new SpeechEventHandler( EventSink_Speech );
|
||||
}
|
||||
|
||||
public static void EventSink_Speech( SpeechEventArgs e )
|
||||
{
|
||||
if ( e.Blocked || e.Handled )
|
||||
return;
|
||||
|
||||
Player pl = Player.Find( e.Mobile );
|
||||
|
||||
if ( pl == null )
|
||||
{
|
||||
for ( int i = 0; i < Ethics.Length; ++i )
|
||||
{
|
||||
Ethic ethic = Ethics[i];
|
||||
|
||||
if ( !ethic.IsEligible( e.Mobile ) )
|
||||
continue;
|
||||
|
||||
if ( !Insensitive.Equals( ethic.Definition.JoinPhrase.String, e.Speech ) )
|
||||
continue;
|
||||
|
||||
bool isNearAnkh = false;
|
||||
|
||||
foreach ( Item item in e.Mobile.GetItemsInRange( 2 ) )
|
||||
{
|
||||
if ( item is Items.AnkhEast || item is Items.AnkhWest )
|
||||
{
|
||||
isNearAnkh = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !isNearAnkh )
|
||||
continue;
|
||||
|
||||
pl = new Player( ethic, e.Mobile );
|
||||
|
||||
pl.Attach();
|
||||
|
||||
e.Mobile.FixedEffect( 0x373A, 10, 30 );
|
||||
e.Mobile.PlaySound( 0x209 );
|
||||
|
||||
e.Handled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Ethic ethic = pl.Ethic;
|
||||
|
||||
for ( int i = 0; i < ethic.Definition.Powers.Length; ++i )
|
||||
{
|
||||
Power power = ethic.Definition.Powers[i];
|
||||
|
||||
if ( !Insensitive.Equals( power.Definition.Phrase.String, e.Speech ) )
|
||||
continue;
|
||||
|
||||
if ( !power.CheckInvoke( pl ) )
|
||||
continue;
|
||||
|
||||
power.BeginInvoke( pl );
|
||||
e.Handled = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected EthicDefinition m_Definition;
|
||||
|
||||
protected PlayerCollection m_Players;
|
||||
|
||||
public EthicDefinition Definition
|
||||
{
|
||||
get { return m_Definition; }
|
||||
}
|
||||
|
||||
public PlayerCollection Players
|
||||
{
|
||||
get { return m_Players; }
|
||||
}
|
||||
|
||||
public static Ethic Find( Mobile mob )
|
||||
{
|
||||
return Find( mob, false, false );
|
||||
}
|
||||
|
||||
public static Ethic Find( Mobile mob, bool inherit )
|
||||
{
|
||||
return Find( mob, inherit, false );
|
||||
}
|
||||
|
||||
public static Ethic Find( Mobile mob, bool inherit, bool allegiance )
|
||||
{
|
||||
Player pl = Player.Find( mob );
|
||||
|
||||
if ( pl != null )
|
||||
return pl.Ethic;
|
||||
|
||||
if ( inherit && mob is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature) mob;
|
||||
|
||||
if ( bc.Controlled )
|
||||
return Find( bc.ControlMaster, false );
|
||||
else if ( bc.Summoned )
|
||||
return Find( bc.SummonMaster, false );
|
||||
else if ( allegiance )
|
||||
return bc.EthicAllegiance;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Ethic()
|
||||
{
|
||||
m_Players = new PlayerCollection();
|
||||
}
|
||||
|
||||
public abstract bool IsEligible( Mobile mob );
|
||||
|
||||
public virtual void Deserialize( GenericReader reader )
|
||||
{
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
int playerCount = reader.ReadEncodedInt();
|
||||
|
||||
for ( int i = 0; i < playerCount; ++i )
|
||||
{
|
||||
Player pl = new Player( this, reader );
|
||||
|
||||
if ( pl.Mobile != null )
|
||||
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( pl.CheckAttach ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.WriteEncodedInt( m_Players.Count );
|
||||
|
||||
for ( int i = 0; i < m_Players.Count; ++i )
|
||||
m_Players[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public static readonly Ethic Hero = new Hero.HeroEthic();
|
||||
public static readonly Ethic Evil = new Evil.EvilEthic();
|
||||
|
||||
public static readonly Ethic[] Ethics = new Ethic[]
|
||||
{
|
||||
Hero,
|
||||
Evil
|
||||
};
|
||||
}
|
||||
}
|
||||
66
Scripts/Engines/Ethics/Core/Persistance.cs
Normal file
66
Scripts/Engines/Ethics/Core/Persistance.cs
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Ethics
|
||||
{
|
||||
public class EthicsPersistance : Item
|
||||
{
|
||||
private static EthicsPersistance m_Instance;
|
||||
|
||||
public static EthicsPersistance Instance { get { return m_Instance; } }
|
||||
|
||||
public override string DefaultName
|
||||
{
|
||||
get { return "Ethics Persistance - Internal"; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public EthicsPersistance()
|
||||
: base( 1 )
|
||||
{
|
||||
Movable = false;
|
||||
|
||||
if ( m_Instance == null || m_Instance.Deleted )
|
||||
m_Instance = this;
|
||||
else
|
||||
base.Delete();
|
||||
}
|
||||
|
||||
public EthicsPersistance( Serial serial )
|
||||
: base( serial )
|
||||
{
|
||||
m_Instance = this;
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
for ( int i = 0; i < Ethics.Ethic.Ethics.Length; ++i )
|
||||
Ethics.Ethic.Ethics[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
for ( int i = 0; i < Ethics.Ethic.Ethics.Length; ++i )
|
||||
Ethics.Ethic.Ethics[i].Deserialize( reader );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Delete()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
171
Scripts/Engines/Ethics/Core/Player.cs
Normal file
171
Scripts/Engines/Ethics/Core/Player.cs
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Ethics
|
||||
{
|
||||
public class PlayerCollection : System.Collections.ObjectModel.Collection<Player>
|
||||
{
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class Player
|
||||
{
|
||||
public static Player Find( Mobile mob )
|
||||
{
|
||||
return Find( mob, false );
|
||||
}
|
||||
|
||||
public static Player Find( Mobile mob, bool inherit )
|
||||
{
|
||||
PlayerMobile pm = mob as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
{
|
||||
if ( inherit && mob is BaseCreature )
|
||||
{
|
||||
BaseCreature bc = mob as BaseCreature;
|
||||
|
||||
if ( bc != null && bc.Controlled )
|
||||
pm = bc.ControlMaster as PlayerMobile;
|
||||
else if ( bc != null && bc.Summoned )
|
||||
pm = bc.SummonMaster as PlayerMobile;
|
||||
}
|
||||
|
||||
if ( pm == null )
|
||||
return null;
|
||||
}
|
||||
|
||||
Player pl = pm.EthicPlayer;
|
||||
|
||||
if ( pl != null && !pl.Ethic.IsEligible( pl.Mobile ) )
|
||||
pm.EthicPlayer = pl = null;
|
||||
|
||||
return pl;
|
||||
}
|
||||
|
||||
private Ethic m_Ethic;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
private int m_Power;
|
||||
private int m_History;
|
||||
|
||||
private Mobile m_Steed;
|
||||
private Mobile m_Familiar;
|
||||
|
||||
private DateTime m_Shield;
|
||||
|
||||
public Ethic Ethic { get { return m_Ethic; } }
|
||||
public Mobile Mobile { get { return m_Mobile; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Power { get { return m_Power; } set { m_Power = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int History { get { return m_History; } set { m_History = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public Mobile Steed { get { return m_Steed; } set { m_Steed = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public Mobile Familiar { get { return m_Familiar; } set { m_Familiar = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsShielded
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Shield == DateTime.MinValue )
|
||||
return false;
|
||||
|
||||
if ( DateTime.Now < ( m_Shield + TimeSpan.FromHours( 1.0 ) ) )
|
||||
return true;
|
||||
|
||||
FinishShield();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void BeginShield()
|
||||
{
|
||||
m_Shield = DateTime.Now;
|
||||
}
|
||||
|
||||
public void FinishShield()
|
||||
{
|
||||
m_Shield = DateTime.MinValue;
|
||||
}
|
||||
|
||||
public Player( Ethic ethic, Mobile mobile )
|
||||
{
|
||||
m_Ethic = ethic;
|
||||
m_Mobile = mobile;
|
||||
|
||||
m_Power = 5;
|
||||
m_History = 5;
|
||||
}
|
||||
|
||||
public void CheckAttach()
|
||||
{
|
||||
if ( m_Ethic.IsEligible( m_Mobile ) )
|
||||
Attach();
|
||||
}
|
||||
|
||||
public void Attach()
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile )
|
||||
( m_Mobile as PlayerMobile ).EthicPlayer = this;
|
||||
|
||||
m_Ethic.Players.Add( this );
|
||||
}
|
||||
|
||||
public void Detach()
|
||||
{
|
||||
if ( m_Mobile is PlayerMobile )
|
||||
( m_Mobile as PlayerMobile ).EthicPlayer = null;
|
||||
|
||||
m_Ethic.Players.Remove( this );
|
||||
}
|
||||
|
||||
public Player( Ethic ethic, GenericReader reader )
|
||||
{
|
||||
m_Ethic = ethic;
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
|
||||
m_Power = reader.ReadEncodedInt();
|
||||
m_History = reader.ReadEncodedInt();
|
||||
|
||||
m_Steed = reader.ReadMobile();
|
||||
m_Familiar = reader.ReadMobile();
|
||||
|
||||
m_Shield = reader.ReadDeltaTime();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_Mobile );
|
||||
|
||||
writer.WriteEncodedInt( m_Power );
|
||||
writer.WriteEncodedInt( m_History );
|
||||
|
||||
writer.Write( m_Steed );
|
||||
writer.Write( m_Familiar );
|
||||
|
||||
writer.WriteDeltaTime( m_Shield );
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue