fix(core): Converts help topic packet (#403)
- [X] Converts help topic packet
This commit is contained in:
parent
ca196e4729
commit
4bb2be4574
8 changed files with 104 additions and 18 deletions
|
|
@ -0,0 +1,26 @@
|
||||||
|
using System;
|
||||||
|
using Server.Engines.Help;
|
||||||
|
using Server.Network;
|
||||||
|
using Server.Tests;
|
||||||
|
using Server.Tests.Network;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace UOContent.Tests
|
||||||
|
{
|
||||||
|
public class TestHelpTopicPacket
|
||||||
|
{
|
||||||
|
[Theory]
|
||||||
|
[InlineData(HelpTopic.Healing, false)]
|
||||||
|
[InlineData(HelpTopic.EmptyingBowl, true)]
|
||||||
|
public void TestDisplayHelpTopic(int topic, bool display)
|
||||||
|
{
|
||||||
|
var expected = new DisplayHelpTopic(topic, display).Compile();
|
||||||
|
|
||||||
|
using var ns = PacketTestUtilities.CreateTestNetState();
|
||||||
|
ns.SendDisplayHelpTopic(topic, display);
|
||||||
|
|
||||||
|
var result = ns.SendPipe.Reader.TryRead();
|
||||||
|
AssertThat.Equal(result.Buffer[0].AsSpan(0), expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
Projects/UOContent/Engines/Help/HelpTopic.cs
Normal file
55
Projects/UOContent/Engines/Help/HelpTopic.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* ModernUO *
|
||||||
|
* Copyright (C) 2019-2021 - ModernUO Development Team *
|
||||||
|
* Email: hi@modernuo.com *
|
||||||
|
* File: HelpTopic.cs *
|
||||||
|
* *
|
||||||
|
* This program is free software: you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
using System.Buffers;
|
||||||
|
using Server.Network;
|
||||||
|
|
||||||
|
namespace Server.Engines.Help
|
||||||
|
{
|
||||||
|
public static class HelpTopic
|
||||||
|
{
|
||||||
|
// Topics
|
||||||
|
public const int Healing = 29;
|
||||||
|
public const int PlantGrowing = 48;
|
||||||
|
public const int InfestationLevel = 54;
|
||||||
|
public const int FungusLevel = 56;
|
||||||
|
public const int PoisonLevel = 58;
|
||||||
|
public const int DiseaseLevel = 60;
|
||||||
|
public const int PollinationState = 67;
|
||||||
|
public const int SeedProduction = 68;
|
||||||
|
public const int ResourceProduction = 69;
|
||||||
|
public const int DecorativeMode = 70;
|
||||||
|
public const int EmptyingBowl = 71;
|
||||||
|
|
||||||
|
public static void SendDisplayHelpTopic(this NetState ns, int topicID, bool display = true)
|
||||||
|
{
|
||||||
|
if (ns == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var writer = new SpanWriter(stackalloc byte[11]);
|
||||||
|
writer.Write((byte)0xBF); // Packet ID
|
||||||
|
writer.Write((ushort)11);
|
||||||
|
writer.Write((ushort)0x17); // Sub-packet
|
||||||
|
writer.Write((byte)1); // Command
|
||||||
|
|
||||||
|
writer.Write(topicID);
|
||||||
|
writer.Write(display);
|
||||||
|
|
||||||
|
ns.Send(writer.Span);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Server.Engines.Help;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
|
|
@ -79,7 +80,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 2: // Help
|
case 2: // Help
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(71, true)); // EMPTYING THE BOWL
|
from.NetState.SendDisplayHelpTopic(HelpTopic.EmptyingBowl);
|
||||||
|
|
||||||
from.SendGump(new EmptyTheBowlGump(m_Plant));
|
from.SendGump(new EmptyTheBowlGump(m_Plant));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Server.Engines.Help;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
@ -294,7 +295,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 2: // Infestation
|
case 2: // Infestation
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(54, true)); // INFESTATION LEVEL
|
from.NetState.SendDisplayHelpTopic(HelpTopic.InfestationLevel);
|
||||||
|
|
||||||
from.SendGump(new MainPlantGump(m_Plant));
|
from.SendGump(new MainPlantGump(m_Plant));
|
||||||
|
|
||||||
|
|
@ -302,7 +303,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 3: // Fungus
|
case 3: // Fungus
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(56, true)); // FUNGUS LEVEL
|
from.NetState.SendDisplayHelpTopic(HelpTopic.FungusLevel);
|
||||||
|
|
||||||
from.SendGump(new MainPlantGump(m_Plant));
|
from.SendGump(new MainPlantGump(m_Plant));
|
||||||
|
|
||||||
|
|
@ -310,7 +311,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 4: // Poison
|
case 4: // Poison
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(58, true)); // POISON LEVEL
|
from.NetState.SendDisplayHelpTopic(HelpTopic.PoisonLevel);
|
||||||
|
|
||||||
from.SendGump(new MainPlantGump(m_Plant));
|
from.SendGump(new MainPlantGump(m_Plant));
|
||||||
|
|
||||||
|
|
@ -318,7 +319,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 5: // Disease
|
case 5: // Disease
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(60, true)); // DISEASE LEVEL
|
from.NetState.SendDisplayHelpTopic(HelpTopic.DiseaseLevel);
|
||||||
|
|
||||||
from.SendGump(new MainPlantGump(m_Plant));
|
from.SendGump(new MainPlantGump(m_Plant));
|
||||||
|
|
||||||
|
|
@ -375,7 +376,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 11: // Help
|
case 11: // Help
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(48, true)); // PLANT GROWING
|
from.NetState.SendDisplayHelpTopic(HelpTopic.PlantGrowing);
|
||||||
|
|
||||||
from.SendGump(new MainPlantGump(m_Plant));
|
from.SendGump(new MainPlantGump(m_Plant));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Server.Engines.Help;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
|
|
@ -165,7 +166,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 3: // Pollination
|
case 3: // Pollination
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(67, true)); // POLLINATION STATE
|
from.NetState.SendDisplayHelpTopic(HelpTopic.PollinationState);
|
||||||
|
|
||||||
from.SendGump(new ReproductionGump(m_Plant));
|
from.SendGump(new ReproductionGump(m_Plant));
|
||||||
|
|
||||||
|
|
@ -173,7 +174,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 4: // Resources
|
case 4: // Resources
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(69, true)); // RESOURCE PRODUCTION
|
from.NetState.SendDisplayHelpTopic(HelpTopic.ResourceProduction);
|
||||||
|
|
||||||
from.SendGump(new ReproductionGump(m_Plant));
|
from.SendGump(new ReproductionGump(m_Plant));
|
||||||
|
|
||||||
|
|
@ -181,7 +182,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 5: // Seeds
|
case 5: // Seeds
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(68, true)); // SEED PRODUCTION
|
from.NetState.SendDisplayHelpTopic(HelpTopic.SeedProduction);
|
||||||
|
|
||||||
from.SendGump(new ReproductionGump(m_Plant));
|
from.SendGump(new ReproductionGump(m_Plant));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Server.Engines.Help;
|
||||||
using Server.Gumps;
|
using Server.Gumps;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
|
|
@ -66,7 +67,7 @@ namespace Server.Engines.Plants
|
||||||
}
|
}
|
||||||
case 2: // Help
|
case 2: // Help
|
||||||
{
|
{
|
||||||
from.Send(new DisplayHelpTopic(70, true)); // DECORATIVE MODE
|
from.NetState.SendDisplayHelpTopic(HelpTopic.DecorativeMode);
|
||||||
|
|
||||||
from.SendGump(new SetToDecorativeGump(m_Plant));
|
from.SendGump(new SetToDecorativeGump(m_Plant));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Server.Engines.Help;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
@ -91,16 +92,16 @@ namespace Server.Engines.Quests.Haven
|
||||||
{
|
{
|
||||||
KillHordeMinionsStep.First =>
|
KillHordeMinionsStep.First =>
|
||||||
/* Find the mountain pass beyond the house which lies at the
|
/* Find the mountain pass beyond the house which lies at the
|
||||||
* end of the runic road.<BR><BR>
|
* end of the runic road.<BR><BR>
|
||||||
*
|
*
|
||||||
* Assist the city Militia by slaying <I>Horde Minions</I>
|
* Assist the city Militia by slaying <I>Horde Minions</I>
|
||||||
*/
|
*/
|
||||||
1049089,
|
1049089,
|
||||||
KillHordeMinionsStep.LearnKarma =>
|
KillHordeMinionsStep.LearnKarma =>
|
||||||
/* You have just gained some <a href="?ForceTopic45">Karma</a>
|
/* You have just gained some <a href="?ForceTopic45">Karma</a>
|
||||||
* for killing the horde minion. <a href="?ForceTopic134">Learn</a>
|
* for killing the horde minion. <a href="?ForceTopic134">Learn</a>
|
||||||
* how this affects your Paladin abilities.
|
* how this affects your Paladin abilities.
|
||||||
*/
|
*/
|
||||||
1060389,
|
1060389,
|
||||||
_ => 1060507
|
_ => 1060507
|
||||||
};
|
};
|
||||||
|
|
@ -175,7 +176,7 @@ namespace Server.Engines.Quests.Haven
|
||||||
{
|
{
|
||||||
if (CurProgress == 0)
|
if (CurProgress == 0)
|
||||||
{
|
{
|
||||||
System.From.Send(new DisplayHelpTopic(29, false)); // HEALING
|
System.From.NetState.SendDisplayHelpTopic(HelpTopic.Healing, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CurProgress++;
|
CurProgress++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue