marsicanomaurizio68
Initiate
- ServUO Version
- Publish 57
- Ultima Expansion
- None
I made him create this script, I like the RPG very much, it is for me the last online of rpg is limited and therefore I want to implement it with many more things that will make it much more beautiful in my opinion I made the human world generate me with diseases, but it is not perfect it always gives me mistakes maybe it is me who does not explain what I want but the scripts do them, and he makes complex ones but they are not perfect
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;
namespace Server
{
public class DiseaseSystem
{
private static List<string> diseaseNames = new List<string>
{
"Fever of the Night",
"Crimson Plague",
"Wasting Sickness",
"Rotting Flesh",
"Coughing Curse",
"Blight of the Undead",
"Chill of the Grave",
"Pestilence",
"Miasma",
"Sorrow's Affliction"
};
private static List<string> potionNames = new List<string>
{
"Elixir of Vitality",
"Potion of Restoration",
"Tonic of Health",
"Balm of the Healer",
"Syrup of Renewal",
"Vial of Purity",
"Draught of Recovery",
"Infusion of Life",
"Nectar of the Gods",
"Philter of the Phoenix"
};
public static void Initialize()
{
Timer.DelayCall(TimeSpan.FromMinutes(1), CheckForDiseases);
CreateDoctorVendors();
}
private static void CreateDoctorVendors()
{
// Create vendors in various cities
string[] cities = { "Britain", "Moonglow", "Trinsic", "Yew", "Skara Brae" };
foreach (string city in cities)
{
Random rand = new Random();
string doctorName = "Doctor " + RandomName();
DoctorVendor vendor = new DoctorVendor(doctorName);
vendor.Location = GetRandomLocationInCity(city);
vendor.Map = Map.Felucca; // Change to appropriate map
vendor.AddToWorld();
}
}
private static void CheckForDiseases()
{
foreach (Mobile mobile in World.Mobiles.Values)
{
if (mobile is PlayerMobile player && player.Alive)
{
if (player.HasDisease)
{
// Check if the disease duration has expired
if (DateTime.UtcNow >= player.DiseaseEndTime)
{
player.CureDisease();
}
else
{
// Random chance of dying from the disease
if (Utility.RandomDouble() < 0.05) // 5% chance to die
{
player.Kill();
}
}
}
else if (Utility.RandomDouble() < 0.01) // 1% chance to get sick
{
player.GetSick();
}
}
}
Timer.DelayCall(TimeSpan.FromMinutes(1), CheckForDiseases);
}
private static Point3D GetRandomLocationInCity(string city)
{
// Implement logic to return a random Point3D within the specified city
return new Point3D(0, 0, 0); // Placeholder
}
private static string RandomName()
{
return "RandomName"; // Implement logic to generate a random name
}
}
public class DoctorVendor : BaseVendor
{
public DoctorVendor(string name) : base(name)
{
AddPotionItems();
}
private void AddPotionItems()
{
foreach (string potionName in DiseaseSystem.potionNames)
{
AddItem(new CurePotion(potionName));
}
}
}
public class PlayerMobile : Mobile
{
public bool HasDisease { get; set; }
public DateTime DiseaseEndTime { get; set; }
public void GetSick()
{
HasDisease = true;
DiseaseEndTime = DateTime.UtcNow.AddDays(Utility.Random(3, 5)); // Random duration between 3 to 7 days
// Assign a random disease name
string diseaseName = DiseaseSystem.diseaseNames[Utility.Random(DiseaseSystem.diseaseNames.Count)];
// Notify player of the disease
SendMessage($"You have contracted {diseaseName}!");
}
public void CureDisease()
{
HasDisease = false;
SendMessage("You have recovered from your illness.");
}
}
public class CurePotion : Item
{
public CurePotion(string name) : base(0x0F0C) // Use appropriate item ID
{
Name = name;
Weight = 1.0;
}
}
}
using System;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Mobiles;
namespace Server
{
public class DiseaseSystem
{
private static List<string> diseaseNames = new List<string>
{
"Fever of the Night",
"Crimson Plague",
"Wasting Sickness",
"Rotting Flesh",
"Coughing Curse",
"Blight of the Undead",
"Chill of the Grave",
"Pestilence",
"Miasma",
"Sorrow's Affliction"
};
private static List<string> potionNames = new List<string>
{
"Elixir of Vitality",
"Potion of Restoration",
"Tonic of Health",
"Balm of the Healer",
"Syrup of Renewal",
"Vial of Purity",
"Draught of Recovery",
"Infusion of Life",
"Nectar of the Gods",
"Philter of the Phoenix"
};
public static void Initialize()
{
Timer.DelayCall(TimeSpan.FromMinutes(1), CheckForDiseases);
CreateDoctorVendors();
}
private static void CreateDoctorVendors()
{
// Create vendors in various cities
string[] cities = { "Britain", "Moonglow", "Trinsic", "Yew", "Skara Brae" };
foreach (string city in cities)
{
Random rand = new Random();
string doctorName = "Doctor " + RandomName();
DoctorVendor vendor = new DoctorVendor(doctorName);
vendor.Location = GetRandomLocationInCity(city);
vendor.Map = Map.Felucca; // Change to appropriate map
vendor.AddToWorld();
}
}
private static void CheckForDiseases()
{
foreach (Mobile mobile in World.Mobiles.Values)
{
if (mobile is PlayerMobile player && player.Alive)
{
if (player.HasDisease)
{
// Check if the disease duration has expired
if (DateTime.UtcNow >= player.DiseaseEndTime)
{
player.CureDisease();
}
else
{
// Random chance of dying from the disease
if (Utility.RandomDouble() < 0.05) // 5% chance to die
{
player.Kill();
}
}
}
else if (Utility.RandomDouble() < 0.01) // 1% chance to get sick
{
player.GetSick();
}
}
}
Timer.DelayCall(TimeSpan.FromMinutes(1), CheckForDiseases);
}
private static Point3D GetRandomLocationInCity(string city)
{
// Implement logic to return a random Point3D within the specified city
return new Point3D(0, 0, 0); // Placeholder
}
private static string RandomName()
{
return "RandomName"; // Implement logic to generate a random name
}
}
public class DoctorVendor : BaseVendor
{
public DoctorVendor(string name) : base(name)
{
AddPotionItems();
}
private void AddPotionItems()
{
foreach (string potionName in DiseaseSystem.potionNames)
{
AddItem(new CurePotion(potionName));
}
}
}
public class PlayerMobile : Mobile
{
public bool HasDisease { get; set; }
public DateTime DiseaseEndTime { get; set; }
public void GetSick()
{
HasDisease = true;
DiseaseEndTime = DateTime.UtcNow.AddDays(Utility.Random(3, 5)); // Random duration between 3 to 7 days
// Assign a random disease name
string diseaseName = DiseaseSystem.diseaseNames[Utility.Random(DiseaseSystem.diseaseNames.Count)];
// Notify player of the disease
SendMessage($"You have contracted {diseaseName}!");
}
public void CureDisease()
{
HasDisease = false;
SendMessage("You have recovered from your illness.");
}
}
public class CurePotion : Item
{
public CurePotion(string name) : base(0x0F0C) // Use appropriate item ID
{
Name = name;
Weight = 1.0;
}
}
}