المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : SuperGuildWar FullAdd


Hassan Emprator
2019-07-08, 08:37 PM
1-الشرح ,
هيا زي الوار بالظبط ..
بس ليها توبات خاصة وجوائز خاصة ,
أنا عاملها يومين فالاسبوع ومعدل ع الوقت من الساعة 9 لـ 10 نبدا هتعمل كلاس جديد وهتسميه ,

SuperGuildWar

وايه الي عنده امسحه وضيف دا

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HarryPotter.Network.GamePackets;
using HarryPotter.Game.ConquerStructures.Society;

namespace HarryPotter.Game
{
public class SuperGuildWar
{
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, 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["sgwclaim"]; }
set { Program.Vars["sgwclaim"] = value; }
}
public static uint KeeperID
{
get { return Program.Vars["sgwkeeperid"]; }
set { Program.Vars["sgwkeeperid"] = value; }
}
public static void Initiate()
{
var Map = Kernel.Maps[10380];
Pole = (SobNpcSpawn)Map.Npcs[8100];
LeftGate = (SobNpcSpawn)Map.Npcs[516174];
RightGate = (SobNpcSpawn)Map.Npcs[516175];
Console.WriteLine("SuperGuildWar Information Loaded");

}

public static void Start()
{
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);
Kernel.SendWorldMessage(new Message("Super Guild war has began!", System.Drawing.Color.Red, Message.Center), Program.Values);
FirstRound = true;
foreach (Guild guild in Kernel.Guilds.Values)
{
guild.sWarScore = 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.Values, (ushort)10380);
upd.Clear();
upd.UID = RightGate.UID;
upd.Append(Update.Mesh, RightGate.Mesh);
upd.Append(Update.Hitpoints, RightGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.Values, (ushort)10380);
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.Values, (ushort)10380);
upd.Clear();
upd.UID = RightGate.UID;
upd.Append(Update.Mesh, RightGate.Mesh);
upd.Append(Update.Hitpoints, RightGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.Values, (ushort)10380);

foreach (Guild guild in Kernel.Guilds.Values)
{
guild.sWarScore = 0;
}

IsWar = true;
}

public static void FinishRound()
{

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 Super guild war round!", System.Drawing.Color.Red, Message.Center), Program.Values);
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.Values, (ushort)6001);

Pole.Name = PoleKeeper.Name;
}
Pole.Hitpoints = Pole.MaxHitpoints;
Kernel.SendWorldMessage(Pole, Program.Values, (ushort)10380);
Reset();
}

public static void End()
{
if (PoleKeeper != null)
{
Kernel.SendWorldMessage(new Message("The guild, " + PoleKeeper.Name + ", owned by " + PoleKeeper.LeaderName + " has won this Super guild war!---Guild war has ended!", System.Drawing.Color.White, Message.Center), Program.Values);
//HarryPotter.Database.EntityTable.Status2();
}
else
{
Kernel.SendWorldMessage(new Message("Super Guild war has ended and there was no winner!", System.Drawing.Color.Red, Message.Center), Program.Values);
//HarryPotter.Database.EntityTable.Status2();
}
IsWar = false;
Claim = true;
UpdatePole(Pole);
}

public static void AddScore(uint addScore, Guild guild)
{
if (guild != null)
{
guild.sWarScore += 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.Values, (ushort)10380);
Kernel.SendWorldMessage(msg, Program.Values, (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.sWarScore))
{
if (Place == 0)
winner = guild;
string str = "No " + (Place + 1).ToString() + ": " + guild.Name + "(" + guild.sWarScore + ")";
ret.Add(str);
Place++;
if (Place == 4)
break;
}

changed = false;
scoreMessages = ret.ToArray();
}

private static void UpdatePole(SobNpcSpawn pole)
{
new Database.MySqlCommand(HarryPotter.Database.MySqlCo mmandType.UPDATE)
.Update("sobnpcs").Set("name", pole.Name).Set("life", Pole.Hitpoints).Where("id", pole.UID).Execute();
}
}
}

خش عا

