أضافة Top Ahley We Zamalek - مدونة عرب وود

الافضل لكم


Breaking

Post Top Ad

Responsive Ads Here

Post Top Ad

Responsive Ads Here

الأحد، 14 أغسطس 2016

أضافة Top Ahley We Zamalek



التوب ده انا اللي معدل عليه و سهرت ليلة بحالها علشان اخليها كاملة و ده كله علشانكم و انا بوفي بوعدي للي كان عايز التوب و قعد علشان يدور عليه و ملاقهوش النهاردة بقدمهوله هدية بمناسبة رمــــــضــــــان كفاية كلام نخش في المفيد علي طول
طبعا ده شغل الكلينت هتضيف الجرمنتات دية من الموضوع ده
جرمنت الاهلي و الزمالك
نكمل بقي

أول حاجة افتح السورس من البروجكت و احرص علي البحث بتاعك يكون علي الكلمة دية علشان متتعبش نفسك Current projetct

ثانيا تبحث علي الكود ده و هيبقي في الملف ده PacketHandler

static void Revive(Data generalData, Client.GameState client) 

هتنزل الاخر الفويد و تضيف دول
else if (client.Entity.MapID == 8883)
                {
                    if (
client.Entity.TeamDeathMatch_WhiteTeam == true)
                    {
                        
client.Entity.Teleport(8883, 066, 064);
                    }
                    if (
client.Entity.TeamDeathMatch_RedTeam == true)
                    {
                        
client.Entity.Teleport(8883, 039, 036);
                    }
                } 

هتبحث علي الكود ده و هيبقي في الملف ده Entity
public int EarthResistance; 

تحتيه ده
public int TeamDeathMatch_Hits = 0; 

و بعدين تبحث علي ده
public bool Tournament_Signed2 = false; 

تحتيه دول
public bool TeamDeathMatch_Signed2 = false;
        public 
bool TeamDeathMatch_RedCaptain2 = false;
        public 
bool TeamDeathMatch_WhiteCaptain2 = false;
        public 
bool TeamDeathMatch_RedTeam2 = false;
        public 
bool TeamDeathMatch_WhiteTeam2 = false;
        public 
int TeamDeathMatch_Hits2 = 0;
        public 
int TeamDeathMatchTeamKey2
        
{
            
get
            
{
                if (
TeamDeathMatch_WhiteTeam2) return 3;
                else if (
TeamDeathMatch_RedTeam2) return 2;
                return 
2;
            }
        } 

و بعدين هتبحث علي ده في نفس الملف
public bool SpawnProtection = false; 

تحتيه هتضيف دول
public bool TeamDeathMatch_Signed = false;
        public 
bool TeamDeathMatch_RedCaptain = false;
        public 
bool TeamDeathMatch_WhiteCaptain = false;
        public 
bool TeamDeathMatch_RedTeam = false;
        public 
bool TeamDeathMatch_WhiteTeam = false;
        public 
int TeamDeathMatchTeamKey
        
{
            
get
            
{
                if (
TeamDeathMatch_WhiteTeam) return 3;
                else if (
TeamDeathMatch_RedTeam) return 2;
                return 
2;
            }
        } 

نروح علي Handle و نبحث علي ده
public static void ReceiveAttack(Game.Entity attacker, Game.Entity attacked, Attack attack, ref uint damage, Database.SpellInformation spell) 

تحت الكوس دول
//if (attacked.EntityFlag == EntityFlag.Player)
            //    attack.Damage = damage = Math.Min(attacked.Hitpoints,damage);
            
if (attacker.MapID == DeathMatch.MAPID)
            {
                
DeathMatch.Points[attacker.TeamDeathMatchTeamKey]++;
                
attacker.TeamDeathMatch_Hits++;
                
attacked.Hitpoints = attacked.MaxHitpoints;
            }
            if (
attacker.MapID == DeathMatch2.MAPID)
            {
                
DeathMatch2.Points[attacker.TeamDeathMatchTeamKey2]++;
                
attacker.TeamDeathMatch_Hits2++;
                
attacked.Hitpoints = attacked.MaxHitpoints;
                
damage = 1;
            } 

و بعدين تبحث علي ده
if (!CaptureTheFlag.Attackable(attacker) || !CaptureTheFlag.Attackable(attacked)) 

تحتيه ده
if (attacker.MapID == DeathMatch2.MAPID)
                return 
attacker.TeamDeathMatchTeamKey2 != attacked.TeamDeathMatchTeamKey2;
            if (
attacker.MapID == DeathMatch.MAPID)
                return 
