|
|
المشاركات 199 |
+التقييم 0.11 |
تاريخ التسجيل Oct 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 2186 |
#region Reward CTF
case 8713:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Just The Guild Leader will receive the CTF Reward?");
dialog.Option("CTF area.", 2);
dialog.Option("I See.", 255);
dialog.Avatar(83);
dialog.Send();
break;
}
case 2:
{
if (client.Player.Level >= 120)
if (CaptureTheFlag.IsWar)
{
Program.World.CTF.SignUp(client);
}
else
{
dialog.Text("The CTF is not on going at this time. The Ctf Will start EveryDay at 19:00 .");
dialog.Option("Oh.", 255);
dialog.Send();
}
else
{
dialog.Text("You Should Level 140 and SecondReborn .");
dialog.Option("Oh.", 255);
dialog.Send();
}
break;
}
case 3:
{
if (client.Guild != null)
{
if (client.AsMember != null)
{
if (client.AsMember.Rank == Enums.GuildMemberRank.GuildLeader)
{
uint Reaward = (uint)(client.Guild.CTFReward * 100);
if (Reaward != 0)
{
byte[] messaje = new Network.GamePackets.Message("The Guild Leader " + client.Player.Name + " of " + client.Guild.Name + " Receive the CTFReward 100 cps", System.Drawing.Color.Red, Network.GamePackets.Message.System).ToArray();
client.Player.ConquerPoints += 100;
client.Guild.CTFReward = 0;
Database.GuildTable.SaveCTFReward(client.Guild);
foreach (var clients in Kernel.GamePool.Values)
{
client.Send(messaje);
}
}
else
{
dialog.Text("You Guild Not Have CTF Points ");
dialog.Option("Oh Sorry.", 255);
dialog.Avatar(83);
dialog.Send();
}
}
else
{
dialog.Text("Just The Guild Leader will receive the CTF Reward ");
dialog.Option("Oh Sorry.", 255);
dialog.Avatar(83);
dialog.Send();
}
break;
}
}
break;
}
}
break;
}
#endregion
#region Capture the flag
if (Now64.DayOfWeek == DayOfWeek.Saturday || Now64.DayOfWeek == DayOfWeek.Sunday || Now64.DayOfWeek == DayOfWeek.Monday || Now64.DayOfWeek == DayOfWeek.Tuesday || Now64.DayOfWeek == DayOfWeek.Wednesday || Now64.DayOfWeek == DayOfWeek.Thursday)
{
if (Copra_Times.Start.CTF && !CaptureTheFlag.IsWar)
{
CaptureTheFlag.IsWar = true;
CaptureTheFlag.StartTime = DateTime.Now;
foreach (var guild in Kernel.Guilds.Values)
{
guild.CTFFlagScore = 0;
guild.CTFPoints = 0;
}
foreach (Client.GameState client in Kernel.GamePool.Values)
{
if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Player.Dead)
{
EventAlert alert = new EventAlert
{
StrResID = 10539,
Countdown = 60,
UK12 = 1
};
client.Player.StrResID = 10539;
client.Send(alert);
}
}
}
}
if (CaptureTheFlag.IsWar && CTF != null)
{
Program.World.CTF.SendUpdates();
if (Now64 > CaptureTheFlag.StartTime.AddHours(1))
{
CaptureTheFlag.IsWar = false;
CaptureTheFlag.Close();
}
}
if (CTF != null)
CTF.SpawnFlags();
#endregion
#region CTF
case 1063:
{
byte typ = packet[4];
switch (typ)
{
case 0:
{
if (client.Guild == null || client.AsMember == null)
break;
if (!CaptureTheFlag.IsWar)
{
CaptureTheFlag.CTFGuildsRank(client, packet);
}
else
{
CaptureTheFlag.CTFExpolitsRank(client, packet);
}
break;
}
case 1:
{
if (client.Guild == null || client.AsMember == null)
break;
CaptureTheFlag.CTFExpolitsRank2(client, packet);
break;
}
case 3:
{
uint setCTFCps = BitConverter.ToUInt32(packet, 18);
if (client.Guild == null || client.AsMember == null)
break;
if (client.Guild.ConquerPointFund > setCTFCps)
{
client.Guild.ConquerPointFund -= setCTFCps;
client.Guild.CTFdonationCPsold += setCTFCps;
Database.GuildTable.SaveFunds(client.Guild);
}
goto case 0;
}
case 4:
{
uint setCTFMoney = BitConverter.ToUInt32(packet, 22);
if (client.Guild == null || client.AsMember == null)
break;
if (client.Guild.SilverFund > setCTFMoney)
{
client.Guild.SilverFund -= setCTFMoney;
client.Guild.CTFdonationSilverold += setCTFMoney;
Database.GuildTable.SaveFunds(client.Guild);
}
goto case 0;
}
case 5:
{
uint setCTFCps = BitConverter.ToUInt32(packet, 18);
if (client.Guild == null || client.AsMember == null)
break;
if (client.Guild.ConquerPointFund > setCTFCps)
{
client.Guild.ConquerPointFund -= setCTFCps;
client.Guild.CTFdonationCPsold += setCTFCps;
Database.GuildTable.SaveFunds(client.Guild);
}
uint setCTFMoney = BitConverter.ToUInt32(packet, 22);
if (client.Guild.SilverFund > setCTFMoney)
{
client.Guild.SilverFund -= setCTFMoney;
client.Guild.CTFdonationSilverold += setCTFMoney;
Database.GuildTable.SaveFunds(client.Guild);
}
goto case 0;
}
case 8:
{
if (client.Guild == null || client.AsMember == null)
break;
CaptureTheFlag.CTFGuildsRank2(client, packet);
break;
}
case 9:
{
if (client.Guild == null || client.AsMember == null)
break;
if (CaptureTheFlag.IsWar)
{
new CaptureTheFlag.CTF_Rank(client).Send(client);
}
else
{
CaptureTheFlag.CTFsRank(client, packet);
}
break;
}
}
break;
}
case 2224:
{
if (packet[4] == 7)//2
client.Send(Program.World.CTF.generateCTFRanking());
if (CaptureTheFlag.IsWar)
{
byte[] p773 = new byte[] { 60, 0, 176, 8, 11, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 81, 83, 101, 114, 118, 101, 114 };
client.Send(p773);
}
else
client.Send(packet);
break;
}
#endregion
if (client.Player.InteractionInProgress && client.Player.InteractionSet)
if (client.Player.MapID == CaptureTheFlag.MapID)
CheckForFlag(client);
client.SendScreen(generalData, true);
client.Screen.Reload(generalData);
if (client.Player.InteractionInProgress)
if (client.Player.MapID == CaptureTheFlag.MapID)
CheckForFlag(client);
client.SendScreen(groundMovement, true);
client.Screen.Reload(groundMovement);
static void GetSurroundings(Client.GameState client)
if (client.Player.PreviousMapID == CaptureTheFlag.MapID)
Program.World.CTF.CloseList(client);
attacker.Owner.IncreaseSpellExperience(damage, spell.ID);
if (attacked.UID == 123456)
{
}
if (attacker.MapID == CaptureTheFlag.MapID)
if (attacker.GuildID != 0 && Program.World.CTF.Bases[attacked.UID].CapturerID != attacker.GuildID)
{
Program.World.CTF.AddScore(damage, attacker.Owner.Guild, attacked);
}
if (Database.GuildCondutors.GuildConductors.ContainsKey(attacked.UID))
if (attacker.MapID == CaptureTheFlag.MapID)
{
if (Program.World.CTF.Bases.ContainsKey(attacked.UID))
{
var _base = Program.World.CTF.Bases[attacked.UID];
if (_base.CapturerID == attacker.GuildID)
return false;
}
return true;
}
if (attacked.UID == 123456)
if (attacked.Hitpoints > 0)
return true;
else return false;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BlackBlock.Network.GamePackets;
using BlackBlock.Client;
using System.Collections.Concurrent;
using BlackBlock.Game.ConquerStructures.Society;
using BlackBlock.Network;
using BlackBlock.Database;
namespace BlackBlock.Game
{
public class CaptureTheFlag
{
public class CTF_Rank : Writer
{
private byte[] Packet;
public CTF_Rank(GameState client)
{
this.Packet = new byte[354];
Writer.WriteUInt16(346, 0, this.Packet);
Writer.WriteUInt16(1063, 2, this.Packet);
this.Packet[4] = 9;
this.Packet[6] = 1;
this.Packet[14] = 8;
Writer.WriteUInt32(client.Guild.CTFPoints, 18, this.Packet);
}
public void Send(GameState client)
{
client.Send(this.ToArray());
}
public byte[] ToArray()
{
ushort num = 30;
Guild[] array = (
from p in Kernel.Guilds.Values
where p.CTFPoints != 0u
orderby p.CTFPoints descending
select p).ToArray<Guild>();
if (array != null)
{
byte b = 0;
while ((int)b < array.Length && b != 9)
{
Writer.WriteString(array[(int)b].Name, (int)num, this.Packet);
num += 16;
Writer.WriteUInt32(array[(int)b].CTFPoints, (int)num, this.Packet);
num += 4;
Writer.WriteUInt32(array[(int)b].MemberCount, (int)num, this.Packet);
num += 4;
Writer.WriteUInt64((ulong)array[(int)b].CTFdonationSilverold, (int)num, this.Packet);
num += 8;
Writer.WriteUInt32(array[(int)b].CTFdonationCPsold, (int)num, this.Packet);
num += 4;
b += 1;
}
}
return this.Packet;
}
}
public class Base
{
public SobNpcSpawn Flag;
public ConcurrentDictionary<uint, uint> Scores;
public uint CapturerID;
public Base(SobNpcSpawn flag)
{
Flag = flag;
Scores = new ConcurrentDictionary<uint, uint>();
CapturerID = 0;
}
public void Capture()
{
if (Scores.Count == 0) Scores.Add((uint)0, (uint)0);
uint guildId = Scores.OrderByDescending(p => p.Value).FirstOrDefault().Key;
CapturerID = guildId;
var guild = Kernel.Guilds[guildId];
Flag.Name = guild.Name;
Flag.Hitpoints = Flag.MaxHitpoints;
Kernel.SendScreen(Flag, Flag);
foreach (var Entity in Program.Values)
{
if (Entity.Player.MapID == MapID)
{
Entity.Send(generatePacket2(5, (Flag.UID - 20570)));
}
}
Scores.Clear();
}
}
public const ushort MapID = 2057;
private Map Map;
public Dictionary<uint, Base> Bases;
public static bool IsWar;
public static DateTime StartTime;
public CaptureTheFlag()
{
Database.DMaps.LoadMap(2057);
Bases = new Dictionary<uint, Base>();
if (!Kernel.Maps.ContainsKey((int)2057L))
{
new Map(MapID, DMaps.MapPaths[MapID]);
}
Map = Kernel.Maps[MapID];
foreach (var npc in Map.Npcs.Values)
if (npc is SobNpcSpawn)
Bases.Add(npc.UID, new Base((SobNpcSpawn)npc));
SpawnFlags();
}
public void SpawnFlags()
{
int toAdd = 60 - Map.StaticEntities.Count;
for (int i = toAdd; i > 0; i--)
{
var coords = Map.RandomCoordinates();
StaticEntity entity = new StaticEntity((uint)(coords.Item1 * 1000 + coords.Item2), coords.Item1, coords.Item2, MapID);
entity.DoFlag();
Map.AddStaticEntity(entity);
}
}
public bool SignUp(GameState client)
{
if (client.Player.GuildID == 0) return false;
if (client.Guild == null) return false;
var coords = Map.RandomCoordinates(482, 367, 27);
client.Player.Teleport(MapID, coords.Item1, coords.Item2);
return true;
}
public void AroundBase(GameState client)
{
if (client.Player.MapID != MapID) return;
if (client.Player.GuildID == 0) return;
if (client.Guild == null) return;
foreach (var _base in Bases.Values)
{
if (Kernel.GetDistance(client.Player.X, client.Player.Y, _base.Flag.X, _base.Flag.Y) == 9)
{
if (_base.CapturerID == client.Player.GuildID)
{
if (client.Player.ContainsFlag2(Update.Flags2.CarryingFlag))
{
client.Send(generateTimer(0));
client.Send(generateEffect(client));
client.Player.RemoveFlag2(Update.Flags2.CarryingFlag);
// client.Entity.nRemoveFlag(91);
client.Guild.CTFPoints += 15;
Program.World.CTF.SendUpdates();
client.Send(generatePacket(7, client.Player.UID));
client.AsMember.Exploits += (ushort)(client.Player.Level / 2);
}
}
}
else
{
foreach (var item in client.Map.StaticEntities.Values)
{
if (Kernel.GetDistance(item.X, item.Y, client.Player.X, client.Player.Y) == 0)
{
if (client.Player.ContainsFlag2(Update.Flags2.CarryingFlag))
{
client.Player.FlagStamp = Time32.Now;
client.Send(Program.World.CTF.generateTimer(60));
client.Send(Program.World.CTF.generateEffect(client));
client.Guild.CTFPoints += 3;
client.Map.RemoveStaticItem(item);
client.RemoveScreenSpawn(item, true);
}
}
}
}
}
}
public static bool Attackable(Game.Entity entity)
{
return Kernel.GetDistance(entity.X, entity.Y, 482, 367) > 32;
}
public void AddScore(uint damage, Guild guild, SobNpcSpawn attacked)
{
if (Bases.ContainsKey(attacked.UID))
{
{
var _base = Program.World.CTF.Bases[attacked.UID];
if (!_base.Scores.ContainsKey(guild.ID))
_base.Scores.Add(guild.ID, damage);
else
_base.Scores[guild.ID] += damage;
}
}
}
public void FlagOwned(SobNpcSpawn attacked)
{
if (Bases.ContainsKey(attacked.UID))
{
foreach (var Entity in Program.Values)
{
if (Entity.Player.MapID == MapID)
{
Entity.Send(generatePacket(5, (attacked.UID - 20570)));
}
}
}
}
public static void Close()
{
foreach (var Entity in Program.Values)
if (Entity.Player.MapID == MapID)
Entity.Player.Teleport(1002, 225, 243);
var array = Kernel.Guilds.Values.Where(p => p.CTFPoints != 0).OrderByDescending(p => p.CTFPoints).ToArray();
for (int i = 0; i < Math.Min(8, array.Length); i++)
{
array[i].CalculateCTFRANK(true);
Database.GuildTable.SaveCTFPoins(array[i]);
if (i == 0)
{
array[i].CTFReward += 10;
array[i].ConquerPointFund += 3000;
array[i].SilverFund += 120000000;
}
else if (i == 1)
{
array[i].CTFReward += 9;
array[i].ConquerPointFund += 2000;
array[i].SilverFund += 100000000;
}
else if (i == 2)
{
array[i].CTFReward += 8;
array[i].ConquerPointFund += 1000;
array[i].SilverFund += 80000000;
}
else if (i == 3)
{
array[i].CTFReward += 7;
array[i].ConquerPointFund += 600;
array[i].SilverFund += 65000000;
}
else if (i == 4)
{
array[i].CTFReward += 6;
array[i].ConquerPointFund += 500;
array[i].SilverFund += 50000000;
}
else if (i == 5)
{
array[i].CTFReward += 5;
array[i].ConquerPointFund += 400;
array[i].SilverFund += 40000000;
}
else if (i == 6)
{
array[i].CTFReward += 4;
array[i].ConquerPointFund += 300;
array[i].SilverFund += 30000000;
}
else if (i == 7)
{
array[i].CTFReward += 3;
array[i].ConquerPointFund += 200;
array[i].SilverFund += 20000000;
}
Database.GuildTable.SaveCTFReward(array[i]);
array[i].CTFdonationCPs = array[i].CTFdonationCPsold;
array[i].CTFdonationSilver = array[i].CTFdonationSilverold;
array[i].CTFdonationCPsold = 0;
array[i].CTFdonationSilverold = 0;
}
if (array.Length > 8)
{
for (int x = 8; x < array.Length; x++)
{
array[x].CTFPoints = 0;
foreach (var meme in array[x].Members.Values)
{
meme.Exploits = 0;
meme.ExploitsRank = 0;
}
}
}
}
public void SendUpdates(GameState client)
{
if (Time32.Now > client.CTFUpdateStamp.AddSeconds(5))
{
client.CTFUpdateStamp = Time32.Now;
var buffer = generateCTFRanking4();
client.Send(buffer);
foreach (var _base in Bases.Values)
{
if (Kernel.GetDistance(client.Player.X, client.Player.Y, _base.Flag.X, _base.Flag.Y) <= 9)
{
buffer = generateFlagRanking(_base);
client.Send(buffer);
}
}
}
}
public byte[] generateCTFRanking4()
{
var array = Kernel.Guilds.Values.Where(p => p.CTFPoints != 0).OrderByDescending(p => p.CTFPoints).ToArray();
return generateList4(2, array, p => p.CTFPoints);
}
public byte[] generateCTFRanking()
{
var array = Kernel.Guilds.Values.Where(p => p.CTFPoints != 0).OrderByDescending(p => p.CTFPoints).ToArray();
return generateList(2, array, p => p.CTFPoints);
}
private byte[] generateFlagRanking(Base flag)
{
var scores = flag.Scores.OrderByDescending(p => p.Value).ToArray();
var array = new Guild[Math.Min(5, scores.Length)];
for (int i = 0; i < array.Length; i++)
{
array[i] = Kernel.Guilds[scores[i].Key];
array[i].CTFFlagScore = scores[i].Value;
}
return generateList(1, array, p => p.CTFFlagScore);
}
private byte[] generateList(int type, Guild[] array = null, Func<Guild, UInt32> select = null)
{
byte[] data = null;
if (array == null)
data = new byte[48];
else
data = new byte[48 + (array.Length * 24)];
Writer.WriteInt32(data.Length - 8, 0, data);
Writer.WriteUInt16(2224, 2, data);
Writer.WriteInt32(type, 4, data);
if (array != null)
{
Writer.WriteInt32(array.Length, 28, data);
for (int i = 0; i < array.Length; i++)
{
int offset = 32 + (i * 24);
Writer.WriteInt32(i, offset, data); offset += 4;
Writer.WriteUInt32(select(array[i]), offset, data); offset += 4;
Writer.WriteString(array[i].Name, offset, data); offset += 16;
}
}
return data;
}
private byte[] generateList4(int type, Guild[] array = null, Func<Guild, UInt32> select = null)
{
byte[] data = null;
if (array == null)
data = new byte[48 + 4];
else
data = new byte[48 + 4 + (array.Length * 24)];
Writer.WriteInt32(data.Length - 8, 0, data);
Writer.WriteUInt16(2224, 2, data);
Writer.WriteInt32(type, 4 + 4, data);
if (array != null)
{
Writer.WriteInt32(array.Length, 28 + 4, data);
for (int i = 0; i < array.Length; i++)
{
int offset = 32 + 4 + (i * 24);
Writer.WriteInt32(i, offset, data); offset += 4;
Writer.WriteUInt32(select(array[i]), offset, data); offset += 4;
Writer.WriteString(array[i].Name, offset, data); offset += 16;
}
}
return data;
}
public byte[] generateTimer(uint time)
{
return generatePacket(8, time);
}
public byte[] generateEffect(GameState Client)
{
//return generatePacket3(6, 6327607);
return generatePacket(6, Client.Player.UID);
}
private byte[] generatePacket(int type, uint dwParam)
{
byte[] data = new byte[48];
Writer.WriteInt32(data.Length - 8, 0, data);
Writer.WriteUInt16(2224, 2, data);
Writer.WriteInt32(type, 4, data);
Writer.WriteUInt32(dwParam, 8, data);
return data;
}
public static byte[] generatePacket2(int type, uint dwParam)
{
byte[] data = new byte[48];
Writer.WriteInt32(data.Length - 8, 0, data);
Writer.WriteUInt16(2224, 2, data);
Writer.WriteInt32(type, 4, data);
Writer.WriteUInt32(dwParam, 8, data);
return data;
}
public void SendUpdates()
{
foreach (var Entity in Program.Values)
if (Entity.Player.MapID == MapID)
SendUpdates(Entity);
}
public void CloseList(GameState client)
{
client.Send(generateList(3));
}
public static void CTFGuildsRank(GameState client, byte[] packet)
{
var array = Kernel.Guilds.Values.Where(p => p.CTFPoints != 0).OrderByDescending(p => p.CTFPoints).ToArray();
const byte maxcount = 5;
byte page = packet[10];
if (array.Length == 0)
return;
byte[] buffer = new byte[908];
Writer.WriteUInt16(900, 0, buffer);
Writer.WriteUInt16(1063, 2, buffer);
Writer.WriteUInt16(0, 4, buffer);
Writer.WriteUInt32(1, 6, buffer);
Writer.WriteUInt32((uint)(array.Length), 10, buffer);
Writer.WriteUInt32((uint)(array.Length), 14, buffer);
Writer.WriteUInt32(client.Guild.CTFdonationCPsold, 18, buffer);
Writer.WriteUInt64((ulong)client.Guild.CTFdonationSilverold, 22, buffer);
int offset = 30;
for (ushort x = (ushort)(page * maxcount - maxcount); x < page * maxcount; x++)
{
if (x >= array.Length) break;
var guild = array[x];
Writer.WriteUInt32(guild.CTFdonationCPs, offset, buffer);
offset += 4;
Writer.WriteUInt64((ulong)guild.CTFdonationSilver, offset, buffer);
offset += 8;
Writer.WriteString(guild.Name, offset, buffer);
offset += 0x24;
Writer.WriteUInt32(guild.ID, offset, buffer);
offset += 4;
}
client.Send(buffer);
}
public static void CTFGuildsRank2(GameState client, byte[] packet)
{
const byte maxcount = 5;
byte page = packet[10];
var guild_array = Kernel.Guilds.Values.Where(p => p.CTFPoints != 0).OrderByDescending(p => p.CTFPoints).ToArray();
if (guild_array.Length == 0)
return;
byte[] buffer2 = new byte[0x38c];
Writer.WriteUInt16(900, 0, buffer2);
Writer.WriteUInt16(0x427, 2, buffer2);
Writer.WriteUInt16(0, 4, buffer2);
Writer.WriteUInt16(page, 6, buffer2);
Writer.WriteUInt32(10, 10, buffer2);
Writer.WriteUInt32((uint)guild_array.Length, 14, buffer2);
client.Guild = client.AsMember.Guild;
Writer.WriteUInt32(client.Guild.CTFdonationCPsold, 0x12, buffer2);
Writer.WriteUInt64((ulong)client.Guild.CTFdonationSilverold, 0x16, buffer2);
ushort offset = 30;
for (ushort x = (ushort)(page * maxcount - maxcount); x < page * maxcount; x++)
{
if (x >= guild_array.Length) break;
var guild = guild_array[x];
Writer.WriteUInt32(guild.CTFdonationCPsold, offset, buffer2);
offset += 4;
Writer.WriteUInt64((ulong)guild.CTFdonationSilverold, offset, buffer2);
offset += 8;
Writer.WriteString(guild.Name, offset, buffer2);
offset += 0x24;
Writer.WriteUInt32(guild.ID, offset, buffer2);
offset += 4;
}
client.Send(buffer2);
}
public static void CTFsRank(GameState client, byte[] packet)
{
var array = Kernel.Guilds.Values.Where(p => p.CTFPoints != 0).OrderByDescending(p => p.CTFPoints).ToArray();
byte[] Packet = new byte[356];
Writer.WriteUInt16(348, 0, Packet);
Writer.WriteUInt16(1063, 2, Packet);
Packet[4] = 9;//type
Packet[6] = 1; // count
Packet[14] = 8; // count
ushort index = 26;
Writer.WriteUInt32(client.Player.UID, 18, Packet);
for (byte i = 0; i < array.Length; i++)
{
if (i >= 8)
break;
if (i >= array.Length)
break;
var guild = array[i];
Packet[index] = (byte)(i + 1);
index = (ushort)(index + 4);
Writer.WriteString(guild.Name, index, Packet);
index = (ushort)(index + 16);
Writer.WriteUInt32(guild.CTFPoints, index, Packet);
index = (ushort)(index + 4);
Writer.WriteUInt32(guild.MemberCount, index, Packet);
index = (ushort)(index + 12);
}
client.Send(Packet);
}
public static void CTFExpolitsRank(GameState client, byte[] packet)
{
byte page = packet[10];
var array = client.Guild.Members.Values.Where(p => p.Exploits != 0).OrderByDescending(p => p.Exploits).ToArray();
if (array.Length == 0)
return;
byte[] buffer = new byte[0x38c];
Writer.WriteUInt16(900, 0, buffer);
Writer.WriteUInt16(0x427, 2, buffer);
Writer.WriteUInt16(8, 4, buffer);
Writer.WriteUInt32(page, 6, buffer);
Writer.WriteUInt32((uint)array.Length, 10, buffer);
Writer.WriteUInt32(8, 14, buffer);
Writer.WriteUInt32(client.AsMember.Exploits, 0x12, buffer);
int offset = 30;
for (ushort x = 0; x < array.Length; x++)//(ushort)(page * maxcount - maxcount); x < page * maxcount; x++)
{
if (x > 20)
break;
if (x >= array.Length) break;
var member = array[x];
Writer.WriteString(member.Name, offset, buffer);
offset += 0x10;
Writer.WriteUInt32(member.Exploits, offset, buffer);
offset += 4;
}
client.Send(buffer);
}
public static void CTFExpolitsRank2(GameState client, byte[] packet)
{
const byte maxcount = 5;
byte page = packet[10];
var array = client.Guild.Members.Values.Where(p => p.Exploits != 0).OrderByDescending(p => p.Exploits).ToArray();
if (array.Length == 0)
return;
byte[] buffer = new byte[0x38c];
Writer.WriteUInt16(900, 0, buffer);
Writer.WriteUInt16(0x427, 2, buffer);
Writer.WriteUInt16(1, 4, buffer);
Writer.WriteUInt32(page, 6, buffer);
Writer.WriteUInt32((uint)array.Length, 10, buffer);
Writer.WriteUInt32(5, 14, buffer);
Writer.WriteUInt32(client.Guild.CTFdonationCPsold, 0x12, buffer);
Writer.WriteUInt64((ulong)client.Guild.CTFdonationSilverold, 0x16, buffer);
Writer.WriteUInt32((ushort)array.Length, 30, buffer);
int offset = 30;
for (ushort x = (ushort)(page * maxcount - maxcount); x < page * maxcount; x++)
{
if (x >= array.Length) break;
var member = array[x];
Writer.WriteUInt32((ushort)(x + 1), offset, buffer);
offset += 4;
Writer.WriteUInt32(member.Exploits, offset, buffer);
offset += 4;
Writer.WriteUInt32(member.CTFCpsReward, offset, buffer);
offset += 4;
Writer.WriteUInt64(member.CTFSilverReward, offset, buffer);
offset += 8;
Writer.WriteUInt32(member.ID, offset, buffer);
offset += 4;
Writer.WriteString(member.Name, offset, buffer);
offset += 0x24;
}
client.Send(buffer);
}
}
}
Program.World.PoleDomination.KillPole();
if (MapID == CaptureTheFlag.MapID)
{
if (Program.World.CTF.Bases.ContainsKey(UID))
{
var _base = Program.World.CTF.Bases[UID];
_base.Capture();
}
}
#region CaptureTheFlag
if (killer.GuildID != 0 && killer.MapID == CaptureTheFlag.MapID && CaptureTheFlag.IsWar)
{
if (GuildID != 0)
{
if (killer.Owner.Guild.Enemy.ContainsKey(GuildID))
killer.Owner.Guild.CTFPoints += 1;
else if (killer.Owner.Guild.Ally.ContainsKey(GuildID))
killer.Owner.Guild.CTFPoints += 1;
}
if (ContainsFlag2(Network.GamePackets.Update.Flags2.CarryingFlag))
{
StaticEntity entity = new StaticEntity((uint)(X * 1000 + Y), X, Y, MapID);
entity.DoFlag();
Owner.Map.AddStaticEntity(entity);
RemoveFlag2(Network.GamePackets.Update.Flags2.CarryingFlag);
Owner.Send(Program.World.CTF.generateTimer(0));
Owner.Send(Program.World.CTF.generateEffect(Owner));
if (killer.GuildID != GuildID)
{
Killer.AddFlag2(Network.GamePackets.Update.Flags2.CarryingFlag);
Time32 end = FlagStamp.AddSeconds(60) - Time32.Now;
killer.FlagStamp = end;
killer.Owner.Send(Program.World.CTF.generateTimer((uint)end.Value));
killer.Owner.Send(Program.World.CTF.generateEffect(killer.Owner));
killer.Owner.Guild.CTFPoints += 3;
}
}
}
#endregion
8713 CS-CTF-Manager 2 26390 1002 230 228
|
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
صفحات تسجيل كونكر تهيس | Mr. Co | صفحات التسجيل كونكر اونلاين | 183 | يوم أمس 01:27 AM |
طلب شراء سورس كونكر تهيس | Abod ayman | الطلبات المدفوعه | 12 | 2024-04-10 02:38 PM |
سيرقر جديد ادخل وشوف بنفسك ومش هتندم | mohamedabdo | اعلانات السيرفيرات الشخصية | 1 | 2022-03-16 02:20 PM |
مشكلة في عمل كونكر تهيس | Abod ayman | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2020-03-23 04:27 PM |