Carlos_ar
Member
- ServUO Version
- Publish 57
- Ultima Expansion
- Endless Journey
I'm not trying to reinvent the wheel... in fact I REALLY like the point systems in the game. What I want to do is just make an additional point tracker.
I based mine off of the Virtue Artifact System. I added the appropriate lines in PointsSystem.cs, SeasonalEventSystem.cs, etc... basically everywhere it threw an error telling me there was no reference there. After fixing a few exceptions I got it to compile.
I'm using the Heritage Sovereigns (thanks for those!) and dropping them in players' packs based on points... this seems like a fun thing to do.
For testing purposes I have it at near 100% drop rate but nothing is happening. So I'm guessing I missed something important lol. There is also no entry for the point value on the [props of the players. Do I need to add something to the player mobiles?
In Pointsystem.CS I have under public static void Configure() - AwardSovereign = new AwardSovereignSystem();
Then under public static List<PointsSystem> Systems { get; set; } I have - public static AwardSovereignSystem AwardSovereign { get; set; }
Then under public static void Configure() I have - AwardSovereign = new AwardSovereignSystem();
And finally in SeasonEventSystem.cs under public enum EventType I have - AwardSovereign
I realized through trial and error that the 'Trammel" region is apparently not a region so I changed that to something more specific to see if it would work and it didn't so I'm still missing something.
I based mine off of the Virtue Artifact System. I added the appropriate lines in PointsSystem.cs, SeasonalEventSystem.cs, etc... basically everywhere it threw an error telling me there was no reference there. After fixing a few exceptions I got it to compile.
I'm using the Heritage Sovereigns (thanks for those!) and dropping them in players' packs based on points... this seems like a fun thing to do.
For testing purposes I have it at near 100% drop rate but nothing is happening. So I'm guessing I missed something important lol. There is also no entry for the point value on the [props of the players. Do I need to add something to the player mobiles?
using Server.Engines.Points;
using Server.Engines.SeasonalEvents;
using Server.Items;
using Server.Mobiles;
using System;
namespace Server.Misc
{
public class AwardSovereignSystem : PointsSystem
{
public static bool Enabled => SeasonalEventSystem.IsActive(EventType.AwardSovereign);
private static readonly Type[] m_AwardSovereign = new Type[]
{
typeof( HeritageSovereign )
};
public static Type[] Artifacts => m_AwardSovereign;
public override PointsType Loyalty => PointsType.Sovereign;
public override TextDefinition Name => m_Name;
public override bool AutoAdd => true;
public override double MaxPoints => double.MaxValue;
public override bool ShowOnLoyaltyGump => true;
private readonly TextDefinition m_Name = new TextDefinition("Sovereign Reward System");
private bool CheckLocation(Mobile m)
{
Region r = m.Region;
if (m is BaseCreature && ((BaseCreature)m).IsChampionSpawn)
return false;
if (r.IsPartOf<Regions.HouseRegion>() || Multis.BaseBoat.FindBoatAt(m, m.Map) != null)
return false;
if (r.IsPartOf("Covetous") || r.IsPartOf("Deceit") || r.IsPartOf("Despise") || r.IsPartOf("Destard") ||
r.IsPartOf("Hythloth") || r.IsPartOf("Shame") || r.IsPartOf("Wrong"))return false;
return (r.IsPartOf("Trammel") || r.IsPartOf("Felucca") || r.IsPartOf("Ilshenar") || r.IsPartOf("Malas") ||
r.IsPartOf("Tokuno") || r.IsPartOf("TerMur"));
}
public override void SendMessage(PlayerMobile from, double old, double points, bool quest)
{
// No message here
}
public override TextDefinition GetTitle(PlayerMobile from)
{
return new TextDefinition("Sovereign Reward System");
}
public override void ProcessKill(Mobile victim, Mobile damager)
{
PlayerMobile pm = damager as PlayerMobile;
BaseCreature bc = victim as BaseCreature;
if (!Enabled || pm == null || bc == null || !CheckLocation(bc) || !CheckLocation(pm) || !damager.InRange(victim, 18) || !damager.Alive || bc.GivenSpecialArtifact)
return;
if (bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0)
return;
int luck = Math.Max(0, pm.RealLuck);
AwardPoints(pm, (int)Math.Max(0, (bc.Fame * (1 + Math.Sqrt(luck) / 1))));
double vapoints = GetPoints(pm);
const double A = 0.000863316841;
const double B = 0.00000425531915;
double chance = A * Math.Pow(10, B * vapoints);
double roll = Utility.RandomDouble();
if (chance > roll)
{
Item i = null;
try
{
i = Activator.CreateInstance(m_AwardSovereign[Utility.Random(m_AwardSovereign.Length)]) as Item;
}
catch (Exception e)
{
Diagnostics.ExceptionLogging.LogException(e);
}
if (i != null)
{
damager.PlaySound(0x5B4);
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(damager, 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);
}
}
bc.GivenSpecialArtifact = true;
SetPoints(pm, 0);
}
}
}
}
}
using Server.Engines.SeasonalEvents;
using Server.Items;
using Server.Mobiles;
using System;
namespace Server.Misc
{
public class AwardSovereignSystem : PointsSystem
{
public static bool Enabled => SeasonalEventSystem.IsActive(EventType.AwardSovereign);
private static readonly Type[] m_AwardSovereign = new Type[]
{
typeof( HeritageSovereign )
};
public static Type[] Artifacts => m_AwardSovereign;
public override PointsType Loyalty => PointsType.Sovereign;
public override TextDefinition Name => m_Name;
public override bool AutoAdd => true;
public override double MaxPoints => double.MaxValue;
public override bool ShowOnLoyaltyGump => true;
private readonly TextDefinition m_Name = new TextDefinition("Sovereign Reward System");
private bool CheckLocation(Mobile m)
{
Region r = m.Region;
if (m is BaseCreature && ((BaseCreature)m).IsChampionSpawn)
return false;
if (r.IsPartOf<Regions.HouseRegion>() || Multis.BaseBoat.FindBoatAt(m, m.Map) != null)
return false;
if (r.IsPartOf("Covetous") || r.IsPartOf("Deceit") || r.IsPartOf("Despise") || r.IsPartOf("Destard") ||
r.IsPartOf("Hythloth") || r.IsPartOf("Shame") || r.IsPartOf("Wrong"))return false;
return (r.IsPartOf("Trammel") || r.IsPartOf("Felucca") || r.IsPartOf("Ilshenar") || r.IsPartOf("Malas") ||
r.IsPartOf("Tokuno") || r.IsPartOf("TerMur"));
}
public override void SendMessage(PlayerMobile from, double old, double points, bool quest)
{
// No message here
}
public override TextDefinition GetTitle(PlayerMobile from)
{
return new TextDefinition("Sovereign Reward System");
}
public override void ProcessKill(Mobile victim, Mobile damager)
{
PlayerMobile pm = damager as PlayerMobile;
BaseCreature bc = victim as BaseCreature;
if (!Enabled || pm == null || bc == null || !CheckLocation(bc) || !CheckLocation(pm) || !damager.InRange(victim, 18) || !damager.Alive || bc.GivenSpecialArtifact)
return;
if (bc.Controlled || bc.Owners.Count > 0 || bc.Fame <= 0)
return;
int luck = Math.Max(0, pm.RealLuck);
AwardPoints(pm, (int)Math.Max(0, (bc.Fame * (1 + Math.Sqrt(luck) / 1))));
double vapoints = GetPoints(pm);
const double A = 0.000863316841;
const double B = 0.00000425531915;
double chance = A * Math.Pow(10, B * vapoints);
double roll = Utility.RandomDouble();
if (chance > roll)
{
Item i = null;
try
{
i = Activator.CreateInstance(m_AwardSovereign[Utility.Random(m_AwardSovereign.Length)]) as Item;
}
catch (Exception e)
{
Diagnostics.ExceptionLogging.LogException(e);
}
if (i != null)
{
damager.PlaySound(0x5B4);
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(damager, 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);
}
}
bc.GivenSpecialArtifact = true;
SetPoints(pm, 0);
}
}
}
}
}
In Pointsystem.CS I have under public static void Configure() - AwardSovereign = new AwardSovereignSystem();
Then under public static List<PointsSystem> Systems { get; set; } I have - public static AwardSovereignSystem AwardSovereign { get; set; }
Then under public static void Configure() I have - AwardSovereign = new AwardSovereignSystem();
And finally in SeasonEventSystem.cs under public enum EventType I have - AwardSovereign
I realized through trial and error that the 'Trammel" region is apparently not a region so I changed that to something more specific to see if it would work and it didn't so I'm still missing something.
Last edited: