احصائياتى

الردود
2

المشاهدات
91
 
Hazem
.:: المدير العام::.

    متواجد  الان

المشاركات
2,308

+التقييم
0.84

تاريخ التسجيل
Apr 2019

الاقامة
Egypt

نظام التشغيل
windows 7

رقم العضوية
1
2021-08-18, 04:05 PM
المشاركة 1
2021-08-18, 04:05 PM
المشاركة 1
افتراضي اضافة Activeness System كامل ، والكمال لله وحده !


اهــلا و سهــلا ب اعضــاء و زوار عرب كود

هخش فـ الموضوع علطول وهوا اضافة Activeness System كامل ,

هتعمل Folder جديد فـ السورس باسم Activeness .

هتضيف فيه الكلاسين دول .

1- Activeness.cs ,

كود:
using System;

namespace 
COServer.Network.GamePackets
{
    public class 
Activeness : Writer, Interfaces.IPacket
    
{
        
byte[] Buffer;
        public 
enum Types : byte
        
{
            
NumberOfTasks = 14,
            
LoginTask = 25,
            
VIPTask = 26,
            
HoursTask = 27,
            
LotteryTask = 28,
            
DailyQuestTask = 29,
            
FlowerTask = 30,
            
QualiferTask = 31,
            
ChampionPTask = 32,
            
HorseRacingTask = 33,
            
TIBTask = 34,
            
Enlightenment = 35,
            
TeamQualiferTask = 36,
            
ChiTask = 37,
            
JiangTask = 38,
        }
        public 
Activeness(Client.GameState client, bool Ok = true)
        {
            if (
Ok)
            {
                
Buffer = new byte[90 + 8];
                
Buffer[0] = 90;
                
Writer.WriteInt32(2820, 2, Buffer);
                
Buffer[4] = 3;
                
Buffer[5] = (byte)Types.NumberOfTasks;
                
Buffer[6] = (byte)Types.LoginTask;
                
Buffer[12] = (byte)Types.VIPTask;
                
Buffer[18] = (byte)Types.HoursTask;
                
Buffer[24] = (byte)Types.LotteryTask;
                
Buffer[30] = (byte)Types.DailyQuestTask;
                
Buffer[36] = (byte)Types.FlowerTask;
                
Buffer[42] = (byte)Types.QualiferTask;
                
Buffer[48] = (byte)Types.ChampionPTask;
                
Buffer[72] = (byte)Types.TeamQualiferTask;
                
Buffer[54] = (byte)Types.HorseRacingTask;
                
Buffer[60] = (byte)Types.TIBTask;
                
Buffer[66] = (byte)Types.Enlightenment;
                
Buffer[78] = (byte)Types.ChiTask;
                
Buffer[84] = (byte)Types.JiangTask;
            }
        }
        public 
byte GetMaxTimesOfTask(Types type)
        {
            
byte Count = 0;
            if (
type == (Types)25)
                
Count = 1;
            if (
type == (Types)26)
                
Count = 1;
            if (
type == (Types)27)
                
Count = 5;
            if (
type == (Types)28)
                
Count = 10;
            if (
type == (Types)29)
                
Count = 8;
            if (
type == (Types)30)
                
Count = 1;
            if (
type == (Types)31)
                
Count = 5;
            if (
type == (Types)32)
                
Count = 1;
            if (
type == (Types)33)
                
Count = 1;
            if (
type == (Types)34)
                
Count = 1;
            if (
type == (Types)35)
                
Count = 3;
            if (
type == (Types)36)
                
Count = 5;
            if (
type == (Types)37)
                
Count = 12;
            if (
type == (Types)38)
                
Count = 12;
            return 
Count;
        }
        public 
void SendSinglePacket(Client.GameState client, Types type, byte value)
        {
            if (
value > GetMaxTimesOfTask(type))
            {
                
value = GetMaxTimesOfTask(type);
            }
            
byte[] ary = new byte[12 + 8];
            
Writer.WriteByte((byte)12, 0, ary);
            
Writer.WriteUInt16((ushort)2820, 2, ary);
            
ary[4] = 3;
            
ary[5] = 1;
            
ary[6] = (byte)type;
            if (
value >= GetMaxTimesOfTask(type))
            {
                
ary[10] = 1;
            }
            
ary[11] = value;
            
client.Send(ary);
            if (
type == (Types)25)
            {
                
client.Activenes.LoginTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteLoginTask = 1;
                }
            }
            if (
type == (Types)26)
            {
                
client.Activenes.VIPActivenessTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteVIPActiveness = 1;
                }
            }
            if (
type == (Types)27)
            {
                
client.Activenes.HalfAnHourOnlineTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteHalfAnHourOnline = 1;
                }
            }
            if (
type == (Types)28)
            {
                
client.Activenes.LotteryTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteLottery = 1;
                }
            }
            if (
type == (Types)29)
            {
                
client.Activenes.DailyQuestTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteDailyQuest = 1;
                }
            }
            if (
type == (Types)30)
            {
                
client.Activenes.FlowerAndGiftTime = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteFlowerAndGift = 1;
                }
            }
            if (
type == (Types)31)
            {
                
client.Activenes.QualiferTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteQualifer = 1;
                }
            }
            if (
type == (Types)32)
            {
                
client.Activenes.ChampionPointsTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteChampionPoints = 1;
                }
            }
            if (
type == (Types)33)
            {
                
client.Activenes.HorseRacingTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.HorseRacingComplete = 1;
                }
            }
            if (
type == (Types)34)
            {
                
client.Activenes.TIBTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteTIB = 1;
                }
            }
            if (
type == (Types)35)
            {
                
client.Activenes.EnlightenmentTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteEnlightenment = 1;
                }
            }
            if (
type == (Types)36)
            {
                
client.Activenes.TeamQualiferTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteTeamQualifer = 1;
                }
            }
            if (
type == (Types)37)
            {
                
client.Activenes.ChiStudyTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteChiStudy = 1;
                }
            }
            if (
type == (Types)38)
            {
                
client.Activenes.JiangStudyTimes = value;
                if (
value >= GetMaxTimesOfTask(type))
                {
                    
client.Activenes.CompleteJiangStudy = 1;
                }
            }
            
ActivenessPoints AP = new ActivenessPoints();
            
AP.Points = AP.GetActivenessPoints(client.Activenes.ToArray());
            
client.ActivenessPoints = AP.Points;
            
AP.Send(client);
        }
        public static 
void Login(Client.GameState client, bool JustLoggingNow = false)
        {
            
Activeness AN = new Activeness(client);
            
AN.CompleteLoginTask = 1;
            
AN.LoginTimes = 1;
            if (
client.Entity.VIPLevel > 0)
            {
                
AN.CompleteVIPActiveness = 1;
                
AN.VIPActivenessTimes = 1;
            }
            else
            {
                
AN.CompleteVIPActiveness = 0;
                
AN.VIPActivenessTimes = 0;
            }
            if (
JustLoggingNow)
            {
                
AN.HalfHourTask = Time32.Now;
            }
            
AN.HalfAnHourOnlineTimes = Math.Min((byte)5, client.Entity.HoursTimes);
            if (
Math.Min((byte)5, client.Entity.HoursTimes) >= 5)
            {
                
AN.CompleteHalfAnHourOnline = 1;
            }
            if (
client.LotteryEntries >= 10)
            {
                
AN.CompleteLottery = 1;
                
AN.LotteryTimes = 10;
            }
            else
            {
                
AN.CompleteLottery = 0;
                
AN.LotteryTimes = client.LotteryEntries;
            }
            if (
AN.DailyQuestCompletedTimes(client) >= 8)
            {
                
AN.CompleteDailyQuest = 1;
                
AN.DailyQuestTimes = AN.DailyQuestCompletedTimes(client);
            }
            else
            {
                
AN.CompleteDailyQuest = 0;
                
AN.DailyQuestTimes = AN.DailyQuestCompletedTimes(client);
            }
            if (
client.Entity.AddFlower >= 1)
            {
                
AN.CompleteFlowerAndGift = 0;
                
AN.FlowerAndGiftTime = 0;
            }
            else
            {
                
AN.CompleteFlowerAndGift = 1;
                
AN.FlowerAndGiftTime = 1;
            }
            if (
client.ArenaStatistic != null && client.ArenaStatistic.TodayBattles >= 5)
            {
                
AN.CompleteQualifer = 1;
                
AN.QualiferTimes = 5;
            }
            else
            {
                
AN.CompleteQualifer = 0;
                
AN.QualiferTimes = (byte)client.ArenaStatistic.TodayBattles;
            }
            
AN.ChiStudyTimes = Math.Min((byte)client.Entity.ChiStudyTimes, (byte)12);
            
AN.JiangStudyTimes = Math.Min((byte)client.Entity.JiangStudyTimes, (byte)12);
            if (
AN.ChiStudyTimes >= 12)
            {
                
AN.CompleteChiStudy = 1;
            }
            if (
AN.JiangStudyTimes >= 12)
            {
                
AN.CompleteJiangStudy = 1;
            }
            if (
client.ChampionPoints != 0 && client.CP.TodayPoints != 0)
            {
                
AN.CompleteChampionPoints = 1;
                
AN.ChampionPointsTimes = 1;
            }
            else
            {
                
AN.CompleteChampionPoints = 0;
                
AN.ChampionPointsTimes = 0;
            }
            if (
client.Entity.RacePoints != 0)
            {
                
AN.HorseRacingComplete = 1;
                
AN.HorseRacingTimes = 1;
            }
            else
            {
                
AN.HorseRacingComplete = 0;
                
AN.HorseRacingTimes = 0;
            }
            if (
client.Entity.DidTIB == true)
            {
                
AN.TIBTimes = 1;
                
AN.CompleteTIB = 1;
            }
            else
            {
                
AN.CompleteTIB = 0;
                
AN.TIBTimes = 0;
            }
            if (
client.Entity.EnlightenPoints != 0)
            {
                
byte EnlightenP = (byte)Math.Min((byte)3, client.Entity.EnlightmentTimes);
                
AN.EnlightenmentTimes = EnlightenP;
                if (
AN.EnlightenmentTimes >= 3)
                    
AN.CompleteEnlightenment = 1;
            }
            if (
client.TeamArenaStatistic != null && client.TeamArenaStatistic.TodayBattles >= 2)
            {
                
AN.CompleteTeamQualifer = 1;
                
AN.TeamQualiferTimes = 2;
            }
            else
            {
                
AN.CompleteTeamQualifer = 0;
                
AN.TeamQualiferTimes = (byte)client.TeamArenaStatistic.TodayBattles;
            }
            
AN.Send(client);
            
ActivenessPoints AP = new ActivenessPoints();
            
AP.Points = AP.GetActivenessPoints(AN.ToArray());
            
client.ActivenessPoints = AP.Points;
            
AP.Send(client);
            if (
client.Entity.ClaimedActivenessGift1 == 1)
            {
                
ClaimActivenessGift CAG = new ClaimActivenessGift();
                
CAG.Type = 1;
                
client.Send(CAG.ToArray());
            }
            if (
client.Entity.ClaimedActivenessGift2 == 1)
            {
                
ClaimActivenessGift CAG = new ClaimActivenessGift();
                
CAG.Type = 2;
                
client.Send(CAG.ToArray());
            }
            if (
client.Entity.ClaimedActivenessGift3 == 1)
            {
                
ClaimActivenessGift CAG = new ClaimActivenessGift();
                
CAG.Type = 3;
                
client.Send(CAG.ToArray());
            }
            
client.Activenes = AN;
            
client.Entity.LoadedActivenessSystem = true;
        }
        public 
