MohamedModyAdel
2019-06-11, 01:22 PM
سلام عليكم انهاردة جيبلكو في اه بي ايام شغاله تمام
كلاس EntityTable
هتبحث عن
client.Entity.LoadTopStatus();
هتحط تحتها
client.VIPDays.Load(client);
وبعدين هتخش علي gamestate او gameclient
هتحط دا في اي مكان
public VIPDays VIPDays = new VIPDays();
هتبحث عن
private void ShutDown()
وبعدين لغيت
Kernel.GamePool.Remove(this.Entity.UID);
تحتيها دا
VIPDays.Save(this);
كلاس packethandle
هتبحث عن
case 2032:
هتنزل تحت
لغيت
#region Captchas
هتحط تحتها
#region VIIPDays.
if (client.ActiveNpc == 780000)
{
//Npcs dialog = new Npcs(client);
if (client.Inventory.Contains(client.ActiveNpc, 1))
{
if (req.OptionID == 1)
{
if (client.Entity.VIPLevel > 3)
{
dialog.Text("You are VIPLevel " + client.Entity.VIPLevel + ", So You Can't Unlock This Item.");
dialog.Option("Sorry.", 255);
dialog.Send();
}
else
{
if (client.Entity.VIPLevel < 4)
{
dialog.Text("Are You Sure You Want To Unlock This Item.");
dialog.Option("Yes I'M Sure.", 2);
dialog.Send();
}
}
}
if (req.OptionID == 2)
if (client.Entity.VIPLevel < 4)
{
client.VIPDays.Insert(DateTime.Now, DateTime.Now.AddHours(1), 4, client.Entity.VIPLevel, client);
client.Inventory.Remove(client.ActiveNpc, 1);
}
}
}
#endregion
#region VIIPDays.
if (client.ActiveNpc == 780001)
{
//Npcs dialog = new Npcs(client);
if (client.Inventory.Contains(client.ActiveNpc, 1))
{
if (req.OptionID == 1)
{
if (client.Entity.VIPLevel > 3)
{
dialog.Text("You are VIPLevel " + client.Entity.VIPLevel + ", So You Can't Unlock This Item.");
dialog.Option("Sorry.", 255);
dialog.Send();
}
else
{
if (client.Entity.VIPLevel < 4)
{
dialog.Text("Are You Sure You Want To Unlock This Item.");
dialog.Option("Yes I'M Sure.", 2);
dialog.Send();
}
}
}
if (req.OptionID == 2)
if (client.Entity.VIPLevel < 4)
{
client.VIPDays.Insert(DateTime.Now, DateTime.Now.AddDays(1), 4, client.Entity.VIPLevel, client);
client.Inventory.Remove(client.ActiveNpc, 1);
}
}
}
#endregion
#region VIIPDays.
if (client.ActiveNpc == 780010)
{
//Npcs dialog = new Npcs(client);
if (client.Inventory.Contains(client.ActiveNpc, 1))
{
if (req.OptionID == 1)
{
if (client.Entity.VIPLevel > 3)
{
dialog.Text("You are VIPLevel " + client.Entity.VIPLevel + ", So You Can't Unlock This Item.");
dialog.Option("Sorry.", 255);
dialog.Send();
}
else
{
if (client.Entity.VIPLevel < 4)
{
dialog.Text("Are You Sure You Want To Unlock This Item.");
dialog.Option("Yes I'M Sure.", 2);
dialog.Send();
}
}
}
if (req.OptionID == 2)
if (client.Entity.VIPLevel < 4)
{
client.VIPDays.Insert(DateTime.Now, DateTime.Now.AddDays(7), 4, client.Entity.VIPLevel, client);
client.Inventory.Remove(client.ActiveNpc, 1);
}
}
}
#endregion
وبعدين هتبحث عن
#region Misc
هتحط تختها
#region VIP4Days
case 780000:
{
Npcs dialog = new Npcs(client);
dialog.Avatar(item.ID);
dialog.Text("Hello " + client.Entity.Name + ", There is VIPLevel 4 For 1 Hour. If You Want To Get it Just Confirm.");
dialog.Option("Confirm.", 1);
dialog.Option("Cancel.", 255);
dialog.Send();
client.ActiveNpc = item.ID;
break;
}
#endregion
#region VIP4Days
case 780001:
{
Npcs dialog = new Npcs(client);
dialog.Avatar(item.ID);
dialog.Text("Hello " + client.Entity.Name + ", There is VIPLevel 4 For 1 Day. If You Want To Get it Just Confirm.");
dialog.Option("Confirm.", 1);
dialog.Option("Cancel.", 255);
dialog.Send();
client.ActiveNpc = item.ID;
break;
}
#endregion
#region VIP4Days
case 780010:
{
Npcs dialog = new Npcs(client);
dialog.Avatar(item.ID);
dialog.Text("Hello " + client.Entity.Name + ", There is VIPLevel 4 For 7 Days. If You Want To Get it Just Confirm.");
dialog.Option("Confirm.", 1);
dialog.Option("Cancel.", 255);
dialog.Send();
client.ActiveNpc = item.ID;
break;
}
#endregion
هتعمل كلاس بي الاسم دا VIPDays
هتحط فيه دول
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DarkWay.Database;
namespace DarkWay
{
public class VIPDays
{
public DateTime StartOn, EndOn;
public byte Level, OLDLevel;
public Time32 CheckStamp = Time32.Now;
public void Insert(DateTime _StartOn, DateTime _EndOn, byte _Level, byte _OLDLevel, Client.GameState client)
{
this.StartOn = _StartOn;
this.EndOn = _EndOn;
this.Level = _Level;
this.OLDLevel = _OLDLevel;
client.Entity.VIPLevel = this.Level;
#region Insert
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("vipdays").Where("UID", client.Entity.UID))
using (var reader = new MySqlReader(cmd))
{
if (!reader.Read())
using (var cmds = new MySqlCommand(MySqlCommandType.INSERT))
cmds.Insert("vipdays").Insert("UID", client.Entity.UID).Execute();
}
#endregion
this.Save(client);
client.Send("Your VIP, Now level " + this.Level + " will end in " + this.EndOn + "");
}
public void Check(Client.GameState client)
{
if (DateTime.Now >= this.EndOn)
{
client.Entity.VIPLevel = this.OLDLevel;
this.Level = 0;
this.OLDLevel = 0;
this.Delete(client);
client.Send("Your VIP, is ended, Now your VIP level is " + client.Entity.VIPLevel + "");
}
this.CheckStamp = Time32.Now;
}
public void Load(Client.GameState c)
{
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("vipdays").Where("UID", c.Entity.UID))
using (var reader = new MySqlReader(cmd))
{
if (reader.Read())
{
this.Level = reader.ReadByte("Level");
this.OLDLevel = reader.ReadByte("OLDLevel");
this.StartOn = Kernel.FromDateTimeInt(reader.ReadUInt64("StartOn"));
this.EndOn = Kernel.FromDateTimeInt(reader.ReadUInt64("EndOn"));
}
}
}
public void Save(Client.GameState client)
{
Database.MySqlCommand cmd = new Database.MySqlCommand(Database.MySqlCommandType.UP DATE);
cmd.Update("vipdays").Set("Level", this.Level).Set("OLDLevel", this.OLDLevel).Set("StartOn", Kernel.ToDateTimeInt(this.StartOn)).Set("EndOn", Kernel.ToDateTimeInt(this.EndOn))
.Where("UID", client.Entity.UID).Execute();
}
public void Delete(Client.GameState client)
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE);
cmd.Delete("vipdays", "UID", client.Entity.UID).Execute();
}
}
}
هتخش علي كلاس world
هتبحث عن
private void CharactersCallback
هتحط تحتها دا
#region VIPDays
if (client.VIPDays.Level > 0 && Time32.Now >= client.VIPDays.CheckStamp.AddSeconds(2))
{
client.VIPDays.Check(client);
}
#endregion
الي هيطلعه ارور
خش علي كلاس
gamestate
ابحث عن دا
public DateTime LastVote;
هتلقي تحتها
public uint VIPDays;
تحميل ملف القاعده (عفواً لايمكن عرض الروابط في الإرشيف)
كلاس EntityTable
هتبحث عن
client.Entity.LoadTopStatus();
هتحط تحتها
client.VIPDays.Load(client);
وبعدين هتخش علي gamestate او gameclient
هتحط دا في اي مكان
public VIPDays VIPDays = new VIPDays();
هتبحث عن
private void ShutDown()
وبعدين لغيت
Kernel.GamePool.Remove(this.Entity.UID);
تحتيها دا
VIPDays.Save(this);
كلاس packethandle
هتبحث عن
case 2032:
هتنزل تحت
لغيت
#region Captchas
هتحط تحتها
#region VIIPDays.
if (client.ActiveNpc == 780000)
{
//Npcs dialog = new Npcs(client);
if (client.Inventory.Contains(client.ActiveNpc, 1))
{
if (req.OptionID == 1)
{
if (client.Entity.VIPLevel > 3)
{
dialog.Text("You are VIPLevel " + client.Entity.VIPLevel + ", So You Can't Unlock This Item.");
dialog.Option("Sorry.", 255);
dialog.Send();
}
else
{
if (client.Entity.VIPLevel < 4)
{
dialog.Text("Are You Sure You Want To Unlock This Item.");
dialog.Option("Yes I'M Sure.", 2);
dialog.Send();
}
}
}
if (req.OptionID == 2)
if (client.Entity.VIPLevel < 4)
{
client.VIPDays.Insert(DateTime.Now, DateTime.Now.AddHours(1), 4, client.Entity.VIPLevel, client);
client.Inventory.Remove(client.ActiveNpc, 1);
}
}
}
#endregion
#region VIIPDays.
if (client.ActiveNpc == 780001)
{
//Npcs dialog = new Npcs(client);
if (client.Inventory.Contains(client.ActiveNpc, 1))
{
if (req.OptionID == 1)
{
if (client.Entity.VIPLevel > 3)
{
dialog.Text("You are VIPLevel " + client.Entity.VIPLevel + ", So You Can't Unlock This Item.");
dialog.Option("Sorry.", 255);
dialog.Send();
}
else
{
if (client.Entity.VIPLevel < 4)
{
dialog.Text("Are You Sure You Want To Unlock This Item.");
dialog.Option("Yes I'M Sure.", 2);
dialog.Send();
}
}
}
if (req.OptionID == 2)
if (client.Entity.VIPLevel < 4)
{
client.VIPDays.Insert(DateTime.Now, DateTime.Now.AddDays(1), 4, client.Entity.VIPLevel, client);
client.Inventory.Remove(client.ActiveNpc, 1);
}
}
}
#endregion
#region VIIPDays.
if (client.ActiveNpc == 780010)
{
//Npcs dialog = new Npcs(client);
if (client.Inventory.Contains(client.ActiveNpc, 1))
{
if (req.OptionID == 1)
{
if (client.Entity.VIPLevel > 3)
{
dialog.Text("You are VIPLevel " + client.Entity.VIPLevel + ", So You Can't Unlock This Item.");
dialog.Option("Sorry.", 255);
dialog.Send();
}
else
{
if (client.Entity.VIPLevel < 4)
{
dialog.Text("Are You Sure You Want To Unlock This Item.");
dialog.Option("Yes I'M Sure.", 2);
dialog.Send();
}
}
}
if (req.OptionID == 2)
if (client.Entity.VIPLevel < 4)
{
client.VIPDays.Insert(DateTime.Now, DateTime.Now.AddDays(7), 4, client.Entity.VIPLevel, client);
client.Inventory.Remove(client.ActiveNpc, 1);
}
}
}
#endregion
وبعدين هتبحث عن
#region Misc
هتحط تختها
#region VIP4Days
case 780000:
{
Npcs dialog = new Npcs(client);
dialog.Avatar(item.ID);
dialog.Text("Hello " + client.Entity.Name + ", There is VIPLevel 4 For 1 Hour. If You Want To Get it Just Confirm.");
dialog.Option("Confirm.", 1);
dialog.Option("Cancel.", 255);
dialog.Send();
client.ActiveNpc = item.ID;
break;
}
#endregion
#region VIP4Days
case 780001:
{
Npcs dialog = new Npcs(client);
dialog.Avatar(item.ID);
dialog.Text("Hello " + client.Entity.Name + ", There is VIPLevel 4 For 1 Day. If You Want To Get it Just Confirm.");
dialog.Option("Confirm.", 1);
dialog.Option("Cancel.", 255);
dialog.Send();
client.ActiveNpc = item.ID;
break;
}
#endregion
#region VIP4Days
case 780010:
{
Npcs dialog = new Npcs(client);
dialog.Avatar(item.ID);
dialog.Text("Hello " + client.Entity.Name + ", There is VIPLevel 4 For 7 Days. If You Want To Get it Just Confirm.");
dialog.Option("Confirm.", 1);
dialog.Option("Cancel.", 255);
dialog.Send();
client.ActiveNpc = item.ID;
break;
}
#endregion
هتعمل كلاس بي الاسم دا VIPDays
هتحط فيه دول
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DarkWay.Database;
namespace DarkWay
{
public class VIPDays
{
public DateTime StartOn, EndOn;
public byte Level, OLDLevel;
public Time32 CheckStamp = Time32.Now;
public void Insert(DateTime _StartOn, DateTime _EndOn, byte _Level, byte _OLDLevel, Client.GameState client)
{
this.StartOn = _StartOn;
this.EndOn = _EndOn;
this.Level = _Level;
this.OLDLevel = _OLDLevel;
client.Entity.VIPLevel = this.Level;
#region Insert
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("vipdays").Where("UID", client.Entity.UID))
using (var reader = new MySqlReader(cmd))
{
if (!reader.Read())
using (var cmds = new MySqlCommand(MySqlCommandType.INSERT))
cmds.Insert("vipdays").Insert("UID", client.Entity.UID).Execute();
}
#endregion
this.Save(client);
client.Send("Your VIP, Now level " + this.Level + " will end in " + this.EndOn + "");
}
public void Check(Client.GameState client)
{
if (DateTime.Now >= this.EndOn)
{
client.Entity.VIPLevel = this.OLDLevel;
this.Level = 0;
this.OLDLevel = 0;
this.Delete(client);
client.Send("Your VIP, is ended, Now your VIP level is " + client.Entity.VIPLevel + "");
}
this.CheckStamp = Time32.Now;
}
public void Load(Client.GameState c)
{
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("vipdays").Where("UID", c.Entity.UID))
using (var reader = new MySqlReader(cmd))
{
if (reader.Read())
{
this.Level = reader.ReadByte("Level");
this.OLDLevel = reader.ReadByte("OLDLevel");
this.StartOn = Kernel.FromDateTimeInt(reader.ReadUInt64("StartOn"));
this.EndOn = Kernel.FromDateTimeInt(reader.ReadUInt64("EndOn"));
}
}
}
public void Save(Client.GameState client)
{
Database.MySqlCommand cmd = new Database.MySqlCommand(Database.MySqlCommandType.UP DATE);
cmd.Update("vipdays").Set("Level", this.Level).Set("OLDLevel", this.OLDLevel).Set("StartOn", Kernel.ToDateTimeInt(this.StartOn)).Set("EndOn", Kernel.ToDateTimeInt(this.EndOn))
.Where("UID", client.Entity.UID).Execute();
}
public void Delete(Client.GameState client)
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.DELETE);
cmd.Delete("vipdays", "UID", client.Entity.UID).Execute();
}
}
}
هتخش علي كلاس world
هتبحث عن
private void CharactersCallback
هتحط تحتها دا
#region VIPDays
if (client.VIPDays.Level > 0 && Time32.Now >= client.VIPDays.CheckStamp.AddSeconds(2))
{
client.VIPDays.Check(client);
}
#endregion
الي هيطلعه ارور
خش علي كلاس
gamestate
ابحث عن دا
public DateTime LastVote;
هتلقي تحتها
public uint VIPDays;
تحميل ملف القاعده (عفواً لايمكن عرض الروابط في الإرشيف)