attacker.TeamDeathMatchTeamKey != attacked.TeamDeathMatchTeamKey; 

هتعمل كلاس جديد بأسم DeathMatch في فولدر Game و تحط دول فيه
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Desco_Pj.Network.GamePackets;

namespace 
Desco_Pj.Game {
    public class 
DeathMatch2
    
{
        public const 
ushort MAPID = 18883;
        public static 
int[] Points = new int[4];
        public const 
uint
            AhleyTeam 
= 0,
            
ZamalekTeam = 1;
        public static 
bool IsOn = false;
        public static 
bool CouplesWar = false;
        public static 
IDisposable TimerA, TimerB, TimerC;
        public static 
void SendTimer()
        {
            
TimerA = World.Subscribe(SignUp, 1000);
        }
        public static 
bool signup = false;
        public static 
bool send = false;
        public static 
bool end = false;

        public static 
void SignUp(int ttime)
        {
            var 
time = DateTime.Now;
            if ((
time.Minute == 10) && signup == false)
            {
                
TimerA.Dispose();
                
TimerB = World.Subscribe(Send, 1000);
                for (
int i = 0; i < Points.Length; i++) Points[i] = 0;
                
send = false;
                
end = false;
                
signup = true;
                
IsOn = true;
                
Kernel.SendWorldMessage(new Message("Ahley We Zamalek have started. Sign Up in TwinCity! You have one minute", System.Drawing.Color.Red, Message.Center), Program.Values);
                foreach (var 
player in Program.Values)
                {
                    
player.MessageBox("Team Ahely we Zamalek has started. Do you want to join?",
                        (
p) => { p.Entity.Teleport(1002, 456, 378); }, null, 60);
                }
            }
        }
        static 
Time32 LastUpdate;
        public static 
void Send(int ttime)
        {
            
Time32 now = new Time32(ttime);

            var 
time = DateTime.Now;
            if ((
time.Minute == 11) && send == false)
            {
                
TimerC = World.Subscribe(End, 1000);
                
signup = false;
                
send = true;
                
LastUpdate = now;
                
Kernel.SendWorldMessage(new Network.GamePackets.Message("Kill!!", System.Drawing.Color.Red, Network.GamePackets.Message.Center), Program.Values);
                
SendTeam();
            }
            if (
send)
            {
                if (
now > LastUpdate.AddSeconds(5))
                {
                    
LastUpdate = now;

                    var array = new[] 
                    {
                        
string.Format("Ahley team: {0}", Points[AhleyTeam]),
                        
string.Format("Zamalek team: {0}", Points[ZamalekTeam]),
                    };
                    
int Place = 0;
                    foreach (var 
str in array)
                    {
                        
Message msg = new Message(str, System.Drawing.Color.Red, Place == 0 ? Message.FirstRightCorner : Message.ContinueRightCorner);
                        
Kernel.SendWorldMessage(msg, Program.Values, (ushort)MAPID);
                        
Place++;
                    }
                }
            }
        }
        public static 
void SendTeam()
        {
            foreach (
Client.GameState C in Program.Values)
            {
                if (
C.Entity.Tournament_Signed == true)
                {
                    
C.Entity.TeamDeathMatch_Hits2 = 0;
                    
C.Entity.AppearanceBkp = C.Entity.Appearance;
                    
Network.PacketHandler.ChangeAppearance(new Data(true) { ID = Data.AppearanceType, UID = C.Entity.UID, dwParam = (byte)AppearanceType.Garment }, C);
                    if (
C.Entity.TeamDeathMatch_WhiteTeam2 == true)
                    {
                        
C.Entity.Teleport(MAPID, 066, 064);
                    }
                    if (
C.Entity.TeamDeathMatch_RedTeam2 == true)
                    {
                        
C.Entity.Teleport(MAPID, 039, 036);
                    }
                }
            }
        }
        public static 
void End(int ttime)
        {
            var 
time = DateTime.Now;
            if ((
time.Minute == 16) && end == false)
            {
                
signup = false;
                
end = true;
                
IsOn = false;
                foreach (
Client.GameState client in Program.Values)
                {
                    if (
client.Entity.MapID == MAPID)
                    {
                        
client.Entity.Teleport(1002, 400, 400);
                        
client.Entity.RemoveFlag(Update.Flags.Flashy);
                    }
                    if (
client.Entity.Tournament_Signed2)
                    {
                        
client.Entity.Tournament_Signed2 = false;
                        
Network.PacketHandler.ChangeAppearance(new Data(true) { ID = Data.AppearanceType, UID = client.Entity.UID, dwParam = (byte)client.Entity.AppearanceBkp }, client);
                        
client.SetNewArmorLook(client.BackupArmorLook);
                        
client.BackupArmorLook = 0;
                    }
                }
                
Reward();
                
TimerB.Dispose();
                
TimerC.Dispose();
            }
        }

        public static 
bool redwin = false;
        public static 
bool whitewin = false;

        public static 
void Reward()
        {
            
Dictionary<int, int> top = new Dictionary<int, int>();
            for (
int i = 0; i < Points.Length; i++) top.Add(i, Points[i]);
            var array = 
top.OrderByDescending(o => o.Value).ToArray();
            if (array[
0].Key == AhleyTeam)
            {
                
redwin = true;
            }
            else if (array[
0].Key == ZamalekTeam)
            {
                
whitewin = true;
            }
            
int winKey = array[0].Key;
            
int hits = DeathMatch.Points[winKey];
            
uint prize = 250 * (uint)hits;
            
string name = "AhleyTeam";
            if (
whitewin) name = "ZamalekTeam";
            
Kernel.SendWorldMessage(new Network.GamePackets.Message(name + " have won TeamMatch! The Winner Team Have Gained " + prize + " ConquerPoints", System.Drawing.Color.Red, Desco_Pj.Network.GamePackets.Message.Center), Program.Values);

            foreach (
Client.GameState C in Program.Values)
            {
                
#region Winner
                
if (C.Entity.TeamDeathMatch_RedTeam2 && redwin)
                    
C.Entity.ConquerPoints += prize;
                if (
C.Entity.TeamDeathMatch_WhiteTeam2 == whitewin)
                    
C.Entity.ConquerPoints += prize;
                
#endregion

                
C.Entity.Tournament_Signed2 = false;
                
C.Entity.TeamDeathMatch_Hits2 = 0;
                
C.Entity.TeamDeathMatch_RedCaptain2 = false;
                
C.Entity.TeamDeathMatch_RedTeam2 = false;
                
C.Entity.TeamDeathMatch_WhiteCaptain2 = false;
                
C.Entity.TeamDeathMatch_WhiteTeam2 = false;
            }
        }
    }

    public class 
DeathMatch
    
{
        public const 
ushort MAPID = 8883;
        public static 
int[] Points = new int[4];
        public const 
uint
            RedTeam 
= 2,
            
WhiteTeam = 3;
        public static 
bool IsOn = false;
        public static 
bool CouplesWar = false;
        public static 
IDisposable TimerA, TimerB, TimerC;
        public static 
void SendTimer()
        {
            
TimerA = World.Subscribe(SignUp, 1000);
        }
        public static 
bool signup = false;
        public static 
bool send = false;
        public static 
bool end = false;

        public static 
void SignUp(int ttime)
        {
            var 
time = DateTime.Now;
            if (
time.DayOfWeek == DayOfWeek.Tuesday && (time.Hour == 15 || time.Hour == 23) && time.Minute == 00 && signup == false)
            {
                
TimerA.Dispose();
                
TimerB = World.Subscribe(Send, 1000);
                for (
int i = 0; i < Points.Length; i++) Points[i] = 0;
                
send = false;
                
end = false;
                
signup = true;
                
IsOn = true;
                
Kernel.SendWorldMessage(new Message("Ahley We Zamalek have started. Sign Up in TwinCity! You have one minute", System.Drawing.Color.Red, Message.Center), Program.Values);
                foreach (var 
player in Program.Values)
                {
                    
player.MessageBox("Team Ahley We Zamalek has started. Do you want to join?",
                        (
p) => { p.Entity.Teleport(1002, 456, 378); }, null, 60);
                }
            }
        }
        static 
Time32 LastUpdate;
        public static 
void Send(int ttime)
        {
            
Time32 now = new Time32(ttime);

            var 
time = DateTime.Now;
            if (
time.DayOfWeek == DayOfWeek.Tuesday && (time.Hour == 15 || time.Hour == 23) && time.Minute == 1 && send == false)
            {
                
TimerC = World.Subscribe(End, 1000);
                
signup = false;
                
send = true;
                
LastUpdate = now;
                
Kernel.SendWorldMessage(new Network.GamePackets.Message("Kill!!", System.Drawing.Color.Red, Network.GamePackets.Message.Center), Program.Values);
                
SendTeam();
            }
            if (
send)
            {
                if (
now > LastUpdate.AddSeconds(5))
                {
                    
LastUpdate = now;

                    var array = new[] 
                    {
                        
string.Format("Red team: {0}", Points[RedTeam]),
                        
string.Format("White team: {0}", Points[WhiteTeam]),
                    };
                    
int Place = 0;
                    foreach (var 
str in array)
                    {
                        
Message msg = new Message(str, System.Drawing.Color.Red, Place == 0 ? Message.FirstRightCorner : Message.ContinueRightCorner);
                        
Kernel.SendWorldMessage(msg, Program.Values, (ushort)MAPID);
                        
Place++;
                    }
                }
            }
        }
        public static 
void SendTeam()
        {
            foreach (
Client.GameState C in Program.Values)
            {
                if (
C.Entity.Tournament_Signed == true)
                {
                    
C.Entity.SpawnProtection = true;
                    
C.Entity.TeamDeathMatch_Hits = 0;
                    
C.Entity.AppearanceBkp = C.Entity.Appearance;
                    
Network.PacketHandler.ChangeAppearance(new Data(true) { ID = Data.AppearanceType, UID = C.Entity.UID, dwParam = (byte)AppearanceType.Garment }, C);
                    if (
C.Entity.TeamDeathMatch_WhiteTeam == true)
                    {
                        
C.Entity.Teleport(8883, 066, 064);
                    }
                    if (
C.Entity.TeamDeathMatch_RedTeam == true)
                    {
                        
C.Entity.Teleport(8883, 039, 036);
                    }
                }
            }
        }
        public static 
void End(int ttime)
        {
            var 
time = DateTime.Now;
            if (
time.DayOfWeek == DayOfWeek.Tuesday && (time.Hour == 15 || time.Hour == 23) && time.Minute == 6 && end == false)
            {
                
signup = false;
                
end = true;
                
IsOn = false;
                foreach (
Client.GameState client in Program.Values)
                {
                    if (
client.Entity.MapID == 8883)
                    {
                        
client.Entity.Teleport(1002, 400, 400);
                        
client.Entity.RemoveFlag(Update.Flags.Flashy);
                    }
                    if (
client.Entity.Tournament_Signed)
                    {
                        
client.Entity.Tournament_Signed = false;
                        
Network.PacketHandler.ChangeAppearance(new Data(true) { ID = Data.AppearanceType, UID = client.Entity.UID, dwParam = (byte)client.Entity.AppearanceBkp }, client);
                        
client.SetNewArmorLook(client.BackupArmorLook);
                        
client.BackupArmorLook = 0;
                    }
                }
                
Reward();
                
TimerB.Dispose();
                
TimerC.Dispose();
            }
        }

        public static 
bool redwin = false;
        public static 
bool whitewin = false;

        public static 
void Reward()
        {
            
Dictionary<int, int> top = new Dictionary<int, int>();
            for (
int i = 0; i < Points.Length; i++) top.Add(i, Points[i]);
            var array = 
top.OrderByDescending(o => o.Value).ToArray();
            if (array[
0].Key == RedTeam)
            {
                
redwin = true;
            }
            else if (array[
0].Key == WhiteTeam)
            {
                
whitewin = true;
            }
            
int winKey = array[0].Key;
            
int hits = DeathMatch.Points[winKey];
            
uint prize = 250 * (uint)hits;
            
string name = "RedTeam";
            if (
whitewin) name = "WhiteTeam";
            
Kernel.SendWorldMessage(new Network.GamePackets.Message(name + " have won TeamDeathMatch! The Winner Team Have Gained " + prize + " ConquerPoints", System.Drawing.Color.Red, Desco_Pj.Network.GamePackets.Message.Center), Program.Values);

            foreach (
Client.GameState C in Program.Values)
            {
                
#region Winner
                
if (C.Entity.TeamDeathMatch_RedTeam && redwin)
                    
C.Entity.ConquerPoints += prize;
                if (
C.Entity.TeamDeathMatch_WhiteTeam == whitewin)
                    
C.Entity.ConquerPoints += prize;
                
#endregion

                
C.Entity.Tournament_Signed = false;
                
C.Entity.TeamDeathMatch_Hits = 0;
                
C.Entity.TeamDeathMatch_RedCaptain = false;
                
C.Entity.TeamDeathMatch_RedTeam = false;
                
C.Entity.TeamDeathMatch_WhiteCaptain = false;
                
C.Entity.TeamDeathMatch_WhiteTeam = false;
            }
        }
    }
} 