byte DailyQuestCompletedTimes(Client.GameState client)
        {
            
byte count = 0;
            if (
client.Quests.HasQuest(QuestID.WorshipLeaders))
                if (
client.Quests.CheckQuest(QuestID.WorshipLeaders) == QuestPacket.QuestData.QuestStatus.Finished)
                    
count++;
            if (
client.Quests.HasQuest(QuestID.EveryThingHasAPrice))
                if (
client.Quests.CheckQuest(QuestID.EveryThingHasAPrice) == QuestPacket.QuestData.QuestStatus.Finished)
                    
count++;
            if (
client.Quests.HasQuest(QuestID.TowerOfMystery))
                if (
client.Quests.CheckQuest(QuestID.TowerOfMystery) == QuestPacket.QuestData.QuestStatus.Finished)
                    
count++;
            if (
client.Quests.HasQuest(QuestID.HeavenTreasury))
                if (
client.Quests.CheckQuest(QuestID.HeavenTreasury) == QuestPacket.QuestData.QuestStatus.Finished)
                    
count++;
            if (
client.Quests.HasQuest(QuestID.Magnolias))
                if (
client.Quests.CheckQuest(QuestID.Magnolias) == QuestPacket.QuestData.QuestStatus.Finished)
                    
count++;
            if (
client.Quests.HasQuest(QuestID.RareMaterials))
                if (
client.Quests.CheckQuest(QuestID.RareMaterials) == QuestPacket.QuestData.QuestStatus.Finished)
                    
count++;
            if (
client.Quests.HasQuest(QuestID.Release_the_souls))
                if (
client.Quests.CheckQuest(QuestID.Release_the_souls) == QuestPacket.QuestData.QuestStatus.Finished)
                    
count++;
            if (
client.Quests.HasQuest(QuestID.Spirit_Beads))
                if (
client.Quests.CheckQuest(QuestID.Spirit_Beads) == QuestPacket.QuestData.QuestStatus.Finished)
                    
count++;
            return 
count;
        }
        public 
byte CompleteLoginTask
        
{
            
get { return Buffer[10]; }
            
set { Buffer[10] = value; }
        }
        public 
byte LoginTimes
        
{
            
get { return Buffer[11]; }
            
set { Buffer[11] = value; }
        }
        public 
byte CompleteVIPActiveness
        
{
            
get { return Buffer[16]; }
            
set { Buffer[16] = value; }
        }
        public 
byte VIPActivenessTimes
        
{
            
get { return Buffer[17]; }
            
set { Buffer[17] = value; }
        }
        public 
byte CompleteHalfAnHourOnline
        
{
            
get { return Buffer[22]; }
            
set { Buffer[22] = value; }
        }
        public 
Time32 HalfHourTask = Time32.Now;
        public 
byte HalfAnHourOnlineTimes
        
{
            
get { return Buffer[23]; }
            
set { Buffer[23] = value; }
        }
        public 
byte CompleteLottery
        
{
            
get { return Buffer[28]; }
            
set { Buffer[28] = value; }
        }
        public 
byte LotteryTimes
        
