Revert "Updates Packets & Randomizer (#43)" (#61)

This reverts commit 179cb50557.
This commit is contained in:
Kamron Batman 2019-11-11 08:46:11 -08:00 • committed by GitHub
parent 179cb50557
commit c2ecc76457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
588 changed files with 16260 additions and 10926 deletions

View file

@ -75,7 +75,7 @@ namespace Server.Engines.Plants
}
case 2: // Help
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 17, true); // EMPTYING THE BOWL
from.Send(new DisplayHelpTopic(71, true)); // EMPTYING THE BOWL
from.SendGump(new EmptyTheBowlGump(m_Plant));

View file

@ -264,7 +264,9 @@ namespace Server.Engines.Plants
case 1: // Reproduction menu
{
if (m_Plant.PlantStatus > PlantStatus.BowlOfDirt)
{
from.SendGump(new ReproductionGump(m_Plant));
}
else
{
from.SendLocalizedMessage(1061885); // You need to plant a seed in the bowl first.
@ -276,28 +278,32 @@ namespace Server.Engines.Plants
}
case 2: // Infestation
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 54, true); // INFESTATION LEVEL
from.Send(new DisplayHelpTopic(54, true)); // INFESTATION LEVEL
from.SendGump(new MainPlantGump(m_Plant));
break;
}
case 3: // Fungus
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 56, true); // FUNGUS LEVEL
from.Send(new DisplayHelpTopic(56, true)); // FUNGUS LEVEL
from.SendGump(new MainPlantGump(m_Plant));
break;
}
case 4: // Poison
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 58, true); // POISON LEVEL
from.Send(new DisplayHelpTopic(58, true)); // POISON LEVEL
from.SendGump(new MainPlantGump(m_Plant));
break;
}
case 5: // Disease
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 60, true); // DISEASE LEVEL
from.Send(new DisplayHelpTopic(60, true)); // DISEASE LEVEL
from.SendGump(new MainPlantGump(m_Plant));
break;
@ -314,7 +320,9 @@ namespace Server.Engines.Plants
$"#{m_Plant.GetLocalizedPlantStatus()}"); // Target the container you wish to use to water the ~1_val~.
}
else
{
m_Plant.Pour(from, bev);
}
from.SendGump(new MainPlantGump(m_Plant));
@ -346,7 +354,7 @@ namespace Server.Engines.Plants
}
case 11: // Help
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 48, true); // PLANT GROWING
from.Send(new DisplayHelpTopic(48, true)); // PLANT GROWING
from.SendGump(new MainPlantGump(m_Plant));
@ -366,7 +374,9 @@ namespace Server.Engines.Plants
Item item = GetPotion(from, effects);
if (item != null)
{
m_Plant.Pour(from, item);
}
else
{
if (m_Plant.ApplyPotion(effects[0], true, out int message))

View file

@ -0,0 +1,15 @@
namespace Server.Network
{
public class DisplayHelpTopic : Packet
{
public DisplayHelpTopic(int topicID, bool display) : base(0xBF)
{
EnsureCapacity(11);
m_Stream.Write((short)0x17);
m_Stream.Write((byte)1);
m_Stream.Write(topicID);
m_Stream.Write(display);
}
}
}

View file

@ -84,7 +84,8 @@ namespace Server.Engines.Plants
}
else
{
PlantSystem ??= new PlantSystem(this, false);
if (PlantSystem == null)
PlantSystem = new PlantSystem(this, false);
int hits = (int)(PlantSystem.MaxHits * ratio);

View file

@ -1,5 +1,4 @@
using System;
using System.Linq;
using Server.Items;
namespace Server.Engines.Plants
@ -32,9 +31,15 @@ namespace Server.Engines.Plants
public Type ResourceType{ get; }
public static PlantResourceInfo GetInfo(PlantType plantType, PlantHue plantHue) =>
m_ResourceList.FirstOrDefault(info => info.PlantType == plantType && info.PlantHue == plantHue);
public static PlantResourceInfo GetInfo(PlantType plantType, PlantHue plantHue)
{
foreach (PlantResourceInfo info in m_ResourceList)
if (info.PlantType == plantType && info.PlantHue == plantHue)
return info;
return null;
}
public Item CreateResource() => (Item)Activator.CreateInstance(ResourceType);
}
}
}

View file

@ -383,7 +383,6 @@ namespace Server.Engines.Plants
return 1060827; // soft
if (Water <= 3)
return 1060828; // squishy
return 1060829; // sopping wet
}

View file

