Help about console log in c#

01/01/2018 19:41 HatersDAD#1
hello best community!,
i wanna make log to table in db.
example: if gm drop item, my filter log it in db (Charname,Code,Date).
any help pls!
thanks.
01/03/2018 05:54 KingDollar#2
then you should create sql table first
Code:
create table _GM_Log (Charname varchar(64),Command varchar(50),Date Datetime)
after you will have to parse 7010 packet which is gm command packet

this enum would help you
it doesn't have the all commands but that what i have parsed, you can parse more if you need just use any packet analyzer, send command , check what byte you received
Code:
public enum GameCommands : byte
{
    FindUser = 1,
    GoTown = 2,
    ToTown = 3,
    WorldStatus = 4,
    LoadMonster = 6,
    MakeItem = 7,
    MoveToUser = 8,
    WP = 10,
    Zoe = 12,
    Ban = 13,
    Invisible = 14,
    Invincible = 15,
    Recalluser = 17,
    Recallguild = 18,
    Liename = 19,
    Mobkill = 20,
    resetq = 28,
    Movetonpc = 31,
    Makerentitem = 38,
    Spawnunique_loc = 42
}
now let's parse the packet it self
Code:
byte action = pck.ReadUInt8();
GameCommands commandsEnum = (GameCommands)action;
string commandName = commandsEnum.ToString();

//exceute your sqlfunction with parsed paramters and charname
01/03/2018 18:10 HatersDAD#3
Quote:
Originally Posted by KingDollar View Post
then you should create sql table first
Code:
create table _GM_Log (Charname varchar(64),Command varchar(50),Date Datetime)
after you will have to parse 7010 packet which is gm command packet

this enum would help you
it doesn't have the all commands but that what i have parsed, you can parse more if you need just use any packet analyzer, send command , check what byte you received
Code:
public enum GameCommands : byte
{
    FindUser = 1,
    GoTown = 2,
    ToTown = 3,
    WorldStatus = 4,
    LoadMonster = 6,
    MakeItem = 7,
    MoveToUser = 8,
    WP = 10,
    Zoe = 12,
    Ban = 13,
    Invisible = 14,
    Invincible = 15,
    Recalluser = 17,
    Recallguild = 18,
    Liename = 19,
    Mobkill = 20,
    resetq = 28,
    Movetonpc = 31,
    Makerentitem = 38,
    Spawnunique_loc = 42
}
now let's parse the packet it self
Code:
byte action = pck.ReadUInt8();
GameCommands commandsEnum = (GameCommands)action;
string commandName = commandsEnum.ToString();

//exceute your sqlfunction with parsed paramters and charname
Thanks my hero :cool:

Quote:
Originally Posted by KingDollar View Post
then you should create sql table first
Code:
create table _GM_Log (Charname varchar(64),Command varchar(50),Date Datetime)
after you will have to parse 7010 packet which is gm command packet

this enum would help you
it doesn't have the all commands but that what i have parsed, you can parse more if you need just use any packet analyzer, send command , check what byte you received
Code:
public enum GameCommands : byte
{
    FindUser = 1,
    GoTown = 2,
    ToTown = 3,
    WorldStatus = 4,
    LoadMonster = 6,
    MakeItem = 7,
    MoveToUser = 8,
    WP = 10,
    Zoe = 12,
    Ban = 13,
    Invisible = 14,
    Invincible = 15,
    Recalluser = 17,
    Recallguild = 18,
    Liename = 19,
    Mobkill = 20,
    resetq = 28,
    Movetonpc = 31,
    Makerentitem = 38,
    Spawnunique_loc = 42
}
now let's parse the packet it self
Code:
byte action = pck.ReadUInt8();
GameCommands commandsEnum = (GameCommands)action;
string commandName = commandsEnum.ToString();

//exceute your sqlfunction with parsed paramters and charname
hello best, thats save only command name i want to save command who is typed like if he type (/makeitem item_scroll_01) thats save in table (charname,item_scroll_01,date). thanks in advance.
01/04/2018 14:18 KingDollar#4
it depends then on action
as example if make item
Code:
if(commandsEnum == GameCommands.MakeItem)
{
 uint itemid = pck.ReadUint32();
 byte itemplus = pck.ReadUint8();
}
01/04/2018 17:51 HatersDAD#5
Quote:
Originally Posted by KingDollar View Post
it depends then on action
as example if make item
Code:
if(commandsEnum == GameCommands.MakeItem)
{
 uint itemid = pck.ReadUint32();
 byte itemplus = pck.ReadUint8();
}
thank you my hero.