mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-12 19:14:34 +01:00
More Helpful Help Command (#5)
* Deleted TestCommand.cs No longer needed. * Update AbyssCommand.cs Added a command to adjust the player's bracket at will. * Update User.cs Added Abyss Group Value * Update Command.cs Added Examples[] to the constructor and handler. * Update HelpCommand.cs Made the Help command more helpful! * Update AbyssCommand.cs Added Help Examples * Update GiveCommand.cs Added help examples, handles negative inputs again, added more aliases, can add or remove materials by ID, can now for add all skipped characters with `give avatars-scuffed` * Update AbyssCommand.cs missed a quote * Update UltraEndlessGetMainDataReqHandler.cs Bracket can now be set with commands. Need to unscuff the fight cycle. * Update GiveCommand.cs Cheeky give gold command * Further refined the Help Command --------- Co-authored-by: TerminalAide0017 <Sucks@code>
This commit is contained in:
@@ -36,6 +36,7 @@ namespace Common.Database
|
||||
AssistantAvatarId = 101,
|
||||
BirthDate = 0,
|
||||
AbyssDynamicHard = 100,
|
||||
AbyssGroupLevel = 8,
|
||||
AvatarTeamList = new List<AvatarTeam> { new AvatarTeam { AvatarIdLists = new uint[] { 101 }, StageType = ((uint)StageType.StageStory) } },
|
||||
CustomAvatarTeamList = new List<CustomAvatarTeam> { }
|
||||
};
|
||||
@@ -85,6 +86,7 @@ namespace Common.Database
|
||||
public int AssistantAvatarId { get; set; }
|
||||
public int BirthDate { get; set; }
|
||||
public uint AbyssDynamicHard { get; set; }
|
||||
public uint AbyssGroupLevel { get; set; }
|
||||
public List<AvatarTeam> AvatarTeamList { get; set; }
|
||||
public List<CustomAvatarTeam> CustomAvatarTeamList { get; set; }
|
||||
|
||||
|
||||
@@ -1,28 +1,36 @@
|
||||
using PemukulPaku.GameServer.Game;
|
||||
using Common.Database;
|
||||
using Common.Resources.Proto;
|
||||
using Common.Utils.ExcelReader;
|
||||
using PemukulPaku.GameServer.Game;
|
||||
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("abyss", "", CommandType.Player)]
|
||||
[CommandHandler("abyss", "<sel> [#]", CommandType.Player,"temp 400", "bracket [1-9]")]
|
||||
internal class AbyssCommand : Command
|
||||
{
|
||||
public override void Run(Session session, string[] args)
|
||||
{
|
||||
Run(session.Player, args);
|
||||
|
||||
// session.ProcessPacket(Packet.FromProto(new UltraEndlessGetMainDataReq() { }, CmdId.UltraEndlessGetMainDataReq));
|
||||
//session.ProcessPacket(Packet.FromProto(new UltraEndlessGetMainDataReq() { }, CmdId.UltraEndlessGetMainDataReq));
|
||||
}
|
||||
public override void Run(Player player, string[] args)
|
||||
{
|
||||
string action = args[0];
|
||||
uint value = args[1] is not null ? uint.Parse(args[1]) : 0;
|
||||
|
||||
switch (action.ToLower())
|
||||
switch (action)
|
||||
{
|
||||
case "disturbance":
|
||||
case "d":
|
||||
case "temp":
|
||||
player.User.AbyssDynamicHard = value;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Unrecognized action");
|
||||
case "bracket":
|
||||
case "group":
|
||||
player.User.AbyssGroupLevel = value > 0 && value < 10 ? value : 9;
|
||||
break;
|
||||
default: throw new ArgumentException("Unrecognized action");
|
||||
}
|
||||
|
||||
player.User.Save();
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Globalization;
|
||||
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("avatar", "Add avatar to player account", CommandType.Player)]
|
||||
[CommandHandler("avatar", "<sel> <id> [Prop] [#]", CommandType.Player, "add 406", "modify -1 star 5")]
|
||||
internal class AvatarCommand : Command
|
||||
{
|
||||
public override void Run(Session session, string[] args)
|
||||
@@ -26,7 +26,7 @@ namespace PemukulPaku.GameServer.Commands
|
||||
session.ProcessPacket(Packet.FromProto(new GetAvatarDataReq() { AvatarIdLists = new uint[] { (uint)avatarId } }, CmdId.GetAvatarDataReq));
|
||||
}
|
||||
|
||||
if (action.ToLower() == "modify")
|
||||
if (action.ToLower() == "modify" || action.ToLower() == "mod")
|
||||
{
|
||||
List<uint> updatedAvatars = new();
|
||||
|
||||
@@ -85,6 +85,7 @@ namespace PemukulPaku.GameServer.Commands
|
||||
player.Equipment.Save();
|
||||
break;
|
||||
case "modify":
|
||||
case "mod":
|
||||
if (avatarId == -1)
|
||||
{
|
||||
foreach (AvatarScheme av in player.AvatarList)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Common.Utils;
|
||||
using Common.Utils;
|
||||
using System.Reflection;
|
||||
using PemukulPaku.GameServer.Game;
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace PemukulPaku.GameServer.Commands
|
||||
public static readonly Logger c = new("Command", ConsoleColor.Cyan, false);
|
||||
public string Name = string.Empty;
|
||||
public string Description = string.Empty;
|
||||
public string[] Examples = Array.Empty<string>();
|
||||
public CommandType CmdType = CommandType.Player;
|
||||
|
||||
/// <summary>
|
||||
@@ -63,13 +64,15 @@ namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public string[] Examples { get; }
|
||||
public CommandType CmdType { get; }
|
||||
|
||||
public CommandHandler(string name, string description, CommandType type = CommandType.Player)
|
||||
public CommandHandler(string name, string description, CommandType type = CommandType.Player, params string[] examples)
|
||||
{
|
||||
Name = name;
|
||||
Description = description;
|
||||
CmdType = type;
|
||||
Examples = examples;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +101,7 @@ namespace PemukulPaku.GameServer.Commands
|
||||
cmd.Name = attr.Name;
|
||||
cmd.Description = attr.Description;
|
||||
cmd.CmdType = attr.CmdType;
|
||||
cmd.Examples = attr.Examples;
|
||||
Commands.Add(cmd);
|
||||
|
||||
#if DEBUG
|
||||
|
||||
@@ -5,7 +5,10 @@ using PemukulPaku.GameServer.Game;
|
||||
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("give", "Mass give resources", CommandType.Player)]
|
||||
[CommandHandler("give", "<sel> [#] [id]", CommandType.Player,
|
||||
//example commands list
|
||||
"gold 123456789","stigs 1", "weaps", "mats 999 2008", "valks", "outfits"
|
||||
)]
|
||||
internal class GiveCommand : Command
|
||||
{
|
||||
public override void Run(Session session, string[] args)
|
||||
@@ -19,9 +22,9 @@ namespace PemukulPaku.GameServer.Commands
|
||||
public override void Run(Player player, string[] args)
|
||||
{
|
||||
string action = args[0];
|
||||
uint value = (args.Length > 1 && args[1] is not null) ? uint.Parse(args[1]) : 0;
|
||||
int value = (args.Length > 1 && args[1] is not null) ? int.Parse(args[1]) : -1;
|
||||
|
||||
switch (action.ToLower())
|
||||
switch (action)
|
||||
{
|
||||
case "avatars":
|
||||
case "characters":
|
||||
@@ -30,31 +33,39 @@ namespace PemukulPaku.GameServer.Commands
|
||||
case "valkyries":
|
||||
foreach (AvatarDataExcel avatarData in AvatarData.GetInstance().All)
|
||||
{
|
||||
if (avatarData.AvatarId >= 9000 || avatarData.AvatarId == 316) continue; // Avoid APHO avatars
|
||||
if (avatarData.AvatarId >= 9000 || avatarData.AvatarId == 316) continue; // Avoid scuffed characters
|
||||
|
||||
AvatarScheme avatar = Common.Database.Avatar.Create(avatarData.AvatarId, player.User.Uid, player.Equipment);
|
||||
player.AvatarList = player.AvatarList.Append(avatar).ToArray();
|
||||
}
|
||||
break;
|
||||
case "avatars-scuffed":
|
||||
case "valkyries-scuffed":
|
||||
foreach (AvatarDataExcel avatarData in AvatarData.GetInstance().All)
|
||||
{
|
||||
if (!(avatarData.AvatarId >= 9000 || avatarData.AvatarId == 316)) continue; // Adds scuffed characters
|
||||
|
||||
AvatarScheme avatar = Common.Database.Avatar.Create(avatarData.AvatarId, player.User.Uid, player.Equipment);
|
||||
player.AvatarList = player.AvatarList.Append(avatar).ToArray();
|
||||
}
|
||||
break;
|
||||
case "weapons":
|
||||
case "weap":
|
||||
case "wep":
|
||||
case "weaps":
|
||||
foreach (WeaponDataExcel weaponData in WeaponData.GetInstance().All)
|
||||
{
|
||||
if (weaponData.EvoId == 0)
|
||||
{
|
||||
Weapon weapon = player.Equipment.AddWeapon(weaponData.Id);
|
||||
weapon.Level = value == 0 ? (uint)weaponData.MaxLv : value;
|
||||
weapon.Level = value <= 0 ? (uint)weaponData.MaxLv : (uint)value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "weapons-all":
|
||||
case "weap-all":
|
||||
case "wep-all":
|
||||
case "weaps-all":
|
||||
foreach (WeaponDataExcel weaponData in WeaponData.GetInstance().All)
|
||||
{
|
||||
Weapon weapon = player.Equipment.AddWeapon(weaponData.Id);
|
||||
weapon.Level = value == 0 ? (uint)weaponData.MaxLv : value;
|
||||
weapon.Level = value <= 0 ? (uint)weaponData.MaxLv : (uint)value;
|
||||
}
|
||||
break;
|
||||
case "stigmata":
|
||||
@@ -64,7 +75,7 @@ namespace PemukulPaku.GameServer.Commands
|
||||
if (stigmataData.EvoId == 0)
|
||||
{
|
||||
Stigmata stigmata = player.Equipment.AddStigmata(stigmataData.Id);
|
||||
stigmata.Level = value == 0 ? (uint)stigmataData.MaxLv : value;
|
||||
stigmata.Level = value <= 0 ? (uint)stigmataData.MaxLv : (uint)value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -73,17 +84,24 @@ namespace PemukulPaku.GameServer.Commands
|
||||
foreach (StigmataDataExcel stigmataData in StigmataData.GetInstance().All)
|
||||
{
|
||||
Stigmata stigmata = player.Equipment.AddStigmata(stigmataData.Id);
|
||||
stigmata.Level = value == 0 ? (uint)stigmataData.MaxLv : value;
|
||||
stigmata.Level = value <= 0 ? (uint)stigmataData.MaxLv : (uint)value;
|
||||
}
|
||||
break;
|
||||
case "materials":
|
||||
case "mats":
|
||||
case "matz":
|
||||
foreach (MaterialDataExcel materialData in MaterialData.GetInstance().All)
|
||||
{
|
||||
player.Equipment.AddMaterial(materialData.Id, value == 0 ? 1 : (int)value);
|
||||
player.Equipment.AddMaterial(materialData.Id, value > 0 || value < -1 ? value : 9999);
|
||||
}
|
||||
break;
|
||||
case "material-id":
|
||||
case "gold":
|
||||
int materialId = args[2] is not null ? int.Parse(args[2]) : 100;
|
||||
player.Equipment.AddMaterial(materialId, value > 0 || value < -1 ? value : 9999);
|
||||
break;
|
||||
case "dress":
|
||||
case "outfits":
|
||||
foreach (DressDataExcel dressData in DressData.GetInstance().All)
|
||||
{
|
||||
foreach (int avatarId in dressData.AvatarIdList)
|
||||
|
||||
@@ -1,13 +1,53 @@
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
using Common.Resources.Proto;
|
||||
using Common;
|
||||
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
|
||||
[CommandHandler("help", "Shows the help page", CommandType.All)]
|
||||
[CommandHandler("help", " - shows help page >:3", CommandType.All)]
|
||||
internal class HelpCommand : Command
|
||||
{
|
||||
public override void Run(Session session, string[] args)
|
||||
{
|
||||
// TODO: Implement online help
|
||||
base.Run(session, args);
|
||||
RecvChatMsgNotify notify = new() { };
|
||||
//hardcoding values is fun AND easy!
|
||||
string msg = "<color=#B00B><size=26>Commands</size></color><size=16><color=#555>\n";
|
||||
msg += "command <required> [optional]\n";
|
||||
//msg += "┌\n";
|
||||
foreach (Command Cmd in CommandFactory.Commands)
|
||||
{
|
||||
if(Cmd.CmdType == CommandType.All || Cmd.CmdType == CommandType.Player)
|
||||
{
|
||||
msg += "┝<size=22>" + Cmd.Name + " " + Cmd.Description + "</size>\n";
|
||||
if (Cmd.Examples is not null)
|
||||
{
|
||||
foreach (string Example in Cmd.Examples)
|
||||
{
|
||||
msg += "│┕" + Example + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
msg += "</color></size>";
|
||||
|
||||
//I really want to figure out how to grab from Chatroom.cs instead, but oh well.
|
||||
ChatMsg AiMsg = new()
|
||||
{
|
||||
Uid = 0,
|
||||
Nickname = "Ai-chan",
|
||||
Time = (uint)Global.GetUnixInSeconds(),
|
||||
Msg = msg,
|
||||
Content = new() { },
|
||||
Channel = ChatMsg.MsgChannel.World,
|
||||
AvatarId = 3201,
|
||||
DressId = 593201,
|
||||
FrameId = 200001,
|
||||
CustomHeadId = 161080,
|
||||
CheckResult = new() { NumberCheck = 0, ShieldType = 0, RewriteText = msg }
|
||||
};
|
||||
AiMsg.Content.Items.Add(new() { MsgStr = msg });
|
||||
notify.ChatMsgLists.Add(AiMsg);
|
||||
session.Send(Packet.FromProto(notify, CmdId.RecvChatMsgNotify));
|
||||
}
|
||||
|
||||
public override void Run(string[] args)
|
||||
|
||||
@@ -4,7 +4,7 @@ using Common.Resources.Proto;
|
||||
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("level", "Modify the player captain level", CommandType.Player)]
|
||||
[CommandHandler("level", "<1-88>", CommandType.Player)]
|
||||
internal class LevelCommand : Command
|
||||
{
|
||||
public override void Run(Session session, string[] args)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("target", "Select session target for console command action", CommandType.Console)]
|
||||
[CommandHandler("target", "[id], displays and selects User sessions for commands", CommandType.Console)]
|
||||
internal class TargetCommand : Command
|
||||
{
|
||||
public override void Run(string[] args)
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace PemukulPaku.GameServer.Commands
|
||||
{
|
||||
[CommandHandler("test", "Test command used for testing")]
|
||||
public class TestCommand : Command
|
||||
{
|
||||
public override void Run(Session session, string[] args)
|
||||
{
|
||||
if (args.Length < 3)
|
||||
{
|
||||
c.Error("Not enough arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
c.Log($"Testing {args[0]} {args[1]} {args[2]}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using Common;
|
||||
using Common.Resources.Proto;
|
||||
using Common.Utils.ExcelReader;
|
||||
using Common.Database;
|
||||
|
||||
namespace PemukulPaku.GameServer.Handlers
|
||||
{
|
||||
@@ -11,11 +10,13 @@ namespace PemukulPaku.GameServer.Handlers
|
||||
|
||||
public void Handle(Session session, Packet packet)
|
||||
{
|
||||
uint bracket = session.Player.User.AbyssGroupLevel;
|
||||
uint temp = session.Player.User.AbyssDynamicHard;
|
||||
UltraEndlessGetMainDataRsp Rsp = new()
|
||||
{
|
||||
retcode = UltraEndlessGetMainDataRsp.Retcode.Succ,
|
||||
ScheduleId = 1028,
|
||||
GroupLevel = 9,
|
||||
GroupLevel = bracket,
|
||||
TopGroupLevel = 9,
|
||||
CupNum = 2000,
|
||||
MainData = new()
|
||||
@@ -27,7 +28,7 @@ namespace PemukulPaku.GameServer.Handlers
|
||||
CloseTime = (uint)Global.GetUnixInSeconds() + 3600 * 24 * 7 + 1200,
|
||||
CurSeasonId = 1
|
||||
},
|
||||
DynamicHardLevel = session.Player.User.AbyssDynamicHard,
|
||||
DynamicHardLevel = temp,
|
||||
LastSettleInfo = new() { }
|
||||
};
|
||||
Rsp.MainData.SiteLists.AddRange(Common.Utils.ExcelReader.UltraEndlessSite.GetInstance().All.Where(x => x.SiteId > 1019).Select(siteData =>
|
||||
|
||||
Reference in New Issue
Block a user