الموضوع : اضافه سيستم GameUpdate
شرح الاضافة:
هتروح على المسار دة
Network > GamePackets
و تعمل كلاس جديد بـ اسم
GameUpdates.cs
الكود:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Naruto.Network.GamePackets
{
public unsafe class GameUpdates : Writer, Interfaces.IPacket
{
byte[] Packet;
public enum Mode : byte
{
Header,
Body,
Footer
}
public GameUpdates(Mode _Action, string _String)
{
Packet = new byte[29 + _String.Length];
WriteUInt16((ushort)(Packet.Length - 8), 0, Packet);
WriteUInt16((ushort)MsgTypes.MsgTaskDialog, 2, Packet);
WriteUInt32((uint)Time32.timeGetTime().GetHashCode(), 4, Packet);
Packet[15] = 112;
Packet[16] = 1;
Action = _Action;
String = _String;
}
public Mode Action
{
get { return (Mode)Packet[14]; }
set { Packet[14] = (Byte)value; }
}
public string String
{
get { return System.BitConverter.ToString(Packet, 18, Packet[17]); }
set { WriteStringWithLength(value, 17, Packet); }
}
public byte[] ToArray()
{
return Packet;
}
public void Deserialize(byte[] packet)
{
Packet = packet;
}
public void Send(Client.GameState client)
{
client.Send(Packet);
}
}
}
2 - داخل كلاس
class GameState
تبحث عن
public uint RacePoints
و تحط تحتها دة
الكود:
#region GameUpdates
private uint _updatelist;
public uint UpdateList
{
get { return _updatelist; }
set
{
_updatelist = value;
UpdateDatabase("updatelist", value);
}
}
private void UpdateDatabase(string p, uint value)
{
throw new NotImplementedException();
}
#endregion
private void UpdateDatabase(string p, uint value)
{
throw new NotImplementedException();
}
3 - داخل ملف PacketHandler.cs
تبحث عن
if (client.Entity.FullyLoaded)
{
و تضيف دة تحت القوص
الكود:
#region Game Updates
if (client.Entity.UpdateList == 0)
{
client.Send(new GameUpdates(GameUpdates.Mode.Header, "Welcome To, ServerName Online" + DateTime.Now.ToString()));
client.Send(new GameUpdates(GameUpdates.Mode.Body, "1.New skills have been added\n"));
client.Send(new GameUpdates(GameUpdates.Mode.Body, "2.Support ServerName Online By Invite ur Friends\n"));
client.Send(new GameUpdates(GameUpdates.Mode.Body, "3.Don't trust anyone claiming that he is the GM/PM\n"));
client.Send(new GameUpdates(GameUpdates.Mode.Body, "4.If you found any bug you can repot it By ServerName"));
client.Send(new GameUpdates(GameUpdates.Mode.Body, "5.Enjoy Playing ServerName Online with us and invite friends!"));
client.Send(new GameUpdates(GameUpdates.Mode.Footer, "A lot of surprises awaited during these days"));
client.Entity.UpdateList += 1;
}
#endregion
هتروح ملف
Entity
وضيف دة في اخر
public int UpdateList;