{
            
get { return Buffer[29]; }
            
set { Buffer[29] = value; }
        }
        public 
byte CompleteDailyQuest
        
{
            
get { return Buffer[34]; }
            
set { Buffer[34] = value; }
        }
        public 
byte DailyQuestTimes
        
{
            
get { return Buffer[35]; }
            
set { Buffer[35] = value; }
        }
        public 
byte CompleteFlowerAndGift
        
{
            
get { return Buffer[40]; }
            
set { Buffer[40] = value; }
        }
        public 
byte FlowerAndGiftTime
        
{
            
get { return Buffer[41]; }
            
set { Buffer[41] = value; }
        }
        public 
byte CompleteQualifer
        
{
            
get { return Buffer[46]; }
            
set { Buffer[46] = value; }
        }
        public 
byte QualiferTimes
        
{
            
get { return Buffer[47]; }
            
set { Buffer[47] = value; }
        }
        public 
byte CompleteChampionPoints
        
{
            
get { return Buffer[52]; }
            
set { Buffer[52] = value; }
        }
        public 
byte ChampionPointsTimes
        
{
            
get { return Buffer[53]; }
            
set { Buffer[53] = value; }
        }
        public 
byte HorseRacingComplete
        
{
            
get { return Buffer[58]; }
            
set { Buffer[58] = value; }
        }
        public 
byte HorseRacingTimes
        
{
            
get { return Buffer[59]; }
            
set { Buffer[59] = value; }
        }
        public 
byte CompleteTIB
        
{
            
get { return Buffer[64]; }
            
set { Buffer[64] = value; }
        }
        public 
byte TIBTimes
        
{
            
get { return Buffer[65]; }
            
set { Buffer[65] = value; }
        }
        public 
byte CompleteEnlightenment
        
{
            
get { return Buffer[70]; }
            
set { Buffer[70] = value; }
        }
        public 
byte EnlightenmentTimes
        
{
            
get { return Buffer[71]; }
            
set { Buffer[71] = value; }
        }
        public 
byte CompleteTeamQualifer
        
{
            
get { return Buffer[76]; }
            
set { Buffer[76] = value; }
        }
        public 
byte TeamQualiferTimes
        
{
            
get { return Buffer[77]; }
            
set { Buffer[77] = value; }
        }
        public 
byte CompleteChiStudy
        
{
            
get { return Buffer[82]; }
            
set { Buffer[82] = value; }
        }
        public 
byte ChiStudyTimes
        
{
            
get { return Buffer[83]; }
            
set { Buffer[83] = value; }
        }
        public 
byte CompleteJiangStudy
        
{
            
get { return Buffer[88]; }
            
set { Buffer[88] = value; }
        }
        public 
byte JiangStudyTimes
        
{
            
get { return Buffer[89]; }
            
set { Buffer[89] = value; }
        }
        public 
void Deserialize(byte[] buffer)
        {
            
Buffer = buffer;
        }
        public 
byte[] ToArray()
        {
            return 
Buffer;
        }
        public 
void Send(Client.GameState client)
        {
            if (
Buffer != null)
                
client.Send(Buffer);
        }
    }
    public class 
ClaimActivenessGift : Writer, Interfaces.IPacket
    
{
        
byte[] Buffer;

        public 
ClaimActivenessGift()
        {
            
Buffer = new byte[30 + 8];
            
Buffer[0] = 30;//Length
            
Writer.WriteInt32(2822, 2, Buffer);
        }
        public 
byte Type//1 To Complete
        
{
            
get { return Buffer[4]; }
            
set { Buffer[4] = value; }
        }
        public 
void Deserialize(byte[] buffer)
        {
            
Buffer = buffer;
        }
        public 
byte[] ToArray()
        {
            return 
Buffer;
        }
        public 
void Send(Client.GameState client)
        {
            if (
Buffer != null)
                
client.Send(Buffer);
        }
        public static 
void Process(byte[] packet, Client.GameState client)
        {
            
ClaimActivenessGift CA = new ClaimActivenessGift();
            
CA.Deserialize(packet);
            switch (
CA.Type)
            {
                case 
1:
                    {
                        if (
client.Entity.ClaimedActivenessGift1 == 1)
                            return;

                        
client.Inventory.AddTime(3005062, 43200);
                        break;
                    }
                case 
2:
                    {
                        if (
client.Entity.ClaimedActivenessGift2 == 1)
                            return;

                        
client.Inventory.AddTime(3005065, 43200);
                        break;
                    }
                case 
3:
                    {
                        if (
client.Entity.ClaimedActivenessGift3 == 1)
                            return;

                        
client.Inventory.AddTime(3005065, 43200);
                        break;
                    }
                case 
4:
                    {
                        if (
client.ActivenessPoints >= 100)
                        {
                            
ActivenessPoints Point = new ActivenessPoints();
                            
Point.Type = 2;
                            
Point.Points = client.ActivenessPoints;
                            
client.Send(Point.ToArray());
                            
client.Entity.ActivenessDone = true;
                        }
                        break;
                    }
            }
            if (
CA.Type == 1)
                
client.Entity.ClaimedActivenessGift1 = 1;
            if (
CA.Type == 2)
                
client.Entity.ClaimedActivenessGift2 = 1;
            if (
CA.Type == 3)
                
client.Entity.ClaimedActivenessGift3 = 1;
            
CA.Send(client);
        }
    }
    public class 
