|
المشاركات 1,940 |
+التقييم 0.95 |
تاريخ التسجيل Apr 2019 |
الاقامة Egypt |
نظام التشغيل windows 7 |
رقم العضوية 1 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using T3Alo.Database;
namespace T3Alo.Game
{
public class VIPDays
{
/*
* All Rights Reserved © Mahmoud Mohammed
*/
public DateTime VIPStartON, VIPEndAt;
public byte VIPLevelDays, OldVIPLevel;
public int VIPLogMessage;
public VIPDays()
{
foreach (Client.GameState client in Program.GamePool)
{
this.VIPLevelDays = 0;
this.OldVIPLevel = client.Entity.VIPLevel;
}
}
public static void READ(Client.GameState client)
{
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("vipdays").Where("UID", client.Entity.UID))
using (var reader = new MySqlReader(cmd))
{
if (reader.Read())
{
client.VIPDays.VIPLevelDays = reader.ReadByte("VIPLevelDays");
client.VIPDays.OldVIPLevel = reader.ReadByte("OldVIPLevel");
client.VIPDays.VIPStartON = DateTime.FromBinary(reader.ReadInt64("VIPStartON"));
client.VIPDays.VIPEndAt = DateTime.FromBinary(reader.ReadInt64("VIPEndAt"));
}
else
{
using (var cmds = new MySqlCommand(MySqlCommandType.INSERT))
cmds.Insert("vipdays").Insert("Name", client.Entity.Name).Insert("UID", client.Entity.UID).Execute();
}
}
}
public static void SAVE(Client.GameState client)
{
xConquer.Database.MySqlCommand cmd = new xConquer.Database.MySqlCommand(xConquer.Database.MySqlCommandType.UPDATE);
cmd.Update("vipdays")
.Set("VIPLevelDays", client.VIPDays.VIPLevelDays)
.Set("OldVIPLevel", client.VIPDays.OldVIPLevel)
.Set("VIPStartON", client.VIPDays.VIPStartON)
.Set("VIPEndAt", client.VIPDays.VIPEndAt);
cmd.Where("UID", client.Entity.UID);
cmd.Execute();
}
}
}
public Game.VIPDays VIPDays = new Game.VIPDays();
#region VIPDays Check
/*
* All Rights Reserved © Mahmoud Mohammed
*/
if (client.VIPDays.VIPLevelDays > 0 && DateTime.Now >= client.VIPDays.VIPEndAt)
{
client.Entity.VIPLevel = client.VIPDays.OldVIPLevel;
client.VIPDays.VIPLevelDays = 0;
client.VIPDays.VIPStartON = Convert.ToDateTime(0);
client.VIPDays.VIPEndAt = Convert.ToDateTime(0);
VIPDays.SAVE(client);
client.Send("Your VIP is end, Try to get other item and unlock it.");
}
#endregion
Npcs dialog = new Npcs(client);
#region VIIPDays.
/*
* All Rights Reserved © T3Alo
*/
if (client.ActiveNpc == 3004121)
{
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("Ohh, 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.OldVIPLevel = client.Entity.VIPLevel;//هنا بيحفظ الفي اي بي القديم بتاعك علشان بعد الاسبوع يرجعهولك تاني
client.VIPDays.VIPLevelDays = 4;//هنا بيديلك الفي اي بي الي موجود في الشنه والي انت هتتحدو
client.VIPDays.VIPStartON = DateTime.Now;//هنا بيسجل بدايه الاسبوع بتاعك من وقت فتح الشنطه
client.VIPDays.VIPEndAt = DateTime.Now.AddDays(7);//هنا بيحدد الوقت الي هيخلص فيه الفي اي بي ويرجعلك الفي اي بي القديم
client.Entity.VIPLevel = client.VIPDays.VIPLevelDays;//هنا بيديلك الفي اي بي
client.Inventory.Remove(client.ActiveNpc, 1);
client.Send("Congratulations " + client.Entity.Name + ", You have got VIPLevel " + client.VIPDays.VIPLevelDays + " to " + client.VIPDays.VIPEndAt + ".");
VIPDays.SAVE(client);
}
}
}
}
#endregion
tatic void UseItem
#region VIP7Days
case 3004121:
{
Npcs dialog = new Npcs(client);
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.Avatar(318);
dialog.Send();
client.ActiveNpc = item.ID;
break;
}
#endregion
client.Entity.FullyLoaded = true;
Game.VIPDays.READ(client);
rivate void ShutDown()
Kernel.GamePool.Remove(Entity.UID);
VIPDays.SAVE(this);
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
أدوات الموضوع | |
|