محمد ياسر
2019-09-16, 06:06 PM
السلام عليكم ورحمه الله وبركاته
تعالو نقسم موضوعنا كدا عشان يبان جميل ومنظم
اولا:ايه هيا حرب رمضان؟
هيا عباره عن حرب بتيجي كل يوم في معاد معين بيجيلك اوتو انفيت ليها في ميعاد بدأ الحرب دي
وفيها بوله
الحرب طبعا للجيلدات مع بعضها
وبتديك سبيس ولو عايز كمان تضيف ليها توبات ضيف زي منت عاوز برحتك
ثالثا: الشرح!!
نبدأ بسم الله
هيجيلك ارورات بس اشتغل لحد منخلص وكلو هيبقا تمام ان شاء الله ولو جالك ارور في VPS_ALMaZeN ابقا غيرها باسم البروجيكت الخاص بتاع سيرفرك
افتح ملف
NPC
#region Gates
case 6547896:
{
if (client.Guild != null)
{
if (client.Guild.PoleKeeper66)
{
switch (npcRequest.OptionID)
{
case 0:
dialog.Text("Select the option you want to pursue.");
if (client.AsMember.Rank != VPS_ALMaZeN.Game.Enums.GuildMemberRank.Member)
{
dialog.Option("Open gate.", 1);
dialog.Option("Close gate.", 2);
}
dialog.Option("Get inside.", 3);
dialog.Option("Nothing.", 255);
dialog.Send();
break;
case 1:
{
if (Game.ramadanwar.LeftGate.Mesh == (ushort)(240 + ramadanwar.LeftGate.Mesh % 10))
{
VPS_ALMaZeN.Game.ramadanwar.LeftGate.Mesh = (ushort)(250 + VPS_ALMaZeN.Game.ramadanwar.LeftGate.Mesh % 10);
Update upd = new Update(true);
upd.UID = VPS_ALMaZeN.Game.ramadanwar.LeftGate.UID;
upd.Append(Update.Mesh, VPS_ALMaZeN.Game.ramadanwar.LeftGate.Mesh);
client.SendScreen(upd, true);
break;
}
break;
}
case 2:
{
if (Game.ramadanwar.LeftGate.Mesh == (ushort)(250 + ramadanwar.LeftGate.Mesh % 10))
{
Game.ramadanwar.LeftGate.Mesh = (ushort)(240 + Game.ramadanwar.LeftGate.Mesh % 10);
Game.ramadanwar.LeftGate.Hitpoints = Game.ramadanwar.LeftGate.MaxHitpoints;
Update upd = new Update(true);
upd.UID = VPS_ALMaZeN.Game.ramadanwar.LeftGate.UID;
upd.Append(Update.Mesh, VPS_ALMaZeN.Game.ramadanwar.LeftGate.Mesh);
upd.Append(Update.Hitpoints, VPS_ALMaZeN.Game.ramadanwar.LeftGate.Hitpoints);
client.SendScreen(upd, true);
break;
}
break;
}
case 3:
{
client.Entity.Teleport(1037, 237, 242);
break;
}
}
}
}
break;
}
case 456852:
{
if (client.Guild != null)
{
if (client.Guild.PoleKeeper66)
{
switch (npcRequest.OptionID)
{
case 0:
dialog.Text("Select the option you want to pursue.");
if (client.AsMember.Rank != VPS_ALMaZeN.Game.Enums.GuildMemberRank.Member)
{
dialog.Option("Open gate.", 1);
dialog.Option("Close gate.", 2);
}
dialog.Option("Get inside.", 3);
dialog.Option("Nothing.", 255);
dialog.Send();
break;
case 1:
{
if (VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh == (ushort)(270 + VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh % 10))
{
VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh = (ushort)(280 + VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh % 10);
Update upd = new Update(true);
upd.UID = VPS_ALMaZeN.Game.ramadanwar.RightGate.UID;
upd.Append(Update.Mesh, VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh);
client.SendScreen(upd, true);
break;
}
break;
}
case 2:
{
if (VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh == (ushort)(280 + VPS_ALMaZeN_Server.Game.ramadanwar.RightGate.Mesh % 10))
{
VPS_ALMaZeN.Game.PoleTwin.RightGate.Mesh = (ushort)(270 + VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh % 10);
Game.ramadanwar.RightGate.Hitpoints = Game.ramadanwar.RightGate.MaxHitpoints;
Update upd = new Update(true);
upd.UID = VPS_ALMaZeN.Game.ramadanwar.RightGate.UID;
upd.Append(Update.Mesh, VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh);
upd.Append(Update.Hitpoints, VPS_ALMaZeN.Game.ramadanwar.RightGate.Hitpoints);
client.SendScreen(upd, true);
break;
}
break;
}
case 3:
{
client.Entity.Teleport(1037, 237, 242);
break;
}
}
}
}
break;
}
#endregion
بردو في ملف الان بي سي هتبحث عن
#region ElitePole
اقفلو بالسالب وحط دا تحتو
#region ramadanwar
case 78963214:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Hey there " + client.Entity.Name + " Would you like to Join Ramadan war?.");
dialog.Text("or claim the Prize?, you can join Every day expect Saturday and Sunday At 16:30 to 17:30.");
dialog.Text("and the winner Guild Leader will get 5M cps after it finish u have 5 minutes to claim?.");
dialog.Option("Join ramadan war", 1);
dialog.Option("Claim Prize.", 5);
dialog.Send();
break;
}
case 1:
{
if (ramadanwar.IsWar)
{
client.Entity.Teleport(1037, 265, 270);
}
else
{
dialog.Text("The war is not held now! It will start every day expect Saturday and Sunday at 16:30");
dialog.Option("okay", 255);
dialog.Send();
break;
}
break;
}
case 5:
{
if (!ramadanwar.IsWar)
{
if (client.Guild != null)
{
if (ramadanwar.KeeperID != 0)
{
if (ramadanwar.Claim && client.AsMember.Rank == Game.Enums.GuildMemberRank.GuildLeader && client.Guild.ID == ramadanwar.KeeperID)
{
ramadanwar.Claim = false;
ramadanwar.KeeperID = 0;
VPS_ALMaZeN.Kernel.SendWorldMessage(new Message("Congratulations! " + client.Entity.Name + " claimed the prize 5M ConquerPoints for winning the ramadanwar.", System.Drawing.Color.Black, Message.Center), Program.GamePool);
client.Entity.ConquerPoints += 5000000;
Program.AddWarLog("ramadanwar", "5M CPS", client.Entity.Name);
}
else
{
dialog.Text("sorry u dont have any prize to claim....");
dialog.Option("okay", 255);
dialog.Send();
break;
}
}
}
else
{
dialog.Text("sorry u dont have any prize to claim");
dialog.Option("okay", 255);
dialog.Send();
break;
}
}
else
{
dialog.Text("Hey there " + client.Entity.Name + " You can't get the prize while the war is on!");
dialog.Option("okay", 255);
dialog.Send();
break;
}
break;
}
}
break;
}
#endregion
#region ramadanwar
case 8696:
{
dialog.Text("Welcome in ramadanwar HaveFun!.");
dialog.Option("Thanks.", 255);
dialog.Send();
break;
}
#endregion
بعد كدا هتعمل كلاسس جديد في فولدر game وهتسميه
ramadanwar.cs
وتقوب خابط الكلام دا كلو جوا الكلاسس الي انت ضيفتو دا
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VPS_ALMaZeN.Network.GamePackets;
using VPS_ALMaZeN.Game.ConquerStructures.Society;
namespace VPS_ALMaZeN.Game
{
public class ramadanwar
{
public static SobNpcSpawn Pole, RightGate, LeftGate;
public static SobNpcSpawn Poles;
public static SafeDictionary<uint, Guild> Scores = new SafeDictionary<uint, Guild>(100);
public static bool IsWar = false, Flame10th = false, FirstRound = false;
public static Time32 ScoreSendStamp, LastWin;
public static Guild PoleKeeper, CurrentTopLeader;
private static bool changed = false;
private static string[] scoreMessages;
public static DateTime StartTime;
public static bool Claim
{
get { return Program.Vars["rwclaim"]; }
set { Program.Vars["rwclaim"] = value; }
}
public static uint KeeperID
{
get { return Program.Vars["rwkeeperid"]; }
set { Program.Vars["rwkeeperid"] = value; }
}
public static void ramadanwarIni()
{
var Map = Kernel.Maps[1037];
Pole = (SobNpcSpawn)Map.Npcs[8696];
LeftGate = (SobNpcSpawn)Map.Npcs[6547896];
RightGate = (SobNpcSpawn)Map.Npcs[456852];
}
public static void Start()
{
object[] name;
if (LeftGate == null) return;
Scores = new SafeDictionary<uint, Guild>(100);
StartTime = DateTime.Now;
LeftGate.Mesh = (ushort)(240 + LeftGate.Mesh % 10);
RightGate.Mesh = (ushort)(270 + LeftGate.Mesh % 10);
name = new object[] { "Quest ramadanwar Has Started Go To RamadanWar At TwinCity " };
Kernel.SendWorldMessage(new Message(string.Concat(name), "ALLUSERS", "ramadanwar", System.Drawing.Color.Red, 2500), Program.GamePool);
Kernel.SendWorldMessage(new Message("ramadanwar has began!", System.Drawing.Color.Red, Message.Center), Program.GamePool);
FirstRound = true;
foreach (Guild guild in Kernel.Guilds.Values)
{
guild.rwScore = 0;
}
Update upd = new Update(true);
upd.UID = LeftGate.UID;
upd.Append(Update.Mesh, LeftGate.Mesh);
upd.Append(Update.Hitpoints, LeftGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2072);
upd.Clear();
upd.UID = RightGate.UID;
upd.Append(Update.Mesh, RightGate.Mesh);
upd.Append(Update.Hitpoints, RightGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2072);
Claim = false;
IsWar = true;
}
public static void Reset()
{
Scores = new SafeDictionary<uint, Guild>(100);
LeftGate.Mesh = (ushort)(240 + LeftGate.Mesh % 10);
RightGate.Mesh = (ushort)(270 + LeftGate.Mesh % 10);
LeftGate.Hitpoints = LeftGate.MaxHitpoints;
RightGate.Hitpoints = RightGate.MaxHitpoints;
Pole.Hitpoints = Pole.MaxHitpoints;
Update upd = new Update(true);
upd.UID = LeftGate.UID;
upd.Append(Update.Mesh, LeftGate.Mesh);
upd.Append(Update.Hitpoints, LeftGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2072);
upd.Clear();
upd.UID = RightGate.UID;
upd.Append(Update.Mesh, RightGate.Mesh);
upd.Append(Update.Hitpoints, RightGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2072);
foreach (Guild guild in Kernel.Guilds.Values)
{
guild.rwScore = 0;
}
IsWar = true;
}
public static void FinishRound()
{
if (PoleKeeper != null && !FirstRound)
{
if (PoleKeeper.Wins == 0)
PoleKeeper.Losts++;
else
PoleKeeper.Wins--;
Database.GuildTable.UpdateGuildWarStats(PoleKeeper );
}
LastWin = Time32.Now;
FirstRound = false;
SortScores(out PoleKeeper);
if (PoleKeeper != null)
{
KeeperID = PoleKeeper.ID;
Kernel.SendWorldMessage(new Message("The guild, " + PoleKeeper.Name + ", owned by " + PoleKeeper.LeaderName + " has won this ramadanwar round!", System.Drawing.Color.Red, Message.Center), Program.GamePool);
Kernel.SendWorldMessage(new Message("It is generald pardon time. You have 5 minutes to leave, run for your life!", System.Drawing.Color.White, Message.TopLeft), Program.GamePool, (ushort)6001);
if (PoleKeeper.Losts == 0)
PoleKeeper.Wins++;
else
PoleKeeper.Losts--;
Database.GuildTable.UpdateGuildWarStats(PoleKeeper );
Pole.Name = PoleKeeper.Name;
}
Pole.Hitpoints = Pole.MaxHitpoints;
Kernel.SendWorldMessage(Pole, Program.GamePool, (ushort)1037);
Reset();
}
public static void End()
{
if (PoleKeeper != null)
{
Kernel.SendWorldMessage(new Message("The guild, " + PoleKeeper.Name + ", owned by " + PoleKeeper.LeaderName + " has won this ramadanwar!---ramadanwar has ended!", System.Drawing.Color.White, Message.Center), Program.GamePool);
VPS_ALMaZeN.Database.EntityTable.Status2();
}
else
{
Kernel.SendWorldMessage(new Message("ramadanwar has ended and there was no winner!", System.Drawing.Color.Red, Message.Center), Program.GamePool);
VPS_ALMaZeN.Database.EntityTable.Status2();
}
IsWar = false;
Claim = true;
UpdatePole(Pole);
foreach (Client.GameClient client in Program.GamePool)
{
client.Entity.Status2 = 0;
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.TopDeputyLeader);
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.TopGuildLeader);
}
}
public static void AddScore(uint addScore, Guild guild)
{
if (guild != null)
{
guild.rwScore += addScore;
changed = true;
if (!Scores.ContainsKey(guild.ID))
Scores.Add(guild.ID, guild);
if ((int)Pole.Hitpoints <= 0)
{
FinishRound();
return;
}
}
}
public static void SendScores()
{
if (scoreMessages == null)
scoreMessages = new string[0];
if (Scores.Count == 0)
return;
if (changed)
SortScores(out CurrentTopLeader);
for (int c = 0; c < scoreMessages.Length; c++)
{
Message msg = new Message(scoreMessages[c], System.Drawing.Color.Red, c == 0 ? Message.FirstRightCorner : Message.ContinueRightCorner);
Kernel.SendWorldMessage(msg, Program.GamePool, (ushort)2072);
Kernel.SendWorldMessage(msg, Program.GamePool, (ushort)6001);
}
}
private static void SortScores(out Guild winner)
{
winner = null;
List<string> ret = new List<string>();
int Place = 0;
foreach (Guild guild in Scores.Values.OrderByDescending((p) => p.rwScore))
{
if (Place == 0)
winner = guild;
string str = "No " + (Place + 1).ToString() + ": " + guild.Name + "(" + guild.rwScore + ")";
ret.Add(str);
Place++;
if (Place == 4)
break;
}
changed = false;
scoreMessages = ret.ToArray();
}
private static void UpdatePole(SobNpcSpawn pole)
{
new Database.MySqlCommand(VPS_ALMaZeN.Database.MySqlCo mmandType.UPDATE)
.Update("sobnpcs").Set("name", pole.Name).Set("life", Pole.Hitpoints).Where("id", pole.UID).Execute();
}
}
}
وبعدين في ملف Handle.cs
ابحث عن
public static void ReceiveAttack(Game.Entity attacker, SobNpcSpawn attacked, Attack attack, uint damage, Database.SpellInformation spell)
وتحت اول قوص يقابلك ضيف دا
if (attacker.MapID == 1037)
{
if (attacked.UID == 8696)
{
if (Game.ramadanwar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
attacker.Money += 1000;
Game.ramadanwar.AddScore(damage, attacker.Owner.Guild);
}
}
بردو في نفس الملف ابحث عن
public static bool CanAttack(Game.Entity attacker, SobNpcSpawn attacked, Database.SpellInformation spell)
تحت اول قوس يقابلك ضيف دول
if (attacker.MapID == 1037)
{
if (attacker.GuildID == 0 || !Game.ramadanwar.IsWar)
{
if (attacked.UID == 8696)
{
return false;
}
}
if (Game.ramadanwar.PoleKeeper != null)
{
if (Game.ramadanwar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 8696)
{
return false;
}
}
else if (attacked.UID == 456852 || attacked.UID == 6547896)
{
if (Game.ramadanwar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
}
بعدها تسيف وتروح على ملف
ده مساره لان الاسم بيتختلف حسب السورس ومش عايزكم تدوخه
Network.GamePackets.SobNpcsSpawn
وابحث عن الكود دا
private Client.GameClient owner_null = null;
هتلاقي فوقو قوسيت فوق اول قوس ضيف الكود دا
if (MapID == 1037)
{
if (UID != 8696)
{
if (Hitpoints != 0 || Mesh != 251 && Mesh != 281)
{
if (Mesh == 241)
Mesh = (ushort)(250 + Mesh % 10);
else
Mesh = (ushort)(280 + Mesh % 10);
Update upd = new Update(true);
upd.UID = UID;
upd.Append(Update.Mesh, Mesh);
killer.Owner.SendScreen(upd, true);
Hitpoints = 0;
}
Attack attack = new Attack(true);
attack.Attacker = killer.UID;
attack.Attacked = UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = X;
attack.Y = Y;
killer.Owner.Send(attack);
killer.KOCount++;
}
}
else
{
Attack attack = new Attack(true);
attack.Attacker = killer.UID;
attack.Attacked = UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = X;
attack.Y = Y;
killer.Owner.Send(attack);
Hitpoints = MaxHitpoints;
Update upd = new Update(true);
upd.UID = UID;
upd.Append(Update.Hitpoints, MaxHitpoints);
killer.Owner.SendScreen(upd, true);
}
بعد كدا تروح يا معلم على ملف
Guild.cs
وابحث عن الكود دا
public uint EWarScore;
وحط تحتو الكود دا
public uint rwScore;
public bool PoleKeeper66
{
get
{
return ramadan.Poles.Name == Name;
}
}
وبعدين افتح ملف World.cs
ضيف الانفيت
#region ramadanwar
if (DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday)
if (!Game.ramadanwar.IsWar)
{
if (Now64.Hour == 16 && Now64.Minute == 30 && Now64.Second == 04)
{
Game.ramadanwar.Start();
Kernel.SendWorldMessage(new Message("Elite GW began!", Color.White, Message.Center), Program.GamePool);
foreach (var client in Program.GamePool)
if (client.Entity.MapID == 6000 || client.Entity.MapID == 6001 || client.Entity.MapID == 6002 || client.Entity.MapID == 6003 || client.Entity.MapID == 6004)
return;
foreach (var client in Program.GamePool)
if (client.Entity.GuildID != 0)
client.MessageBox("ramadanwar has begun! Would you like to join? ",
p => { p.Entity.Teleport(1002, 311, 271); }, null);
}
}
if (Game.ramadanwar.IsWar)
{
if (Time32.Now > Game.PoleTwin.ScoreSendStamp.AddSeconds(3))
{
Game.ramadanwar.ScoreSendStamp = Time32.Now;
Game.ramadanwar.SendScores();
}
if (Now64.Hour == 16 && Now64.Minute == 20 && Now64.Second <= 4)
{
Kernel.SendWorldMessage(new Network.GamePackets.Message(" egre yad enta we hoa ramadan war ht5ls kman 10 min.", System.Drawing.Color.White, Network.GamePackets.Message.Center), Program.GamePool);
}
}
if (Game.ramadanwar.IsWar)
{
if (Now64.Hour == 17 && Now64.Minute == 30 && Now64.Second == 04)
{
Game.ramadanwar.End();
{
Kernel.SendWorldMessage(new Network.GamePackets.Message("Elite GW has Ended", System.Drawing.Color.White, Network.GamePackets.Message.Center), Program.GamePool);
}
}
}
#endregion
بص يا معلم لو جالك في كلينت ايرور انقل الكود دا كلو في حته تانيه تحت كوسته PoleTwin لو عندك ولا حاجه
بعد كدا هتفتح ملف Program.cs وابحث عن الكود دا
Game.ClanWar.Initiate();
ضيف دا تحتو
Game.ramadanwar.ramadanwarIni();
Console.WriteLine("ramadanwar initializated.");
وبعدين في ملف sobnpcs في النافي كيت هتضيف دول
6547896 iii 26 251 2072 439 424 10000000 10000000 24 21 0 0
456852 iii 26 277 5000 501 355 10000000 10000000 27 21 0 0
8696 FlagBase 10 1137 5000 438 377 10000000 10000000 0 17 1 0
ودا بقا الان بي سي انا حطو في التون ارميه انت في اي حته لو عايز تغير
78963214 0 0 PoleTwin 2 28080 -1 1002 349 342 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
حط الملف دا فكو في السورس
عفواً لايمكن عرض الروابط في الإرشيف (عفواً لايمكن عرض الروابط في الإرشيف)
وفي النافي كات في ملف maps ضيف دا
1037 1002 7 0
بس كدا خلصنا يا ريت ميبقاش في اي مشاكل ان شاء الله ولو فيه قول
الكوسته ده كانت موجوده في تيم اكسور قبل ما يقفل
تعالو نقسم موضوعنا كدا عشان يبان جميل ومنظم
اولا:ايه هيا حرب رمضان؟
هيا عباره عن حرب بتيجي كل يوم في معاد معين بيجيلك اوتو انفيت ليها في ميعاد بدأ الحرب دي
وفيها بوله
الحرب طبعا للجيلدات مع بعضها
وبتديك سبيس ولو عايز كمان تضيف ليها توبات ضيف زي منت عاوز برحتك
ثالثا: الشرح!!
نبدأ بسم الله
هيجيلك ارورات بس اشتغل لحد منخلص وكلو هيبقا تمام ان شاء الله ولو جالك ارور في VPS_ALMaZeN ابقا غيرها باسم البروجيكت الخاص بتاع سيرفرك
افتح ملف
NPC
#region Gates
case 6547896:
{
if (client.Guild != null)
{
if (client.Guild.PoleKeeper66)
{
switch (npcRequest.OptionID)
{
case 0:
dialog.Text("Select the option you want to pursue.");
if (client.AsMember.Rank != VPS_ALMaZeN.Game.Enums.GuildMemberRank.Member)
{
dialog.Option("Open gate.", 1);
dialog.Option("Close gate.", 2);
}
dialog.Option("Get inside.", 3);
dialog.Option("Nothing.", 255);
dialog.Send();
break;
case 1:
{
if (Game.ramadanwar.LeftGate.Mesh == (ushort)(240 + ramadanwar.LeftGate.Mesh % 10))
{
VPS_ALMaZeN.Game.ramadanwar.LeftGate.Mesh = (ushort)(250 + VPS_ALMaZeN.Game.ramadanwar.LeftGate.Mesh % 10);
Update upd = new Update(true);
upd.UID = VPS_ALMaZeN.Game.ramadanwar.LeftGate.UID;
upd.Append(Update.Mesh, VPS_ALMaZeN.Game.ramadanwar.LeftGate.Mesh);
client.SendScreen(upd, true);
break;
}
break;
}
case 2:
{
if (Game.ramadanwar.LeftGate.Mesh == (ushort)(250 + ramadanwar.LeftGate.Mesh % 10))
{
Game.ramadanwar.LeftGate.Mesh = (ushort)(240 + Game.ramadanwar.LeftGate.Mesh % 10);
Game.ramadanwar.LeftGate.Hitpoints = Game.ramadanwar.LeftGate.MaxHitpoints;
Update upd = new Update(true);
upd.UID = VPS_ALMaZeN.Game.ramadanwar.LeftGate.UID;
upd.Append(Update.Mesh, VPS_ALMaZeN.Game.ramadanwar.LeftGate.Mesh);
upd.Append(Update.Hitpoints, VPS_ALMaZeN.Game.ramadanwar.LeftGate.Hitpoints);
client.SendScreen(upd, true);
break;
}
break;
}
case 3:
{
client.Entity.Teleport(1037, 237, 242);
break;
}
}
}
}
break;
}
case 456852:
{
if (client.Guild != null)
{
if (client.Guild.PoleKeeper66)
{
switch (npcRequest.OptionID)
{
case 0:
dialog.Text("Select the option you want to pursue.");
if (client.AsMember.Rank != VPS_ALMaZeN.Game.Enums.GuildMemberRank.Member)
{
dialog.Option("Open gate.", 1);
dialog.Option("Close gate.", 2);
}
dialog.Option("Get inside.", 3);
dialog.Option("Nothing.", 255);
dialog.Send();
break;
case 1:
{
if (VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh == (ushort)(270 + VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh % 10))
{
VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh = (ushort)(280 + VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh % 10);
Update upd = new Update(true);
upd.UID = VPS_ALMaZeN.Game.ramadanwar.RightGate.UID;
upd.Append(Update.Mesh, VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh);
client.SendScreen(upd, true);
break;
}
break;
}
case 2:
{
if (VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh == (ushort)(280 + VPS_ALMaZeN_Server.Game.ramadanwar.RightGate.Mesh % 10))
{
VPS_ALMaZeN.Game.PoleTwin.RightGate.Mesh = (ushort)(270 + VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh % 10);
Game.ramadanwar.RightGate.Hitpoints = Game.ramadanwar.RightGate.MaxHitpoints;
Update upd = new Update(true);
upd.UID = VPS_ALMaZeN.Game.ramadanwar.RightGate.UID;
upd.Append(Update.Mesh, VPS_ALMaZeN.Game.ramadanwar.RightGate.Mesh);
upd.Append(Update.Hitpoints, VPS_ALMaZeN.Game.ramadanwar.RightGate.Hitpoints);
client.SendScreen(upd, true);
break;
}
break;
}
case 3:
{
client.Entity.Teleport(1037, 237, 242);
break;
}
}
}
}
break;
}
#endregion
بردو في ملف الان بي سي هتبحث عن
#region ElitePole
اقفلو بالسالب وحط دا تحتو
#region ramadanwar
case 78963214:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Hey there " + client.Entity.Name + " Would you like to Join Ramadan war?.");
dialog.Text("or claim the Prize?, you can join Every day expect Saturday and Sunday At 16:30 to 17:30.");
dialog.Text("and the winner Guild Leader will get 5M cps after it finish u have 5 minutes to claim?.");
dialog.Option("Join ramadan war", 1);
dialog.Option("Claim Prize.", 5);
dialog.Send();
break;
}
case 1:
{
if (ramadanwar.IsWar)
{
client.Entity.Teleport(1037, 265, 270);
}
else
{
dialog.Text("The war is not held now! It will start every day expect Saturday and Sunday at 16:30");
dialog.Option("okay", 255);
dialog.Send();
break;
}
break;
}
case 5:
{
if (!ramadanwar.IsWar)
{
if (client.Guild != null)
{
if (ramadanwar.KeeperID != 0)
{
if (ramadanwar.Claim && client.AsMember.Rank == Game.Enums.GuildMemberRank.GuildLeader && client.Guild.ID == ramadanwar.KeeperID)
{
ramadanwar.Claim = false;
ramadanwar.KeeperID = 0;
VPS_ALMaZeN.Kernel.SendWorldMessage(new Message("Congratulations! " + client.Entity.Name + " claimed the prize 5M ConquerPoints for winning the ramadanwar.", System.Drawing.Color.Black, Message.Center), Program.GamePool);
client.Entity.ConquerPoints += 5000000;
Program.AddWarLog("ramadanwar", "5M CPS", client.Entity.Name);
}
else
{
dialog.Text("sorry u dont have any prize to claim....");
dialog.Option("okay", 255);
dialog.Send();
break;
}
}
}
else
{
dialog.Text("sorry u dont have any prize to claim");
dialog.Option("okay", 255);
dialog.Send();
break;
}
}
else
{
dialog.Text("Hey there " + client.Entity.Name + " You can't get the prize while the war is on!");
dialog.Option("okay", 255);
dialog.Send();
break;
}
break;
}
}
break;
}
#endregion
#region ramadanwar
case 8696:
{
dialog.Text("Welcome in ramadanwar HaveFun!.");
dialog.Option("Thanks.", 255);
dialog.Send();
break;
}
#endregion
بعد كدا هتعمل كلاسس جديد في فولدر game وهتسميه
ramadanwar.cs
وتقوب خابط الكلام دا كلو جوا الكلاسس الي انت ضيفتو دا
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VPS_ALMaZeN.Network.GamePackets;
using VPS_ALMaZeN.Game.ConquerStructures.Society;
namespace VPS_ALMaZeN.Game
{
public class ramadanwar
{
public static SobNpcSpawn Pole, RightGate, LeftGate;
public static SobNpcSpawn Poles;
public static SafeDictionary<uint, Guild> Scores = new SafeDictionary<uint, Guild>(100);
public static bool IsWar = false, Flame10th = false, FirstRound = false;
public static Time32 ScoreSendStamp, LastWin;
public static Guild PoleKeeper, CurrentTopLeader;
private static bool changed = false;
private static string[] scoreMessages;
public static DateTime StartTime;
public static bool Claim
{
get { return Program.Vars["rwclaim"]; }
set { Program.Vars["rwclaim"] = value; }
}
public static uint KeeperID
{
get { return Program.Vars["rwkeeperid"]; }
set { Program.Vars["rwkeeperid"] = value; }
}
public static void ramadanwarIni()
{
var Map = Kernel.Maps[1037];
Pole = (SobNpcSpawn)Map.Npcs[8696];
LeftGate = (SobNpcSpawn)Map.Npcs[6547896];
RightGate = (SobNpcSpawn)Map.Npcs[456852];
}
public static void Start()
{
object[] name;
if (LeftGate == null) return;
Scores = new SafeDictionary<uint, Guild>(100);
StartTime = DateTime.Now;
LeftGate.Mesh = (ushort)(240 + LeftGate.Mesh % 10);
RightGate.Mesh = (ushort)(270 + LeftGate.Mesh % 10);
name = new object[] { "Quest ramadanwar Has Started Go To RamadanWar At TwinCity " };
Kernel.SendWorldMessage(new Message(string.Concat(name), "ALLUSERS", "ramadanwar", System.Drawing.Color.Red, 2500), Program.GamePool);
Kernel.SendWorldMessage(new Message("ramadanwar has began!", System.Drawing.Color.Red, Message.Center), Program.GamePool);
FirstRound = true;
foreach (Guild guild in Kernel.Guilds.Values)
{
guild.rwScore = 0;
}
Update upd = new Update(true);
upd.UID = LeftGate.UID;
upd.Append(Update.Mesh, LeftGate.Mesh);
upd.Append(Update.Hitpoints, LeftGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2072);
upd.Clear();
upd.UID = RightGate.UID;
upd.Append(Update.Mesh, RightGate.Mesh);
upd.Append(Update.Hitpoints, RightGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2072);
Claim = false;
IsWar = true;
}
public static void Reset()
{
Scores = new SafeDictionary<uint, Guild>(100);
LeftGate.Mesh = (ushort)(240 + LeftGate.Mesh % 10);
RightGate.Mesh = (ushort)(270 + LeftGate.Mesh % 10);
LeftGate.Hitpoints = LeftGate.MaxHitpoints;
RightGate.Hitpoints = RightGate.MaxHitpoints;
Pole.Hitpoints = Pole.MaxHitpoints;
Update upd = new Update(true);
upd.UID = LeftGate.UID;
upd.Append(Update.Mesh, LeftGate.Mesh);
upd.Append(Update.Hitpoints, LeftGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2072);
upd.Clear();
upd.UID = RightGate.UID;
upd.Append(Update.Mesh, RightGate.Mesh);
upd.Append(Update.Hitpoints, RightGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2072);
foreach (Guild guild in Kernel.Guilds.Values)
{
guild.rwScore = 0;
}
IsWar = true;
}
public static void FinishRound()
{
if (PoleKeeper != null && !FirstRound)
{
if (PoleKeeper.Wins == 0)
PoleKeeper.Losts++;
else
PoleKeeper.Wins--;
Database.GuildTable.UpdateGuildWarStats(PoleKeeper );
}
LastWin = Time32.Now;
FirstRound = false;
SortScores(out PoleKeeper);
if (PoleKeeper != null)
{
KeeperID = PoleKeeper.ID;
Kernel.SendWorldMessage(new Message("The guild, " + PoleKeeper.Name + ", owned by " + PoleKeeper.LeaderName + " has won this ramadanwar round!", System.Drawing.Color.Red, Message.Center), Program.GamePool);
Kernel.SendWorldMessage(new Message("It is generald pardon time. You have 5 minutes to leave, run for your life!", System.Drawing.Color.White, Message.TopLeft), Program.GamePool, (ushort)6001);
if (PoleKeeper.Losts == 0)
PoleKeeper.Wins++;
else
PoleKeeper.Losts--;
Database.GuildTable.UpdateGuildWarStats(PoleKeeper );
Pole.Name = PoleKeeper.Name;
}
Pole.Hitpoints = Pole.MaxHitpoints;
Kernel.SendWorldMessage(Pole, Program.GamePool, (ushort)1037);
Reset();
}
public static void End()
{
if (PoleKeeper != null)
{
Kernel.SendWorldMessage(new Message("The guild, " + PoleKeeper.Name + ", owned by " + PoleKeeper.LeaderName + " has won this ramadanwar!---ramadanwar has ended!", System.Drawing.Color.White, Message.Center), Program.GamePool);
VPS_ALMaZeN.Database.EntityTable.Status2();
}
else
{
Kernel.SendWorldMessage(new Message("ramadanwar has ended and there was no winner!", System.Drawing.Color.Red, Message.Center), Program.GamePool);
VPS_ALMaZeN.Database.EntityTable.Status2();
}
IsWar = false;
Claim = true;
UpdatePole(Pole);
foreach (Client.GameClient client in Program.GamePool)
{
client.Entity.Status2 = 0;
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.TopDeputyLeader);
client.Entity.RemoveFlag(Network.GamePackets.Updat e.Flags.TopGuildLeader);
}
}
public static void AddScore(uint addScore, Guild guild)
{
if (guild != null)
{
guild.rwScore += addScore;
changed = true;
if (!Scores.ContainsKey(guild.ID))
Scores.Add(guild.ID, guild);
if ((int)Pole.Hitpoints <= 0)
{
FinishRound();
return;
}
}
}
public static void SendScores()
{
if (scoreMessages == null)
scoreMessages = new string[0];
if (Scores.Count == 0)
return;
if (changed)
SortScores(out CurrentTopLeader);
for (int c = 0; c < scoreMessages.Length; c++)
{
Message msg = new Message(scoreMessages[c], System.Drawing.Color.Red, c == 0 ? Message.FirstRightCorner : Message.ContinueRightCorner);
Kernel.SendWorldMessage(msg, Program.GamePool, (ushort)2072);
Kernel.SendWorldMessage(msg, Program.GamePool, (ushort)6001);
}
}
private static void SortScores(out Guild winner)
{
winner = null;
List<string> ret = new List<string>();
int Place = 0;
foreach (Guild guild in Scores.Values.OrderByDescending((p) => p.rwScore))
{
if (Place == 0)
winner = guild;
string str = "No " + (Place + 1).ToString() + ": " + guild.Name + "(" + guild.rwScore + ")";
ret.Add(str);
Place++;
if (Place == 4)
break;
}
changed = false;
scoreMessages = ret.ToArray();
}
private static void UpdatePole(SobNpcSpawn pole)
{
new Database.MySqlCommand(VPS_ALMaZeN.Database.MySqlCo mmandType.UPDATE)
.Update("sobnpcs").Set("name", pole.Name).Set("life", Pole.Hitpoints).Where("id", pole.UID).Execute();
}
}
}
وبعدين في ملف Handle.cs
ابحث عن
public static void ReceiveAttack(Game.Entity attacker, SobNpcSpawn attacked, Attack attack, uint damage, Database.SpellInformation spell)
وتحت اول قوص يقابلك ضيف دا
if (attacker.MapID == 1037)
{
if (attacked.UID == 8696)
{
if (Game.ramadanwar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
attacker.Money += 1000;
Game.ramadanwar.AddScore(damage, attacker.Owner.Guild);
}
}
بردو في نفس الملف ابحث عن
public static bool CanAttack(Game.Entity attacker, SobNpcSpawn attacked, Database.SpellInformation spell)
تحت اول قوس يقابلك ضيف دول
if (attacker.MapID == 1037)
{
if (attacker.GuildID == 0 || !Game.ramadanwar.IsWar)
{
if (attacked.UID == 8696)
{
return false;
}
}
if (Game.ramadanwar.PoleKeeper != null)
{
if (Game.ramadanwar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 8696)
{
return false;
}
}
else if (attacked.UID == 456852 || attacked.UID == 6547896)
{
if (Game.ramadanwar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
}
بعدها تسيف وتروح على ملف
ده مساره لان الاسم بيتختلف حسب السورس ومش عايزكم تدوخه
Network.GamePackets.SobNpcsSpawn
وابحث عن الكود دا
private Client.GameClient owner_null = null;
هتلاقي فوقو قوسيت فوق اول قوس ضيف الكود دا
if (MapID == 1037)
{
if (UID != 8696)
{
if (Hitpoints != 0 || Mesh != 251 && Mesh != 281)
{
if (Mesh == 241)
Mesh = (ushort)(250 + Mesh % 10);
else
Mesh = (ushort)(280 + Mesh % 10);
Update upd = new Update(true);
upd.UID = UID;
upd.Append(Update.Mesh, Mesh);
killer.Owner.SendScreen(upd, true);
Hitpoints = 0;
}
Attack attack = new Attack(true);
attack.Attacker = killer.UID;
attack.Attacked = UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = X;
attack.Y = Y;
killer.Owner.Send(attack);
killer.KOCount++;
}
}
else
{
Attack attack = new Attack(true);
attack.Attacker = killer.UID;
attack.Attacked = UID;
attack.AttackType = Network.GamePackets.Attack.Kill;
attack.X = X;
attack.Y = Y;
killer.Owner.Send(attack);
Hitpoints = MaxHitpoints;
Update upd = new Update(true);
upd.UID = UID;
upd.Append(Update.Hitpoints, MaxHitpoints);
killer.Owner.SendScreen(upd, true);
}
بعد كدا تروح يا معلم على ملف
Guild.cs
وابحث عن الكود دا
public uint EWarScore;
وحط تحتو الكود دا
public uint rwScore;
public bool PoleKeeper66
{
get
{
return ramadan.Poles.Name == Name;
}
}
وبعدين افتح ملف World.cs
ضيف الانفيت
#region ramadanwar
if (DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday)
if (!Game.ramadanwar.IsWar)
{
if (Now64.Hour == 16 && Now64.Minute == 30 && Now64.Second == 04)
{
Game.ramadanwar.Start();
Kernel.SendWorldMessage(new Message("Elite GW began!", Color.White, Message.Center), Program.GamePool);
foreach (var client in Program.GamePool)
if (client.Entity.MapID == 6000 || client.Entity.MapID == 6001 || client.Entity.MapID == 6002 || client.Entity.MapID == 6003 || client.Entity.MapID == 6004)
return;
foreach (var client in Program.GamePool)
if (client.Entity.GuildID != 0)
client.MessageBox("ramadanwar has begun! Would you like to join? ",
p => { p.Entity.Teleport(1002, 311, 271); }, null);
}
}
if (Game.ramadanwar.IsWar)
{
if (Time32.Now > Game.PoleTwin.ScoreSendStamp.AddSeconds(3))
{
Game.ramadanwar.ScoreSendStamp = Time32.Now;
Game.ramadanwar.SendScores();
}
if (Now64.Hour == 16 && Now64.Minute == 20 && Now64.Second <= 4)
{
Kernel.SendWorldMessage(new Network.GamePackets.Message(" egre yad enta we hoa ramadan war ht5ls kman 10 min.", System.Drawing.Color.White, Network.GamePackets.Message.Center), Program.GamePool);
}
}
if (Game.ramadanwar.IsWar)
{
if (Now64.Hour == 17 && Now64.Minute == 30 && Now64.Second == 04)
{
Game.ramadanwar.End();
{
Kernel.SendWorldMessage(new Network.GamePackets.Message("Elite GW has Ended", System.Drawing.Color.White, Network.GamePackets.Message.Center), Program.GamePool);
}
}
}
#endregion
بص يا معلم لو جالك في كلينت ايرور انقل الكود دا كلو في حته تانيه تحت كوسته PoleTwin لو عندك ولا حاجه
بعد كدا هتفتح ملف Program.cs وابحث عن الكود دا
Game.ClanWar.Initiate();
ضيف دا تحتو
Game.ramadanwar.ramadanwarIni();
Console.WriteLine("ramadanwar initializated.");
وبعدين في ملف sobnpcs في النافي كيت هتضيف دول
6547896 iii 26 251 2072 439 424 10000000 10000000 24 21 0 0
456852 iii 26 277 5000 501 355 10000000 10000000 27 21 0 0
8696 FlagBase 10 1137 5000 438 377 10000000 10000000 0 17 1 0
ودا بقا الان بي سي انا حطو في التون ارميه انت في اي حته لو عايز تغير
78963214 0 0 PoleTwin 2 28080 -1 1002 349 342 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
حط الملف دا فكو في السورس
عفواً لايمكن عرض الروابط في الإرشيف (عفواً لايمكن عرض الروابط في الإرشيف)
وفي النافي كات في ملف maps ضيف دا
1037 1002 7 0
بس كدا خلصنا يا ريت ميبقاش في اي مشاكل ان شاء الله ولو فيه قول
الكوسته ده كانت موجوده في تيم اكسور قبل ما يقفل