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

مشاهدة النسخة كاملة : EliteGuildwar To Alex Source


Tarek Y Fareed
2019-12-03, 03:42 PM
| السلام عليكم انشاء الله اليوم هنضيف EliteGuildwar |


" طبعا دة اول موضوع ليا علي المنتدي و انشاء الله مش هيبقا الاخير "


" يلا نخش ع الاضافة ع طول حمل التكست دة و في شرح كامل للحرب بي كل الاكواد "

Add EliteGuildWar

Add Class in Tournaments Name MsgEliteGuildWar\

Add


using Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;

namespace Project_Terror_v2.Game.MsgTournaments
{
public class MsgEliteGuildWar
{
public static SafeDictionary<uint, Winner> ScoreList = new SafeDictionary<uint, Winner>();
public Dictionary<Role.SobNpc.StaticMesh, Role.SobNpc> Furnitures;
public Winner RoundOwner;
public static ushort MapID = 6521;
public ProcesType Proces;
public class Winner
{
public uint GuildID;
public uint Score;
public string GuildName;
}
public MsgEliteGuildWar()
{
Proces = ProcesType.Dead;
Furnitures = new Dictionary<Role.SobNpc.StaticMesh, Role.SobNpc>();
}
public void Load()
{
Furnitures.Add(Role.SobNpc.StaticMesh.Pole, Database.Server.ServerMaps[MapID].View.GetMapObject<Role.SobNpc>(Role.MapObjectType.SobNpc, 6521));
}
public void CheckUP()
{
DateTime Now = DateTime.Now;
if (Proces == ProcesType.Dead && Now.Hour == 12 && Now.Minute == 30)
this.Start();
if (Proces == ProcesType.Alive)
{
if (Now.Hour == 12 && Now.Minute == 40 && Now.Second <= 2)
MsgSchedules.SendSysMesage("EliteGuildWar will ended after 10 Minutes.", MsgServer.MsgMessage.ChatMode.Center);

if (Now.Hour == 12 && Now.Minute == 43 && Now.Second <= 2)
MsgSchedules.SendSysMesage("EliteGuildWar will ended after 2 Minutes.", MsgServer.MsgMessage.ChatMode.Center);

if (Now.Hour == 12 && Now.Minute == 45 && Now.Second > 2)
this.End();
}
}
public void Start()
{
RoundOwner = null;
Proces = ProcesType.Alive;
ScoreList = new SafeDictionary<uint, Winner>();
MsgSchedules.SendSysMesage("EliteGuildWar war has began", MsgServer.MsgMessage.ChatMode.Center);
MsgSchedules.SendInvitation("EliteGuildWar has begun! Would you like to join?", "CPs", 330, 249, 1002, 0, 60);
}
public void Reset(ServerSockets.Packet stream)
{
ScoreList = new SafeDictionary<uint, Winner>();

foreach (var npc in Furnitures.Values)
npc.HitPoints = npc.MaxHitPoints;

var Pole = Furnitures[Role.SobNpc.StaticMesh.Pole];
var users = Database.Server.GamePoll.Values.Where(u => Role.Core.GetDistance(u.Player.X, u.Player.Y, Pole.X, Pole.Y) <= Role.SobNpc.SeedDistrance).ToArray();
if (users != null)
{
foreach (var user in users)
{
MsgServer.MsgUpdate upd = new MsgServer.MsgUpdate(stream, Pole.UID, 2);
stream = upd.Append(stream, MsgServer.MsgUpdate.DataType.Mesh, (long)Pole.Mesh);
stream = upd.Append(stream, MsgServer.MsgUpdate.DataType.Hitpoints, Pole.HitPoints);
stream = upd.GetArray(stream);
user.Send(stream);
if ((Role.SobNpc.StaticMesh)Pole.Mesh == Role.SobNpc.StaticMesh.Pole)
user.Send(Pole.GetArray(stream, false));
}
}
}
public void FinishRound(ServerSockets.Packet stream)
{
SortScores(true);
Furnitures[Role.SobNpc.StaticMesh.Pole].Name = RoundOwner.GuildName;
MsgSchedules.SendSysMesage("The Round Ownered by guild " + RoundOwner.GuildName + ".", MsgServer.MsgMessage.ChatMode.Center);
Reset(stream);
}
public void End()
{
if (Proces == ProcesType.Alive)
{
Proces = ProcesType.Dead;
MsgSchedules.SendSysMesage(RoundOwner == null ? "EliteGuildWar has ended and there is no winner" : "Guild " + RoundOwner.GuildName + ", He is the winner of EliteGuildWar.", MsgServer.MsgMessage.ChatMode.Center);
ScoreList.Clear();
}
}
public void UpdateScore(ServerSockets.Packet stream, uint Score, Role.Instance.Guild Guild)
{
if (!ScoreList.ContainsKey(Guild.Info.GuildID))
ScoreList.Add(Guild.Info.GuildID, new Winner() { GuildName = Guild.GuildName, GuildID = Guild.Info.GuildID, Score = Score });
else
ScoreList[Guild.Info.GuildID].Score += Score;

SortScores();

if (Furnitures[Role.SobNpc.StaticMesh.Pole].HitPoints < 1)
{
FinishRound(stream);
return;
}
}
private void SortScores(bool getwinner = false)
{
if (Proces != ProcesType.Dead)
{
var Array = ScoreList.Values.ToArray();
var DescendingList = Array.OrderByDescending(p => p.Score).ToArray();
for (int x = 0; x < DescendingList.Length; x++)
{
var element = DescendingList[x];
if (x == 0 && getwinner)
{
RoundOwner = element;
}
using (var rec = new ServerSockets.RecycledPacket())
{
Game.MsgServer.MsgMessage msg = new MsgServer.MsgMessage("No " + (x + 1).ToString() + ". " + element.GuildName + " (" + element.Score + ")"
, MsgServer.MsgMessage.MsgColor.yellow, x == 0 ? MsgServer.MsgMessage.ChatMode.FirstRightCorner : MsgServer.MsgMessage.ChatMode.ContinueRightCorner) ;

SendMapPacket(msg.GetArray(rec.GetStream()));
}
if (x == 4)
break;
}
}
}
public void SendMapPacket(ServerSockets.Packet packet)
{
foreach (var client in Database.Server.ServerMaps[MapID].Values)
client.Send(packet);
}
}
}