Handel.cs

ابحث عن الكود دا

if (attacker.MapID == 10380)

لو مش موجود عندك ضفله دا

if (attacker.MapID == 10380)
{
if (attacker.GuildID == 0 || !Game.SuperGuildWar.IsWar)
{
if (attacked.UID == 8100)
{
return false;
}
}
if (Game.SuperGuildWar.PoleKeeper != null)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacked.UID == 8100)
{
return false;
}
}
else if (attacked.UID == 516175 || attacked.UID == 516174)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
}

ابحث عن الكود دا

Game.GuildWar.AddScore(damage, attacker.Owner.Guild);

وبعد اخر قوصين في الاكواد حط دولي

if (attacker.MapID == 10380)
{
if (attacked.UID == 8100)
{
if (Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.SuperGuildWar.AddScore(damage, attacker.Owner.Guild);
}
}

..
كدة تمام ,
..
تم اضافة الـكود الناقص

افتح كلاس

Claculations.cs

ابحث عن دة لو مش لقيته ضيفه من الاول معايا

else if (client.Entity.MapID == HarryPotter.Game.SuperGuildWar.RightGate.MapID)


بعد اما تلاقيه بدل بي دا

else if (client.Entity.MapID == HarryPotter.Game.SuperGuildWar.RightGate.MapID)
{
if (HarryPotter.Game.SuperGuildWar.RightGate.Mesh == (270 + HarryPotter.Game.SuperGuildWar.RightGate.Mesh % 10) && oldX >= HarryPotter.Game.SuperGuildWar.RightGate.X && client.Entity.X <= HarryPotter.Game.SuperGuildWar.RightGate.X && client.Entity.Y < HarryPotter.Game.SuperGuildWar.LeftGate.Y)
{
client.Entity.X = oldX;
client.Entity.Y = oldY;
client.Disconnect();
return;
}

if (HarryPotter.Game.SuperGuildWar.LeftGate.Mesh == (240 + HarryPotter.Game.SuperGuildWar.LeftGate.Mesh % 10) && oldY >= HarryPotter.Game.SuperGuildWar.LeftGate.Y && client.Entity.Y <= HarryPotter.Game.SuperGuildWar.LeftGate.Y && client.Entity.X < HarryPotter.Game.SuperGuildWar.RightGate.X)
{
client.Entity.X = oldX;
client.Entity.Y = oldY;
client.Disconnect();
return;
}
}
}
}
}

خش ع

PacketHandler.cs

ابحث عن

if (client.Map.BaseID == 1038 && (HarryPotter.Game.GuildWar.IsWar

وضيف جنبها دا

|| HarryPotter.Game.SuperGuildWar.IsWar))

بمعنا اصح هيبقا كله كدا

if (client.Map.BaseID == 1038 && (HarryPotter.Game.GuildWar.IsWar || HarryPotter.Game.SuperGuildWar.IsWar))

تمام ,
ابحث فـ

Entity.cs

علي دا

if (Game.GuildWar.RightGate.Mesh / 10 == 27)

وبعد اخر قوص ضيف دا

if (Game.SuperGuildWar.RightGate == null)
return false;
if (MapID == 10380)
{
if ((X == 223 || X == 222) && (Y >= 175 && Y <= 185))
{
if (Game.SuperGuildWar.RightGate.Mesh / 10 == 27)
{
return true;
}
}
}
return false;
}

انزل تحت شويه هتلاقي الكود دا كمان

if (Game.GuildWar.LeftGate.Mesh / 10 == 24)

بعد اخر قوص هضيف دا برضو

if (Game.SuperGuildWar.LeftGate == null)
return false;
if (MapID == 10380)
{
if ((Y == 210 || Y == 209) && (X >= 154 && X <= 166))
{
if (Game.SuperGuildWar.LeftGate.Mesh / 10 == 24)
{
return true;
}
}
}
return false;
}

افتح كلاس

Guild.cs

ضيف دا فيه

public uint sWarScore;

وضيف دا كمان

public bool SuperPoleKeeper
{
get
{
return SuperGuildWar.Pole.Name == Name;
}
}

