#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.

This commit is contained in:
WarrentyExpired 2026-08-06 11:06:05 -04:00
parent b51c58f514
commit 3045c83799
3512 changed files with 627673 additions and 0 deletions

View file

@ -0,0 +1,266 @@
using Server;
using System;
using Server.Misc;
using Server.Mobiles;
namespace Server.Items
{
public abstract class BasePigmentsOfTokuno : Item, IUsesRemaining
{
private static Type[] m_Glasses = new Type[]
{
typeof( MaritimeGlasses ),
typeof( WizardsGlasses ),
typeof( TradeGlasses ),
typeof( LyricalGlasses ),
typeof( NecromanticGlasses ),
typeof( LightOfWayGlasses ),
typeof( FoldedSteelGlasses ),
typeof( PoisonedGlasses ),
typeof( TreasureTrinketGlasses ),
typeof( MaceShieldGlasses ),
typeof( ArtsGlasses ),
typeof( AnthropomorphistGlasses )
};
private static Type[] m_Replicas = new Type[]
{
typeof( ANecromancerShroud ),
typeof( BraveKnightOfTheBritannia ),
typeof( CaptainJohnsHat ),
typeof( DetectiveBoots ),
typeof( DjinnisRing ),
typeof( EmbroideredOakLeafCloak ),
typeof( GuantletsOfAnger ),
typeof( LieutenantOfTheBritannianRoyalGuard ),
typeof( OblivionsNeedle ),
typeof( RoyalGuardSurvivalKnife ),
typeof( SamaritanRobe ),
typeof( TheMostKnowledgePerson ),
typeof( TheRobeOfBritanniaAri ),
typeof( AcidProofRobe ),
typeof( Calm ),
typeof( CrownOfTalKeesh ),
typeof( FangOfRactus ),
typeof( GladiatorsCollar ),
typeof( OrcChieftainHelm ),
typeof( Pacify ),
typeof( Quell ),
typeof( ShroudOfDeciet ),
typeof( Subdue )
};
private static Type[] m_DyableHeritageItems = new Type[]
{
typeof( ChargerOfTheFallen ),
typeof( SamuraiHelm ),
typeof( HolySword ),
typeof( LeggingsOfEmbers ),
typeof( ShaminoCrossbow )
};
public override int LabelNumber { get { return 1070933; } } // Pigments of Tokuno
private int m_UsesRemaining;
private TextDefinition m_Label;
protected TextDefinition Label
{
get { return m_Label; }
set { m_Label = value; InvalidateProperties(); }
}
#region Old Item Serialization Vars
/* DO NOT USE! Only used in serialization of pigments that originally derived from Item */
private bool m_InheritsItem;
protected bool InheritsItem
{
get{ return m_InheritsItem; }
}
#endregion
public BasePigmentsOfTokuno() : base( 0xEFF )
{
Weight = 1.0;
m_UsesRemaining = 1;
}
public BasePigmentsOfTokuno( int uses ) : base( 0xEFF )
{
Weight = 1.0;
m_UsesRemaining = uses;
}
public BasePigmentsOfTokuno( Serial serial ) : base( serial )
{
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
if( m_Label != null && m_Label > 0 )
TextDefinition.AddTo( list, m_Label );
list.Add( 1060584, m_UsesRemaining.ToString() ); // uses remaining: ~1_val~
}
public override void OnDoubleClick( Mobile from )
{
if( IsAccessibleTo( from ) && from.InRange( GetWorldLocation(), 3 ) )
{
from.SendLocalizedMessage( 1070929 ); // Select the artifact or enhanced magic item to dye.
from.BeginTarget( 3, false, Server.Targeting.TargetFlags.None, new TargetStateCallback( InternalCallback ), this );
}
else
from.SendLocalizedMessage( 502436 ); // That is not accessible.
}
private void InternalCallback( Mobile from, object targeted, object state )
{
BasePigmentsOfTokuno pigment = (BasePigmentsOfTokuno)state;
if( pigment.Deleted || pigment.UsesRemaining <= 0 || !from.InRange( pigment.GetWorldLocation(), 3 ) || !pigment.IsAccessibleTo( from ))
return;
Item i = targeted as Item;
if( i == null )
from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub.
else if( !from.InRange( i.GetWorldLocation(), 3 ) || !IsAccessibleTo( from ) )
from.SendLocalizedMessage( 502436 ); // That is not accessible.
else if( from.Items.Contains( i ) )
from.SendLocalizedMessage( 1070930 ); // Can't dye artifacts or enhanced magic items that are being worn.
else if( i.IsLockedDown )
from.SendLocalizedMessage( 1070932 ); // You may not dye artifacts and enhanced magic items which are locked down.
else if( i.QuestItem )
from.SendLocalizedMessage( 1151836 ); // You may not dye toggled quest items.
else if( i is MetalPigmentsOfTokuno )
from.SendLocalizedMessage( 1042417 ); // You cannot dye that.
else if( i is LesserPigmentsOfTokuno )
from.SendLocalizedMessage( 1042417 ); // You cannot dye that.
else if( i is PigmentsOfTokuno )
from.SendLocalizedMessage( 1042417 ); // You cannot dye that.
else if( !IsValidItem( i ) )
from.SendLocalizedMessage( 1070931 ); // You can only dye artifacts and enhanced magic items with this tub. //Yes, it says tub on OSI. Don't ask me why ;p
else
{
//Notes: on OSI there IS no hue check to see if it's already hued. and no messages on successful hue either
i.Hue = Hue;
if( --pigment.UsesRemaining <= 0 )
pigment.Delete();
from.PlaySound(0x23E); // As per OSI TC1
}
}
public static bool IsValidItem( Item i )
{
if( i is BasePigmentsOfTokuno )
return false;
Type t = i.GetType();
CraftResource resource = CraftResource.None;
if( i is BaseWeapon )
resource = ((BaseWeapon)i).Resource;
else if( i is BaseArmor )
resource = ((BaseArmor)i).Resource;
else if (i is BaseClothing)
resource = ((BaseClothing)i).Resource;
if( !CraftResources.IsStandard( resource ) )
return true;
if ( i is ITokunoDyable )
return true;
return(
IsInTypeList( t, TreasuresOfTokuno.LesserArtifactsTotal )
|| IsInTypeList( t, TreasuresOfTokuno.GreaterArtifacts )
|| IsInTypeList( t, DemonKnight.ArtifactRarity10 )
|| IsInTypeList( t, DemonKnight.ArtifactRarity11 )
|| IsInTypeList( t, MondainsLegacy.Artifacts )
|| IsInTypeList( t, StealableArtifactsSpawner.TypesOfEntires )
|| IsInTypeList( t, Paragon.Artifacts )
|| IsInTypeList( t, Leviathan.Artifacts )
|| IsInTypeList( t, TreasureMapChest.Artifacts )
|| IsInTypeList( t, m_Replicas )
|| IsInTypeList( t, m_DyableHeritageItems )
|| IsInTypeList( t, m_Glasses )
);
}
private static bool IsInTypeList( Type t, Type[] list )
{
for( int i = 0; i < list.Length; i++ )
{
if( list[i] == t ) return true;
}
return false;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)1 );
writer.WriteEncodedInt( m_UsesRemaining );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 1:
{
m_UsesRemaining = reader.ReadEncodedInt();
break;
}
case 0: // Old pigments that inherited from item
{
m_InheritsItem = true;
if ( this is LesserPigmentsOfTokuno )
((LesserPigmentsOfTokuno)this).Type = (LesserPigmentType)reader.ReadEncodedInt();
else if ( this is PigmentsOfTokuno )
((PigmentsOfTokuno)this).Type = (PigmentType)reader.ReadEncodedInt();
else if ( this is MetalPigmentsOfTokuno )
reader.ReadEncodedInt();
m_UsesRemaining = reader.ReadEncodedInt();
break;
}
}
}
#region IUsesRemaining Members
[CommandProperty( AccessLevel.GameMaster )]
public int UsesRemaining
{
get { return m_UsesRemaining; }
set { m_UsesRemaining = value; InvalidateProperties(); }
}
public bool ShowUsesRemaining
{
get { return true; }
set {}
}
#endregion
}
}

