|
|
المشاركات 237 |
+التقييم 0.12 |
تاريخ التسجيل Apr 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 111 |
using Conquer_Online_Server.Network.GamePackets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Conquer_Online_Server.Events
{
public class KingsWar
{
public static System.DateTime StartTime;
public static Time32 ScoreSendStamp;
public static int StartHour = 18, StartMinute = 00, EndMinute = 30;
public static bool IsWar = false;
public static bool FirstRound = false;
public static bool Claim
{
get { return Program.Vars["KingsWarClaim"]; }
set { Program.Vars["KingsWarClaim"] = value; }
}
public static uint KeeperID
{
get { return Program.Vars["KingsWarID"]; }
set { Program.Vars["KingsWarID"] = value; }
}
public static SobNpcSpawn Pole;
public static Client.GameState PoleKeeper, CurrentTop;
private static bool changed = false;
private static string[] scoreMessages;
public static SafeDictionary<uint, Client.GameState> Scores = new SafeDictionary<uint, Client.GameState>();
public static void Initiate()
{
var Map = Kernel.Maps[1500];
Pole = (SobNpcSpawn)Map.Npcs[1500];
}
public static void Start()
{
StartTime = System.DateTime.Now;
Scores = new SafeDictionary<uint, Client.GameState>(100);
Pole.Hitpoints = Pole.MaxHitpoints;
Kernel.SendWorldMessage(new Message("KingsWar war has began!", System.Drawing.Color.Red, Message.Center), Program.Values);
FirstRound = true;
foreach (var Client in Kernel.GamePool.Values)
{
Client.KingsWarScore = 0;
}
Claim = false;
IsWar = true;
foreach (var client in Program.Values)
client.MessageBox("KingsWar has started. JOIN NOW ?",
(p) => { p.Player.Teleport(1002, 301, 160); }, null, 60);
}
public static void End()
{
if (PoleKeeper != null)
{
Kernel.SendWorldMessage(new Message(PoleKeeper.Player.Name + " has won KingsWar!---KingsWar has ended! Go clime Your Prize", System.Drawing.Color.White, Message.Center), Program.Values);
}
else
{
Kernel.SendWorldMessage(new Message("KingsWar has ended and there was no winner!", System.Drawing.Color.Red, Message.Center), Program.Values);
}
IsWar = false;
Claim = true;
}
public static void Reset()
{
Scores = new SafeDictionary<uint, Client.GameState>(100);
Pole.MaxHitpoints = Pole.MaxHitpoints;
Pole.Hitpoints = Pole.MaxHitpoints;
foreach (var Client in Kernel.GamePool.Values)
{
Client.KingsWarScore = 0;
}
IsWar = true;
}
public static void FinishRound()
{
FirstRound = false;
SortScores(out PoleKeeper);
if (PoleKeeper != null)
{
KeeperID = PoleKeeper.Player.UID;
Kernel.SendWorldMessage(new Message(PoleKeeper.Player.Name + ", has won this KingWar Round!", System.Drawing.Color.Red, Message.Center), Program.Values);
Pole.Name = PoleKeeper.Player.Name;
}
Pole.MaxHitpoints = Pole.MaxHitpoints;
Pole.Hitpoints = Pole.MaxHitpoints;
Kernel.SendWorldMessage(Pole, Program.Values, (ushort)1500);
Reset();
}
public static void AddScore(uint addScore, Client.GameState client)
{
if (client != null)
{
client.KingsWarScore += addScore;
changed = true;
if (!Scores.ContainsKey(client.Player.UID))
Scores.Add(client.Player.UID, client);
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 CurrentTop);
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)1500);
}
}
private static void SortScores(out Client.GameState winner)
{
winner = null;
List<string> ret = new List<string>();
int Place = 0;
foreach (var client in Scores.Values.OrderByDescending((p) => p.KingsWarScore))
{
if (Place == 0)
winner = client;
string str = "No " + (Place + 1).ToString() + ": " + client.Player.Name + "(" + client.KingsWarScore + ")";
ret.Add(str);
Place++;
if (Place == 4)
break;
}
changed = false;
scoreMessages = ret.ToArray();
}
}
}
Conquer_Online_Server
public static void ReceiveAttack(Game.Entity attacker, SobNpcSpawn
#region KingsWar
if (Events.KingsWar.IsWar)
{
if (attacker.MapID == 1500)
{
if (attacked.UID == 1500)
{
if (Events.KingsWar.PoleKeeper != null)
{
if (Events.KingsWar.PoleKeeper.Player.UID == attacker.UID)
{
return;
}
}
if (attacked.Hitpoints <= damage)
{
attacked.Hitpoints = 0;
}
Events.KingsWar.AddScore(damage, attacker.Owner);
}
}
}
#endregion
#region InNpc
case 15000:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Kings war starts at xx:20. Inside your nobility rank will be promoted to be king and all the players will be equivalent. You'll have the chace of beating up your rivals.");
dialog.Option("Lemme in.", 1);
if (Events.KingsWar.KeeperID != 0)
{
if (Events.KingsWar.KeeperID == client.Player.UID)
{
dialog.Option("Lemme claim.", 2);
}
}
dialog.Option("Later.", 255);
dialog.Send();
break;
}
case 1:
{
if (Events.KingsWar.IsWar)
{
client.Player.Teleport(1500, 141, 134);
}
else
{
dialog.Text("The War hasn't started yet it starts at (00:20)");
dialog.Send();
}
break;
}
case 2:
{
if (Events.KingsWar.Claim == true)
{
Events.KingsWar.Claim = false;
client.Player.ConquerPoints += 5000000;
client.Player.Money += 5000000;
uint random = (ushort)Conquer_Online_Server.Kernel.Random.Next(1, 300);
client.ChampionPoints += random;
//client.Inventory.Add(723720, 0, 1);
client.Player.AddTopStatus((ulong)Conquer_Online_Server.Network.GamePackets.Update.Flags3.jaspr, 3, DateTime.Now.AddHours(1));
Kernel.SendWorldMessage(new Message(client.Player.Name + " has won [" + random + "]Champion points . From KingsWar ! and Got 5m [Cps-Gold]", System.Drawing.Color.White, Message.Center), Program.Values);
//client.Inventory.Add(3009003, 0, 1);
//client.Inventory.Add(3009003, 0, 1);
//client.Inventory.Add(3009003, 0, 1);
}
else
{
dialog.Text("You already claimed your prize");
dialog.Send();
}
break;
}
}
break;
}
#endregion
private void BuffersCallback(GameState client, int time)
#region KingsWar
if (client.Player.MapID == 1500)
{
if (client.Player.NobilityRank != NobilityRank.King)
{
client.TempNobilityInformation = new NobilityInformation();
client.TempNobilityInformation.Rank = client.NobilityInformation.Rank;
client.NobilityInformation.Rank = NobilityRank.King;
NobilityInfo update = new NobilityInfo(true);
update.Type = NobilityInfo.Icon;
update.dwParam = client.Player.UID;
update.UpdateString(client.NobilityInformation);
client.SendScreen(update, true);
client.Player.NobilityRank = client.NobilityInformation.Rank;
}
}
else
{
if (client.TempNobilityInformation != null)
{
client.NobilityInformation.Rank = client.TempNobilityInformation.Rank;
NobilityInfo update = new NobilityInfo(true);
update.Type = NobilityInfo.Icon;
update.dwParam = client.Player.UID;
update.UpdateString(client.NobilityInformation);
client.SendScreen(update, true);
client.Player.NobilityRank = client.NobilityInformation.Rank;
client.TempNobilityInformation = null;
}
}
if (client.Player.MapID == 1500)
{
if (Events.KingsWar.IsWar == false)
{
client.Player.Teleport(1002, 299, 285);
}
}
#endregion
private void WorldTournaments(int time)
#region KingsWar[xx:20 - xx:40]
if (Events.KingsWar.IsWar)
{
if (Time32.Now > Events.KingsWar.ScoreSendStamp.AddSeconds(57))
{
Events.KingsWar.ScoreSendStamp = Time32.Now;
Events.KingsWar.SendScores();
}
}
if (Now64.Minute == 25 && !Events.KingsWar.IsWar)
{
Events.KingsWar.Start();
}
if (Events.KingsWar.IsWar)
{
if (Now64.Minute == 40 && Events.KingsWar.IsWar)
Events.KingsWar.End();
}
#endregion
if (DMaps.LoadMap(1038))
Game.Guildwar
if (DMaps.LoadMap(1500))
Events.KingsWar.Initiate();
public uint KingsWarScore;
public Game.ConquerStructures.NobilityInformation TempNobilityInformation;
84
99
5000000
|
الذين يشاهدون محتوى الموضوع الآن : 5 ( الأعضاء 0 والزوار 5) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
Soruce Mr.khled V4 كام وعت وفيت | SourceDanger | سورسات كونكر | 161 | 2024-10-25 09:32 PM |
Source Mr.khled V3 بعد حل جميع المشاكل | SourceDanger | سورسات كونكر | 124 | 2024-10-12 09:24 AM |
سورس Source Mr.khled V3 بعدل حل مشاكل كتير | osama | سورسات كونكر | 117 | 2024-10-10 12:49 PM |
مشكلة فى سورس Source Mr.khled V3 | osama | مشكلات السيرفيرات كونكر الشخصيه | 1 | 2019-06-25 10:57 PM |