ActivenessPoints : Writer, Interfaces.IPacket
    
{
        
byte[] Buffer;

        public 
ActivenessPoints()
        {
            
Buffer = new byte[30 + 8];
            
Buffer[0] = 30;
            
Writer.WriteInt32(2823, 2, Buffer);
            
Buffer[4] = 1;
            
Buffer[5] = 2;
            
Buffer[9] = 1;
        }
        public 
ushort GetActivenessPoints(byte[] buffer)
        {
            
ushort points = 0;
            if (
buffer != null)
            {
                
points += ((byte)(buffer[11] * 5));
                
points += ((byte)(buffer[17] * 5));
                
points += ((byte)(buffer[23] * 5));
                
points += ((byte)(buffer[29] * 5));
                
points += ((byte)(buffer[35] * 5));
                
points += ((byte)(buffer[41] * 5));
                
points += ((byte)(buffer[47] * 5));
                
points += ((byte)(buffer[53] * 10));
                
points += ((byte)(buffer[59] * 10));
                
points += ((byte)(buffer[65] * 10));
                
points += ((byte)(buffer[71] * 5));
                
points += ((byte)(buffer[77] * 10));
                
points += ((byte)(buffer[83] * 5));
                
points += ((byte)(buffer[89] * 5));
                return 
points;
            }
            return 
0;
        }
        public 
byte Type
        
{
            
get { return Buffer[4]; }
            
set { Buffer[4] = value; }
        }
        public 
ushort Points
        
{
            
get { return BitConverter.ToUInt16(Buffer, 13); }
            
set { Writer.WriteUInt16(value, 13, Buffer); }
        }
        public 
void Deserialize(byte[] buffer)
        {
            
Buffer = buffer;
        }
        public 
byte[] ToArray()
        {
            return 
Buffer;
        }
        public 
void Send(Client.GameState client)
        {
            if (
Buffer != null)
                
client.Send(Buffer);
        }
    }
} 

2- ActivenessTable.cs ,

كود:
using System;
using COServer.Client;

namespace 
COServer.Database
{
    public class 
ActivenessTable
    
{
        public static 
void Load(GameState client)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("Activeness").Where("UID", client.Entity.UID))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    
client.Entity.ClaimedActivenessGift1 = reader.ReadByte("ClaimedGift1");
                    
client.Entity.ClaimedActivenessGift2 = reader.ReadByte("ClaimedGift2");
                    
client.Entity.ClaimedActivenessGift3 = reader.ReadByte("ClaimedGift3");
                    
client.Entity.ChiStudyTimes = reader.ReadByte("ChiStudy");
                    
client.Entity.JiangStudyTimes = reader.ReadByte("JiangStudy");
                    
client.Entity.DidTIB = reader.ReadBoolean("DidTIB");
                    
client.Entity.EnlightmentTimes = reader.ReadByte("EnlightmentTimes");
                    
client.Entity.HoursTimes = reader.ReadByte("HoursTimes");
                    
client.Entity.ActivenessDone = reader.ReadBoolean("ActivenessDone");
                    return;
                }
                
ActivenessTable.Insert(client);
            }
        }
        public static 
void Save(GameState client)
        {
            if (
client.Entity == null) return;
            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("Activeness"))
                
cmd.Set("ClaimedGift1", client.Entity.ClaimedActivenessGift1)
                    .
Set("ClaimedGift2", client.Entity.ClaimedActivenessGift2)
                    .
Set("ClaimedGift3", client.Entity.ClaimedActivenessGift3)
                    .
Set("JiangStudy", client.Entity.JiangStudyTimes)
                    .
Set("ChiStudy", client.Entity.ChiStudyTimes)
                    .
Set("EnlightmentTimes", client.Entity.EnlightmentTimes)
                    .
Set("DidTIB", client.Entity.DidTIB)
                    .
Set("HoursTimes", client.Entity.HoursTimes)
                    .
Set("ActivenessDone", client.Entity.ActivenessDone)
                    .
Where("UID", client.Entity.UID)
                    .
Execute();
        }
        public static 
void Reset(GameState client)
        {
            if (
client.Entity == null) return;
            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("Activeness"))
                
cmd.Set("ClaimedGift1", 0)
                    .
Set("ClaimedGift2", 0)
                    .
Set("ClaimedGift3", 0)
                    .
Set("ChiStudy", 0)
                    .
Set("JiangStudy", 0)
                    .
Set("DidTIB", false)
                    .
Set("EnlightmentTimes", 0)
                    .
Set("HoursTimes", 0)
                    .
