|
المشاركات 328 |
+التقييم 0.18 |
تاريخ التسجيل Nov 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 2314 |
Game.MsgTournaments.MsgGuildWar.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Concurrent;
namespace Project_Terror_v2.Game.MsgTournaments
{
public class MsgGuildWar
{
public bool SendInvitation = false;
internal ushort[][] StatueCoords =
{
new ushort[] {140 ,134 }
,new ushort[] {144 ,124 }
,new ushort[] {130 ,138 }
,new ushort[] {153 ,124 }
,new ushort[] {161 ,124 }
,new ushort[] {130 ,147 }
,new ushort[] {130 ,155 }
};
public class GuildConductor
{
public static List<uint> BlockMaps = new List<uint>()
{
1038
};
public Game.MsgNpc.Npc Npc;
public uint ToMap;
public ushort ToX, ToY;
public override string ToString()
{
Database.DBActions.WriteLine Line = new Database.DBActions.WriteLine(',');
Line.Add(Npc.UID).Add(Npc.X).Add(Npc.Y).Add(Npc.Map).Add(Npc.Mesh).Add((ushort)Npc.NpcType)
.Add(ToX).Add(ToY).Add(ToMap);
return Line.Close();
}
internal void Load(string Line, MsgNpc.NpcID UID)
{
Npc = Game.MsgNpc.Npc.Create();
if (Line == "")
{
Npc.UID = (uint)UID;
return;
}
Database.DBActions.ReadLine Reader = new Database.DBActions.ReadLine(Line, ',');
Npc.UID = Reader.Read((uint)0);
Npc.X = Reader.Read((ushort)0);
Npc.Y = Reader.Read((ushort)0);
Npc.Map = Reader.Read((ushort)0);
Npc.Mesh = Reader.Read((ushort)0);
Npc.NpcType = (Role.Flags.NpcType)Reader.Read((ushort)0);
ToX = Reader.Read((ushort)0);
ToY = Reader.Read((ushort)0);
ToMap = Reader.Read((ushort)0);
}
internal static bool ChangeNpcLocation(Role.GameMap map, ref ushort X, ref ushort Y, ref uint Map)
{
return false;
}
internal void GetCoords(out ushort x, out ushort y, out uint map)
{
if (ToMap != 0 && ToX != 0 && ToY != 0)
{
x = ToX;
y = ToY;
map = ToMap;
return;
}
x = 300;
y = 278;
map = 1002;
}
}
public class DataFlameQuest
{
public List<uint> Registred;
public bool ActiveFlame10;
public DataFlameQuest()
{
Registred = new List<uint>();
ActiveFlame10 = false;
}
}
public class GuildWarScrore
{
//public const int ConquerPointsReward = 3000000;
public uint GuildID;
public string Name;
public uint Score;
//for reward
//public int LeaderReward = 1;
//public int DeputiLeaderReward = 7;
}
//public List<uint> RewardLeader = new List<uint>();
//public List<uint> RewardDeputiLeader = new List<uint>();
public DateTime StampRound = new DateTime();
public DateTime StampShuffleScore = new DateTime();
private Role.GameMap GuildWarMap;
public ProcesType Proces { get; set; }
public DataFlameQuest FlamesQuest;
public Dictionary<Role.SobNpc.StaticMesh, Role.SobNpc> Furnitures { get; set; }
public ConcurrentDictionary<uint, GuildWarScrore> ScoreList;
public GuildWarScrore Winner;
public Dictionary<MsgNpc.NpcID, GuildConductor> GuildConductors;
public bool SignUp(Client.GameClient client)
{
if (Proces == ProcesType.Idle || Proces == ProcesType.Alive)
{
byte RandTele = (byte)Program.GetRandom.Next(1, 14);
switch (RandTele)
{
case 1: client.Teleport(326, 374, 1038); break;
case 2: client.Teleport(299, 371, 1038); break;
case 3: client.Teleport(293, 352, 1038); break;
case 4: client.Teleport(262, 337, 1038); break;
case 5: client.Teleport(285, 324, 1038); break;
case 6: client.Teleport(315, 289, 1038); break;
case 7: client.Teleport(323, 268, 1038); break;
case 8: client.Teleport(351, 282, 1038); break;
case 9: client.Teleport(371, 305, 1038); break;
case 10: client.Teleport(370, 326, 1038); break;
case 11: client.Teleport(357, 335, 1038); break;
case 12: client.Teleport(333, 330, 1038); break;
default: client.Teleport(322, 321, 1038); break;
}
// client.Player.SetPkMode(Role.Flags.PKMode.Guild);
return true;
}
return false;
}
public bool LeftGateOpen { get { return Furnitures[Role.SobNpc.StaticMesh.LeftGate].Mesh == Role.SobNpc.StaticMesh.OpenLeftGate; } }
public bool RightGateOpen { get { return Furnitures[Role.SobNpc.StaticMesh.RightGate].Mesh == Role.SobNpc.StaticMesh.OpenRightGate; } }
public MsgGuildWar()
{
FlamesQuest = new DataFlameQuest();
Proces = ProcesType.Dead;
Furnitures = new Dictionary<Role.SobNpc.StaticMesh, Role.SobNpc>();
GuildConductors = new Dictionary<MsgNpc.NpcID, GuildConductor>();
ScoreList = new ConcurrentDictionary<uint, GuildWarScrore>();
Winner = new GuildWarScrore() { Name = "None", Score = 100, GuildID = 0 };
}
public unsafe void CreateFurnitures()
{
Furnitures.Add(Role.SobNpc.StaticMesh.LeftGate, Database.Server.ServerMaps[1038].View.GetMapObject<Role.SobNpc>(Role.MapObjectType.SobNpc, 516074));
Furnitures.Add(Role.SobNpc.StaticMesh.RightGate, Database.Server.ServerMaps[1038].View.GetMapObject<Role.SobNpc>(Role.MapObjectType.SobNpc, 516075));
Furnitures.Add(Role.SobNpc.StaticMesh.Pole, Database.Server.ServerMaps[1038].View.GetMapObject<Role.SobNpc>(Role.MapObjectType.SobNpc, 810));
}
public unsafe bool Bomb(ServerSockets.Packet stream, Client.GameClient client, Role.SobNpc.StaticMesh gate)
{
if (Furnitures[gate].HitPoints > 3000000)
{
Furnitures[gate].HitPoints -= 2000000;
MsgServer.MsgUpdate upd = new MsgServer.MsgUpdate(stream, Furnitures[gate].UID, 1);
stream = upd.Append(stream, MsgServer.MsgUpdate.DataType.Hitpoints, Furnitures[gate].HitPoints);
Furnitures[gate].SendScrennPacket(upd.GetArray(stream));
client.Player.Dead(null, client.Player.X, client.Player.Y, client.Player.UID);
Furnitures[gate].SendString(stream, MsgServer.MsgStringPacket.StringID.Effect, "firemagic");
Furnitures[gate].SendString(stream, MsgServer.MsgStringPacket.StringID.Effect, "bombarrow");
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("" + client.Player.Name + " from " + (client.Player.MyGuild != null ? client.Player.MyGuild.GuildName.ToString() : "None".ToString()).ToString() + " detonated the Bomb and killed herself/himself. But the " + gate.ToString() + " was blown up!"
, MsgServer.MsgMessage.MsgColor.red, MsgServer.MsgMessage.ChatMode.Center).GetArray(stream));
return true;
}
return false;
}
internal unsafe void ResetFurnitures(ServerSockets.Packet stream)
{
Furnitures[Role.SobNpc.StaticMesh.LeftGate].Mesh = Role.SobNpc.StaticMesh.LeftGate;
Furnitures[Role.SobNpc.StaticMesh.RightGate].Mesh = Role.SobNpc.StaticMesh.RightGate;
foreach (var npc in Furnitures.Values)
npc.HitPoints = npc.MaxHitPoints;
foreach (var client in Database.Server.GamePoll.Values)
{
if (client.Player.Map == 1038)
{
foreach (var npc in Furnitures.Values)
{
if (Role.Core.GetDistance(client.Player.X, client.Player.Y, npc.X, npc.Y) <= Role.SobNpc.SeedDistrance)
{
MsgServer.MsgUpdate upd = new MsgServer.MsgUpdate(stream, npc.UID, 2);
stream = upd.Append(stream, MsgServer.MsgUpdate.DataType.Mesh, (long)npc.Mesh);
stream = upd.Append(stream, MsgServer.MsgUpdate.DataType.Hitpoints, npc.HitPoints);
stream = upd.GetArray(stream);
client.Send(stream);
if ((Role.SobNpc.StaticMesh)npc.Mesh == Role.SobNpc.StaticMesh.Pole)
client.Send(npc.GetArray(stream, false));
}
}
}
}
}
internal unsafe void SendMapPacket(ServerSockets.Packet packet)
{
foreach (var client in Database.Server.GamePoll.Values)
{
if (client.Player.Map == 1038 || client.Player.Map == 6001)
{
client.Send(packet);
}
}
}
internal unsafe void CompleteEndGuildWar()
{
SendInvitation = false;
ShuffleGuildScores();
Proces = ProcesType.Dead;
ScoreList.Clear();
Save();
using (var rec = new ServerSockets.RecycledPacket())
{
var stream = rec.GetStream();
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("Congratulations to " + Winner.Name + ", they've won the CrossGuildWar with a score of " + Winner.Score.ToString() + ""
, MsgServer.MsgMessage.MsgColor.white, MsgServer.MsgMessage.ChatMode.Center).GetArray(stream));
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("Congratulations to " + Winner.Name + ", they've won the CrossGuildWar with a score of " + Winner.Score.ToString() + ""
, MsgServer.MsgMessage.MsgColor.white, MsgServer.MsgMessage.ChatMode.System).GetArray(stream));
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("Congratulations to " + Winner.Name + ", they've won the CrossGuildWar with a score of " + Winner.Score.ToString() + ""
, MsgServer.MsgMessage.MsgColor.white, MsgServer.MsgMessage.ChatMode.BroadcastMessage).GetArray(stream));
}
//RewardDeputiLeader.Clear();
//RewardLeader.Clear();
//Winner.DeputiLeaderReward = 7;
//Winner.LeaderReward = 1;
using (var rec = new ServerSockets.RecycledPacket())
{
var stream = rec.GetStream();
Role.Instance.Union.CheckGuildWar(stream);
}
}
internal unsafe void Start()
{
FlamesQuest = new DataFlameQuest();
Proces = ProcesType.Alive;
using (var rec = new ServerSockets.RecycledPacket())
{
var stream = rec.GetStream();
ResetFurnitures(stream);
ScoreList.Clear();
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("CrossGuild War has started!", MsgServer.MsgMessage.MsgColor.white, MsgServer.MsgMessage.ChatMode.System).GetArray(stream));
}
}
//public void GuildWarRevive()
//{
// Extensions.Time32 Timer = Extensions.Time32.Now;
// foreach (var user in MapPlayers())
// {
// if (user.Player.Alive == false && Proces != ProcesType.Dead)
// {
// if (user.Player.DeadStamp.AddSeconds(6) < Timer)
// {
// ushort x = 0;
// ushort y = 0;
// GuildWarMap.GetRandCoord(ref x, ref y);
// user.Teleport(x, y, GuildWarMap.ID);
// }
// }
// }
//}
internal unsafe void FinishRound()
{
ShuffleGuildScores(true);
Furnitures[Role.SobNpc.StaticMesh.Pole].Name = Winner.Name;
Proces = ProcesType.Idle;
ScoreList.Clear();
using (var rec = new ServerSockets.RecycledPacket())
{
var stream = rec.GetStream();
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("Congratulations to " + Winner.Name + ", they've won The Pole Round of the CrossGuildWar with a score of " + Winner.Score.ToString() + ""
, MsgServer.MsgMessage.MsgColor.white, MsgServer.MsgMessage.ChatMode.System).GetArray(stream));
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("Congratulations to " + Winner.Name + ", they've won The Pole Round of the CrossGuildWar with a score of " + Winner.Score.ToString() + ""
, MsgServer.MsgMessage.MsgColor.red, MsgServer.MsgMessage.ChatMode.Center).GetArray(stream));
ResetFurnitures(stream);
}
StampRound = DateTime.Now.AddSeconds(3);
}
internal unsafe void Began()
{
if (Proces == ProcesType.Idle)
{
Proces = ProcesType.Alive;
using (var rec = new ServerSockets.RecycledPacket())
{
var stream = rec.GetStream();
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("CrossGuild War has began!", MsgServer.MsgMessage.MsgColor.white, MsgServer.MsgMessage.ChatMode.System).GetArray(stream));
}
}
}
internal void UpdateScore(Role.Player client, uint Damage)
{
if (client.MyGuild == null)
return;
if (Proces == ProcesType.Alive)
{
if (!ScoreList.ContainsKey(client.GuildID))
{
ScoreList.TryAdd(client.GuildID, new GuildWarScrore() { GuildID = client.MyGuild.Info.GuildID, Name = client.MyGuild.GuildName, Score = Damage });
}
else
{
ScoreList[client.MyGuild.Info.GuildID].Score += Damage;
}
if (Furnitures[Role.SobNpc.StaticMesh.Pole].HitPoints == 0)
FinishRound();
}
}
internal unsafe void ShuffleGuildScores(bool createWinned = false)
{
if (Proces != ProcesType.Dead)
{
StampShuffleScore = DateTime.Now.AddSeconds(8);
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 && createWinned)
Winner = element;
using (var rec = new ServerSockets.RecycledPacket())
{
var stream = rec.GetStream();
Game.MsgServer.MsgMessage msg = new MsgServer.MsgMessage("No " + (x + 1).ToString() + ". " + element.Name + " (" + element.Score.ToString() + ")"
, MsgServer.MsgMessage.MsgColor.yellow, x == 0 ? MsgServer.MsgMessage.ChatMode.FirstRightCorner : MsgServer.MsgMessage.ChatMode.ContinueRightCorner);
SendMapPacket(msg.GetArray(stream));
}
if (x == 4)
break;
}
}
}
internal bool ValidJump(int Current, out int New, ushort X, ushort Y)
{
if (Role.Core.GetDistance(217, 177, X, Y) <= 3)
{
New = 0;
return true;
}
New = Current;
int new_FloorType = GuildWarMap.FloorType[X, Y];
if (Current == 3)
{
if (new_FloorType == 0 || new_FloorType == 9 || new_FloorType == 13)
{
if (Role.Core.GetDistance(X, Y, 164, 209) <= 20)
{
if (LeftGateOpen)
{
New = new_FloorType;
return true;
}
}
if (Role.Core.GetDistance(X, Y, 222, 177) <= 15)
{
if (RightGateOpen)
{
New = new_FloorType;
return true;
}
}
return false;
}
}
New = new_FloorType;
return true;
}
internal bool ValidWalk(int Current, out int New, ushort X, ushort Y)
{
if (Role.Core.GetDistance(217, 177, X, Y) <= 3)
{
New = 0;
return true;
}
New = Current;
int new_mask = GuildWarMap.FloorType[X, Y];
if (Current == 3)
{
if (new_mask == 0 || new_mask == 9 || new_mask == 13)
{
if (Y == 209 || Y == 208)
{
if (Role.Core.GetDistance(X, Y, 164, 209) <= 3)
{
if (LeftGateOpen)
{
New = new_mask;
return true;
}
}
}
else if (X == 216)
{
if (Role.Core.GetDistance(X, Y, 216, 177) <= 4)
{
if (RightGateOpen)
{
New = new_mask;
return true;
}
}
}
return false;
}
}
New = new_mask;
return true;
}
internal void Save()
{
WindowsAPI.IniFile write = new WindowsAPI.IniFile("\\GuildWarInfo.ini");
if (Proces == ProcesType.Dead)
{
write.Write<uint>("Info", "ID", Winner.GuildID);
write.WriteString("Info", "Name", Winner.Name);
write.Write<uint>("Info", "reward", 0);
//write.Write<int>("Info", "LeaderReward", Winner.LeaderReward);
//write.Write<int>("Info", "DeputiLeaderReward", Winner.DeputiLeaderReward);
//for (int x = 0; x < RewardLeader.Count; x++)
// write.Write<uint>("Info", "LeaderTop" +x.ToString()+"", RewardLeader[x]);
//for (int x = 0; x < 7; x++)
//{
// if (x >= RewardDeputiLeader.Count)
// break;
// write.Write<uint>("Info", "DeputiTop" + x.ToString() + "", RewardDeputiLeader[x]);
//}
write.WriteString("Pole", "Name", Winner.Name);
write.Write<int>("Pole", "HitPoints", Furnitures[Role.SobNpc.StaticMesh.Pole].HitPoints);
}
//write.WriteString("Condutors", "GuildConductor1", GuildConductors[MsgNpc.NpcID.TeleGuild1].ToString());
//write.WriteString("Condutors", "GuildConductor2", GuildConductors[MsgNpc.NpcID.TeleGuild2].ToString());
//write.WriteString("Condutors", "GuildConductor3", GuildConductors[MsgNpc.NpcID.TeleGuild3].ToString());
//write.WriteString("Condutors", "GuildConductor4", GuildConductors[MsgNpc.NpcID.TeleGuild4].ToString());
}
internal void Load()
{
WindowsAPI.IniFile reader = new WindowsAPI.IniFile("\\GuildWarInfo.ini");
Winner.GuildID = reader.ReadUInt32("Info", "ID", 0);
Winner.Name = reader.ReadString("Info", "Name", "None");
//Winner.LeaderReward = reader.ReadInt32("Info", "LeaderReward", 0);
//Winner.DeputiLeaderReward = reader.ReadInt32("Info", "DeputiLeaderReward", 0);
//RewardLeader.Add(reader.ReadUInt32("Info", "LeaderTop0", 0));
//for (int x = 0; x < 7; x++)
//{
// RewardDeputiLeader.Add(reader.ReadUInt32("Info", "DeputiTop" + x.ToString() + "", 0));
//}
Furnitures[Role.SobNpc.StaticMesh.Pole].Name = reader.ReadString("Pole", "Name", "None");
Furnitures[Role.SobNpc.StaticMesh.Pole].HitPoints = reader.ReadInt32("Pole", "HitPoints", 0);
//for (int x = 0; x < 4; x++)
//{
// GuildConductor conductor = new GuildConductor();
// conductor.Load(reader.ReadString("Condutors", "GuildConductor" + (x + 1).ToString() + "", ""), (MsgNpc.NpcID)(101614 + x * 2));
// GuildConductors.Add((MsgNpc.NpcID)(101614 + x * 2), conductor);
// if (conductor.Npc.Map != 0)
// {
// if (Database.Server.ServerMaps.ContainsKey(conductor.Npc.Map))
// Database.Server.ServerMaps[conductor.Npc.Map].AddNpc(conductor.Npc);
// }
//}
GuildWarMap = Database.Server.ServerMaps[1038];
}
}
}
user.Owner.Player.SetPkMode(Role.Flags.PKMode.Union);
if (Program.ServerConfig.IsInterServer)
if (Program.ServerConfig.IsInterServer)
{
if (Game.MsgTournaments.MsgSchedules.GuildWar.Proces == Game.MsgTournaments.ProcesType.Alive || Game.MsgTournaments.MsgSchedules.GuildWar.Proces == Game.MsgTournaments.ProcesType.Idle)
user.Owner.Player.SetPkMode(Role.Flags.PKMode.Guild);
else
user.Owner.Player.SetPkMode(Role.Flags.PKMode.Union);
}
else
user.Owner.Player.SetPkMode(Role.Flags.PKMode.Peace);
public static void SetLocation(Client.GameClient user)
case 2:// Cross Guild War
{
Game.MsgTournaments.MsgSchedules.GuildWar.SignUp(user);
break;
}
GameClient.cs
if (Player.SetLocationType != 1
if (Player.SetLocationType != 1 && Player.SetLocationType != 2 && Player.SetLocationType != 11 && Player.SetLocationType != 3)
if (!Player.Alive && revive /*&& Player.Map != 1038*/)
[DataAttribute(ActionType.Revive)]
if (client.Player.Map == 1038)// gw map
{
client.Teleport(322, 321, 1038, 0, true, true);
client.Teleport(322, 321, 1038);
}
41756,OutCrossGuild,2,16570,1038,51,60,0,0,1,1
[NpcAttribute(NpcID.outCrossGuild)]
public static void outCrossGuild(Client.GameClient client, ServerSockets.Packet stream, byte Option, string Input, uint id)
{
Dialog data = new Dialog(client, stream);
switch (Option)
{
case 0:
{
data.AddText("I have the code to Return you to Your Server. If you want to return to Your Server, i can help you.");
data.AddOption("Return to My Server.", 1)
.AddOption("I see.", 255)
.AddAvatar(6).FinalizeDialog();
break;
}
case 1:
{
client.Socket.Disconnect();
break;
}
}
}
outCrossGuild = 41756,
if (action.npcid == (ushort)NpcID.KingdomMissionEnvoy
|| action.npcid == (ushort)NpcID.RealmEnvoy ||
if (action.npcid == (ushort)NpcID.KingdomMissionEnvoy
|| action.npcid == (ushort)NpcID.RealmEnvoy || action.npcid == (ushort)NpcID.outCrossGuild || action.npcid == (uint)NpcID.LeftGate || action.npcid == (uint)NpcID.RightGate)
GuildWarInfo.ini
[Info]
ID=101003
Name=killer2
reward=1
[Pole]
Name=killer2
HitPoints=40000000
[Condutors]
GuildConductor1=101614,523,410,2056,1487,2,517,404,2056,
GuildConductor2=101616,0,0,0,0,0,0,0,0,
GuildConductor3=101618,361,408,1927,1467,2,358,402,1927,
GuildConductor4=101620,115,205,3846,1457,2,109,199,3846,
[NpcAttribute(NpcID.CaptureTheFlag)]
public static void CaptureTheFlag(Client.GameClient client, ServerSockets.Packet stream, byte Option, string Input, uint id)
{
Dialog data = new Dialog(client, stream);
switch (Option)
{
case 0:
{
data.Text("Hello Player i Cross Server Manger I can help you in all War Cross Server ")
.AddText("==============================================================================")
.AddText("Cross Servers War Starts Every Week At Sunday [20:00] and end [22:00] you can join in that time only")
.AddText("================================================================================")
.AddText("Cross Guild War Starts Every Week At Thrsday [20:00] and end [22:00] you can join in that time only")
//.AddOption("Cross~Servers~War", 3)
.AddOption("Cross~Guild~War", 2)
.AddOption("No Thanks", 255)
.AddAvatar(55).FinalizeDialog();
break;
}
//case 1:
// {
// data.Text("Cross Servers War Starts Every Week At Sunday [20:00] and end [22:00] you can join in that time only")
// .AddOption("Join CrossServersWar", 3)
// .AddAvatar(70).FinalizeDialog();
// break;
// }
case 3:
{
DateTime Now64 = DateTime.Now;
if (Now64.DayOfWeek == DayOfWeek.Sunday)
{
if ((Now64.Hour >= 20) && (Now64.Hour < 22))
{
client.Player.SetLocationType = 3;
MsgInterServer.PipeClient.Connect(client, Database.GroupServerList.InterServer.IPAddress, Database.GroupServerList.InterServer.Port);
}
else
data.Text("Sorry Man the Cross Servers War Starts only in [Sunday] from [20:01] to [22:00]")
.AddAvatar(85).FinalizeDialog();
}
else
data.Text("Sorry Man the Cross Servers War Starts only in [Sunday] from [20:01] to [22:00]")
.AddAvatar(85).FinalizeDialog();
break;
}
case 2:
{
data.Text("Cross Guilds War Starts Every Week At Thrsday [20:00] and end [22:00] you can join in that time only")
.AddOption("Join CrossGuildSWar", 4)
.AddOption("Claim CrossGuildsWar Reward", 5)
.AddAvatar(70).FinalizeDialog();
break;
}
case 4:
{
if (client.Player.MyGuild != null)
{
DateTime Now64 = DateTime.Now;
if (Now64.DayOfWeek == DayOfWeek.Thursday)
{
if ((Now64.Hour >= 20) && (Now64.Hour < 22))
{
client.Player.SetLocationType = 2;
MsgInterServer.PipeClient.Connect(client, Database.GroupServerList.InterServer.IPAddress, Database.GroupServerList.InterServer.Port);
}
else
data.Text("Sorry Man the Cross Guilds War Starts only in [Thursday] from [20:01] to [22:00]")
.AddAvatar(85).FinalizeDialog();
}
else
data.Text("Sorry Man the Cross Guilds War Starts only in [Thursday] from [20:01] to [22:00]")
.AddAvatar(85).FinalizeDialog();
}
else
{
data.Text("You Should be in Guild Bro")
.AddAvatar(40).FinalizeDialog();
}
break;
}
case 5:
{
{
if (client.Player.MyGuild != null)
{
if (client.Player.MyGuild.GuildName == MsgTournaments.MsgSchedules.GuildWar.Winner2.Name && client.Player.MyGuild != null)
{
if (client.Player.GuildRank == Role.Flags.GuildMemberRank.GuildLeader && MsgTournaments.MsgSchedules.GuildWar.mido == 0)
{
client.Player.ConquerPoints += 50000000;
MsgTournaments.MsgSchedules.GuildWar.mido = 1;
WindowsAPI.IniFile2 write = new WindowsAPI.IniFile2("\\GuildWarInfo.ini");
write.Write<uint>("Info", "reward", MsgTournaments.MsgSchedules.GuildWar.mido);
Program.SendGlobalPackets.Enqueue(new MsgServer.MsgMessage("" + client.Player.Name + " , GuildLeader of the Guild[ " + client.Player.MyGuild.GuildName + " ] was rewarded with 50,000,000 Cps [Winner Of the CrossGuildWar].", MsgServer.MsgMessage.MsgColor.red, MsgServer.MsgMessage.ChatMode.Center).GetArray(stream));
}
else
{
data.Text("Only Guild Leader Or You Have Claim The Reward")
.AddAvatar(255).FinalizeDialog();
}
}
else
{
data.Text("Sorry You Are Not in The Guild That Win the Cross Guild War")
.AddAvatar(255).FinalizeDialog();
}
}
else
{
data.Text("You Should be in Guild Bro")
.AddAvatar(40).FinalizeDialog();
}
break;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Project_Terror_v2.WindowsAPI
{
public unsafe class IniFile
{
public string FileName;
public IniFile(string _FileName, bool overridep = false)
{
if (!overridep)
FileName = Program.ServerConfig.DbLocation + _FileName;
else
FileName = _FileName;
}
public IniFile()
{
FileName = null;
}
public const int
Int32_Size = 15,
Int16_Size = 9,
Int8_Size = 6,
Bool_Size = 6,
Double_Size = 20,
Int64_Size = 22,
Float_Size = 10;
public static Func<string, int> ToInt32 = new Func<string, int>(int.Parse);
public static Func<string, uint> ToUInt32 = new Func<string, uint>(uint.Parse);
public static Func<string, short> ToInt16 = new Func<string, short>(short.Parse);
public static Func<string, ushort> ToUInt16 = new Func<string, ushort>(ushort.Parse);
public static Func<string, sbyte> ToInt8 = new Func<string, sbyte>(sbyte.Parse);
public static Func<string, byte> ToUInt8 = new Func<string, byte>(byte.Parse);
public static Func<string, bool> ToBool = new Func<string, bool>(bool.Parse);
public static Func<string, double> ToDouble = new Func<string, double>(double.Parse);
public static Func<string, long> ToInt64 = new Func<string, long>(long.Parse);
public static Func<string, ulong> ToUInt64 = new Func<string, ulong>(ulong.Parse);
public static Func<string, float> ToFloat = new Func<string, float>(float.Parse);
public string ReadString(string Section, string Key, string Default, int Size)
{
char* lpBuffer = stackalloc char[Size];
Kernel32.GetPrivateProfileStringW(Section, Key, Default, lpBuffer, Size, FileName);
return new string(lpBuffer).Trim('\0');
}
public string ReadString(string Section, string Key, string Default)
{
return ReadString(Section, Key, Default, 255);
}
public string ReadBigString(string Section, string Key, string Default)
{
return ReadString(Section, Key, Default, 255 * 4);
}
public void ReadString(string Section, string Key, void* Default, void* Buffer, int Size)
{
Kernel32.GetPrivateProfileStringA(Section, Key, Default, (sbyte*)Buffer, Size, FileName);
}
public T ReadValue<T>(string Section, string Key, T Default, Func<string, T> callback)
{
try
{
return callback.Invoke(ReadString(Section, Key, Default.ToString()));
}
catch
{
return Default;
}
}
public T ReadValue<T>(string Section, string Key, T Default, Func<string, T> callback, int BufferSize)
{
try
{
return callback.Invoke(ReadString(Section, Key, Default.ToString(), BufferSize));
}
catch
{
return Default;
}
}
public int ReadInt32(string Section, string Key, int Default)
{
return ReadValue<int>(Section, Key, Default, ToInt32, Int32_Size);
}
public ulong ReadUInt64(string Section, string Key, ulong Default)
{
return ReadValue<ulong>(Section, Key, Default, ToUInt64, Int64_Size);
}
public long ReadInt64(string Section, string Key, long Default)
{
return ReadValue<long>(Section, Key, Default, ToInt64, Int64_Size);
}
public double ReadDouble(string Section, string Key, double Default)
{
return ReadValue<double>(Section, Key, Default, ToDouble, Double_Size);
}
public uint ReadUInt32(string Section, string Key, uint Default)
{
return ReadValue<uint>(Section, Key, Default, ToUInt32, Int32_Size);
}
public short ReadInt16(string Section, string Key, short Default)
{
return ReadValue<short>(Section, Key, Default, ToInt16, Int16_Size);
}
public ushort ReadUInt16(string Section, string Key, ushort Default)
{
return ReadValue<ushort>(Section, Key, Default, ToUInt16, Int16_Size);
}
public sbyte ReadSByte(string Section, string Key, sbyte Default)
{
return ReadValue<sbyte>(Section, Key, Default, ToInt8, Int8_Size);
}
public byte ReadByte(string Section, string Key, byte Default)
{
return ReadValue<byte>(Section, Key, Default, ToUInt8, Int8_Size);
}
public bool ReadBool(string Section, string Key, bool Default)
{
return ReadValue<bool>(Section, Key, Default, ToBool, Bool_Size);
}
public float ReadFloat(string Section, string Key, float Default)
{
return ReadValue<float>(Section, Key, Default, ToFloat, Float_Size);
}
public void WriteString(string Section, string Key, string Value)
{
if (Value == null)
{
Value = "0";
}
Kernel32.WritePrivateProfileString(Section, Key, Value, FileName);
}
public void Write<T>(string Section, string Key, T Value)
{
Kernel32.WritePrivateProfileString(Section, Key, Value.ToString(), FileName);
}
public void WriteStruct(string Section, string Key, void* lpStruct, int Size)
{
Kernel32.WritePrivateProfileStructW(Section, Key, lpStruct, Size, FileName);
}
public string[] GetSectionNames(int BufferSize)
{
char* lpBuffer = stackalloc char[BufferSize];
int Size = Kernel32.GetPrivateProfileSectionNamesW(lpBuffer, BufferSize, FileName);
if (Size == 0)
return new string[0];
return new string(lpBuffer, 0, Size - 1).Split('\0');
}
public string[] GetSection(string Section, int BufferSize)
{
char* lpBuffer = stackalloc char[BufferSize];
int Size = Kernel32.GetPrivateProfileSectionW(Section, lpBuffer, BufferSize, FileName);
if (Size == 0)
return new string[0];
return new string(lpBuffer, 0, Size - 1).Split('\0');
}
public string[] GetSectionNames()
{
return GetSectionNames(4096);
}
public string[] GetSection(string Section)
{
return GetSection(Section, 4096);
}
public bool SectionExists(string Section)
{
char* temp = stackalloc char[Section.Length + 1];
int r = Kernel32.GetPrivateProfileSectionW(Section, temp, Section.Length + 1, FileName);
return (temp[0] != 0);
}
public bool KeyExists(string Section, string Key)
{
const char not_used = (char)0x007F;
const string not_used_s = "\007F";
char* temp = stackalloc char[2];
uint r = Kernel32.GetPrivateProfileStringW(Section, Key, not_used_s, temp, 2, FileName);
return (r == 0 && temp[0] == 0) || (r > 0 && temp[0] != not_used);
}
}
public unsafe class IniFile2
{
public string FileName2;
public IniFile2(string _FileName2, bool overridep = false)
{
if (!overridep)
FileName2 = Program.ServerConfig.DbLocationcross + _FileName2;
else
FileName2 = _FileName2;
}
public IniFile2()
{
FileName2 = null;
}
public const int
Int32_Size = 15,
Int16_Size = 9,
Int8_Size = 6,
Bool_Size = 6,
Double_Size = 20,
Int64_Size = 22,
Float_Size = 10;
public static Func<string, int> ToInt32 = new Func<string, int>(int.Parse);
public static Func<string, uint> ToUInt32 = new Func<string, uint>(uint.Parse);
public static Func<string, short> ToInt16 = new Func<string, short>(short.Parse);
public static Func<string, ushort> ToUInt16 = new Func<string, ushort>(ushort.Parse);
public static Func<string, sbyte> ToInt8 = new Func<string, sbyte>(sbyte.Parse);
public static Func<string, byte> ToUInt8 = new Func<string, byte>(byte.Parse);
public static Func<string, bool> ToBool = new Func<string, bool>(bool.Parse);
public static Func<string, double> ToDouble = new Func<string, double>(double.Parse);
public static Func<string, long> ToInt64 = new Func<string, long>(long.Parse);
public static Func<string, ulong> ToUInt64 = new Func<string, ulong>(ulong.Parse);
public static Func<string, float> ToFloat = new Func<string, float>(float.Parse);
public string ReadString(string Section, string Key, string Default, int Size)
{
char* lpBuffer = stackalloc char[Size];
Kernel32.GetPrivateProfileStringW(Section, Key, Default, lpBuffer, Size, FileName2);
return new string(lpBuffer).Trim('\0');
}
public string ReadString(string Section, string Key, string Default)
{
return ReadString(Section, Key, Default, 255);
}
public string ReadBigString(string Section, string Key, string Default)
{
return ReadString(Section, Key, Default, 255 * 4);
}
public void ReadString(string Section, string Key, void* Default, void* Buffer, int Size)
{
Kernel32.GetPrivateProfileStringA(Section, Key, Default, (sbyte*)Buffer, Size, FileName2);
}
public T ReadValue<T>(string Section, string Key, T Default, Func<string, T> callback)
{
try
{
return callback.Invoke(ReadString(Section, Key, Default.ToString()));
}
catch
{
return Default;
}
}
public T ReadValue<T>(string Section, string Key, T Default, Func<string, T> callback, int BufferSize)
{
try
{
return callback.Invoke(ReadString(Section, Key, Default.ToString(), BufferSize));
}
catch
{
return Default;
}
}
public int ReadInt32(string Section, string Key, int Default)
{
return ReadValue<int>(Section, Key, Default, ToInt32, Int32_Size);
}
public ulong ReadUInt64(string Section, string Key, ulong Default)
{
return ReadValue<ulong>(Section, Key, Default, ToUInt64, Int64_Size);
}
public long ReadInt64(string Section, string Key, long Default)
{
return ReadValue<long>(Section, Key, Default, ToInt64, Int64_Size);
}
public double ReadDouble(string Section, string Key, double Default)
{
return ReadValue<double>(Section, Key, Default, ToDouble, Double_Size);
}
public uint ReadUInt32(string Section, string Key, uint Default)
{
return ReadValue<uint>(Section, Key, Default, ToUInt32, Int32_Size);
}
public short ReadInt16(string Section, string Key, short Default)
{
return ReadValue<short>(Section, Key, Default, ToInt16, Int16_Size);
}
public ushort ReadUInt16(string Section, string Key, ushort Default)
{
return ReadValue<ushort>(Section, Key, Default, ToUInt16, Int16_Size);
}
public sbyte ReadSByte(string Section, string Key, sbyte Default)
{
return ReadValue<sbyte>(Section, Key, Default, ToInt8, Int8_Size);
}
public byte ReadByte(string Section, string Key, byte Default)
{
return ReadValue<byte>(Section, Key, Default, ToUInt8, Int8_Size);
}
public bool ReadBool(string Section, string Key, bool Default)
{
return ReadValue<bool>(Section, Key, Default, ToBool, Bool_Size);
}
public float ReadFloat(string Section, string Key, float Default)
{
return ReadValue<float>(Section, Key, Default, ToFloat, Float_Size);
}
public void WriteString(string Section, string Key, string Value)
{
if (Value == null)
{
Value = "0";
}
Kernel32.WritePrivateProfileString(Section, Key, Value, FileName2);
}
public void Write<T>(string Section, string Key, T Value)
{
Kernel32.WritePrivateProfileString(Section, Key, Value.ToString(), FileName2);
}
public void WriteStruct(string Section, string Key, void* lpStruct, int Size)
{
Kernel32.WritePrivateProfileStructW(Section, Key, lpStruct, Size, FileName2);
}
public string[] GetSectionNames(int BufferSize)
{
char* lpBuffer = stackalloc char[BufferSize];
int Size = Kernel32.GetPrivateProfileSectionNamesW(lpBuffer, BufferSize, FileName2);
if (Size == 0)
return new string[0];
return new string(lpBuffer, 0, Size - 1).Split('\0');
}
public string[] GetSection(string Section, int BufferSize)
{
char* lpBuffer = stackalloc char[BufferSize];
int Size = Kernel32.GetPrivateProfileSectionW(Section, lpBuffer, BufferSize, FileName2);
if (Size == 0)
return new string[0];
return new string(lpBuffer, 0, Size - 1).Split('\0');
}
public string[] GetSectionNames()
{
return GetSectionNames(4096);
}
public string[] GetSection(string Section)
{
return GetSection(Section, 4096);
}
public bool SectionExists(string Section)
{
char* temp = stackalloc char[Section.Length + 1];
int r = Kernel32.GetPrivateProfileSectionW(Section, temp, Section.Length + 1, FileName2);
return (temp[0] != 0);
}
public bool KeyExists(string Section, string Key)
{
const char not_used = (char)0x007F;
const string not_used_s = "\007F";
char* temp = stackalloc char[2];
uint r = Kernel32.GetPrivateProfileStringW(Section, Key, not_used_s, temp, 2, FileName2);
return (r == 0 && temp[0] == 0) || (r > 0 && temp[0] != not_used);
}
}
}
WindowsAPI.IniFile IniFile = new WindowsAPI.IniFile(System.IO.Directory.GetCurrentDirectory() + "\\shell.ini", true);
Program.ServerConfig.DbLocationcross = IniFile.ReadString("Database", "Location2", "");
public static string DbLocationcross = ""; // for cross war
internal void Load2()
{
WindowsAPI.IniFile2 reader = new WindowsAPI.IniFile2("\\GuildWarInfo.ini");
Winner2.GuildID = reader.ReadUInt32("Info", "ID", 0);
Winner2.Name = reader.ReadString("Info", "Name", "None");
mido = reader.ReadUInt32("Info", "reward", 0);
}
public GuildWarScrore Winner;
public GuildWarScrore Winner2;
Winner = new GuildWarScrore() { Name = "None", Score = 100, GuildID = 0 };
Winner2 = new GuildWarScrore() { Name = "None", Score = 100, GuildID = 0 };
public ProcesType Proces { get; set; }
public uint mido;
MsgSchedules.cs
if (Now64.DayOfWeek == DayOfWeek.Sunday && Now64.Minute == 00 && Now64.Hour == 20 && Now64.Second == 35)
{
SendSysMesage("The CrossServersWar Starts Now Go to CrossServerManger to SignUp now Many Rewards For the best Server.", MsgServer.MsgMessage.ChatMode.Center, MsgServer.MsgMessage.MsgColor.red);
SendSysMesage("The CrossServersWar Starts Now Go to CrossServerManger to SignUp now Many Rewards For the best Server .", MsgServer.MsgMessage.ChatMode.CrossServerIcon, MsgServer.MsgMessage.MsgColor.red);
//SendSysMesage("The CrossServersWar Starts Now Go to CrossServerManger to SignUp now Many Rewards For the best Server .", MsgServer.MsgMessage.ChatMode.Guild, MsgServer.MsgMessage.MsgColor.red);
//SendSysMesage("The CrossServersWar Starts Now Go to CrossServerManger to SignUp now Many Rewards For the best Server .", MsgServer.MsgMessage.ChatMode.CrosTheServer, MsgServer.MsgMessage.MsgColor.red);
SendSysMesage("The CrossServersWar Starts Now Go to CrossServerManger to SignUp now Many Rewards For the best Server .", MsgServer.MsgMessage.ChatMode.BroadcastMessage, MsgServer.MsgMessage.MsgColor.red);
//SendSysMesage("The CrossServersWar Starts Now Go to CrossServerManger to SignUp now Many Rewards For the best Server .", MsgServer.MsgMessage.ChatMode.Whisper, MsgServer.MsgMessage.MsgColor.red);
//SendSysMesage("The CrossServersWar Starts Now Go to CrossServerManger to SignUp now Many Rewards For the best Server .", MsgServer.MsgMessage.ChatMode.TopLeftSystem, MsgServer.MsgMessage.MsgColor.red);
}
if (Now64.DayOfWeek == DayOfWeek.Thursday && Now64.Minute == 00 && Now64.Hour == 22 && Now64.Second == 03)
Game.MsgTournaments.MsgSchedules.GuildWar.Load2();
Location2=G:\سورس اللعبه\DataBase\Cross\
الذين يشاهدون محتوى الموضوع الآن : 3 ( الأعضاء 0 والزوار 3) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
فهرس قسم تطوير السيرفرات | Users | تطوير سيرفرات كونكر | 379 | يوم أمس 11:20 PM |
ودعآ لجميع السيرفرات نقدم لكم اقوي سيرفر 2d | ahmedfathy | اعلانات السيرفيرات الشخصية | 0 | 2019-10-25 11:05 AM |
وداعآ لجميع السيرفرات WolfTeam تعود من جديد | ahmedfathy | اعلانات السيرفيرات الشخصية | 3 | 2019-09-26 04:55 AM |
ازاي تعمل مهمة يوميه زي السيرفرات الكبيره | M.H.B[X-Coder]X | تطوير سيرفرات كونكر | 7 | 2019-07-12 07:55 PM |