|
|
المشاركات 1,941 |
+التقييم 0.96 |
تاريخ التسجيل Apr 2019 |
الاقامة Egypt |
نظام التشغيل windows 7 |
رقم العضوية 1 |
using System;
using MoDY.Network.GamePackets;
using System.Collections.Concurrent;
namespace MoDY.Game
{
public unsafe class Statue : Network.Writer
{
public static ConcurrentDictionary<uint, Statue> Statues = new ConcurrentDictionary<uint, Statue>();
public byte[] SpawnPacket = null;
public uint UID;
public Statue(byte[] array)
{
UID = 105175;
SpawnPacket = new byte[array.Length];
for (ushort x = 0; x < array.Length; x++)
SpawnPacket[x] = array[x];
WriteByte(0, MsgPlayer.Facing, SpawnPacket);
WriteUInt32(0, MsgPlayer.Action, SpawnPacket);
WriteUInt16(1000, MsgPlayer.GuildRank, SpawnPacket);
WriteUInt32(105175, MsgPlayer.UID, SpawnPacket);
WriteUInt64(0, MsgPlayer.StatusFlag, SpawnPacket);
WriteUInt64(0, MsgPlayer.StatusFlag2, SpawnPacket);
WriteUInt64(0, MsgPlayer.StatusFlag3, SpawnPacket);
WriteUInt32(0, MsgPlayer.Hitpoints, SpawnPacket);
WriteUInt32(0, MsgPlayer.GuildID, SpawnPacket);
X = 328;
Y = 304;
if (array.Length > 200)
{
if (!Statues.ContainsKey(105175))
Statues.TryAdd(105175, this);
else
{
Statues[105175] = this;
}
}
}
public static bool operator >(Statue statue, Client.GameState client)
{
if (!client.Screen.Statue.ContainsKey(statue.UID))
{
if (Kernel.GetDistance(statue.X, statue.Y, client.Player.X, client.Player.Y) < 16 && client.Player.MapID == 1002)
{
if (statue.SpawnPacket.Length > 200)
{
client.Send(statue.SpawnPacket);
return true;
}
}
}
return false;
}
public static bool operator <(Statue statue, Client.GameState client)
{
if (Kernel.GetDistance(statue.X, statue.Y, client.Player.X, client.Player.Y) >= 16 && client.Player.MapID == 1002)
{
return true;
}
return false;
}
}
}
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace MoDY.Database
{
public unsafe class StatueTable
{
public static void Load()
{
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("statue").Where("UID", 105175))
using (var reader = cmd.CreateReader())
{
if (reader.Read())
{
using (var stream = new MemoryStream((reader.ReadBlob("data"))))
using (var hreader = new BinaryReader(stream))
{
uint Count = hreader.ReadUInt32();
byte[] array = new byte[Count];
for (int x = 0; x < Count; x++)
array[x] = hreader.ReadByte();
new Game.Statue(array);
}
}
else
{
string SQL = "INSERT INTO `statue` (uid, data) VALUES (@UID, @Data)";
MemoryStream stream = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stream);
writer.Write(0);
byte[] rawData = stream.ToArray();
using (var conn = DataHolder.MySqlConnection)
{
conn.Open();
using (var cmd2 = new MySql.Data.MySqlClient.MySqlCommand(SQL, conn))
{
cmd2.Parameters.AddWithValue("@UID", 105175);
cmd2.Parameters.AddWithValue("@Data", rawData);
cmd2.ExecuteNonQuery();
}
}
}
}
}
public static void Save()
{
MemoryStream stream = new MemoryStream();
BinaryWriter writer = new BinaryWriter(stream);
bool WasAdd = false;
foreach (var statu in Game.Statue.Statues.Values)
{
if (statu.SpawnPacket != null)
{
if (statu.SpawnPacket.Length > 200)
{
WasAdd = true;
writer.Write(statu.SpawnPacket.Length);
writer.Write(statu.SpawnPacket);
}
}
}
if (!WasAdd)
writer.Write(0);
string SQL = "UPDATE `statue` SET data=@Data where UID = " + 105175 + " ;";
byte[] rawData = stream.ToArray();
using (var conn = DataHolder.MySqlConnection)
{
conn.Open();
using (var cmd = new MySql.Data.MySqlClient.MySqlCommand())
{
cmd.Connection = conn;
cmd.CommandText = SQL;
cmd.Parameters.AddWithValue("@Data", rawData);
cmd.ExecuteNonQuery();
}
}
}
}
}
Game\Features\Event
using MoDY.Network.GamePackets;
using System;
using System.Linq;
namespace MoDY.Game.Features.Tournaments
{
public unsafe class HeroOfGame
{
public HeroOfGame()
{
open = false;
}
public void CheakUp()
{
if (DateTime.Now.Hour == 19 && DateTime.Now.Minute == 17 && DateTime.Now.Second <= 2 && !open)
{
Start();
}
}
uint Secounds = 0;
private IDisposable Subscribe;
bool open = false;
bool SendInvitation = false;
public void Start()
{
if (!open)
{
Secounds = 0;
SendInvitation = false;
open = true;
Subscribe = Thread.Subscribe(Work, 1000);
}
}
public void SendMapMessage(string packet)
{
var data = new Network.GamePackets.MsgTalk(packet, System.Drawing.Color.Yellow, Network.GamePackets.MsgTalk.Center);
var MapDictionary = Kernel.GamePool.Values.Where(p => p.Player.MapID == 1507).ToArray();
foreach (var client in MapDictionary)
{
client.Send(data);
}
}
public int CkeckUPAlive()
{
int Count = 0;
var MapDictionary = Kernel.GamePool.Values.Where(p => p.Player.MapID == 1507).ToArray();
foreach (var client in MapDictionary)
{
if (client.Player.Hitpoints > 0)
Count++;
}
return Count;
}
public void Close()
{
open = false;
Subscribe.Dispose();
}
public void Work(int time)
{
if (!SendInvitation)
{
foreach (var client in Kernel.GamePool.Values)
{
if (!client.InQualifier() && client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Player.Dead)
{
client.MessageBox("Hero OF Game has begun! Would you like to join?",
(p) => { p.Player.Teleport(1507, 96, 113); }, null, 40);
}
}
SendInvitation = true;
}
else
{
if (open)
{
if (Secounds == 30)
SendMapMessage("Hero OF Game will start in 30 Secounds");
else if (Secounds == 40)
SendMapMessage("Hero OF Game will start in 20 Secounds");
else if (Secounds == 50)
SendMapMessage("Hero OF Game will start in 10 Secounds");
else if (Secounds == 55)
SendMapMessage("Hero OF Game will start in 5 Secounds");
else if (Secounds == 58)
SendMapMessage("Hero OF Game will start in 3 Secounds");
else if (Secounds == 60)
{
var MapDictionary = Kernel.GamePool.Values.Where(p => p.Player.MapID == 1507).ToArray();
foreach (var client in MapDictionary)
{
client.Player.AllowToAttack = true;
}
SendMapMessage("Fight Now!");
}
else if (Secounds > 60)
{
byte[] Messaje = new Network.GamePackets.MsgTalk("Alive Players : [ " + CkeckUPAlive() + " ]", System.Drawing.Color.Yellow, Network.GamePackets.MsgTalk.FirstRightCorner).ToArray();
var MapDictionar = Kernel.GamePool.Values.Where(p => p.Player.MapID == 1507).ToArray();
foreach (var client in MapDictionar)
client.Send(Messaje);
if (CkeckUPAlive() == 1)
{
var client = Kernel.GamePool.Values.SingleOrDefault(p => p.Player.MapID == 1507 && p.Player.Hitpoints > 0);
if (client != null)
{
Game.Statue statue = new Statue(client.Player.SpawnPacket);
client.Player.ConquerPoints += 5000;
client.Player.AddTopStatus((ulong)MsgUpdate.Flags3.rygh_hglx, 3, DateTime.Now.AddMinutes(58));
Game.Player.SendWorldMessage("Congratulation ! " + client.Player.Name + " win the Hero OF Game, he receice 5000 Conquer Points");
Close();
}
foreach (var player in Kernel.GamePool.Values)
{
if (player.Player.MapID == 1507)
player.Player.Teleport(1002, 300, 278);
player.Player.AllowToAttack = false;
}
}
else if (CkeckUPAlive() == 0)
{
Close();
}
}
Secounds++;
}
}
}
}
}
public void Reload(IPacket spawnWith)
{
CleanUp(spawnWith);
if (Owner.Player.MapID == 1002)
{
foreach (var statue in Game.Statue.Statues.Values)
{
if (statue > Owner)
{
Statue.TryAdd(statue.UID, statue);
}
else if (statue < Owner)
{
Game.Statue astatue;
Statue.TryRemove(statue.UID, out astatue);
}
}
}
else
{
if (Statue.Count > 0)
Statue.Clear();
}
public ConcurrentDictionary<uint, Statue> Statue = new ConcurrentDictionary<uint, Statue>();
public HeroOfGame HeroOfGame = new HeroOfGame();
#region HeroOFGame
if (DateTime.Now.Hour == 19 && DateTime.Now.Hour == 16 && DateTime.Now.Second == 30)
{
HeroOfGame.CheakUp();
}
#endregion
public class Start
public static bool HeroOfGame
{
get
{
return now.Minute == 30;
}
}
DeathWarEnd = reader.ReadUInt32("DeathWarEnd");
HeroOFGameHour = reader.ReadUInt32("HeroOFGameHour");
HeroOFGameMinute = reader.ReadUInt32("HeroOFGameMinute");
DeathWarEnd = 0,
HeroOFGameHour = 0,
HeroOFGameMinute = 0,
|
الذين يشاهدون محتوى الموضوع الآن : 2 ( الأعضاء 0 والزوار 2) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
شرح تغير مكان التمثال لكويسته بطل السيرفر (Hero of Game) | Mero | تطوير سيرفرات كونكر | 8 | 2023-07-28 04:26 AM |
طلب ملف game map مخصص | AliNasser | مشكلات السيرفيرات كونكر الشخصيه | 1 | 2020-02-02 04:45 AM |
Beast Conquer Game | nova | اعلانات السيرفيرات الشخصية | 0 | 2019-11-29 03:39 PM |
طـلـب بـخـصووص سـورس Game~of~Thrones ال 3D | 3abqrino | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2019-09-20 07:44 PM |
مشكلة في توب Hero of Game | Adel Abd El Hay | مشكلات السيرفيرات كونكر الشخصيه | 12 | 2019-07-07 12:16 AM |