Set("ActivenessDone", 0)
                   .
Where("UID", client.Entity.UID)
                   .
Execute();
            
client.Entity.ChiStudyTimes = 0;
            
client.Entity.JiangStudyTimes = 0;
            
client.Entity.EnlightmentTimes = 0;
            
client.Entity.DidTIB = false;
            
client.Entity.HoursTimes = 0;
            
client.Entity.ClaimedActivenessGift1 = 0;
            
client.Entity.ClaimedActivenessGift2 = 0;
            
client.Entity.ClaimedActivenessGift3 = 0;
        }
        private static 
void Insert(GameState client)
        {
            if (!
ActivenessTable.Exists(client.Entity.UID))
            {
                
using (var cmd = new MySqlCommand(MySqlCommandType.INSERT).Insert("Activeness"))
                    
cmd.Insert("UID", client.Entity.UID).Execute();
            }
        }
        private static 
bool Exists(uint UID)
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("Activeness").Where("UID", UID))
            
using (var reader = new MySqlReader(cmd))
            {
                while (
reader.Read())
                {
                    
reader.Close();
                    
reader.Dispose();
                    return 
true;
                }
                return 
false;
            }
        }
    }
} 

فـ GameState أو GameClient حسب ما عندك هتضيف ,

كود:
public ushort ActivenessPoints
        
{
            
get
            
{
                return 
ActivenessPoint.Points;
            }
            
set
            
{
                
ActivenessPoint.Points =
                    
value;
            }
        }
        public 
ActivenessPoints ActivenessPoint;
        public 
Activeness Activenes; 

وفـ نفس الكلاس تبحث عن ,

كود:
public void ReadyToPlay() 

هتضيف ,

كود:
ActivenessPoint = new ActivenessPoints();
                
Activenes = new Activeness(this); 

وفـ نفس الكلاس تبحث عن ,

كود:
private void ShutDown() 

هتضيف ,

كود:
Database.ActivenessTable.Save(this); 

وفـ نفس الكلاس تبحث عن ,

كود:
internal void LoadData(bool loadFake = false) 

هتضيف ف أوله وأخره ,

كود:
Database.ActivenessTable.Load(this); 

فـ EntityTable هتبحث عن ,

كود:
public static bool LoadEntity(Client.GameState client) 

هتضيف ,

كود:
ActivenessTable.Reset(client); 

وكمان هتضيف ,

كود:
ActivenessTable.Load(client); 

فـ Entity هتضيف ,

كود:
ActivenessDone = false;
public 
bool LoadedActivenessSystem = false;
#region Activeness
        
public byte ClaimedActivenessGift1 = 0;
        public 
byte ClaimedActivenessGift2 = 0;
        public 
byte ClaimedActivenessGift3 = 0;
        public 
uint ChiStudyTimes = 0;
        public 
uint JiangStudyTimes = 0;
        public 
bool DidTIB = false;
        public 
byte EnlightmentTimes = 0;
        public 
byte HoursTimes = 0;
        
#endregion 

فـ Arena أو Qualifier هتبحث عن ,

كود:
public static void Win 

هتضيف فيه ,

كود:
winner.Activenes.SendSinglePacket(winner,   Activeness.Types.QualiferTask, (byte)winner.ArenaStatistic.TodayBattles);
                
loser.Activenes.SendSinglePacket(loser, Activeness.Types.QualiferTask, (byte)loser.ArenaStatistic.TodayBattles); 

فـ SteedRace هتبحث عن ,

كود:
public void FinishRace 

هتضيف فيه ,

كود:
client.Activenes.SendSinglePacket(client, Activeness.Types.HorseRacingTask, 1); 

فـ TeamArena أو TeamQualifier هتبحث عن ,

كود:
public static void Win 

هتضيف فيه ,

كود:
teammate.Activenes.SendSinglePacket(teammate, Activeness.Types.TeamQualiferTask, (byte)winner.TeamArenaStatistic.TodayBattles); 

فـ Lottery هتبحث عن ,

كود:
public static void LuckyBox 

هتدور فيه عـ ,

كود:
h.Entity.LotteryJadeAdd++; 

هتضيف تحتها ,

كود:
h.Activenes.SendSinglePacket(h, Activeness.Types.FlowerTask, 1); 

فـ Chi هتبحث عن .

كود:
private static void StudyChi 

هتضيف فيه ,

كود:
client.Activenes.SendSinglePacket(client, Activeness.Types.ChiTask, (byte)client.Entity.ChiStudyTimes); 

فـ Enlight هتبحث عن ,

كود:
public static void Process 

تحت ,

كود:
if (Client.Entity.EnlightmentTime <= 80) 

هتضيف ,

كود:
client.Activenes.SendSinglePacket(client, Activeness.Types.Enlightenment, client.Entity.EnlightmentTime); 

فـ PacketHandler أو GeneralData هتبحث عن ,

كود:
public static void LoginMessages 

هتضيف ,

كود:
#region Activeness
            
