|
المشاركات 1,372 |
+التقييم 0.67 |
تاريخ التسجيل Apr 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 30 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EmpratorServer.Network.GamePackets;
using EmpratorServer.Database;
namespace EmpratorServer.Game
{
public class ClanWar
{
public static SobNpcSpawn Pole;
public static SafeDictionary<uint, Clan> Scores = new SafeDictionary<uint, Clan>(100);
public static bool IsWar = false, FirstRound = false;
public static Time32 ScoreSendStamp, LastWin;
public static Clan PoleKeeper, CurrentTopLeader;
private static bool changed = false;
private static string[] scoreMessages;
public static DateTime StartTime;
public static bool Claim
{
get { return Program.Vars["cwclaim"]; }
set { Program.Vars["cwclaim"] = value; }
}
public static uint KeeperID
{
get { return Program.Vars["cwkeeperid"]; }
set { Program.Vars["cwkeeperid"] = value; }
}
public static void Initiate()
{
var Map = Kernel.Maps[1509];
Pole = (SobNpcSpawn)Map.Npcs[812];
}
public static void Start()
{
Scores = new SafeDictionary<uint, Clan>(100);
StartTime = DateTime.Now;
Kernel.SendWorldMessage(new Message("Clan war has began!", System.Drawing.Color.Red, Message.Center), Program.Values);
FirstRound = true;
foreach (Clan clan in Kernel.Clans.Values)
{
clan.WarScore = 0;
}
Claim = false;
IsWar = true;
}
public static void Reset()
{
Scores = new SafeDictionary<uint, Clan>(100);
Pole.Hitpoints = Pole.MaxHitpoints;
foreach (Clan clan in Kernel.Clans.Values)
{
clan.WarScore = 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 Clan, " + PoleKeeper.Name + ", owned by " + PoleKeeper.LeaderName + " has won this Clan war round!", System.Drawing.Color.Red, Message.Center), Program.Values);
Pole.Name = PoleKeeper.Name;
}
Pole.Hitpoints = Pole.MaxHitpoints;
Kernel.SendWorldMessage(Pole, Program.Values, (ushort)1509);
Reset();
}
public static void End()
{
if (PoleKeeper != null)
{
Kernel.SendWorldMessage(new Message("The clan, " + PoleKeeper.Name + ", owned by " + PoleKeeper.LeaderName + " has won " + ServerRates.Clan + " cps!---Clan war has ended!", System.Drawing.Color.White, Message.Center), Program.Values);
PoleKeeper.PoleKeeper = true;
}
else
{
Kernel.SendWorldMessage(new Message("Clan war has ended and there was no winner!", System.Drawing.Color.Red, Message.Center), Program.Values);
}
Claim = true;
IsWar = false;
UpdatePole(Pole);
}
public static void AddScore(uint addScore, Clan clan)
{
if (clan != null)
{
clan.WarScore += addScore;
changed = true;
if (!Scores.ContainsKey(clan.ID))
Scores.Add(clan.ID, clan);
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)1509);
}
}
private static void SortScores(out Clan winner)
{
winner = null;
List<string> ret = new List<string>();
int Place = 0;
foreach (Clan clan in Scores.Values.OrderByDescending((p) => p.WarScore))
{
if (Place == 0)
winner = clan;
string str = "No " + (Place + 1).ToString() + ": " + clan.Name + "(" + clan.WarScore + ")";
ret.Add(str);
Place++;
if (Place == 4)
break;
}
changed = false;
scoreMessages = ret.ToArray();
}
private static void UpdatePole(SobNpcSpawn pole)
{
new Database.MySqlCommand(EmpratorServer.Database.MySqlCommandType.UPDATE)
.Update("sobnpcs").Set("name", pole.Name).Set("life", Pole.Hitpoints).Where("id", pole.UID).Execute();
}
}
}
if (attacker.MapID == 2075)
if (attacker.MapID == 1509)
{
if (attacked.UID == 812)
{
Clan clan = attacker.GetClan;
if (Game.ClanWar.PoleKeeper == clan)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.ClanWar.AddScore(damage, clan);
}
}
if (attacker.MapID == 2075)
if (attacker.MapID == 1509)
{
if (attacker.ClanId == 0 || !Game.ClanWar.IsWar)
{
if (attacked.UID == 812)
{
return false;
}
}
if (Game.ClanWar.PoleKeeper != null)
{
if (Game.ClanWar.PoleKeeper == attacker.GetClan)
{
if (attacked.UID == 812)
{
return false;
}
}
}
}
#region CLANWAR
case 48116:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Hello there. Do you want to Join The ClanWar?.");
dialog.Option("Yes Please.", 1);
dialog.Option("Claim Prize.", 2);
dialog.Option("Just Passing By!", 255);
dialog.Send();
break;
}
case 1:
{
if (ClanWar.IsWar)
{
client.Entity.Teleport(1509, 82, 118);
client.Entity.PKMode = Game.Enums.PKMode.PK;
client.Send(new Data(true) { UID = client.Entity.UID, ID = Data.ChangePKMode, dwParam = (uint)client.Entity.PKMode });
}
else
{
dialog.Text("The War Has Not Started Start At [8.00] And [20.00]");
dialog.Option("Aww ok!", 255);
dialog.Send();
}
break;
}
case 2:
{
if (ClanWar.KeeperID != 0 && !ClanWar.IsWar && ClanWar.Claim && client.Entity.ClanId == ClanWar.KeeperID && client.Entity.ClanRank == Clan.Ranks.ClanLeader)
{
Program.AddWarLog("ClanWar", " . ", client.Entity.Name);
ClanWar.Claim = false;
ClanWar.KeeperID = 0;
client.Entity.ConquerPoints += ServerRates.Clan;
client.Entity.killerpoints += 100;
client.Entity.AddTopStatus(Update.Flags2.Top8Archer, 2, DateTime.Now.AddDays(1));
EmpratorServer.Kernel.SendWorldMessage(new Message("Congratulations! " + client.Entity.Name + " Leader of " + client.Entity.ClanName + " The winner Clan has Claimed Clan War Prize " + ServerRates.Clan + " cps + 100 Vip point's !", System.Drawing.Color.White, Message.TopLeft), Program.Values);
}
else
{
dialog.Text("Sorry you dont have Any Prize to claim only CL of the winner CLAN can claim Prize After CW");
dialog.Option("Ahh.", 255);
dialog.Send();
}
break;
}
}
break;
}
case 4482115:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Hello there. Do you want to Teleport To Twincity.");
dialog.Option(" Send Me There. ", 1);
dialog.Option("Just Passing By!", 255);
dialog.Send();
break;
}
case 1:
{
client.Entity.Teleport(1002, 300, 266);
break;
}
}
break;
}
#endregion
public static readonly System.Collections.Generic.List<ushort> PKFreeMaps = new System.Collections.Generic.List<ushort>()
1509,
public class Start
public static bool ClanWar
{
get
{
return now.Hour == 14 || now.Hour == 2;
}
}
public Clan GetClan
{
get
{
Clan cl;
Kernel.Clans.TryGetValue(ClanId, out cl);
return cl;
}
}
string clan = "";
#region Clan War
if ((Now64.Hour == 20 || Now64.Hour == 8) && Now64.Minute == 00 && Now64.Second == 5 && !ClanWar.IsWar)
{
Game.ClanWar.Start();
ClanWarAI = false;
if (Now64.Hour != 8)
{
ClanWarAI = Now64.Hour != 8;
foreach (var client in Program.Values)
if (client.Entity.GuildID != 0)
client.MessageBox("ClanWar Has Begun! Would You Like To Join This War ...?",
p => { p.Entity.Teleport(1002, 284, 146); }, null);
}
}
if (Now64.Hour == 8 && Now64.Minute == 10 && !ClanWarAI)
{
ClanWarAI = true;
foreach (var client in Program.Values)
if (client.Entity.GuildID != 0)
client.MessageBox("ClanWar Has Begun! Would You Like To Join This War ...?",
p => { p.Entity.Teleport(1002, 284, 146); }, null);
}
if ((Now64.Hour == 21 || Now64.Hour == 9) && Now64.Minute == 00 && ClanWar.IsWar)
{
Game.ClanWar.End();
}
if (Game.ClanWar.IsWar)
{
if (Time32.Now > Game.ClanWar.ScoreSendStamp.AddSeconds(3))
{
Game.ClanWar.ScoreSendStamp = Time32.Now;
Game.ClanWar.SendScores();
}
}
#endregion
https://up.top4top.net/downloadf-1438rax941-rar.html
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
طبعا بمناسبه عوده منتدي اكواد وحازم العسليه | SourceDanger | تطوير سيرفرات كونكر | 59 | 2024-11-12 11:32 PM |
والي عنده ارينا زيينا نقوله يا عمنا | midoazoz | تطوير سيرفرات كونكر | 43 | 2024-04-19 11:56 AM |
اي حد عنده مشاكل ف رنك كوستة الصناديق يخش هنا | Omar Mohamed100 | تطوير سيرفرات كونكر | 11 | 2023-07-26 01:30 AM |
عندي مشكلتين لو حد عنده حل ياريت يفدني | Mr NemNem | مشكلات السيرفيرات كونكر الشخصيه | 0 | 2021-09-06 03:13 PM |
والي عنده ارينا زيينا نقوله يا عمنا | midoazoz | قسم الاقتراحات والابداع | 3 | 2020-02-23 03:17 AM |