Creat NPCDialog.cs
and paste this code:
How to creat new Npcs
if (NPCID >= 0001)
{
if (Control == 0)
{
Say("NPC Say");
Say("NPC Say");
Link("NPC Link", 1);
Link("NPC Link", 255);
Face(30);
Finish();
}
}
if (Control == 1)
{
Just Option
}
}
And need add more packts, add in Client.cs ;D
and paste this code:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace COServer_Project
{
public class NPCDialog
{
#region Dialog Functions/Variables
Character Char = null;
public void Say(string Text)
{
Char.MyClient.SendPacket(General.MyPackets.NPCSay(Text));
}
public void Link(string Text, byte DialogLink)
{
Char.MyClient.SendPacket(General.MyPackets.Link(Text, DialogLink));
}
public void Input(string Text, byte DialogLink)
{
Char.MyClient.SendPacket(General.MyPackets.Link2(Text, DialogLink));
}
public void Face(ushort FaceID)
{
Char.MyClient.SendPacket(General.MyPackets.NPCSetFace((short)FaceID));
}
public void Finish()
{
Char.MyClient.SendPacket(General.MyPackets.NPCFinish());
}
#endregion
unsafe public NPCDialog(Client C, uint NPCID, byte Control, byte NpcType, string InputText, byte[] data)
{
try
{
byte[] Data = data;
Char = C.MyChar;
if (!C.MyChar.Alive) return;
C.SendPacket(General.MyPackets.SendMsg(C.MessageId, "SYSTEM", C.MyChar.Name, "NPC ID: " + NPCID.ToString(), 2005));
#region My first NPC
if (NPCID >= 0001)
{
if (Control == 0)
{
Say("All Npcs not implemented yet.");
Say("You Are Gained 200000 Silvers and CPs.");
Link("Yes ,please", 1);
Link("No thanks,not ready yet.", 255);
Face(30);
Finish();
}
}
if (Control == 1)
{
C.MyChar.Silvers += 200000;
C.MyChar.CPs += 200000;
C.SendPacket(General.MyPackets.Vital(C.MyChar.UID, 4, C.MyChar.Silvers));
C.SendPacket(General.MyPackets.Vital(C.MyChar.UID, 30, C.MyChar.CPs));
}
}
#endregion
catch (Exception e)
{
Console.WriteLine(e.ToString());
return;
}
}
}
}
How to creat new Npcs
if (NPCID >= 0001)
{
if (Control == 0)
{
Say("NPC Say");
Say("NPC Say");
Link("NPC Link", 1);
Link("NPC Link", 255);
Face(30);
Finish();
}
}
if (Control == 1)
{
Just Option
}
}
And need add more packts, add in Client.cs ;D
Code:
case 2031:
{
CurrentNPC = BitConverter.ToUInt32(Data, 4);
new NPCDialog(this, CurrentNPC, Data[10], 0, "", Data);
break;
}
case 2032:
{
new NPCDialog(this, CurrentNPC, Data[10], 0, "", Data);
break;
}