وافتح كلاس بروجرام وضيف اللود دا

Game.SuperGuildWar.Initiate();
Console.WriteLine("SuperGuildWar By Emprator");

افتح كلاس Npc وبحث عن دا

#region Guild war

اقفله من لاسالب وضيف دا تحتيه

#region SuperGuild war
case 10380:
{
switch (client.ActiveNpc)
{
#region Pole
case 8100:
{
dialog.Text("Please, don't hurt me!.");
dialog.Option("Sorry.", 255);
dialog.Send();
break;
}
#endregion

#region SuperClaimGuildPrize

case 44821140:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Hello there. Do you want to Claim Super Guild War Prize you can only Claim it 1 Time if you won SGW.");
dialog.Option("Leme Claim Prize.", 1);
dialog.Option("Get Top.", 3);
dialog.Option("Just Passing By!", 255);
dialog.Send();
break;
}
case 3:
{
if (client.Guild != null)
{
if (client.AsMember.Rank == HarryPotter.Game.Enums.GuildMemberRank.GuildLeader )
{
dialog.Text("Are you sure you want to exchange for your Prize?");
dialog.Option("Yes.", 4);
dialog.Option("Ah, nevermind.", 255);
dialog.Send();
}
else
{
dialog.Text("Sorry only GuildLeader of the Winner Guild can Claim The Prize After SuperGuildWar End.");
dialog.Option("Ahh.", 255);
dialog.Send();
}
}
else
{
dialog.Text("Sorry You are not Member in any guild yet");
dialog.Option("Ahh.", 255);
dialog.Send();
}
break;
}
case 4:
{
var count = client.Inventory.Objects.Where(x => x.ID == 723467).Count();
switch (count)
{
case 0:
{
dialog.Text("Are you sure you have tokens ?");
dialog.Option("Ah, nevermind.", 255);
dialog.Send();
break;
}
case 1:
{
client.Entity.AddTopStatus((ulong)Update.Flags3.Co nuqerSuperUnderBlue, DateTime.Now.AddDays(7));
// client.Inventory.Add(2100055, 0, 1);
client.Entity.ConquerPoints += CPanel.GuildWar;
break;
}
case 2:
{
client.Entity.AddTopStatus((ulong)Update.Flags3.Co nuqerSuperBlue, DateTime.Now.AddDays(7));
// client.Inventory.Add(2100065, 0, 1);
client.Entity.ConquerPoints += CPanel.EliteGw;
break;
}
default:
{
if (count >= 3)
{
client.Entity.AddTopStatus((ulong)Update.Flags3.Co nuqerSuperYellow, DateTime.Now.AddDays(7));
//client.Inventory.Add(2100075, 0, 1);
client.Entity.ConquerPoints += 100000;
}
break;
}
}
client.Inventory.Remove(723467, (byte)Math.Min(count, 3));
break;
}
case 1:
{
if (client.Guild != null)
{
if (client.Guild.SuperPoleKeeper && client.AsMember.Rank == HarryPotter.Game.Enums.GuildMemberRank.GuildLeader )
{
dialog.Text("Are you sure you want to Claim your Prize?");
dialog.Option("Yes.", 2);
dialog.Option("Ah, nevermind.", 255);
dialog.Send();
}
else
{
dialog.Text("Sorry only GuildLeader of the Winner Guild can Claim The Prize After GuildWar End.");
dialog.Option("Ahh.", 255);
dialog.Send();
}
}
else
{
dialog.Text("Sorry You are not Member in any guild yet");
dialog.Option("Ahh.", 255);
dialog.Send();
}
break;
}
case 2:
{
if (!SuperGuildWar.IsWar && SuperGuildWar.Claim && client.Guild != null && client.Entity.GuildID == SuperGuildWar.KeeperID && client.Entity.GuildRank == (ushort)Game.Enums.GuildMemberRank.GuildLeader)
{
//#warning GUILD WAR PRIZE

SuperGuildWar.Claim = false;
SuperGuildWar.KeeperID = 0;
client.Inventory.Add(723467, 0, 1);
HarryPotter.Kernel.SendWorldMessage(new Message("Congratulations! " + client.Entity.Name + " Leader of " + client.Guild.PoleKeeper + " The winner guild has Claimed Super Guild War Prize " + rates.GuildWar + " cps and LordToken!", System.Drawing.Color.White, Message.TopLeft), Program.Values);
}
else
{
dialog.Text("Sorry you dont have Any Prize to claim only GL of the winner guild can claim Prize After SGW");
dialog.Option("Ahh.", 255);
dialog.Send();
}
break;
}


}
break;
}
#endregion

