محمد ياسر
2019-04-20, 10:11 PM
كويستة TeamDeathMatch هيا موجودة في كل السورسات الي موجودة تقريبأ
بس للاسف مش كاملة و فيها مشاكل:popcorm2:
انا حليتها و شغلتها 100% و ظبطت المواعيد و البريز
كفاية كلام :buba:
اتفضلو
بسم الله
خش على Nps
دور على
case 54239:
و بدل الان بي سي القديم بدا
#region TeamDeathMatch 0
case 54239:
{
switch (npcRequest.OptionID)
{
case 0:
{
if (client.Entity.Tournament_Signed == false)
{
var time = DateTime.Now;
if (DateTime.Now.Minute >= 40 && DateTime.Now.Minute < 41)
{
dialog.Text("The TeamDeathMatch 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 TeamDeathMatch tournament is not active");
dialog.Option("I see", 255);
}
}
else
{
dialog.Text("You already Signed in TeamDeathMatch");
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;
}
//181515 BlackElegance
//181615 RedElegance
//181815 BlueElegance
//181315 WhiteElegence
if (client.Entity.Tournament_Signed == false)
{
var time = DateTime.Now;
if (DateTime.Now.Minute >= 40 && DateTime.Now.Minute < 41)
{
Random r = new Random();
int Team = r.Next(1, 8);
if (Team == 1 || Team == 2)
{
client.BackupArmorLook = client.ArmorLook;
client.SetNewArmorLook(181325);
//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 White>");
//GC.AddSend(Packets.NPCSetFace(0));
//GC.AddSend(Packets.NPCFinish());
}
if (Team == 3 || Team == 4)
{
client.BackupArmorLook = client.ArmorLook;//TeamXor We Not Only But We Are The Best members
client.SetNewArmorLook(181525);
//client.Entity.CurHP = 1;
client.Entity.Tournament_Signed = true;
client.Entity.TeamDeathMatch_BlackTeam = true;
client.Entity.TeamDeathMatch_Hits = 0;
dialog.Text("You have been signed up for <TeamDeathMatch> <Team Black>");
//GC.AddSend(Packets.NPCSetFace(0));
//GC.AddSend(Packets.NPCFinish());
}
if (Team == 5 || Team == 6)
{
client.BackupArmorLook = client.ArmorLook;
client.SetNewArmorLook(181825);
//client.Entity.CurHP = 1;
client.Entity.Tournament_Signed = true;
client.Entity.TeamDeathMatch_BlueTeam = true;
client.Entity.TeamDeathMatch_Hits = 0;
dialog.Text("You have been signed up for <TeamDeathMatch> <Team Blue>");
//GC.AddSend(Packets.NPCSetFace(0));
//GC.AddSend(Packets.NPCFinish());
}
if (Team == 7 || Team == 8)
{
client.BackupArmorLook = client.ArmorLook;
client.SetNewArmorLook(181625);
//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 Red>");
//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
تمام خش على World
و دور على
#region DTM
لو ملقيتوش دور على
DeathMatch.SendTimer();
اقفلو و بدلو بدا
#region DTM
if ((Now64.Minute == 39) && (Now64.Second == 1))
{
DeathMatch.SendTimer();
Kernel.SendWorldMessage(new Message("Team Death match will start in one minute!", Color.White, Message.TopLeft), Program.GamePool);
}
#endregion
نكمل خش المسار دا
\Game\Features\Tournaments
يعني افتح الكلاس دا
DeathMatch.cs
امسح كل الي في و بدلو بدا
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Network.GamePackets;
namespace Conquer_Online_Server.Game
{
public class DeathMatch
{
public const ushort MAPID = 8883;
public static int[] Points = new int[4];
public const uint
BlackTeam = 0,
BlueTeam = 1,
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.Minute == 40) && 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("TeamDeathMatch have started. Sign Up in TwinCity! You have one minute", System.Drawing.Color.Red, Message.Center), Program.GamePool);
foreach (var player in Program.GamePool)
{
player.MessageBox("Team DeathMatch 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 == 41) && 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.GamePool);
SendTeam();
}
if (send)
{
if (now > LastUpdate.AddSeconds(5))
{
LastUpdate = now;
var array = new[]
{
string.Format("Black team: {0}", Points[BlackTeam]),
string.Format("Blue team: {0}", Points[BlueTeam]),
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.GamePool, (ushort)MAPID);
Place++;
}
}
}
}
public static void SendTeam()
{
foreach (Client.GameClient C in Program.GamePool)
{
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_BlackTeam == true)
{
C.Entity.Teleport(8883, 042 ,051);
}
if (C.Entity.TeamDeathMatch_BlueTeam == true)
{
C.Entity.Teleport(8883, 060, 042);
}
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.Minute == 46) && end == false)
{
signup = false;
end = true;
IsOn = false;
foreach (Client.GameClient client in Program.GamePool)
{
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 blackwin = false;
public static bool bluewin = 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 == BlueTeam)
{
bluewin = true;
}
else if (array[0].Key == WhiteTeam)
{
whitewin = true;
}
else
{
blackwin = true;
}
int winKey = array[0].Key;
int hits = DeathMatch.Points[winKey];
uint prize = 250 * (uint)hits;
string name = "RedTeam";
if (bluewin) name = "BlueTeam";
if (blackwin) name = "BlackTeam";
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, Conquer_Online_Server.Network.GamePackets.Message. Center), Program.GamePool);
foreach (Client.GameClient C in Program.GamePool)
{
#region Winner
if (C.Entity.TeamDeathMatch_RedTeam && redwin)
C.Entity.ConquerPoints += prize;
if (C.Entity.TeamDeathMatch_BlueTeam == bluewin)
C.Entity.ConquerPoints += prize;
if (C.Entity.TeamDeathMatch_BlackTeam == blackwin)
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_BlueCaptain = false;
C.Entity.TeamDeathMatch_BlueTeam = false;
C.Entity.TeamDeathMatch_BlackCaptain = false;
C.Entity.TeamDeathMatch_BlackTeam = false;
C.Entity.TeamDeathMatch_WhiteCaptain = false;
C.Entity.TeamDeathMatch_WhiteTeam = false;
}
}
}
}
تمام كدا جربو قولي الكويستة بتبدأ كل ساعة في الدقيقة 40 عندك دقيقة وحدة عشان تسجل و بعد دقيقة هتخش المابة اوتوماتك
و تضرب اس اس و اف بي و هتاخد سي بي اس على قد بيونتات التيم بتاعك بالعدل يعني لو احنا 5 في تيم و كسبنا 50 الف كل واحد هياخد 50 الف مش هتتقسم
بس للاسف مش كاملة و فيها مشاكل:popcorm2:
انا حليتها و شغلتها 100% و ظبطت المواعيد و البريز
كفاية كلام :buba:
اتفضلو
بسم الله
خش على Nps
دور على
case 54239:
و بدل الان بي سي القديم بدا
#region TeamDeathMatch 0
case 54239:
{
switch (npcRequest.OptionID)
{
case 0:
{
if (client.Entity.Tournament_Signed == false)
{
var time = DateTime.Now;
if (DateTime.Now.Minute >= 40 && DateTime.Now.Minute < 41)
{
dialog.Text("The TeamDeathMatch 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 TeamDeathMatch tournament is not active");
dialog.Option("I see", 255);
}
}
else
{
dialog.Text("You already Signed in TeamDeathMatch");
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;
}
//181515 BlackElegance
//181615 RedElegance
//181815 BlueElegance
//181315 WhiteElegence
if (client.Entity.Tournament_Signed == false)
{
var time = DateTime.Now;
if (DateTime.Now.Minute >= 40 && DateTime.Now.Minute < 41)
{
Random r = new Random();
int Team = r.Next(1, 8);
if (Team == 1 || Team == 2)
{
client.BackupArmorLook = client.ArmorLook;
client.SetNewArmorLook(181325);
//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 White>");
//GC.AddSend(Packets.NPCSetFace(0));
//GC.AddSend(Packets.NPCFinish());
}
if (Team == 3 || Team == 4)
{
client.BackupArmorLook = client.ArmorLook;//TeamXor We Not Only But We Are The Best members
client.SetNewArmorLook(181525);
//client.Entity.CurHP = 1;
client.Entity.Tournament_Signed = true;
client.Entity.TeamDeathMatch_BlackTeam = true;
client.Entity.TeamDeathMatch_Hits = 0;
dialog.Text("You have been signed up for <TeamDeathMatch> <Team Black>");
//GC.AddSend(Packets.NPCSetFace(0));
//GC.AddSend(Packets.NPCFinish());
}
if (Team == 5 || Team == 6)
{
client.BackupArmorLook = client.ArmorLook;
client.SetNewArmorLook(181825);
//client.Entity.CurHP = 1;
client.Entity.Tournament_Signed = true;
client.Entity.TeamDeathMatch_BlueTeam = true;
client.Entity.TeamDeathMatch_Hits = 0;
dialog.Text("You have been signed up for <TeamDeathMatch> <Team Blue>");
//GC.AddSend(Packets.NPCSetFace(0));
//GC.AddSend(Packets.NPCFinish());
}
if (Team == 7 || Team == 8)
{
client.BackupArmorLook = client.ArmorLook;
client.SetNewArmorLook(181625);
//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 Red>");
//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
تمام خش على World
و دور على
#region DTM
لو ملقيتوش دور على
DeathMatch.SendTimer();
اقفلو و بدلو بدا
#region DTM
if ((Now64.Minute == 39) && (Now64.Second == 1))
{
DeathMatch.SendTimer();
Kernel.SendWorldMessage(new Message("Team Death match will start in one minute!", Color.White, Message.TopLeft), Program.GamePool);
}
#endregion
نكمل خش المسار دا
\Game\Features\Tournaments
يعني افتح الكلاس دا
DeathMatch.cs
امسح كل الي في و بدلو بدا
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Network.GamePackets;
namespace Conquer_Online_Server.Game
{
public class DeathMatch
{
public const ushort MAPID = 8883;
public static int[] Points = new int[4];
public const uint
BlackTeam = 0,
BlueTeam = 1,
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.Minute == 40) && 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("TeamDeathMatch have started. Sign Up in TwinCity! You have one minute", System.Drawing.Color.Red, Message.Center), Program.GamePool);
foreach (var player in Program.GamePool)
{
player.MessageBox("Team DeathMatch 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 == 41) && 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.GamePool);
SendTeam();
}
if (send)
{
if (now > LastUpdate.AddSeconds(5))
{
LastUpdate = now;
var array = new[]
{
string.Format("Black team: {0}", Points[BlackTeam]),
string.Format("Blue team: {0}", Points[BlueTeam]),
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.GamePool, (ushort)MAPID);
Place++;
}
}
}
}
public static void SendTeam()
{
foreach (Client.GameClient C in Program.GamePool)
{
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_BlackTeam == true)
{
C.Entity.Teleport(8883, 042 ,051);
}
if (C.Entity.TeamDeathMatch_BlueTeam == true)
{
C.Entity.Teleport(8883, 060, 042);
}
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.Minute == 46) && end == false)
{
signup = false;
end = true;
IsOn = false;
foreach (Client.GameClient client in Program.GamePool)
{
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 blackwin = false;
public static bool bluewin = 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 == BlueTeam)
{
bluewin = true;
}
else if (array[0].Key == WhiteTeam)
{
whitewin = true;
}
else
{
blackwin = true;
}
int winKey = array[0].Key;
int hits = DeathMatch.Points[winKey];
uint prize = 250 * (uint)hits;
string name = "RedTeam";
if (bluewin) name = "BlueTeam";
if (blackwin) name = "BlackTeam";
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, Conquer_Online_Server.Network.GamePackets.Message. Center), Program.GamePool);
foreach (Client.GameClient C in Program.GamePool)
{
#region Winner
if (C.Entity.TeamDeathMatch_RedTeam && redwin)
C.Entity.ConquerPoints += prize;
if (C.Entity.TeamDeathMatch_BlueTeam == bluewin)
C.Entity.ConquerPoints += prize;
if (C.Entity.TeamDeathMatch_BlackTeam == blackwin)
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_BlueCaptain = false;
C.Entity.TeamDeathMatch_BlueTeam = false;
C.Entity.TeamDeathMatch_BlackCaptain = false;
C.Entity.TeamDeathMatch_BlackTeam = false;
C.Entity.TeamDeathMatch_WhiteCaptain = false;
C.Entity.TeamDeathMatch_WhiteTeam = false;
}
}
}
}
تمام كدا جربو قولي الكويستة بتبدأ كل ساعة في الدقيقة 40 عندك دقيقة وحدة عشان تسجل و بعد دقيقة هتخش المابة اوتوماتك
و تضرب اس اس و اف بي و هتاخد سي بي اس على قد بيونتات التيم بتاعك بالعدل يعني لو احنا 5 في تيم و كسبنا 50 الف كل واحد هياخد 50 الف مش هتتقسم