تمام قوي لحد هنا
لو عندك امسح اللي فيه و ضيف اللي موجود
هتخش علي Npcs و تحط دول في اي مكان
#region Top Ahley We Zamalek
                
case 54239:
                    {
                        switch (
npcRequest.OptionID)
                        {
                            case 
0:
                                {
                                    if (
client.Entity.Tournament_Signed == false)
                                    {
                                        var 
time = DateTime.Now;
                                        if ((
time.Hour % 12) == 4 && time.Minute == 15)
                                        {
                                            
dialog.Text("The Team Ahley We Zamalek tournament has now started!");
                                            
dialog.Text("You will get divided into 4 teams, black and white , blue and red, and ");
                                            
dialog.Text("must eliminate the other. Only fastblade/scentsword is allowed!");
                                            
dialog.Option("Let me join!", 1);
                                            
dialog.Option("Not intrested", 255);
                                        }
                                        else
                                        {
                                            
dialog.Text("The Team Ahley We Zamalek  tournament is not active");
                                            
dialog.Option("I see", 255);
                                        }
                                    }
                                    else
                                    {
                                        
dialog.Text("You already Signed in Ahley We Zamalek");
                                        
dialog.Option("I see", 255);
                                    }
                                    
dialog.Send();
                                    break;
                                }
                            case 
1:
                                {
                                    if (!
client.Spells.ContainsKey(1045) && !client.Spells.ContainsKey(1046))
                                    {
                                        
dialog.Text("You need to learn FastBlade or ScentSword first!");
                                        
dialog.Option("I see", 255);
                                        
dialog.Send();
                                        return;
                                    }
                                    
//181615 RedElegance
                                    //181315 WhiteElegence
                                    
if (client.Entity.Tournament_Signed == false)
                                    {
                                        var 
time = DateTime.Now;
                                        if ((
time.Hour % 12) == 4 && time.Minute == 15)
                                        {
                                            
Random r = new Random();
                                            
int Team = r.Next(1, 8);
                                            if (
Team == 1 || Team == 2)
                                            {
                                                
client.BackupArmorLook = client.ArmorLook;
                                                
client.SetNewArmorLook(192675);

                                                
//client.Entity.CurHP = 1;
                                                
client.Entity.Tournament_Signed = true;
                                                
client.Entity.TeamDeathMatch_WhiteTeam = true;
                                                
client.Entity.TeamDeathMatch_Hits = 0;

                                                
dialog.Text("You have been signed up for <TeamDeathMatch> <Team Zamalek>");
                                                
//GC.AddSend(Packets.NPCSetFace(0));
                                                //GC.AddSend(Packets.NPCFinish());
                                            
}
                                            if (
Team == 3 || Team == 4)
                                            {
                                                
client.BackupArmorLook = client.ArmorLook;
                                                
client.SetNewArmorLook(192685);


                                                
//client.Entity.CurHP = 1;
                                                
client.Entity.Tournament_Signed = true;
                                                
client.Entity.TeamDeathMatch_RedTeam = true;
                                                
client.Entity.TeamDeathMatch_Hits = 0;

                                                
dialog.Text("You have been signed up for <TeamDeathMatch> <Team Ahley>");
                                                
//GC.AddSend(Packets.NPCSetFace(0));
                                                //GC.AddSend(Packets.NPCFinish());
                                            
}
                                        }
                                    }
                                    else
                                    {
                                        
dialog.Text("You are already signed up for this tournament!");
                                        
dialog.Option("I see.", 255);
                                        
//GC.AddSend(Packets.NPCSetFace(67));
                                        //GC.AddSend(Packets.NPCFinish());
                                    
}
                                    
dialog.Send();
                                    break;
                                }
                        }
                        break;
                    }
                
#endregion 

هتبحث علي ده
public static readonly System.Collections.Generic.List<ulong> FBandSSEvent = new System.Collections.Generic.List<ulong>() 

و تحط فيه المابة دية
8883, 

ملحوظة
التوب ده للفست بليد و الاسكان سورد بس و لو عايز تخلي فيه جميع الاسكلات يبقي هتغير المابة من الكود اللي فوق ده
للكود ده
public static readonly System.Collections.Generic.List<ushort> PKFreeMaps = new System.Collections.Generic.List<ushort>() 

و لو عندك اكواد من اللي فوق دية امسحها و ضيف دول مكانها حاجة سهلة مش صعبة
ناقص بقي شغل النافي كات هتعمل مابة جديدة في جدول الماب

8883    1860    0    0 

ليست هناك تعليقات:

إرسال تعليق

Post Top Ad

Responsive Ads Here
close
عنوان الصورة