Step 2

Search in NPCServer From
Game.MsgTournaments.MsgSchedules.GuildWar.Load();

And Add
Game.MsgTournaments.MsgSchedules.EliteGuildWar.Loa d();
Step3
Open Class NpcID
and add
EliteGuildWar = 6522,

step4
Open Class CanAttackNPC
and add
if (attacked.UID == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Fur nitures[Role.SobNpc.StaticMesh.Pole].UID)
{
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Fu rnitures[Role.SobNpc.StaticMesh.Pole].HitPoints == 0)
return false;
if (client.Player.MyGuild.GuildName == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Fur nitures[Role.SobNpc.StaticMesh.Pole].Name)
return false;
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Pr oces != MsgTournaments.ProcesType.Alive)
return false;
}

step5
Open class NPC
and add
else if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Pr oces == MsgTournaments.ProcesType.Alive && attacked.UID == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Fur nitures[Role.SobNpc.StaticMesh.Pole].UID)
Game.MsgTournaments.MsgSchedules.EliteGuildWar.Upd ateScore(stream, obj.Damage, client.Player.MyGuild);



Step6
Open class MsgSchedules
and Search
internal static MsgDragonIsland DragonIsland;

add add
internal static MsgEliteGuildWar EliteGuildWar;


step7
Open class MsgSchedules
and Search
GuildWar = new MsgGuildWar();

and addEliteGuildWar = new MsgEliteGuildWar();


step8
class Search MsgSchedules
And Search
SteedRace.work(0);

add add
EliteGuildWar

Step9
Open Class Program
and Searchcase "powerarena":

and add
case "eliteguildwaron":
{
Game.MsgTournaments.MsgSchedules.EliteGuildWar.Sta rt();
break;
}
case "eliteguildwarend":
{
Game.MsgTournaments.MsgSchedules.EliteGuildWar.End ();
break;
}

Step 10
Open Class SobNpc
and SearchGame.MsgTournaments.MsgSchedules.CaptureTheF lag.UpdateFlagScore(killer.Player, this, 0, stream);


And add

else if (UID == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Fur nitures[StaticMesh.Pole].UID)
{
uint Damage = (uint)HitPoints;

if (HitPoints > 0)
HitPoints = 0;

Game.MsgTournaments.MsgSchedules.EliteGuildWar.Upd ateScore(stream, Damage, killer.Player.MyGuild);
}



