when I say it's really shit to add monsters on the db with the command. Reboot mandatory, command bug.... Here is the code that will change your life the monster will appear without restarting your server and the command is absolutely not bug
ps: This code does not come from me but from the source I used.
so you may have to adapt the codes to your source to repair the errors.
Code:
////<auto-generated <- Codemaid exclusion for now (PacketIndex Order is important for maintenance)
using OpenNos.Core;
using OpenNos.Domain;
namespace OpenNos.GameObject.CommandPackets
{
[PacketHeader("$AddMonster", PassNonParseablePacket = true, Authority = AuthorityType.GameMaster)]
public class AddMonsterPacket : PacketDefinition
{
#region Properties
[PacketIndex(0)]
public short MonsterVNum { get; set; }
[PacketIndex(1)]
public bool IsMoving { get; set; }
public static string ReturnHelp()
{
return "$AddMonster VNUM MOVE";
}
#endregion
}
}
Code:
/// <summary>
/// $AddMonster Command
/// </summary>
/// <param name="addMonsterPacket"></param>
public void AddMonster(AddMonsterPacket addMonsterPacket)
{
if (addMonsterPacket != null)
{
Logger.LogUserEvent("GMCOMMAND", Session.GenerateIdentity(),
$"[AddMonster]NpcMonsterVNum: {addMonsterPacket.MonsterVNum} IsMoving: {addMonsterPacket.IsMoving}");
if (ServerManager.Instance.Configuration.UseLogService)
{
LogServiceClient.Instance.LogPacket(new PacketLogEntry()
{
Sender = Session.Character.Name,
SenderId = Session.Character.CharacterId,
PacketType = LogType.GMCommand,
Packet = $"[AddMonster]NpcMonsterVNum: {addMonsterPacket.MonsterVNum} IsMoving: {addMonsterPacket.IsMoving}"
});
}
if (!Session.HasCurrentMapInstance)
{
return;
}
NpcMonster npcmonster = ServerManager.GetNpcMonster(addMonsterPacket.MonsterVNum);
if (npcmonster == null)
{
return;
}
MapMonsterDTO monst = new MapMonsterDTO
{
MonsterVNum = addMonsterPacket.MonsterVNum,
MapY = Session.Character.PositionY,
MapX = Session.Character.PositionX,
MapId = Session.Character.MapInstance.Map.MapId,
Position = Session.Character.Direction,
IsMoving = addMonsterPacket.IsMoving,
MapMonsterId = ServerManager.Instance.GetNextMobId()
};
if (!DAOFactory.MapMonsterDAO.DoesMonsterExist(monst.MapMonsterId))
{
DAOFactory.MapMonsterDAO.Insert(monst);
if (DAOFactory.MapMonsterDAO.LoadById(monst.MapMonsterId) is MapMonsterDTO monsterDTO)
{
MapMonster monster = new MapMonster(monsterDTO);
monster.Initialize(Session.CurrentMapInstance);
Session.CurrentMapInstance.AddMonster(monster);
Session.CurrentMapInstance?.Broadcast(monster.GenerateIn());
}
}
Session.SendPacket(Session.Character.GenerateSay(Language.Instance.GetMessageFromKey("DONE"), 10));
}
else
{
Session.SendPacket(Session.Character.GenerateSay(AddMonsterPacket.ReturnHelp(), 10));
}
}






are you gonna do a thread for all commands of
?