Activeness.Login(client, true);
            
#endregion 

هتبحث ف السورس عن ,

كود:
public static void UseItem 

تضيف فيه ,

كود:
#region Magnolias
                
case 729306:
                case 
729307:
                case 
729308:
                case 
729309:
                case 
729310:
                    {
                        if (
client.Inventory.Count <= 38)
                        {
                            if (
client.Entity.MapID != 1806)
                                break;
                            foreach (var 
npc in Kernel.Maps[client.Entity.MapID].Npcs.Values)
                            {
                                if (
npc.UID != 9897 && Kernel.GetDistance(client.Entity.X, client.Entity.Y, npc.X, npc.Y) <= 7)
                                {
                                    
client.ProgressBar = new ProgressBar(client, Database.ConquerItemInformation.BaseInformations[item.ID].Name.Remove(Database.ConquerItemInformation.BaseInformations[item.ID].Name.Length - 4, 4), p =>
                                    {
                                        if (
item.ID == 729306)
                                        {
                                            
client.Entity.SubClasses.StudyPoints += 10;
                                            
client.MessageBox("Congratulations!~You~received~A~Special~Item,~10~Study~Points~and~1~Chi~Token!");
                                        }
                                        if (
item.ID == 729307)
                                        {
                                            
client.Entity.SubClasses.StudyPoints += 20;
                                            
client.MessageBox("Congratulations!~You~received~A~Special~Item,~20~Study~Points~and~1~Chi~Token!");
                                            
client.IncreaseExperience(client.ExpBall, false);
                                        }
                                        if (
item.ID == 729308)
                                        {
                                            
client.Entity.SubClasses.StudyPoints += 50;
                                            
client.MessageBox("Congratulations!~You~received~A~Special~Item,~50~Study~Points~and~1~Chi~Token!");
                                            
client.IncreaseExperience(client.ExpBall * 2, false);
                                        }
                                        if (
item.ID == 729309)
                                        {
                                            
client.Entity.SubClasses.StudyPoints += 100;
                                            
client.MessageBox("Congratulations!~You~received~A~Special~Item,~100~Study~Points~and~1~Chi~Token!");
                                            
client.IncreaseExperience(client.ExpBall * 3, false);
                                        }
                                        if (
item.ID == 729310)
                                        {
                                            
client.Entity.SubClasses.StudyPoints += 300;
                                            
client.MessageBox("Congratulations!~You~received~A~Special~Item,~300~Study~Points~and~1~Chi~Token!");
                                            
client.IncreaseExperience(client.ExpBall * 5, false);
                                        }
                                        
client.Inventory.Add(729304, 0, 1);
                                        if (
Kernel.Rate(50))
                                        {
                                            
client.Inventory.Add(721261, 0, 3);
                                        }
                                        
_String str = new _String(true);
                                        
str.UID = client.Entity.UID;
                                        
str.TextsCount = 1;
                                        
str.Type = _String.Effect;
                                        
str.Texts.Add("end_task");
                                        
client.SendScreen(str, true);
                                        
_String str2 = new _String(true);
                                        
str2.UID = client.Entity.UID;
                                        
str2.TextsCount = 1;
                                        
str2.Type = 10;
                                        
str2.Texts.Add("angelwing");
                                        
client.SendScreen(str2, true);
                                        if (!
client.Quests.HasQuest(QuestID.Magnolias))
                                        {
                                            
client.Quests.Accept(QuestID.Magnolias);
                                        }
                                        
client.Entity.MagniloQuest = true;
                                        
client.Quests.FinishQuest(QuestID.Magnolias);
                                        
client.Activenes.SendSinglePacket(client, Activeness.Types.DailyQuestTask, client.Activenes.DailyQuestCompletedTimes(client));
                                        
INpc NS = new NpcSpawn(true);
                                        
NS.Name = "";
                                        
NS.UID = (uint)Kernel.Random.Next(1, 2000000000);
                                        while (
client.Map.Npcs.ContainsKey(NS.UID)) NS.UID = (uint)Kernel.Random.Next(1, 2000000000);
                                        
NS.MapID = client.Entity.MapID;
                                        
NS.X = (ushort)(npc.X + 1);
                                        
NS.Y = (ushort)(npc.Y + 1);
                                        
NS.Type = (Game.Enums.NpcType)2;
                                        
NS.Mesh = 19360;
                                        
_String str3 = new _String(true);

                                        
str3.TextsCount = 1;
                                        
str3.Type = 10;
                                        if (
item.ID == 729306)
                                        {
                                            
str3.Texts.Add("accession");
                                            
NS.Name = "NormalMagnolia";
                                        }
                                        if (
item.ID == 729307)
                                        {
                                            
str3.Texts.Add("accession1");
                                            
NS.Name = "RefinedMagnolia";
                                        }
                                        if (
item.ID == 729308)
                                        {
                                            
str3.Texts.Add("accession2");
                                            
NS.Name = "UniqueMagnolia";
                                        }
                                        if (
item.ID == 729309)
                                        {
                                            
str3.Texts.Add("accession3");
                                            
NS.Name = "EliteMagnolia";
                                        }
                                        if (
item.ID == 729310)
                                        {
                                            
str3.Texts.Add("accession4");
                                            
NS.Name = "SuperMagnolia";
                                        }
                                        
client.Map.AddNpc(NS);
                                        
client.Screen.Reload(null);
                                        foreach (var 
player in Kernel.GamePool.Values)
                                        {
                                            if (
player.Entity.MapID == NS.MapID && Kernel.GetDistance(player.Entity.X, player.Entity.Y, NS.X, NS.Y) < 17)
                                            {
                                                
NS.SendSpawn(player);
                                                
str3.Send(player);
                                                
player.Screen.Reload(null);
                                            }
                                        }

                                        
client.Inventory.Remove(item, Game.Enums.ItemUse.Remove);
                                    }, 
Database.ConquerItemInformation.BaseInformations[item.ID].Name.Remove(Database.ConquerItemInformation.BaseInformations[item.ID].Name.Length - 4, 4), 1);
                                    break;
                                }
                            }
                            
client.MessageBox("Your~seed~can`t~be~planted~here.~You`ll~need~to~find~a~Flower~Bed.");

                        }
                        else
                        {
                            
client.Send(Constants.FullInventory);
                        }
                        break;
                    }
                