View file

@ -0,0 +1,506 @@
using Server;
using System;
using Server.Misc;
using Server.Mobiles;
namespace Server.Items
{
public class DarkenedSky : Kama
{
public override int InitMinHits { get { return 255; } }
public override int InitMaxHits { get { return 255; } }
public override int LabelNumber { get { return 1070966; } } // Darkened Sky
[Constructable]
public DarkenedSky() : base()
{
WeaponAttributes.HitLightning = 60;
Attributes.WeaponSpeed = 25;
Attributes.WeaponDamage = 50;
}
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
{
phys = fire = pois = chaos = direct = 0;
cold = nrgy = 50;
}
public DarkenedSky( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class KasaOfTheRajin : Kasa
{
public override int LabelNumber { get { return 1070969; } } // Kasa of the Raj-in
public override int BasePhysicalResistance { get { return 12; } }
public override int BaseFireResistance { get { return 17; } }
public override int BaseColdResistance { get { return 21; } }
public override int BasePoisonResistance { get { return 17; } }
public override int BaseEnergyResistance { get { return 17; } }
public override int InitMinHits { get { return 255; } }
public override int InitMaxHits { get { return 255; } }
[Constructable]
public KasaOfTheRajin() : base()
{
Attributes.SpellDamage = 12;
}
public KasaOfTheRajin( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)2 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
if ( version <= 1 )
{
MaxHitPoints = 255;
HitPoints = 255;
}
if( version == 0 )
LootType = LootType.Regular;
}
}
public class RuneBeetleCarapace : PlateDo
{
public override int InitMinHits { get { return 255; } }
public override int InitMaxHits { get { return 255; } }
public override int LabelNumber{ get{ return 1070968; } } // Rune Beetle Carapace
public override int BaseColdResistance { get { return 14; } }
public override int BaseEnergyResistance { get { return 14; } }
[Constructable]
public RuneBeetleCarapace() : base()
{
Attributes.BonusMana = 10;
Attributes.RegenMana = 3;
Attributes.LowerManaCost = 15;
ArmorAttributes.LowerStatReq = 100;
ArmorAttributes.MageArmor = 1;
}
public RuneBeetleCarapace( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class Stormgrip : LeatherNinjaMitts
{
public override int InitMinHits { get { return 255; } }
public override int InitMaxHits { get { return 255; } }
public override int LabelNumber{ get{ return 1070970; } } // Stormgrip
public override int BasePhysicalResistance { get { return 10; } }
public override int BaseColdResistance { get { return 18; } }
public override int BaseEnergyResistance { get { return 18; } }
[Constructable]
public Stormgrip() : base()
{
Attributes.BonusInt = 8;
Attributes.Luck = 125;
Attributes.WeaponDamage = 25;
}
public Stormgrip( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class SwordOfTheStampede : NoDachi
{
public override int InitMinHits { get { return 255; } }
public override int InitMaxHits { get { return 255; } }
public override int LabelNumber { get { return 1070964; } } // Sword of the Stampede
[Constructable]
public SwordOfTheStampede() : base()
{
WeaponAttributes.HitHarm = 100;
Attributes.AttackChance = 10;
Attributes.WeaponDamage = 60;
}
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
{
phys = fire = pois = nrgy = chaos = direct = 0;
cold = 100;
}
public SwordOfTheStampede( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class SwordsOfProsperity : Daisho
{
public override int InitMinHits { get { return 255; } }
public override int InitMaxHits { get { return 255; } }
public override int LabelNumber { get { return 1070963; } } // Swords of Prosperity
[Constructable]
public SwordsOfProsperity() : base()
{
WeaponAttributes.MageWeapon = 30;
Attributes.SpellChanneling = 1;
Attributes.CastSpeed = 1;
Attributes.Luck = 200;
}
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
{
phys = cold = pois = nrgy = chaos = direct = 0;
fire = 100;
}
public SwordsOfProsperity( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class TheHorselord : Yumi
{
public override int InitMinHits { get { return 255; } }
public override int InitMaxHits { get { return 255; } }
public override int LabelNumber { get { return 1070967; } } // The Horselord
[Constructable]
public TheHorselord() : base()
{
Attributes.BonusDex = 5;
Attributes.RegenMana = 1;
Attributes.Luck = 125;
Attributes.WeaponDamage = 50;
Slayer = SlayerName.ElementalBan;
Slayer2 = SlayerName.ReptilianDeath;
}
public TheHorselord( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class TomeOfLostKnowledge : Spellbook
{
public override int LabelNumber { get { return 1070971; } } // Tome of Lost Knowledge
[Constructable]
public TomeOfLostKnowledge() : base()
{
LootType = LootType.Regular;
Hue = 0x530;
SkillBonuses.SetValues( 0, SkillName.Magery, 15.0 );
Attributes.BonusInt = 8;
Attributes.LowerManaCost = 15;
Attributes.SpellDamage = 15;
}
public TomeOfLostKnowledge( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class WindsEdge : Tessen
{
public override int LabelNumber { get { return 1070965; } } // Wind's Edge
[Constructable]
public WindsEdge() : base()
{
WeaponAttributes.HitLeechMana = 40;
Attributes.WeaponDamage = 50;
Attributes.WeaponSpeed = 50;
Attributes.DefendChance = 10;
}
public override void GetDamageTypes( Mobile wielder, out int phys, out int fire, out int cold, out int pois, out int nrgy, out int chaos, out int direct )
{
phys = fire = cold = pois = chaos = direct = 0;
nrgy = 100;
}
public WindsEdge( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)0 );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override int InitMinHits { get { return 255; } }
public override int InitMaxHits { get { return 255; } }
}
public enum PigmentType
{
None,
ParagonGold,
VioletCouragePurple,
InvulnerabilityBlue,
LunaWhite,
DryadGreen,
ShadowDancerBlack,
BerserkerRed,
NoxGreen,
RumRed,
FireOrange,
FadedCoal,
Coal,
FadedGold,
StormBronze,
Rose,
MidnightCoal,
FadedBronze,
FadedRose,
DeepRose
}
public class PigmentsOfTokuno : BasePigmentsOfTokuno
{
private static int[][] m_Table = new int[][]
{
// Hue, Label
new int[]{ /*PigmentType.None,*/ 0, -1 },
new int[]{ /*PigmentType.ParagonGold,*/ 0x501, 1070987 },
new int[]{ /*PigmentType.VioletCouragePurple,*/ 0x486, 1070988 },
new int[]{ /*PigmentType.InvulnerabilityBlue,*/ 0x4F2, 1070989 },
new int[]{ /*PigmentType.LunaWhite,*/ 0x47E, 1070990 },
new int[]{ /*PigmentType.DryadGreen,*/ 0x48F, 1070991 },
new int[]{ /*PigmentType.ShadowDancerBlack,*/ 0x455, 1070992 },
new int[]{ /*PigmentType.BerserkerRed,*/ 0x21, 1070993 },
new int[]{ /*PigmentType.NoxGreen,*/ 0x58C, 1070994 },
new int[]{ /*PigmentType.RumRed,*/ 0x66C, 1070995 },
new int[]{ /*PigmentType.FireOrange,*/ 0x54F, 1070996 },
new int[]{ /*PigmentType.Fadedcoal,*/ 0x96A, 1079579 },
new int[]{ /*PigmentType.Coal,*/ 0x96B, 1079580 },
new int[]{ /*PigmentType.FadedGold,*/ 0x972, 1079581 },
new int[]{ /*PigmentType.StormBronze,*/ 0x977, 1079582 },
new int[]{ /*PigmentType.Rose,*/ 0x97C, 1079583 },
new int[]{ /*PigmentType.MidnightCoal,*/ 0x96C, 1079584 },
new int[]{ /*PigmentType.FadedBronze,*/ 0x975, 1079585 },
new int[]{ /*PigmentType.FadedRose,*/ 0x97B, 1079586 },
new int[]{ /*PigmentType.DeepRose,*/ 0x97E, 1079587 }
};
public static int[] GetInfo( PigmentType type )
{
int v = (int)type;
if( v < 0 || v >= m_Table.Length )
v = 0;
return m_Table[v];
}
private PigmentType m_Type;
[CommandProperty( AccessLevel.GameMaster )]
public PigmentType Type
{
get { return m_Type; }
set
{
m_Type = value;
int v = (int)m_Type;
if ( v >= 0 && v < m_Table.Length )
{
Hue = m_Table[v][0];
Label = m_Table[v][1];
}
else
{
Hue = 0;
Label = -1;
}
}
}
public override int LabelNumber { get { return 1070933; } } // Pigments of Tokuno
[Constructable]
public PigmentsOfTokuno() : this( PigmentType.None, 10 )
{
}
[Constructable]
public PigmentsOfTokuno( PigmentType type ) : this( type, (type == PigmentType.None||type >= PigmentType.FadedCoal)? 10 : 50 )
{
}
[Constructable]
public PigmentsOfTokuno( PigmentType type, int uses ) : base( uses )
{
Weight = 1.0;
Type = type;
}
public PigmentsOfTokuno( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int)1 );
writer.WriteEncodedInt( (int)m_Type );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = ( InheritsItem ? 0 : reader.ReadInt() ); // Required for BasePigmentsOfTokuno insertion
switch ( version )
{
case 1: Type = (PigmentType)reader.ReadEncodedInt(); break;
case 0: break;
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,637 @@
using System;
using Server;
using Server.Network;
using System.Collections;
using System.Collections.Generic;
using Server.Items;
using Server.Gumps;
using Server.Misc;
using Server.Mobiles;
namespace Server.Misc
{
public enum TreasuresOfTokunoEra
{
None,
ToTOne,
ToTTwo,
ToTThree
}
public class TreasuresOfTokuno
{
public const int ItemsPerReward = 10;
private static Type[] m_LesserArtifactsTotal = new Type[]
{
typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), typeof( BlackLotusHood ),
typeof( DaimyosHelm ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ),
typeof( HanzosBow ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ),
typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( PigmentsOfTokuno ), typeof( FluteOfRenewal ),
typeof( LeurociansMempoOfFortune ), typeof( LesserPigmentsOfTokuno ), typeof( MetalPigmentsOfTokuno ), typeof( ChestOfHeirlooms )
};
public static Type[] LesserArtifactsTotal { get { return m_LesserArtifactsTotal; } }
private static TreasuresOfTokunoEra _DropEra = TreasuresOfTokunoEra.None;
private static TreasuresOfTokunoEra _RewardEra = TreasuresOfTokunoEra.ToTOne;
public static TreasuresOfTokunoEra DropEra
{
get { return _DropEra; }
set { _DropEra = value; }
}
public static TreasuresOfTokunoEra RewardEra
{
get { return _RewardEra; }
set { _RewardEra = value; }
}
private static Type[][] m_LesserArtifacts = new Type[][]
{
// ToT One Rewards
new Type[] {
typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ), typeof( BlackLotusHood ),
typeof( DaimyosHelm ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ),
typeof( HanzosBow ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ),
typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( PigmentsOfTokuno ),
typeof( FluteOfRenewal ), typeof( ChestOfHeirlooms )
},
// ToT Two Rewards
new Type[] {
typeof( MetalPigmentsOfTokuno ), typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ),
typeof( MetalPigmentsOfTokuno ), typeof( BlackLotusHood ), typeof( DaimyosHelm ), typeof( DemonForks ),
typeof( MetalPigmentsOfTokuno ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ), typeof( HanzosBow ),
typeof( MetalPigmentsOfTokuno ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ),
typeof( MetalPigmentsOfTokuno ), typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ),
typeof( MetalPigmentsOfTokuno ), typeof( FluteOfRenewal ), typeof( ChestOfHeirlooms )
},
// ToT Three Rewards
new Type[] {
typeof( LesserPigmentsOfTokuno ), typeof( AncientFarmersKasa ), typeof( AncientSamuraiDo ), typeof( ArmsOfTacticalExcellence ),
typeof( LesserPigmentsOfTokuno ), typeof( BlackLotusHood ), typeof( DaimyosHelm ), typeof( HanzosBow ),
typeof( LesserPigmentsOfTokuno ), typeof( DemonForks ), typeof( DragonNunchaku ), typeof( Exiler ), typeof( GlovesOfTheSun ),
typeof( LesserPigmentsOfTokuno ), typeof( LegsOfStability ), typeof( PeasantsBokuto ), typeof( PilferedDancerFans ), typeof( TheDestroyer ),
typeof( LesserPigmentsOfTokuno ), typeof( TomeOfEnlightenment ), typeof( AncientUrn ), typeof( HonorableSwords ), typeof( FluteOfRenewal ),
typeof( LesserPigmentsOfTokuno ), typeof( LeurociansMempoOfFortune ), typeof( ChestOfHeirlooms )
}
};
public static Type[] LesserArtifacts
{
get { return m_LesserArtifacts[(int)RewardEra-1]; }
}
private static Type[][] m_GreaterArtifacts = null;
public static Type[] GreaterArtifacts
{
get
{
if( m_GreaterArtifacts == null )
{
m_GreaterArtifacts = new Type[ToTRedeemGump.NormalRewards.Length][];
for( int i = 0; i < m_GreaterArtifacts.Length; i++ )
{
m_GreaterArtifacts[i] = new Type[ToTRedeemGump.NormalRewards[i].Length];
for( int j = 0; j < m_GreaterArtifacts[i].Length; j++ )
{
m_GreaterArtifacts[i][j] = ToTRedeemGump.NormalRewards[i][j].Type;
}
}
}
return m_GreaterArtifacts[(int)RewardEra-1];
}
}
private static bool CheckLocation( Mobile m )
{
Region r = m.Region;
if( r.IsPartOf( typeof( Server.Regions.HouseRegion ) ) || Server.Multis.BaseBoat.FindBoatAt( m, m.Map ) != null )
return false;
//TODO: a CanReach of something check as opposed to above?
if( r.IsPartOf( "Yomotsu Mines" ) || r.IsPartOf( "Fan Dancer's Dojo" ) )
return true;
return (m.Map == Map.Tokuno);
}
public static void HandleKill( Mobile victim, Mobile killer )
{
PlayerMobile pm = killer as PlayerMobile;
BaseCreature bc = victim as BaseCreature;
if( DropEra == TreasuresOfTokunoEra.None || pm == null || bc == null || !CheckLocation( bc ) || !CheckLocation( pm )|| !killer.InRange( victim, 18 ))
return;
if( bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0 )
return;
//25000 for 1/100 chance, 10 hyrus
//1500, 1/1000 chance, 20 lizard men for that chance.
pm.ToTTotalMonsterFame += (int)(bc.Fame * (1 + Math.Sqrt( pm.Luck ) / 100));
//This is the Exponentional regression with only 2 datapoints.
//A log. func would also work, but it didn't make as much sense.
//This function isn't OSI exact beign that I don't know OSI's func they used ;p
int x = pm.ToTTotalMonsterFame;
//const double A = 8.63316841 * Math.Pow( 10, -4 );
const double A = 0.000863316841;
//const double B = 4.25531915 * Math.Pow( 10, -6 );
const double B = 0.00000425531915;
double chance = A * Math.Pow( 10, B * x );
if( chance > Utility.RandomDouble() )
{
Item i = null;
try
{
i = Activator.CreateInstance( m_LesserArtifacts[(int)DropEra-1][Utility.Random( m_LesserArtifacts[(int)DropEra-1].Length )] ) as Item;
}
catch
{ }
if( i != null )
{
pm.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
if( !pm.PlaceInBackpack( i ) )
{
if( pm.BankBox != null && pm.BankBox.TryDropItem( killer, i, false ) )
pm.SendLocalizedMessage( 1079730 ); // The item has been placed into your bank box.
else
{
pm.SendLocalizedMessage( 1072523 ); // You find an artifact, but your backpack and bank are too full to hold it.
i.MoveToWorld( pm.Location, pm.Map );
}
}
pm.ToTTotalMonsterFame = 0;
}
}
}
}
}
namespace Server.Mobiles
{
public class IharaSoko : BaseVendor
{
public override bool IsActiveVendor { get { return false; } }
public override bool IsInvulnerable { get { return true; } }
public override bool DisallowAllMoves { get { return true; } }
public override bool ClickTitle { get { return true; } }
public override bool CanTeach { get { return false; } }
protected List<SBInfo> m_SBInfos = new List<SBInfo>();
protected override List<SBInfo> SBInfos { get { return m_SBInfos; } }
public override void InitSBInfo()
{
}
public override void InitOutfit()
{
AddItem( new Waraji( 0x711 ) );
AddItem( new Backpack() );
AddItem( new Kamishimo( 0x483 ) );
Item item = new LightPlateJingasa();
item.Hue = 0x711;
AddItem( item );
}
[Constructable]
public IharaSoko() : base( "the Imperial Minister of Trade" )
{
Name = "Ihara Soko";
Female = false;
Body = 0x190;
Hue = 0x8403;
}
public IharaSoko( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
public override bool CanBeDamaged()
{
return false;
}
public override void OnMovement( Mobile m, Point3D oldLocation )
{
if( m.Alive && m is PlayerMobile )
{
PlayerMobile pm = (PlayerMobile)m;
int range = 3;
if( m.Alive && Math.Abs( Z - m.Z ) < 16 && InRange( m, range ) && !InRange( oldLocation, range ) )
{
if( pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward )
{
SayTo( pm, 1070980 ); // Congratulations! You have turned in enough minor treasures to earn a greater reward.
pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity
if( !pm.HasGump( typeof( ToTRedeemGump ) ) )
pm.SendGump( new ToTRedeemGump( this, false ) );
}
else
{
if( pm.ToTItemsTurnedIn == 0 )
SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
else
SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
ArrayList buttons = ToTTurnInGump.FindRedeemableItems( pm );
if( buttons.Count > 0 && !pm.HasGump( typeof( ToTTurnInGump ) ) )
pm.SendGump( new ToTTurnInGump( this, buttons ) );
}
}
int leaveRange = 7;
if( !InRange( m, leaveRange ) && InRange( oldLocation, leaveRange ) )
{
pm.CloseGump( typeof( ToTRedeemGump ) );
pm.CloseGump( typeof( ToTTurnInGump ) );
}
}
}
public override void TurnToTokuno(){}
}
}
namespace Server.Gumps
{
public class ItemTileButtonInfo : ImageTileButtonInfo
{
private Item m_Item;
public Item Item
{
get { return m_Item; }
set { m_Item = value; }
}
public ItemTileButtonInfo( Item i ) : base( i.ItemID, i.Hue, ((i.Name == null || i.Name.Length <= 0)? (TextDefinition)i.LabelNumber : (TextDefinition)i.Name ) )
{
m_Item = i;
}
}
public class ToTTurnInGump : BaseImageTileButtonsGump
{
public static ArrayList FindRedeemableItems( Mobile m )
{
Backpack pack = (Backpack)m.Backpack;
if( pack == null )
return new ArrayList();
ArrayList items = new ArrayList( pack.FindItemsByType( TreasuresOfTokuno.LesserArtifactsTotal ) );
ArrayList buttons = new ArrayList();
for( int i = 0; i < items.Count; i++ )
{
Item item = (Item)items[i];
if( item is ChestOfHeirlooms && !((ChestOfHeirlooms)item).Locked )
continue;
if( item is ChestOfHeirlooms && ((ChestOfHeirlooms)item).TrapLevel != 10 )
continue;
if( item is PigmentsOfTokuno && ((PigmentsOfTokuno)item).Type != PigmentType.None )
continue;
buttons.Add( new ItemTileButtonInfo( item ) );
}
return buttons;
}
Mobile m_Collector;
public ToTTurnInGump( Mobile collector, ArrayList buttons ) : base( 1071012, buttons ) // Click a minor artifact to give it to Ihara Soko.
{
m_Collector = collector;
}
public ToTTurnInGump( Mobile collector, ItemTileButtonInfo[] buttons ) : base( 1071012, buttons ) // Click a minor artifact to give it to Ihara Soko.
{
m_Collector = collector;
}
public override void HandleButtonResponse( NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo )
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
Item item = ((ItemTileButtonInfo)buttonInfo).Item;
if( !( pm != null && item.IsChildOf( pm.Backpack ) && pm.InRange( m_Collector.Location, 7 )) )
return;
item.Delete();
if( ++pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward )
{
m_Collector.SayTo( pm, 1070980 ); // Congratulations! You have turned in enough minor treasures to earn a greater reward.
pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity
if( !pm.HasGump( typeof( ToTRedeemGump ) ) )
pm.SendGump( new ToTRedeemGump( m_Collector, false ) );
}
else
{
m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
ArrayList buttons = FindRedeemableItems( pm );
pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity
if( buttons.Count > 0 )
pm.SendGump( new ToTTurnInGump( m_Collector, buttons ) );
}
}
public override void HandleCancel( NetState sender )
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || !pm.InRange( m_Collector.Location, 7 ) )
return;
if( pm.ToTItemsTurnedIn == 0 )
m_Collector.SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
else if( pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward ) //This case should ALWAYS be true with this gump, jsut a sanity check
m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
else
m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again.
}
}
}
namespace Server.Gumps
{
public class ToTRedeemGump : BaseImageTileButtonsGump
{
public class TypeTileButtonInfo : ImageTileButtonInfo
{
private Type m_Type;
public Type Type { get { return m_Type; } }
public TypeTileButtonInfo( Type type, int itemID, int hue, TextDefinition label, int localizedToolTip ) : base( itemID, hue, label, localizedToolTip )
{
m_Type = type;
}
public TypeTileButtonInfo( Type type, int itemID, TextDefinition label ) : this( type, itemID, 0, label, -1 )
{
}
public TypeTileButtonInfo( Type type, int itemID, TextDefinition label, int localizedToolTip ) : this( type, itemID, 0, label, localizedToolTip )
{
}
}
public class PigmentsTileButtonInfo : ImageTileButtonInfo
{
private PigmentType m_Pigment;
public PigmentType Pigment
{
get
{
return m_Pigment;
}
set
{
m_Pigment = value;
}
}
public PigmentsTileButtonInfo( PigmentType p ) : base( 0xEFF, PigmentsOfTokuno.GetInfo( p )[0], PigmentsOfTokuno.GetInfo( p )[1] )
{
m_Pigment = p;
}
}
#region ToT Normal Rewards Table
private static TypeTileButtonInfo[][] m_NormalRewards = new TypeTileButtonInfo[][]
{
// ToT One Rewards
new TypeTileButtonInfo[] {
new TypeTileButtonInfo( typeof( SwordsOfProsperity ), 0x27A9, 1070963, 1071002 ),
new TypeTileButtonInfo( typeof( SwordOfTheStampede ), 0x27A2, 1070964, 1070978 ),
new TypeTileButtonInfo( typeof( WindsEdge ), 0x27A3, 1070965, 1071003 ),
new TypeTileButtonInfo( typeof( DarkenedSky ), 0x27AD, 1070966, 1071004 ),
new TypeTileButtonInfo( typeof( TheHorselord ), 0x27A5, 1070967, 1071005 ),
new TypeTileButtonInfo( typeof( RuneBeetleCarapace ), 0x277D, 1070968, 1071006 ),
new TypeTileButtonInfo( typeof( KasaOfTheRajin ), 0x2798, 1070969, 1071007 ),
new TypeTileButtonInfo( typeof( Stormgrip ), 0x2792, 1070970, 1071008 ),
new TypeTileButtonInfo( typeof( TomeOfLostKnowledge ), 0x0EFA, 0x530, 1070971, 1071009 ),
new TypeTileButtonInfo( typeof( PigmentsOfTokuno ), 0x0EFF, 1070933, 1071011 )
},
// ToT Two Rewards
new TypeTileButtonInfo[] {
new TypeTileButtonInfo( typeof( SwordsOfProsperity ), 0x27A9, 1070963, 1071002 ),
new TypeTileButtonInfo( typeof( SwordOfTheStampede ), 0x27A2, 1070964, 1070978 ),
new TypeTileButtonInfo( typeof( WindsEdge ), 0x27A3, 1070965, 1071003 ),
new TypeTileButtonInfo( typeof( DarkenedSky ), 0x27AD, 1070966, 1071004 ),
new TypeTileButtonInfo( typeof( TheHorselord ), 0x27A5, 1070967, 1071005 ),
new TypeTileButtonInfo( typeof( RuneBeetleCarapace ), 0x277D, 1070968, 1071006 ),
new TypeTileButtonInfo( typeof( KasaOfTheRajin ), 0x2798, 1070969, 1071007 ),
new TypeTileButtonInfo( typeof( Stormgrip ), 0x2792, 1070970, 1071008 ),
new TypeTileButtonInfo( typeof( TomeOfLostKnowledge ), 0x0EFA, 0x530, 1070971, 1071009 ),
new TypeTileButtonInfo( typeof( PigmentsOfTokuno ), 0x0EFF, 1070933, 1071011 )
},
// ToT Three Rewards
new TypeTileButtonInfo[] {
new TypeTileButtonInfo( typeof( SwordsOfProsperity ), 0x27A9, 1070963, 1071002 ),
new TypeTileButtonInfo( typeof( SwordOfTheStampede ), 0x27A2, 1070964, 1070978 ),
new TypeTileButtonInfo( typeof( WindsEdge ), 0x27A3, 1070965, 1071003 ),
new TypeTileButtonInfo( typeof( DarkenedSky ), 0x27AD, 1070966, 1071004 ),
new TypeTileButtonInfo( typeof( TheHorselord ), 0x27A5, 1070967, 1071005 ),
new TypeTileButtonInfo( typeof( RuneBeetleCarapace ), 0x277D, 1070968, 1071006 ),
new TypeTileButtonInfo( typeof( KasaOfTheRajin ), 0x2798, 1070969, 1071007 ),
new TypeTileButtonInfo( typeof( Stormgrip ), 0x2792, 1070970, 1071008 ),
new TypeTileButtonInfo( typeof( TomeOfLostKnowledge ), 0x0EFA, 0x530, 1070971, 1071009 )
}
};
#endregion
public static TypeTileButtonInfo[][] NormalRewards
{
get { return m_NormalRewards; }
}
#region ToT Pigment Rewards Table
private static PigmentsTileButtonInfo[][] m_PigmentRewards = new PigmentsTileButtonInfo[][]
{
// ToT One Pigment Rewards
new PigmentsTileButtonInfo[] {
new PigmentsTileButtonInfo( PigmentType.ParagonGold ),
new PigmentsTileButtonInfo( PigmentType.VioletCouragePurple ),
new PigmentsTileButtonInfo( PigmentType.InvulnerabilityBlue ),
new PigmentsTileButtonInfo( PigmentType.LunaWhite ),
new PigmentsTileButtonInfo( PigmentType.DryadGreen ),
new PigmentsTileButtonInfo( PigmentType.ShadowDancerBlack ),
new PigmentsTileButtonInfo( PigmentType.BerserkerRed ),
new PigmentsTileButtonInfo( PigmentType.NoxGreen ),
new PigmentsTileButtonInfo( PigmentType.RumRed ),
new PigmentsTileButtonInfo( PigmentType.FireOrange )
},
// ToT Two Pigment Rewards
new PigmentsTileButtonInfo[] {
new PigmentsTileButtonInfo( PigmentType.FadedCoal ),
new PigmentsTileButtonInfo( PigmentType.Coal ),
new PigmentsTileButtonInfo( PigmentType.FadedGold ),
new PigmentsTileButtonInfo( PigmentType.StormBronze ),
new PigmentsTileButtonInfo( PigmentType.Rose ),
new PigmentsTileButtonInfo( PigmentType.MidnightCoal ),
new PigmentsTileButtonInfo( PigmentType.FadedBronze ),
new PigmentsTileButtonInfo( PigmentType.FadedRose ),
new PigmentsTileButtonInfo( PigmentType.DeepRose )
},
// ToT Three Pigment Rewards
new PigmentsTileButtonInfo[] {
new PigmentsTileButtonInfo( PigmentType.ParagonGold ),
new PigmentsTileButtonInfo( PigmentType.VioletCouragePurple ),
new PigmentsTileButtonInfo( PigmentType.InvulnerabilityBlue ),
new PigmentsTileButtonInfo( PigmentType.LunaWhite ),
new PigmentsTileButtonInfo( PigmentType.DryadGreen ),
new PigmentsTileButtonInfo( PigmentType.ShadowDancerBlack ),
new PigmentsTileButtonInfo( PigmentType.BerserkerRed ),
new PigmentsTileButtonInfo( PigmentType.NoxGreen ),
new PigmentsTileButtonInfo( PigmentType.RumRed ),
new PigmentsTileButtonInfo( PigmentType.FireOrange )
}
};
#endregion
public static PigmentsTileButtonInfo[][] PigmentRewards
{
get { return m_PigmentRewards; }
}
private Mobile m_Collector;
public ToTRedeemGump( Mobile collector, bool pigments ) : base( pigments ? 1070986 : 1070985, pigments ? (ImageTileButtonInfo[])m_PigmentRewards[(int)TreasuresOfTokuno.RewardEra-1] : (ImageTileButtonInfo[])m_NormalRewards[(int)TreasuresOfTokuno.RewardEra-1] )
{
m_Collector = collector;
}
public override void HandleButtonResponse( NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo )
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || !pm.InRange( m_Collector.Location, 7 ) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward) )
return;
bool pigments = (buttonInfo is PigmentsTileButtonInfo);
Item item = null;
if( pigments )
{
PigmentsTileButtonInfo p = buttonInfo as PigmentsTileButtonInfo;
item = new PigmentsOfTokuno( p.Pigment );
}
else
{
TypeTileButtonInfo t = buttonInfo as TypeTileButtonInfo;
if( t.Type == typeof( PigmentsOfTokuno ) ) //Special case of course.
{
pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity
pm.CloseGump( typeof( ToTRedeemGump ) );
pm.SendGump( new ToTRedeemGump( m_Collector, true ) );
return;
}
try
{
item = (Item)Activator.CreateInstance( t.Type );
}
catch { }
}
if( item == null )
return; //Sanity
if( pm.AddToBackpack( item ) )
{
pm.ToTItemsTurnedIn -= TreasuresOfTokuno.ItemsPerReward;
m_Collector.SayTo( pm, 1070984, (item.Name == null || item.Name.Length <= 0)? String.Format( "#{0}", item.LabelNumber ) : item.Name ); // You have earned the gratitude of the Empire. I have placed the ~1_OBJTYPE~ in your backpack.
}
else
{
item.Delete();
m_Collector.SayTo( pm, 500722 ); // You don't have enough room in your backpack!
m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again.
}
}
public override void HandleCancel( NetState sender )
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || !pm.InRange( m_Collector.Location, 7 ) )
return;
if( pm.ToTItemsTurnedIn == 0 )
m_Collector.SayTo( pm, 1071013 ); // Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
else if( pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward ) //This and above case should ALWAYS be FALSE with this gump, jsut a sanity check
m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
else
m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again.
}
}
}
/* Notes
Pigments of tokuno do NOT check for if item is already hued 0; APPARENTLY he still accepts it if it's < 10 charges.
Chest of Heirlooms don't show if unlocked.
Chest of heirlooms, locked, HARD to pick at 100 lock picking but not impossible. had 95 health to 0, cause it's trapped >< (explosion i think)
*/

View file

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
namespace Server.Misc
{
public class TreasuresOfTokunoPersistance : Item
{
private static TreasuresOfTokunoPersistance m_Instance;
public static TreasuresOfTokunoPersistance Instance{ get{ return m_Instance; } }
public override string DefaultName
{
get { return "TreasuresOfTokuno Persistance - Internal"; }
}
public static void Initialize()
{
if ( m_Instance == null )
new TreasuresOfTokunoPersistance();
}
public TreasuresOfTokunoPersistance() : base( 1 )
{
Movable = false;
if ( m_Instance == null || m_Instance.Deleted )
m_Instance = this;
else
base.Delete();
}
public TreasuresOfTokunoPersistance( Serial serial ) : base( serial )
{
m_Instance = this;
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
writer.WriteEncodedInt( (int)TreasuresOfTokuno.RewardEra );
writer.WriteEncodedInt( (int)TreasuresOfTokuno.DropEra );
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
TreasuresOfTokuno.RewardEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
TreasuresOfTokuno.DropEra = (TreasuresOfTokunoEra)reader.ReadEncodedInt();
break;
}
}
}
public override void Delete()
{
}
}
}