Step 11
Open Class NpcHandler
And Add
[NpcAttribute(NpcID.ElitGuildWar)]
public static void ServerEvents(Client.GameClient client, ServerSockets.Packet stream, byte Option, string Input, uint id)
{
DateTime Now64 = DateTime.Now;
Dialog dialog = new Dialog(client, stream);
Dialog data = new Dialog(client, stream);

switch (Option)
{

case 0:
{
dialog.AddText("Hey there " + client.Player.Name + " Would you like to join Quest in time?!");
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Pr oces == MsgTournaments.ProcesType.Alive)
dialog.AddOption("EliteGuildWar[Open]", 1);
else
dialog.AddOption("EliteGuildWar[Claim]", 2);
if (Project_Terror_v2.Game.MsgTournaments.MsgWarOfPla yers.Proces == MsgTournaments.ProcesType.Alive)
dialog.AddOption("Thanxs.", 255).AddAvatar(80).FinalizeDialog();
break;
}
case 1:
{
if (client.Player.MyGuild == null)
{
dialog.AddText("Sorry you not have Guild.")
.AddAvatar(123).FinalizeDialog();
break;
}
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Pr oces == MsgTournaments.ProcesType.Alive)
{
client.Teleport(83, 139, 6521);
}
else
dialog.AddText("The EliteGuildWar Is Not Started / 22.00 End 23.00 .").AddOption("Alright.").FinalizeDialog();
break;
}
case 2:
{
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Pr oces != MsgTournaments.ProcesType.Alive)
{
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Ro undOwner != null && Role.Instance.Guild.GuildPoll.ContainsKey(Game.Msg Tournaments.MsgSchedules.EliteGuildWar.RoundOwner. GuildID))
{
if (client.Player.GuildRank == Role.Flags.GuildMemberRank.GuildLeader)
{
if (client.Player.MyGuild.Info.GuildID == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Rou ndOwner.GuildID)
{
client.Player.ConquerPoints += 50000;
client.Inventory.Add(stream, 3009003);
client.Inventory.Add(stream, 722057);
client.Inventory.Add(stream, 722057);
client.Inventory.Add(stream, 722057);
client.Inventory.Add(stream, 722057);
client.Inventory.Add(stream, 3009001);
client.Inventory.Add(stream, 3009002);
Game.MsgTournaments.MsgSchedules.EliteGuildWar.Rou ndOwner = null;
Game.MsgTournaments.MsgSchedules.SendSysMesage(cli ent.Player.Name + " has receved 50,000 CPs + 3x Stone Perf for winning EliteGuildWar .", MsgMessage.ChatMode.Center);
}
else
dialog.AddText("You dont have any rewrd to claim.").AddOption("Alright.").FinalizeDialog();
}
else
dialog.AddText("Only the guild leader can claim the reward.").AddOption("Alright.").FinalizeDialog();
}
else
dialog.AddText("There is no any rewards now..").AddOption("Alright.").FinalizeDialog();
}
else
dialog.AddText("Please come back when eliteguildwar is finished.").AddOption("Alright.").FinalizeDialog();

break;
}
}
}

Step 12
Open Class NpcID
add
ElitGuildWar = 159853,



This is NPC Number 159853
And You Make NPc Exit If You Need

Enjoy



| التحميل |


عفواً لايمكن عرض الروابط في الإرشيف!S8UgSSSA!U9yijkphE5LAyiJNJhK3EJtl0-ZfajKHZ4eZg8ub8Yo


يلا سلام و استنو مني حرب تاني قريب انشاء الله

محمد ياسر
2019-12-03, 07:28 PM
عاش استمر

HBESA
2019-12-03, 09:52 PM
عاش استمر

ابو حمزه
2019-12-04, 01:31 AM
thanks brother

uncelsam
2020-03-03, 11:12 PM
عاااش

asd201230099
2020-03-04, 01:48 AM
عااااااااااااااااااااااش

ahmedyhaey
2021-07-24, 05:56 AM
عاش

OmarMimi5095
2021-07-25, 06:17 AM
عااش

KekoCoder
2021-07-30, 09:50 AM
3aaash

cotest1
2023-05-16, 08:42 PM
nice bro

cotest1
2023-05-16, 08:43 PM
tanks brow