#endregion 

هتبحث عن ,

كود:
public static void ExtraStudy 

فـ Case 0 هتضيف ,

كود:
client.Activenes.SendSinglePacket(client, Activeness.Types.JiangTask, (byte)client.Entity.JiangStudyTimes); 

فـ Case 1 هتضيف ,

كود:
client.Activenes.SendSinglePacket(client, Activeness.Types.JiangTask, (byte)client.Entity.JiangStudyTimes); 

فـ Case 2 هتضيف ,

كود:
client.Activenes.SendSinglePacket(client, Activeness.Types.JiangTask, (byte)client.Entity.JiangStudyTimes); 

فـ RewardEvent هتبحث عن ,

كود:
public static void Process 

هتبدل Case 0 بده ,

كود:
case 0:
                    {
                        
RewardEvent Event = new RewardEvent(client);
                        
client.Send(Event.ToArray());

                        
Activeness Act = new Activeness(client);
                        
client.Send(Act.ToArray());

                        
ActivenessPoints Point = new ActivenessPoints();
                        if (!
client.Entity.ActivenessDone)
                            
Point.Type = 1;
                        else
                            
Point.Type = 2;
                        
Point.Points = client.ActivenessPoints;
                        
client.Send(Point.ToArray());
                        break;
                    } 

فـ PacketHandler هتبدل الباكيت بده ,

كود:
#region Activeness
                
case 2822:
                    {
                        
ClaimActivenessGift.Process(packet, client);
                        break;
                    }
                
#endregion 

فـ Program أو Server هتحث عن ,

كود:
case "@save": 

هتضيف فيها ,

كود:
Database.ActivenessTable.Save(client); 

فـ World أو Thread هتبحث عن ,

كود:
private void CharactersCallback 

تحت القوس هتضيف ,

كود:
#region Activeness
            
if (client.Activenes != null)
            {
                if (
Time32.Now >= client.Activenes.HalfHourTask.AddMinutes(30))
                {
                    
client.Activenes.HalfHourTask = Time32.Now;
                    
client.Entity.HoursTimes++;
                    
client.Activenes.SendSinglePacket(client, Activeness.Types.HoursTask, (byte)(client.Entity.HoursTimes));
                }
            }
            
#endregion 

اخر حاجه اتعمله اتاخد الجدول ده من اي قاعده
Activeness


قديم 2021-08-20, 09:04 PM
المشاركة 2
Jimmy Askr
.:: عضو جديد ::.
  • غير متواجد
افتراضي رد: اضافة Activeness System كامل ، والكمال لله وحده !
تسلم إيدك يا حازم

قديم 2021-08-23, 12:48 PM
المشاركة 3
AliNasser
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: اضافة Activeness System كامل ، والكمال لله وحده !
عاش


العلامات المرجعية



الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1)
 

الانتقال السريع

المواضيع المتشابهه للموضوع: اضافة Activeness System كامل ، والكمال لله وحده !
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
اضافة ابيك القرصان كامل Hazem تطوير سيرفرات كونكر 43 2021-02-06 12:27 AM
اضافة الميلاد كامل بالشخصية الجديده Hazem تطوير سيرفرات كونكر 17 2020-12-29 03:10 AM
اضافة البرفكشن كامل برانك best in the world osama تطوير سيرفرات كونكر 17 2020-07-09 11:30 AM
عايز اضافت البرتو كامل ElSaher الطلبات المدفوعه 2 2020-03-06 12:19 AM
اضافة المونك كامل Hazem تطوير سيرفرات كونكر 7 2020-02-15 10:59 PM


الساعة الآن 08:08 PM