@ -261,13 +261,21 @@ namespace Server.Engines.Plants
double rand = Utility.RandomDouble();
return rand < 0.5 / exp4 ? PlantType.CommonGreenBonsai :
rand < 1.0 / exp4 ? PlantType.CommonPinkBonsai :
rand < (k1 * 0.5 + 1.0) / exp4 ? PlantType.UncommonGreenBonsai :
rand < exp1 / exp4 ? PlantType.UncommonPinkBonsai :
rand < (k2 * 0.5 + exp1) / exp4 ? PlantType.RareGreenBonsai :
rand < exp2 / exp4 ? PlantType.RarePinkBonsai :
rand < exp3 / exp4 ? PlantType.ExceptionalBonsai : PlantType.ExoticBonsai;
if (rand < 0.5 / exp4)
return PlantType.CommonGreenBonsai;
if (rand < 1.0 / exp4)
return PlantType.CommonPinkBonsai;
if (rand < (k1 * 0.5 + 1.0) / exp4)
return PlantType.UncommonGreenBonsai;
if (rand < exp1 / exp4)
return PlantType.UncommonPinkBonsai;
if (rand < (k2 * 0.5 + exp1) / exp4)
return PlantType.RareGreenBonsai;
if (rand < exp2 / exp4)
return PlantType.RarePinkBonsai;
if (rand < exp3 / exp4)
return PlantType.ExceptionalBonsai;
return PlantType.ExoticBonsai;
}
public static bool IsCrossable(PlantType plantType) => GetInfo(plantType).Crossable;
@ -348,4 +356,4 @@ namespace Server.Engines.Plants
return hueInfo.IsBright() ? 1113493 : 1113492; // ~1_amount~ [bright] ~2_color~ ~3_type~ seeds
}
}
}
}

View file

@ -14,30 +14,50 @@ namespace Server.Engines.Plants
from.InRange(m_Plant.GetWorldLocation(), 3))
{
if (!m_Plant.IsUsableBy(from))
{
m_Plant.LabelTo(from,
1061856); // You must have the item in your backpack or locked down in order to use it.
}
else if (!m_Plant.IsCrossable)
{
m_Plant.LabelTo(from, 1053050); // You cannot gather pollen from a mutated plant!
}
else if (!m_Plant.PlantSystem.PollenProducing)
{
m_Plant.LabelTo(from, 1053051); // You cannot gather pollen from a plant in this stage of development!
}
else if (m_Plant.PlantSystem.Health < PlantHealth.Healthy)
{
m_Plant.LabelTo(from, 1053052); // You cannot gather pollen from an unhealthy plant!
}
else
{
if (!(targeted is PlantItem targ) || targ.PlantStatus >= PlantStatus.DecorativePlant ||
targ.PlantStatus <= PlantStatus.BowlOfDirt)
{
m_Plant.LabelTo(from, 1053070); // You can only pollinate other specially grown plants!
}
else if (!targ.IsUsableBy(from))
{
targ.LabelTo(from,
1061856); // You must have the item in your backpack or locked down in order to use it.
}
else if (!targ.IsCrossable)
{
targ.LabelTo(from, 1053073); // You cannot cross-pollinate with a mutated plant!
}
else if (!targ.PlantSystem.PollenProducing)
{
targ.LabelTo(from, 1053074); // This plant is not in the flowering stage. You cannot pollinate it!
}
else if (targ.PlantSystem.Health < PlantHealth.Healthy)
{
targ.LabelTo(from, 1053075); // You cannot pollinate an unhealthy plant!
}
else if (targ.PlantSystem.Pollinated)
{
targ.LabelTo(from, 1053072); // This plant has already been pollinated!
}
else if (targ == m_Plant)
{
targ.PlantSystem.Pollinated = true;
@ -65,4 +85,4 @@ namespace Server.Engines.Plants
m_Plant.IsUsableBy(from)) from.SendGump(new ReproductionGump(m_Plant));
}
}
}
}

View file

@ -138,21 +138,24 @@ namespace Server.Engines.Plants
}
case 3: // Pollination
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 67, true); // POLLINATION STATE
from.Send(new DisplayHelpTopic(67, true)); // POLLINATION STATE
from.SendGump(new ReproductionGump(m_Plant));
break;
}
case 4: // Resources
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 69, true); // RESOURCE PRODUCTION
from.Send(new DisplayHelpTopic(69, true)); // RESOURCE PRODUCTION
from.SendGump(new ReproductionGump(m_Plant));
break;
}
case 5: // Seeds
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 68, true); // SEED PRODUCTION
from.Send(new DisplayHelpTopic(68, true)); // SEED PRODUCTION
from.SendGump(new ReproductionGump(m_Plant));
break;
@ -197,7 +200,9 @@ namespace Server.Engines.Plants
m_Plant.LabelTo(from, 1053055); // Mutated plants do not produce resources!
}
else if (system.AvailableResources == 0)
{
m_Plant.LabelTo(from, 1053056); // This plant has no resources to gather!
}
else
{
Item resource = resInfo.CreateResource();
@ -224,9 +229,13 @@ namespace Server.Engines.Plants
PlantSystem system = m_Plant.PlantSystem;
if (!m_Plant.Reproduces)
{
m_Plant.LabelTo(from, 1053060); // Mutated plants do not produce seeds!
}
else if (system.AvailableSeeds == 0)
{
m_Plant.LabelTo(from, 1053061); // This plant has no seeds to gather!
}
else
{
Seed seed = new Seed(system.SeedType, system.SeedHue, true);

View file

@ -64,7 +64,7 @@ namespace Server.Engines.Plants
}
case 2: // Help
{
ContentPackets.SendDisplayHelpTopic(from.NetState, 70, true); // DECORATIVE MODE
from.Send(new DisplayHelpTopic(70, true)); // DECORATIVE MODE
from.SendGump(new SetToDecorativeGump(m_Plant));