#region Gates
case 516174:
{
if (client.Guild != null)
{
if (client.Guild.SuperPoleKeeper)
{
switch (npcRequest.OptionID)
{
case 0:
dialog.Text("Select the option you want to pursue.");
if (client.AsMember.Rank != HarryPotter.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:
{
HarryPotter.Game.SuperGuildWar.LeftGate.Mesh = (ushort)(250 + HarryPotter.Game.SuperGuildWar.LeftGate.Mesh % 10);

Update upd = new Update(true);
upd.UID = HarryPotter.Game.SuperGuildWar.LeftGate.UID;
upd.Append(Update.Mesh, HarryPotter.Game.SuperGuildWar.LeftGate.Mesh);
client.SendScreen(upd, true);
break;
}
case 2:
{
Game.SuperGuildWar.LeftGate.Mesh = (ushort)(240 + Game.SuperGuildWar.LeftGate.Mesh % 10);
Game.SuperGuildWar.LeftGate.Hitpoints = Game.SuperGuildWar.LeftGate.MaxHitpoints;
Update upd = new Update(true);
upd.UID = HarryPotter.Game.SuperGuildWar.LeftGate.UID;
upd.Append(Update.Mesh, HarryPotter.Game.SuperGuildWar.LeftGate.Mesh);
upd.Append(Update.Hitpoints, HarryPotter.Game.SuperGuildWar.LeftGate.Hitpoints) ;
client.SendScreen(upd, true);
break;
}
case 3:
{
client.Entity.Teleport(10380, 162, 198);
break;
}
}
}
}
break;
}
case 516175:
{
if (client.Guild != null)
{
if (client.Guild.SuperPoleKeeper)
{
switch (npcRequest.OptionID)
{
case 0:
dialog.Text("Select the option you want to pursue.");
if (client.AsMember.Rank != HarryPotter.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:
{
HarryPotter.Game.SuperGuildWar.RightGate.Mesh = (ushort)(280 + HarryPotter.Game.SuperGuildWar.RightGate.Mesh % 10);

Update upd = new Update(true);
upd.UID = HarryPotter.Game.SuperGuildWar.RightGate.UID;
upd.Append(Update.Mesh, HarryPotter.Game.SuperGuildWar.RightGate.Mesh);
client.SendScreen(upd, true);
break;
}
case 2:
{
HarryPotter.Game.SuperGuildWar.RightGate.Mesh = (ushort)(270 + HarryPotter.Game.SuperGuildWar.RightGate.Mesh % 10);
Game.GuildWar.RightGate.Hitpoints = Game.SuperGuildWar.RightGate.MaxHitpoints;
Update upd = new Update(true);
upd.UID = HarryPotter.Game.SuperGuildWar.RightGate.UID;
upd.Append(Update.Mesh, HarryPotter.Game.SuperGuildWar.RightGate.Mesh);
upd.Append(Update.Hitpoints, HarryPotter.Game.SuperGuildWar.RightGate.Hitpoints );
client.SendScreen(upd, true);
break;
}
case 3:
{
client.Entity.Teleport(10380, 210, 177);
break;
}
}
}
}
break;
}
#endregion

#region Guild Conductresses

#region Exit Guild Arena
case 70000:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Do you want to leave the guild arena?");
dialog.Option("Yes.", 1);
dialog.Option("No.", 255);
dialog.Send();
break;
}
case 1:
{
client.Entity.Teleport(1002, 429, 378);
break;
}
}
break;
}
#endregion


