mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-15 11:54:35 +01:00
* Update Equipment.cs Added LVL and EXP params while adding some equipment * Update Equipment.cs changed params to the appropriate type and removed casting * Update Equipment.cs Removed unnecessary changes. * Update RefineStigmataRuneReqHandler.cs Simplified rolling * Update GiveCommand.cs Changed Default behavior of Equipment commands to grant only the max star level versions. Default's to max level as well. * Update GiveCommand.cs Added more command aliases, > valks, valkyries, weap, wep, > weapons-all, weap-all, wep-all, stigmata-all, stigs-all added Avatar ID `316` to the blocked IDs list to prevent buggy behavior. (might add `avatars-all` to get them back) give weap/stigs 0 grants max level items without the `-all` equipment only gives the highest rarity of each weapon. * Update RefineStigmataRuneReqHandler.cs Affixes are now 90% functional * Update SelectNewStigmataRuneReqHandler.cs Should work for any further affix handling changes without needing modifications (might break on 10x but shouldn't) * Update AvatarCommand.cs Blocked Sus-Nya * Update AvatarCommand.cs bitwise -> logical OR * Update GiveCommand.cs bitwise -> logical OR * Update RefineStigmataRuneReqHandler.cs bitwise -> logical AND * Created Personal Abyss Command * Created abyss command * Update User.cs Stores personal Abyss Temperature * Update UltraEndlessGetMainDataReqHandler.cs Uses personal Abyss Temp
112 lines
4.2 KiB
C#
112 lines
4.2 KiB
C#
using Common.Database;
|
|
using Common.Resources.Proto;
|
|
using Common.Utils.ExcelReader;
|
|
using PemukulPaku.GameServer.Game;
|
|
|
|
namespace PemukulPaku.GameServer.Commands
|
|
{
|
|
[CommandHandler("avatar", "Add avatar to player account", CommandType.Player)]
|
|
internal class AvatarCommand : Command
|
|
{
|
|
public override void Run(Session session, string[] args)
|
|
{
|
|
string action = args[0];
|
|
int avatarId = int.Parse(args[1]);
|
|
|
|
Run(session.Player, args);
|
|
|
|
session.ProcessPacket(Packet.FromProto(new GetEquipmentDataReq() { }, CmdId.GetEquipmentDataReq));
|
|
if (avatarId == -1)
|
|
{
|
|
session.ProcessPacket(Packet.FromProto(new GetAvatarDataReq() { AvatarIdLists = new uint[] { 0 } }, CmdId.GetAvatarDataReq));
|
|
}
|
|
else
|
|
{
|
|
session.ProcessPacket(Packet.FromProto(new GetAvatarDataReq() { AvatarIdLists = new uint[] { (uint)avatarId } }, CmdId.GetAvatarDataReq));
|
|
}
|
|
|
|
if (action == "modify")
|
|
{
|
|
List<uint> updatedAvatars = new();
|
|
|
|
if (avatarId == -1)
|
|
{
|
|
foreach (AvatarScheme av in session.Player.AvatarList)
|
|
{
|
|
updatedAvatars.Add(av.AvatarId);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AvatarScheme? avatar = session.Player.AvatarList.FirstOrDefault(av => av.AvatarId == avatarId);
|
|
if (avatar is not null)
|
|
{
|
|
updatedAvatars.Add(avatar.AvatarId);
|
|
}
|
|
}
|
|
|
|
session.ProcessPacket(Packet.FromProto(new GetAvatarDataReq() { AvatarIdLists = updatedAvatars.ToArray() }, CmdId.GetAvatarDataReq));
|
|
}
|
|
}
|
|
|
|
public override void Run(Player player, string[] args)
|
|
{
|
|
string action = args[0];
|
|
int avatarId = int.Parse(args[1]);
|
|
string modType = "";
|
|
int value = 0;
|
|
if (args.Length > 3)
|
|
{
|
|
modType = args[2];
|
|
value = int.Parse(args[3]);
|
|
}
|
|
AvatarScheme? avatar = null;
|
|
|
|
switch (action)
|
|
{
|
|
case "add":
|
|
if (avatarId == -1)
|
|
{
|
|
foreach (AvatarDataExcel avatarData in AvatarData.GetInstance().All)
|
|
{
|
|
if (avatarData.AvatarId >= 9000 || avatarData.AvatarId == 316 ) continue; // Avoid APHO avatars
|
|
|
|
avatar = Common.Database.Avatar.Create(avatarData.AvatarId, player.User.Uid, player.Equipment);
|
|
player.AvatarList = player.AvatarList.Append(avatar).ToArray();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
avatar = Common.Database.Avatar.Create(avatarId, player.User.Uid, player.Equipment);
|
|
player.AvatarList = player.AvatarList.Append(avatar).ToArray();
|
|
}
|
|
player.Equipment.Save();
|
|
break;
|
|
case "modify":
|
|
if (avatarId == -1)
|
|
{
|
|
foreach (var av in player.AvatarList)
|
|
{
|
|
av.GetType()?.GetProperty(modType)?.SetValue(av, (uint)value, null);
|
|
av.Save();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
avatar = player.AvatarList.FirstOrDefault(av => av.AvatarId == avatarId);
|
|
if (avatar is not null)
|
|
{
|
|
avatar.GetType()?.GetProperty(modType)?.SetValue(avatar, (uint)value, null);
|
|
avatar.Save();
|
|
}
|
|
else
|
|
throw new ArgumentException("Avatar not found");
|
|
}
|
|
break;
|
|
default:
|
|
throw new ArgumentException("Unrecognized action");
|
|
}
|
|
}
|
|
}
|
|
}
|