|
|
المشاركات 10 |
+التقييم 0.01 |
تاريخ التسجيل Nov 2019 |
الاقامة القاهره |
نظام التشغيل Windows 10 |
رقم العضوية 3256 |
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);
}
}
}
Game.MsgTournaments.MsgSchedules.GuildWar.Load();
Game.MsgTournaments.MsgSchedules.EliteGuildWar.Load();
EliteGuildWar = 6522,
if (attacked.UID == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Furnitures[Role.SobNpc.StaticMesh.Pole].UID)
{
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Furnitures[Role.SobNpc.StaticMesh.Pole].HitPoints == 0)
return false;
if (client.Player.MyGuild.GuildName == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Furnitures[Role.SobNpc.StaticMesh.Pole].Name)
return false;
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Proces != MsgTournaments.ProcesType.Alive)
return false;
}
else if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.Proces == MsgTournaments.ProcesType.Alive && attacked.UID == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Furnitures[Role.SobNpc.StaticMesh.Pole].UID)
Game.MsgTournaments.MsgSchedules.EliteGuildWar.UpdateScore(stream, obj.Damage, client.Player.MyGuild);
internal static MsgDragonIsland DragonIsland;
internal static MsgEliteGuildWar EliteGuildWar;
GuildWar = new MsgGuildWar();
EliteGuildWar = new MsgEliteGuildWar();
SteedRace.work(0);
EliteGuildWar
case "powerarena":
case "eliteguildwaron":
{
Game.MsgTournaments.MsgSchedules.EliteGuildWar.Start();
break;
}
case "eliteguildwarend":
{
Game.MsgTournaments.MsgSchedules.EliteGuildWar.End();
break;
}
Game.MsgTournaments.MsgSchedules.CaptureTheFlag.UpdateFlagScore(killer.Player, this, 0, stream);
else if (UID == Game.MsgTournaments.MsgSchedules.EliteGuildWar.Furnitures[StaticMesh.Pole].UID)
{
uint Damage = (uint)HitPoints;
if (HitPoints > 0)
HitPoints = 0;
Game.MsgTournaments.MsgSchedules.EliteGuildWar.UpdateScore(stream, Damage, killer.Player.MyGuild);
}
[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.Proces == MsgTournaments.ProcesType.Alive)
dialog.AddOption("EliteGuildWar[Open]", 1);
else
dialog.AddOption("EliteGuildWar[Claim]", 2);
if (Project_Terror_v2.Game.MsgTournaments.MsgWarOfPlayers.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.Proces == 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.Proces != MsgTournaments.ProcesType.Alive)
{
if (Game.MsgTournaments.MsgSchedules.EliteGuildWar.RoundOwner != null && Role.Instance.Guild.GuildPoll.ContainsKey(Game.MsgTournaments.MsgSchedules.EliteGuildWar.RoundOwner.GuildID))
{
if (client.Player.GuildRank == Role.Flags.GuildMemberRank.GuildLeader)
{
if (client.Player.MyGuild.Info.GuildID == Game.MsgTournaments.MsgSchedules.EliteGuildWar.RoundOwner.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.RoundOwner = null;
Game.MsgTournaments.MsgSchedules.SendSysMesage(client.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;
}
}
}
ElitGuildWar = 159853,
|
الذين يشاهدون محتوى الموضوع الآن : 2 ( الأعضاء 0 والزوار 2) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
Gui [alex Source] | Tefa | تطوير سيرفرات كونكر | 67 | اليوم 01:44 AM |
Lotttery item +8 [Source Alex] | Tefa | تطوير سيرفرات كونكر | 55 | 2024-10-11 02:10 AM |
حل مشكلة لاج الي بييجي لما تموت وحوش [Source Alex] | Tefa | تطوير سيرفرات كونكر | 7 | 2020-04-24 03:48 AM |
npc EpicWeapons[Source Alex] | Tefa | تطوير سيرفرات كونكر | 6 | 2019-11-25 10:18 PM |
حل مشكله الاج[Alex] | محمد ياسر | تطوير سيرفرات كونكر | 2 | 2019-11-14 11:02 PM |