#endregion


}
break;
}
#endregion

ضيف دا فيه World

#region SuperGuildWar
if (Now64.DayOfWeek != DayOfWeek.Friday && Now64.DayOfWeek != DayOfWeek.Monday)
if (DateTime.Now.Hour == 21 && DateTime.Now.Minute == 00 && DateTime.Now.Second <= 00)
{ // By HaMaDa.ShaDow // TorNaDo-TeaM === forum.vpscairo.com


Game.SuperGuildWar.Start();
Kernel.SendWorldMessage(new HarryPotter.Network.GamePackets.Message("SuperGuildWar Is Started Now !", Color.Red, 2012));
foreach (var client in Program.Values)
client.MessageBox("SuperGuild War began! Would You Like To Join?",
p => { p.Entity.Teleport(1002, 300, 358); }, null, 60);

if (Game.SuperGuildWar.IsWar)
Kernel.SendWorldMessage(new Message("You Have To Be Ready For The SuperGuild War !", Color.White, Message.Center), Program.Values);
{
if (Time32.Now > Game.SuperGuildWar.ScoreSendStamp.AddSeconds(3))
{
Game.SuperGuildWar.ScoreSendStamp = Time32.Now;
Game.SuperGuildWar.SendScores();
}
if (DateTime.Now.Hour == 21 && DateTime.Now.Minute == 50 && DateTime.Now.Second <= 2)
{
Kernel.SendWorldMessage(new Network.GamePackets.Message("10 Minutes left till Super GuildWar End Hurry kick other Guild's Ass!.", System.Drawing.Color.White, Network.GamePackets.Message.Center), Program.Values);
}
}
}
else if (DateTime.Now.Hour == 22 && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
{
if (Game.SuperGuildWar.IsWar)
{
Game.SuperGuildWar.End();
}
}

#endregion

افتح كلاس

Entity.cs

ابحث عن

case Network.GamePackets.Update.Flags2.TopPirate: return 22;

ضيف دا تحته

case Network.GamePackets.Update.Flags3.ConuqerSuperUnde rBlue: return 230;
case Network.GamePackets.Update.Flags3.ConuqerSuperBlue : return 240;
case Network.GamePackets.Update.Flags3.ConuqerSuperYell ow: return 250;

ابحث عن دا

case 22: return Network.GamePackets.Update.Flags2.TopPirate;

وضيف دا تحته

ase 230: return Network.GamePackets.Update.Flags3.ConuqerSuperUnde rBlue;
case 240: return Network.GamePackets.Update.Flags3.ConuqerSuperBlue ;
case 250: return Network.GamePackets.Update.Flags3.ConuqerSuperYell ow;

وافتح كلاس

Update.cs

وابحث عن

public class Flags3

وضيف دا فيه

ConuqerSuperYellow = (ulong)1UL << 23, //GL flag
ConuqerSuperBlue = (ulong)1UL << 24, //DL flag
ConuqerSuperUnderBlue = (ulong)1UL << 25, // Memeber Flag

كدا خلاص اضافه النافي كات افتح النافي كات ودوس f6 او اعمله يدوي

Maps
10380 1038 0 0
..
Sobnpcs
8100 Hassan.Emprator 10 1137 10380 84 99 23446500 30000000 0 17 1 0
516174 ii 26 251 10380 163 210 10000000 10000000 24 21 0 0
516175 ii 26 277 10380 223 177 10000000 10000000 27 21 0 0
..
Npc
44821140 Super Guild War 2 8160 10380 44 60


كدا تم الاتنهاء بفضل الله دعوه حلوه بقا ملحوظه الي هيطلع ايرور في HarryPotter يبدلها في اسم البروجكت بتاعه وبس كدا

محمد ياسر
2019-07-08, 08:41 PM
عاش الله ينور

MohamedModyAdel
2019-07-10, 03:29 PM
تسلم

Gamal Askr
2021-08-19, 01:18 PM
عاش استمر يا بطل