Reorganizes Project (#41)

This commit is contained in:
Kamron Batman 2019-08-02 18:13:40 -07:00 • committed by GitHub
parent 08bf44af9a
commit 3614a66aee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3499 changed files with 79 additions and 55 deletions

View file

@ -0,0 +1,288 @@
using System;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
public abstract class BasePigmentsOfTokuno : Item, IUsesRemaining
{
private static Type[] m_Glasses =
{
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 =
{
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 =
{
typeof(ChargerOfTheFallen),
typeof(SamuraiHelm),
typeof(HolySword),
typeof(LeggingsOfEmbers),
typeof(ShaminoCrossbow)
};
private TextDefinition m_Label;
private int m_UsesRemaining;
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 int LabelNumber => 1070933; // Pigments of Tokuno
protected TextDefinition Label
{
get => 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 */
protected bool InheritsItem{ get; private set; }
#endregion
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, TargetFlags.None, InternalCallback);
}
else
{
from.SendLocalizedMessage(502436); // That is not accessible.
}
}
private void InternalCallback(Mobile from, object targeted)
{
if (Deleted || UsesRemaining <= 0 || !from.InRange(GetWorldLocation(), 3) ||
!IsAccessibleTo(from))
return;
if (!(targeted is Item i))
{
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 (--UsesRemaining <= 0)
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 weapon)
resource = weapon.Resource;
else if (i is BaseArmor armor)
resource = armor.Resource;
else if (i is BaseClothing clothing)
resource = clothing.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(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
{
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 => m_UsesRemaining;
set
{
m_UsesRemaining = value;
InvalidateProperties();
}
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
#endregion
}
}

View file

@ -0,0 +1,557 @@
namespace Server.Items
{
public class DarkenedSky : Kama
{
[Constructible]
public DarkenedSky()
{
WeaponAttributes.HitLightning = 60;
Attributes.WeaponSpeed = 25;
Attributes.WeaponDamage = 50;
}
public DarkenedSky(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070966; // Darkened Sky
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 override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class KasaOfTheRajin : Kasa
{
[Constructible]
public KasaOfTheRajin()
{
Attributes.SpellDamage = 12;
}
public KasaOfTheRajin(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1070969; // Kasa of the Raj-in
public override int BasePhysicalResistance => 12;
public override int BaseFireResistance => 17;
public override int BaseColdResistance => 21;
public override int BasePoisonResistance => 17;
public override int BaseEnergyResistance => 17;
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(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
{
[Constructible]
public RuneBeetleCarapace()
{
Attributes.BonusMana = 10;
Attributes.RegenMana = 3;
Attributes.LowerManaCost = 15;
ArmorAttributes.LowerStatReq = 100;
ArmorAttributes.MageArmor = 1;
}
public RuneBeetleCarapace(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070968; // Rune Beetle Carapace
public override int BaseColdResistance => 14;
public override int BaseEnergyResistance => 14;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class Stormgrip : LeatherNinjaMitts
{
[Constructible]
public Stormgrip()
{
Attributes.BonusInt = 8;
Attributes.Luck = 125;
Attributes.WeaponDamage = 25;
}
public Stormgrip(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070970; // Stormgrip
public override int BasePhysicalResistance => 10;
public override int BaseColdResistance => 18;
public override int BaseEnergyResistance => 18;
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class SwordOfTheStampede : NoDachi
{
[Constructible]
public SwordOfTheStampede()
{
WeaponAttributes.HitHarm = 100;
Attributes.AttackChance = 10;
Attributes.WeaponDamage = 60;
}
public SwordOfTheStampede(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070964; // Sword of the Stampede
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 override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class SwordsOfProsperity : Daisho
{
[Constructible]
public SwordsOfProsperity()
{
WeaponAttributes.MageWeapon = 30;
Attributes.SpellChanneling = 1;
Attributes.CastSpeed = 1;
Attributes.Luck = 200;
}
public SwordsOfProsperity(Serial serial) : base(serial)
{
}
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070963; // Swords of Prosperity
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 override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class TheHorselord : Yumi
{
[Constructible]
public TheHorselord()
{
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 int InitMinHits => 255;
public override int InitMaxHits => 255;
public override int LabelNumber => 1070967; // The Horselord
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class TomeOfLostKnowledge : Spellbook
{
[Constructible]
public TomeOfLostKnowledge()
{
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 int LabelNumber => 1070971; // Tome of Lost Knowledge
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
public class WindsEdge : Tessen
{
[Constructible]
public WindsEdge()
{
WeaponAttributes.HitLeechMana = 40;
Attributes.WeaponDamage = 50;
Attributes.WeaponSpeed = 50;
Attributes.DefendChance = 10;
}
public WindsEdge(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1070965; // Wind's Edge
public override int InitMinHits => 255;
public override int InitMaxHits => 255;
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 override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
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 =
{
// Hue, Label
new[]
{
/*PigmentType.None,*/ 0, -1
},
new[]
{
/*PigmentType.ParagonGold,*/ 0x501, 1070987
},
new[]
{
/*PigmentType.VioletCouragePurple,*/ 0x486, 1070988
},
new[]
{
/*PigmentType.InvulnerabilityBlue,*/ 0x4F2, 1070989
},
new[]
{
/*PigmentType.LunaWhite,*/ 0x47E, 1070990
},
new[]
{
/*PigmentType.DryadGreen,*/ 0x48F, 1070991
},
new[]
{
/*PigmentType.ShadowDancerBlack,*/ 0x455, 1070992
},
new[]
{
/*PigmentType.BerserkerRed,*/ 0x21, 1070993
},
new[]
{
/*PigmentType.NoxGreen,*/ 0x58C, 1070994
},
new[]
{
/*PigmentType.RumRed,*/ 0x66C, 1070995
},
new[]
{
/*PigmentType.FireOrange,*/ 0x54F, 1070996
},
new[]
{
/*PigmentType.Fadedcoal,*/ 0x96A, 1079579
},
new[]
{
/*PigmentType.Coal,*/ 0x96B, 1079580
},
new[]
{
/*PigmentType.FadedGold,*/ 0x972, 1079581
},
new[]
{
/*PigmentType.StormBronze,*/ 0x977, 1079582
},
new[]
{
/*PigmentType.Rose,*/ 0x97C, 1079583
},
new[]
{
/*PigmentType.MidnightCoal,*/ 0x96C, 1079584
},
new[]
{
/*PigmentType.FadedBronze,*/ 0x975, 1079585
},
new[]
{
/*PigmentType.FadedRose,*/ 0x97B, 1079586
},
new[]
{
/*PigmentType.DeepRose,*/ 0x97E, 1079587
}
};
private PigmentType m_Type;
[Constructible]
public PigmentsOfTokuno(PigmentType type = PigmentType.None) : this(type,
type == PigmentType.None || type >= PigmentType.FadedCoal ? 10 : 50)
{
}
[Constructible]
public PigmentsOfTokuno(PigmentType type, int uses) : base(uses)
{
Weight = 1.0;
Type = type;
}
public PigmentsOfTokuno(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public PigmentType Type
{
get => 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 => 1070933; // Pigments of Tokuno
public static int[] GetInfo(PigmentType type)
{
int v = (int)type;
if (v < 0 || v >= m_Table.Length)
v = 0;
return m_Table[v];
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(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,627 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Gumps;
using Server.Items;
using Server.Misc;
using Server.Mobiles;
using Server.Multis;
using Server.Network;
using Server.Regions;
namespace Server.Misc
{
public enum TreasuresOfTokunoEra
{
None,
ToTOne,
ToTTwo,
ToTThree
}
public class TreasuresOfTokuno
{
public const int ItemsPerReward = 10;
private static Type[][] m_LesserArtifacts =
{
// ToT One Rewards
new[]
{
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[]
{
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[]
{
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)
}
};
private static Type[][] m_GreaterArtifacts;
public static Type[] LesserArtifactsTotal{ get; } =
{
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 TreasuresOfTokunoEra DropEra{ get; set; } = TreasuresOfTokunoEra.None;
public static TreasuresOfTokunoEra RewardEra{ get; set; } = TreasuresOfTokunoEra.ToTOne;
public static Type[] LesserArtifacts => m_LesserArtifacts[(int)RewardEra - 1];
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<HouseRegion>() || 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)
{
if (DropEra == TreasuresOfTokunoEra.None || !(killer is PlayerMobile pm) || !(victim is BaseCreature bc) ||
!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
{
// ignored
}
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?.TryDropItem(killer, i, false) == true)
{
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
{
protected List<SBInfo> m_SBInfos = new List<SBInfo>();
[Constructible]
public IharaSoko() : base("the Imperial Minister of Trade")
{
Female = false;
Body = 0x190;
Hue = 0x8403;
}
public IharaSoko(Serial serial) : base(serial)
{
}
public override bool IsActiveVendor => false;
public override bool IsInvulnerable => true;
public override bool DisallowAllMoves => true;
public override bool ClickTitle => true;
public override bool CanTeach => false;
public override string DefaultName => "Ihara Soko";
protected override List<SBInfo> SBInfos => 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);
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(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 pm)
{
int range = 3;
if (pm.Alive && Math.Abs(Z - pm.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<ToTTurnInGump>(); //Sanity
if (!pm.HasGump<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,
$"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
List<ItemTileButtonInfo> buttons = ToTTurnInGump.FindRedeemableItems(pm);
if (buttons.Count > 0 && !pm.HasGump<ToTTurnInGump>())
pm.SendGump(new ToTTurnInGump(this, buttons));
}
}
int leaveRange = 7;
if (!InRange(m, leaveRange) && InRange(oldLocation, leaveRange))
{
pm.CloseGump<ToTRedeemGump>();
pm.CloseGump<ToTTurnInGump>();
}
}
}
public override void TurnToTokuno()
{
}
}
}
namespace Server.Gumps
{
public class ItemTileButtonInfo : ImageTileButtonInfo
{
public ItemTileButtonInfo(Item i) : base(i.ItemID, i.Hue,
i.Name == null || i.Name.Length <= 0 ? (TextDefinition)i.LabelNumber : (TextDefinition)i.Name)
{
Item = i;
}
public Item Item{ get; set; }
}
public class ToTTurnInGump : BaseImageTileButtonsGump
{
private Mobile m_Collector;
public ToTTurnInGump(Mobile collector, List<ItemTileButtonInfo> buttons) :
base(1071012, Utility.CastListContravariant<ItemTileButtonInfo, ImageTileButtonInfo>(buttons)) // Click a minor artifact to give it to Ihara Soko.
{
m_Collector = collector;
}
public static List<ItemTileButtonInfo> FindRedeemableItems(Mobile m)
{
Container pack = m.Backpack;
if (pack == null)
return new List<ItemTileButtonInfo>();
List<ItemTileButtonInfo> buttons = new List<ItemTileButtonInfo>();
Item[] items = pack.FindItemsByType(TreasuresOfTokuno.LesserArtifactsTotal);
for (int i = 0; i < items.Length; i++)
{
Item item = items[i];
if (item is ChestOfHeirlooms heirlooms && !heirlooms.Locked)
continue;
if (item is ChestOfHeirlooms ofHeirlooms && ofHeirlooms.TrapLevel != 10)
continue;
if (item is PigmentsOfTokuno tokuno && tokuno.Type != PigmentType.None)
continue;
buttons.Add(new ItemTileButtonInfo(item));
}
return buttons;
}
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<ToTTurnInGump>(); //Sanity
if (!pm.HasGump<ToTRedeemGump>())
pm.SendGump(new ToTRedeemGump(m_Collector, false));
}
else
{
m_Collector.SayTo(pm, 1070981,
$"{pm.ToTItemsTurnedIn}\t{TreasuresOfTokuno.ItemsPerReward}"); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.
List<ItemTileButtonInfo> buttons = FindRedeemableItems(pm);
pm.CloseGump<ToTTurnInGump>(); //Sanity
if (buttons.Count > 0)
pm.SendGump(new ToTTurnInGump(m_Collector, buttons));
}
}
public override void HandleCancel(NetState sender)
{
if (!(sender.Mobile is PlayerMobile pm) || !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,
$"{pm.ToTItemsTurnedIn}\t{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
{
private Mobile m_Collector;
public ToTRedeemGump(Mobile collector, bool pigments) : base(pigments ? 1070986 : 1070985,
pigments
? PigmentRewards[(int)TreasuresOfTokuno.RewardEra - 1].ToArray<ImageTileButtonInfo>()
: NormalRewards[(int)TreasuresOfTokuno.RewardEra - 1].ToArray<ImageTileButtonInfo>()
)
{
m_Collector = collector;
}
public static TypeTileButtonInfo[][] NormalRewards{ get; } =
{
// ToT One Rewards
new[]
{
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[]
{
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[]
{
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)
}
};
public static PigmentsTileButtonInfo[][] PigmentRewards{ get; } =
{
// ToT One Pigment Rewards
new[]
{
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[]
{
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[]
{
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)
}
};
public override void HandleButtonResponse(NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo)
{
if (!(sender.Mobile is PlayerMobile pm) || !pm.InRange(m_Collector.Location, 7) ||
!(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward))
return;
Item item = null;
if (buttonInfo is PigmentsTileButtonInfo p)
{
item = new PigmentsOfTokuno(p.Pigment);
}
else
{
TypeTileButtonInfo t = (TypeTileButtonInfo)buttonInfo;
if (t.Type == typeof(PigmentsOfTokuno)) //Special case of course.
{
pm.CloseGump<ToTTurnInGump>(); //Sanity
pm.CloseGump<ToTRedeemGump>();
pm.SendGump(new ToTRedeemGump(m_Collector, true));
return;
}
try
{
item = (Item)Activator.CreateInstance(t.Type);
}
catch
{
// ignored
}
}
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
? $"#{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)
{
if (!(sender.Mobile is PlayerMobile pm) || !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,
$"{pm.ToTItemsTurnedIn}\t{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.
}
public class TypeTileButtonInfo : ImageTileButtonInfo
{
public TypeTileButtonInfo(Type type, int itemID, TextDefinition label, int localizedToolTip = -1) : this(type, itemID,
0, label, localizedToolTip)
{
}
public TypeTileButtonInfo(Type type, int itemID, int hue, TextDefinition label, int localizedToolTip = -1) : base(
itemID, hue, label, localizedToolTip)
{
Type = type;
}
public Type Type{ get; }
}
public class PigmentsTileButtonInfo : ImageTileButtonInfo
{
public PigmentsTileButtonInfo(PigmentType p) : base(0xEFF, PigmentsOfTokuno.GetInfo(p)[0],
PigmentsOfTokuno.GetInfo(p)[1])
{
Pigment = p;
}
public PigmentType Pigment{ get; set; }
}
#region ToT Normal Rewards Table
#endregion
#region ToT Pigment Rewards Table
#endregion
}
}
/* 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,62 @@
namespace Server.Misc
{
public class TreasuresOfTokunoPersistance : Item
{
public TreasuresOfTokunoPersistance() : base(1)
{
Movable = false;
if (Instance?.Deleted != false)
Instance = this;
else
base.Delete();
}
public TreasuresOfTokunoPersistance(Serial serial) : base(serial)
{
Instance = this;
}
public static TreasuresOfTokunoPersistance Instance{ get; private set; }
public override string DefaultName => "TreasuresOfTokuno Persistance - Internal";
public static void Initialize()
{
if (Instance == null)
new TreasuresOfTokunoPersistance();
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(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()
{
}
}
}