|
المشاركات 407 |
+التقييم 0.20 |
تاريخ التسجيل May 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 248 |
using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using PlayConquer.Network;
using PlayConquer.Database;
using PlayConquer.Network.Sockets;
using PlayConquer.Network.AuthPackets;
using PlayConquer.Game;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using PlayConquer.Network.GamePackets;
using PlayConquer.Client;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Threading;
using PlayConquer;
using PlayConquer.Network.GamePackets.Union;
using ProtoBuf;
using PlayConquer.MaTrix;
namespace PlayConquer
{
class Program
{
#region publics
public static Encoding Encoding = ASCIIEncoding.Default;
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
public static int PlayerCap = 1000;
public static bool ALEXPC = false;
public static bool NemesisTyrantSpanwed = false;
public static long MaxOn = 0;
public static long MaxEntitys = 0;
public static ServerSocket[] AuthServer;
public static MemoryCompressor MCompressor = new MemoryCompressor();
public static bool CpuUsageTimer = true;
public static int CpuUse = 0;
public static ServerSocket GameServer;
public static Counter EntityUID;
public static string GameIP;
public static bool SpookAlive = false;
public static DayOfWeek Today;
public static ushort GamePort;
public static ushort AuthPort;
public static DateTime StartDate;
public static bool reseted = false;
public static uint ScreenColor = 0;
public static DateTime RestartDate = DateTime.Now.AddHours(24);
public static bool restarted = false;
public static bool WarEnd = false;
public static bool uniquepk = false;
public static uint mess = 0;
public static World World;
public static Client.GameState[] GamePool = new Client.GameState[0];
public static Client.GameState[] Values = new Client.GameState[0];
public static VariableVault Vars;
public static long WeatherType = 0L;
public static bool TestingMode = false;
public static bool AllTest = false;
public static bool SnowBa = true;
public static bool Vampira = true;
public static bool Nemesiss = true;
public static bool Legendary = true;
public static bool LostMan = true;
public static bool Crap = true;
public static bool Shangi = true;
public static bool DeadMan = true;
public static bool SwordMaster = true;
public static bool TeratoDragon = true;
public static bool Destructive = true;
public static bool SnowSoul = true;
public static int RandomSeed = 0;
public static bool Ares = true;
public static bool ThrillingSpook = true;
public static bool Odin = true;
public static bool Pharaoh = true;
public static bool Zeus = true;
#endregion
#region Translate
public static void SaveTranslate()
{
var file = Environment.CurrentDirectory + "Translate.txt";
if (File.Exists(file))
File.Delete(file);
StreamWriter writer = new StreamWriter(File.Create(file), Encoding);
writer.AutoFlush = true;
foreach (var item in Kernel.Translateed)
writer.WriteLine(item.Key + "@@" + item.Value);
writer.Close();
}
public static void LoadTranslate()
{
var file = Environment.CurrentDirectory + "Translate.txt";
if (File.Exists(file))
{
string[] text = File.ReadAllLines(file, Encoding);
for (int x = 0; x < text.Length; x++)
{
string line = text[x];
string[] split = line.Split(new string[] { "@@" }, StringSplitOptions.RemoveEmptyEntries);
if (split.Length < 1)
continue;
var key = split[0];
if (split.Length < 2)
continue;
var value = split[1];
if (!Kernel.Translateed.ContainsKey(key))
Kernel.Translateed.Add(key, value);
}
}
}
#endregion
#region AddpokerAllinCps
public static void AddpokerAllinCps(string text)
{
try
{
text = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + text;
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\AddpokerAllinCps\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(text);
file.Close();
}
}
catch (Exception ex) { Console.WriteLine(ex); }
}
#endregion
public static void Main(string[] args)
{
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Application_ThreadException);
Time32 Start = Time32.Now;
RandomSeed = Convert.ToInt32(DateTime.Now.Ticks.ToString().Remove(DateTime.Now.Ticks.ToString().Length / 2));
Kernel.Random = new FastRandom(RandomSeed);
StartDate = DateTime.Now;
Console.Title = "EgyArmy-Co"; Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.Red;
System.Console.ForegroundColor = ConsoleColor.Black;
Console.WriteLine(@"+-----------------------------------------------------------------------------+");
Console.WriteLine(@"| EgyArmy-Co :Servers: |");
Console.WriteLine(@"| Fixd:-(BY)CaptinOsama |");
Console.WriteLine(@"| Hard:Server |");
Console.WriteLine(@"| Source:-Fixd |");
Console.WriteLine(@"| MyPhone:-(01554020258) |");
Console.WriteLine(@"| CopyRight (C) 2019 - 2020 |");
Console.WriteLine(@"+-----------------------------------------------------------------------------+");
System.Console.ForegroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Loading server configuration.");
string ConfigFileName = "PlayConquer.ini";
IniFile IniFile = new IniFile(ConfigFileName);
GameIP = IniFile.ReadString("configuration", "IP");
GamePort = IniFile.ReadUInt16("configuration", "GamePort");
AuthPort = IniFile.ReadUInt16("configuration", "AuthPort");
Constants.ServerName = IniFile.ReadString("configuration", "ServerName");
TestingMode = IniFile.ReadString("configuration", "TestMode", "0") == "1" ? true : false;
AllTest = IniFile.ReadString("configuration", "AllTest", "0") == "1" ? true : false;
rates.Load(IniFile);
#region Check IP
String strHostName = System.Net.Dns.GetHostName();
System.Net.IPHostEntry iphostentry = System.Net.Dns.GetHostEntry(strHostName);
List<string> ips = new List<string>();
foreach (var ip in iphostentry.AddressList.Where(ip => ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).ToArray())
{
if (!ips.Contains(ip.ToString()))
ips.Add(ip.ToString());
}
if (!ips.Contains(GameIP))
{
Console.WriteLine("Wrong IP");
Console.WriteLine("Please Choose One from these");
for (int i = 0; i < ips.Count; i++)
{
Console.WriteLine((i + 1) + ". " + ips[i]);
}
var read = System.Console.ReadKey();
int no = 0;
if (int.TryParse(read.KeyChar.ToString(), out no))
{
if (no <= ips.Count)
{
GameIP = ips[no - 1];
IniFile.Write("configuration", "IP", GameIP);
}
}
}
#endregion Check IP
Database.DataHolder.CreateConnection(
IniFile.ReadString("MySql", "Host", "localhost"),
IniFile.ReadString("MySql", "Username", "root"),
IniFile.ReadString("MySql", "Password", "01206157750"),
IniFile.ReadString("MySql", "Database", "osama")
);
EntityUID = new Counter(0);
bool x = false;
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
{
cmd.Select("configuration").Where("Server", Constants.ServerName);
using (MySqlReader r = new MySqlReader(cmd))
{
if (r.Read())
{
EntityUID = new Counter(r.ReadUInt32("EntityID"));
Game.ConquerStructures.Society.Guild.GuildCounter = new PlayConquer.Counter(r.ReadUInt32("GuildID"));
ConquerItem.ItemUID = new Counter(r.ReadUInt32("ItemUID"));
Union.UnionCounter = new Counter(r.ReadUInt32("UnionID"));
Constants.ExtraExperienceRate = r.ReadUInt32("ExperienceRate");
Kernel.ServerKingdom = r.ReadUInt32("ServerKingdom");
Constants.ExtraSpellRate = r.ReadUInt32("ProficiencyExperienceRate");
Constants.ExtraProficiencyRate = r.ReadUInt32("SpellExperienceRate");
Constants.MoneyDropRate = r.ReadUInt32("MoneyDropRate");
Constants.MoneyDropMultiple = r.ReadUInt32("MoneyDropMultiple");
if (r.ReadByte("LastDailySignReset") != DateTime.Now.Month) x = true;
Constants.ConquerPointsDropRate = r.ReadUInt32("ConquerPointsDropRate");
Constants.ConquerPointsDropMultiple = r.ReadUInt32("ConquerPointsDropMultiple");
Constants.ItemDropRate = r.ReadUInt32("ItemDropRate");
Constants.ItemDropQualityRates = r.ReadString("ItemDropQualityString").Split('~');
Constants.WebAccExt = r.ReadString("AccountWebExt");
Constants.WebVoteExt = r.ReadString("VoteWebExt");
Constants.WebDonateExt = r.ReadString("DonateWebExt");
Constants.ServerWebsite = r.ReadString("ServerWebsite");
Constants.ServerGMPass = r.ReadString("ServerGMPass");
PlayerCap = r.ReadInt32("PlayerCap");
Union.UnionCounter = new Counter(r.ReadUInt32("UnionID"));
Database.EntityVariableTable.Load(0, out Vars);
}
}
}
if (EntityUID.Now == 0)
{
Console.Clear();
Console.WriteLine("Database error. Please check your MySQL. Server will now close.");
Console.ReadLine();
return;
}
if (GameIP != GetLocalIPAddress())
{
for (uint i = 0; i < 0x3e8; i += 1)
{
System.Console.Beep();
}
}
else
{
ProjectX_V3_Game.Database.ScriptDatabase.LoadSettings();
ProjectX_V3_Game.Database.ScriptDatabase.LoadNPCScripts();
Console.WriteLine("Loading The Hard Things !!");
Database.helpdesk.LoadRates();
Database.ConquerItemInformation.Load();
Database.ConquerItemTable.ClearNulledItems();
InnerPowerTable.LoadDBInformation();
InnerPowerTable.Load();
PerfectionTable.LoadItemRefineAttribute();
if (x) MsgSignIn.Reset();
PerfectionTable.LoadItemRefineEffect();
PerfectionTable.LoadItemRefineEffectEX();
Database.Flowers.LoadFlowers();
Database.SignInTable.Load();
Database.MonsterInformation.Load();
Database.MapsTable.Load();
PlayConquer.MaTrix.SoulProtection.Load();
Loadspells.LoadSpells();
World = new World();
World.Init();
Map.CreateTimerFactories();
Database.SignInTable.Load();
Database.DMaps.LoadMapPaths();
Database.DMaps.LoadMap(700);
DMaps.LoadMap(2068);
Database.DMaps.LoadMap(3868);
Database.DMaps.LoadMap(3935);
Copra.QuestInfo.Load();
Database.Furniture.Load();
Database.VipTable.LoadAllVips();
Database.SpellTable.Load();
Database.ShopFile.Load();
Database.HonorShop.Load();
Database.RacePointShop.Load();
Database.ChampionShop.Load();
Database.EShopFile.Load();
Database.EShopV2File.Load();
StorageManager.Load();
Database.AddingInformationTable.Load();
Database.LotteryTable.Load();
Copra.Roulette.Database.Roulettes.Load();
Copra.Way2Heroes.Load();
Database.ConquerItemTable.ClearNulledItems();
Refinery.LoadItems();
Values = new Client.GameState[0];
#region Maps
Database.DMaps.LoadMap(700);//Lucky
Database.DMaps.LoadMap(4020);
Database.DMaps.LoadMap(3998);
Database.DMaps.LoadMap(4020);
Database.DMaps.LoadMap(10088);
Database.DMaps.LoadMap(10137);
Database.DMaps.LoadMap(1000);
Database.DMaps.LoadMap(1015);
Database.DMaps.LoadMap(1020);
Database.DMaps.LoadMap(1004);
Database.DMaps.LoadMap(5000);
Database.DMaps.LoadMap(1011);
Database.DMaps.LoadMap(2068);
Database.DMaps.LoadMap(3935);//Realm
Database.DMaps.LoadMap(1730);//Realm
Database.DMaps.LoadMap(3030);
new Map(1002, DMaps.MapPaths[1002]);
new Map(1038, DMaps.MapPaths[1038]);
new Map(2071, DMaps.MapPaths[2071]);
new Map(1509, DMaps.MapPaths[1509]);
new Map(10002, 2021, DMaps.MapPaths[2021]);
new Map(8883, 1004, DMaps.MapPaths[1004]);
new Map(3846, DMaps.MapPaths[3846]);
new Map(1927, DMaps.MapPaths[1927]);
if (DMaps.LoadMap(1038))
if (DMaps.LoadMap(10380))
new Game.Map(1509, Database.DMaps.MapPaths[1509]);
new Game.Map(10002, 2021, Database.DMaps.MapPaths[2021]);
new Game.Map(8883, 1004, Database.DMaps.MapPaths[1004]);
Constants.PKFreeMaps.Add(8883);
if (DMaps.LoadMap(1509))
#endregion
Game.ClanWar.Initiate();
Game.GuildWar.Initiate();
rates.LoadEff();
Game.EliteGuildWar.EliteGwint();
Database.DataHolder.ReadStats();
Database.IPBan.Load();
Database.JiangHu.LoadStatus();
Database.JiangHu.LoadJiangHu();
Database.NobilityTable.Load();
Database.ArenaTable.Load();
Database.TeamArenaTable.Load();
Database.GuildTable.Load();
UnionTable.Load();
MagicTypeOP.Load();
AuctionBase.Load();
Database.ChiTable.LoadAllChi();
StorageManager.Load();
Database.WardrobeTable.Load();
Clan.LoadClans();
FloorItemTable.Load();
new MsgUserAbilityScore().GetRankingList();
new MsgEquipRefineRank().UpdateRanking();
new MsgRankMemberShow().UpdateBestEntity();
Game.Screen.CreateTimerFactories();
Network.Cryptography.AuthCryptography.PrepareAuthCryptography();
World.CreateTournaments();
new MySqlCommand(MySqlCommandType.UPDATE).Update("entities").Set("Online", 0).Execute();
Console.WriteLine("Initializing Sockets.");
ServerSocket AccountServer = new ServerSocket("AccountServer", 60, 50)
{
OnConnect = AuthServer_OnClientConnect,
OnReceive = AuthServer_OnClientReceive,
OnDisconnect = AuthServer_OnClientDisconnect,
ClientBufferSize = 4048
};
AccountServer.Prepare(AuthPort, System.Net.Sockets.IPProtectionLevel.EdgeRestricted);
AccountServer.BeginAccept();
{
ServerSocket MessageServer = new ServerSocket("MessageServer", 60, 50)
{
OnConnect = GameServer_OnClientConnect,
OnReceive = GameServer_OnClientReceive,
OnDisconnect = GameServer_OnClientDisconnect,
ClientBufferSize = 4048
};
MessageServer.Prepare(GamePort, System.Net.Sockets.IPProtectionLevel.EdgeRestricted);
MessageServer.BeginAccept();
Console.WriteLine("Game server online.");
Console.WriteLine("Web server online.");
AI.CreateTimerFactories();
var client = new GameState(null);
client.Entity = new Entity(EntityFlag.Monster, false);
client.Entity.MapID = 1002;
Npcs npc = new Npcs(client);
var req = new NpcRequest();
req.Deserialize(new byte[28]);
Npcs.GetDialog(req, client);
client = null;
Poker.Database.Load();
PlayConquer.Booths.Load();
if (Poker.Database.Tables != null) foreach (Poker.Structures.PokerTable value in Poker.Database.Tables.Values) World.PokerTables.Add(value);
}
Console.WriteLine(@"+-----------------------------------------------------------------------------+");
Console.WriteLine(@"| Welcome:-To:TheFuture ! :) |");
Console.WriteLine(@"+-----------------------------------------------------------------------------+");
Console.Title = "EgyArmy-Co - is Online Now !";
DeshaHandler += DeshaConsole_CloseEvent;
SetConsoleCtrlHandler(DeshaHandler, true);
GC.Collect();
WorkConsole();
}
}
#region Closing Events
private static bool DeshaConsole_CloseEvent(CtrlType sig)
{
Save();
return true;
}
private static Native.ConsoleEventHandler DeshaHandler;
[DllImport("Kernel32")]
private static extern bool SetConsoleCtrlHandler(Native.ConsoleEventHandler handler, bool add);
private delegate bool EventHandler(CtrlType sig);
#endregion
#region Save
public static bool Save(bool Exit = false)
{
try
{
Database.JiangHu.SaveJiangHu();
using (var conn = Database.DataHolder.MySqlConnection)
{
conn.Open();
foreach (Client.GameState client in Program.Values)
{
Database.EntityTable.SaveEntity(client);
Database.SkillTable.SaveProficiencies(client);
Database.SkillTable.SaveSpells(client);
Database.ArenaTable.SaveArenaStatistics(client.ArenaStatistic);
Database.TeamArenaTable.SaveArenaStatistics(client.TeamArenaStatistic);
Database.MailboxTable.Save(client);
}
}
Database.InnerPowerTable.Save();
Database.Flowers.SaveFlowers();
AuctionBase.Save();
Game.ClanWarArena.Save();
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("configuration").Where("Server", Constants.ServerName))
{
using (MySqlReader r = new MySqlReader(cmd))
{
if (r.Read())
{
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ServerKingdom", Kernel.ServerKingdom).Set("GuildID", Game.ConquerStructures.Society.Guild.GuildCounter.Now).Where("Server", Constants.ServerName).Execute();
if (r.ReadByte("LastDailySignReset") != DateTime.Now.Month) MsgSignIn.Reset();
}
}
}
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration"))
cmd.Set("LastDailySignReset", DateTime.Now.Month).Execute();
new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration").Set("ServerKingdom", Kernel.ServerKingdom).Set("ItemUID", ConquerItem.ItemUID.Now).Set("ItemUID", ConquerItem.ItemUID.Next).Where("Server", Constants.ServerName).Execute();
Console.WriteLine("Saving cmd Done.");
if (Exit)
Environment.Exit(0);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
return false;
}
return true;
}
public static string GetLocalIPAddress()
{
var host = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName());
foreach (var ip in host.AddressList)
{
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
return ip.ToString();
}
}
throw new Exception("Local IP Address Not Found!");
}
#endregion
#region Exceptions & Logs
public static void AddVendorLog(String vendor, string buying, string moneyamount, ConquerItem Item)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\VendorLogs\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine("------------------------------------------------------------------------------------");
file.WriteLine("{0} HAS BOUGHT AN ITEM : {2} FROM {1} SHOP - for {3}", vendor, buying, Item.ToLog(), moneyamount);
file.WriteLine("------------------------------------------------------------------------------------");
}
}
public static void addiplog(string Player, string ip)
{
String folderN = Player + DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\Accountsiplog\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(Player + ip);
}
}
public static void banhacks(String name, string prog)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\banhacks\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine("------------------------------------------------------------------------------------");
file.WriteLine("{0} HAS Banned For using prog : {2}", name, prog);
file.WriteLine("------------------------------------------------------------------------------------");
}
}
public static void AddGMCommand(string gm, string commandStr)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\GMCommandsLog\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(gm + commandStr);
}
}
public static void AddTradeLog(PlayConquer.Game.ConquerStructures.Trade first, String firstN, PlayConquer.Game.ConquerStructures.Trade second, String secondN, String firstip, String secondip)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\tradelogs\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine("************************************************************************************");
file.WriteLine("**************************Gived***********************");
file.WriteLine("First Person TradeLog ( {0} ) -", firstN);
file.WriteLine("First Person TradeLog and his ip ( {0} ) -", firstip);
file.WriteLine("Gold Traded: " + first.Money);
file.WriteLine("Conquer Points Traded: " + first.ConquerPoints);
for (int i = 0; i < first.Items.Count; i++)
{
file.WriteLine("------------------------------------------------------------------------------------");
file.WriteLine("Item : " + first.Items[i].ToLog());
if (first.Items[i].item_id / 1000 == 202)
file.WriteLine("Tower ");
if (first.Items[i].item_id / 1000 == 201)
file.WriteLine("Fan ");
if (first.Items[i].item_id / 1000 == 500)
file.WriteLine("Bow ");
if (first.Items[i].item_id / 1000 == 900)
file.WriteLine("Shield ");
if (first.Items[i].item_id / 1000 == 620)
file.WriteLine("EpicBackSword ");
if (first.Items[i].item_id / 1000 == 421)
file.WriteLine("BackSword ");
if (first.Items[i].item_id / 1000 == 410)
file.WriteLine("Blade ");
if (first.Items[i].item_id / 1000 == 204)
file.WriteLine("Wing ");
if (first.Items[i].item_id / 1000 == 420)
file.WriteLine("Sword ");
if (first.Items[i].item_id / 1000 == 601)
file.WriteLine("Katana-Ninja ");
if (first.Items[i].item_id / 1000 == 610)
file.WriteLine("Monk-Beeds ");
if (first.Items[i].item_id / 1000 == 203)
file.WriteLine("Crop ");
if (first.Items[i].item_id / 1000 == 181 || first.Items[i].item_id / 1000 == 182)
file.WriteLine("Germant ");
if (first.Items[i].item_id / 1000 == 2100)
file.WriteLine("Cup ");
if (first.Items[i].item_id / 1000 == 150)
file.WriteLine("Ring ");
if (first.Items[i].item_id / 1000 == 160)
file.WriteLine("Boot");
if (first.Items[i].item_id / 1000 == 200)
file.WriteLine("Mount ");
if (first.Items[i].item_id / 1000 == 120)
file.WriteLine("Necklace ");
if (first.Items[i].item_id / 1000 == 152)
file.WriteLine("Bracelet ");
if (first.Items[i].item_id / 1000 == 350 || first.Items[i].item_id / 1000 == 360 || first.Items[i].item_id / 1000 == 370 || first.Items[i].item_id / 1000 == 380)
file.WriteLine("Accessory ");
if (first.Items[i].item_id / 1000 == 152)
file.WriteLine("Bag ");
if (first.Items[i].item_id / 1000 == 622)
file.WriteLine("EpicMonk ");
if (first.Items[i].item_id / 1000 == 616)
file.WriteLine("EpicNinja ");
if (first.Items[i].item_id / 1000 == 619)
file.WriteLine("Hossu ");
if (first.Items[i].item_id / 1000 == 136)
file.WriteLine("Armor-Monk ");
if (first.Items[i].item_id / 1000 == 138)
file.WriteLine("Armor-Dragonwarrior ");
if (first.Items[i].item_id / 1000 == 139)
file.WriteLine("Armor-Pirate ");
if (first.Items[i].item_id / 1000 == 141)
file.WriteLine("Hat-Warrior ");
if (first.Items[i].item_id / 1000 == 142)
file.WriteLine("Hat-Archer ");
if (first.Items[i].item_id / 1000 == 143)
file.WriteLine("Hat-Monk ");
if (first.Items[i].item_id / 1000 == 144)
file.WriteLine("Hat-Pirate ");
if (first.Items[i].item_id / 1000 == 145)
file.WriteLine("Hat-Pirate ");
if (first.Items[i].item_id / 1000 == 148)
file.WriteLine("Hat-DragonWarrior ");
if (first.Items[i].item_id / 1000 == 170)
file.WriteLine("Hat-WindWalker ");
if (first.Items[i].item_id / 1000 == 142)
file.WriteLine("Hat-Archer ");
if (first.Items[i].item_id / 1000 == 143)
file.WriteLine("Hat-Monk ");
file.WriteLine("------------------------------------------------------------------------------------");
}
file.WriteLine("**************************Gived***********************");
file.WriteLine("Second Person TradeLog ( {0} ) -", secondN);
file.WriteLine("Second Person TradeLog and his ip ( {0} ) -", secondip);
file.WriteLine("Gold Traded: " + second.Money);
file.WriteLine("Conquer Points Traded: " + second.ConquerPoints);
for (int i = 0; i < second.Items.Count; i++)
{
file.WriteLine("------------------------------------------------------------------------------------");
file.WriteLine("Item : " + second.Items[i].ToLog());
if (second.Items[i].item_id / 1000 == 202)
file.WriteLine("Tower ");
if (second.Items[i].item_id / 1000 == 201)
file.WriteLine("Fan ");
if (second.Items[i].item_id / 1000 == 500)
file.WriteLine("Bow ");
if (second.Items[i].item_id / 1000 == 900)
file.WriteLine("Shield ");
if (second.Items[i].item_id / 1000 == 620)
file.WriteLine("EpicBackSword ");
if (second.Items[i].item_id / 1000 == 421)
file.WriteLine("BackSword ");
if (second.Items[i].item_id / 1000 == 410)
file.WriteLine("Blade ");
if (second.Items[i].item_id / 1000 == 204)
file.WriteLine("Wing ");
if (second.Items[i].item_id / 1000 == 420)
file.WriteLine("Sword ");
if (second.Items[i].item_id / 1000 == 601)
file.WriteLine("Katana-Ninja ");
if (second.Items[i].item_id / 1000 == 610)
file.WriteLine("Monk-Beeds ");
if (second.Items[i].item_id / 1000 == 203)
file.WriteLine("Crop ");
if (second.Items[i].item_id / 1000 == 181 || second.Items[i].item_id / 1000 == 182)
file.WriteLine("Germant ");
if (second.Items[i].item_id / 1000 == 2100)
file.WriteLine("Cup ");
if (second.Items[i].item_id / 1000 == 150)
file.WriteLine("Ring ");
if (second.Items[i].item_id / 1000 == 160)
file.WriteLine("Boot");
if (second.Items[i].item_id / 1000 == 200)
file.WriteLine("Mount ");
if (second.Items[i].item_id / 1000 == 120)
file.WriteLine("Necklace ");
if (second.Items[i].item_id / 1000 == 152)
file.WriteLine("Bracelet ");
if (second.Items[i].item_id / 1000 == 350 || second.Items[i].item_id / 1000 == 360 || second.Items[i].item_id / 1000 == 370 || second.Items[i].item_id / 1000 == 380)
file.WriteLine("Accessory ");
if (second.Items[i].item_id / 1000 == 152)
file.WriteLine("Bag ");
if (second.Items[i].item_id / 1000 == 622)
file.WriteLine("EpicMonk ");
if (second.Items[i].item_id / 1000 == 616)
file.WriteLine("EpicNinja ");
if (second.Items[i].item_id / 1000 == 619)
file.WriteLine("Hossu ");
if (second.Items[i].item_id / 1000 == 136)
file.WriteLine("Armor-Monk ");
if (second.Items[i].item_id / 1000 == 138)
file.WriteLine("Armor-Dragonwarrior ");
if (second.Items[i].item_id / 1000 == 139)
file.WriteLine("Armor-Pirate ");
if (second.Items[i].item_id / 1000 == 141)
file.WriteLine("Hat-Warrior ");
if (second.Items[i].item_id / 1000 == 142)
file.WriteLine("Hat-Archer ");
if (second.Items[i].item_id / 1000 == 143)
file.WriteLine("Hat-Monk ");
if (second.Items[i].item_id / 1000 == 144)
file.WriteLine("Hat-Pirate ");
if (second.Items[i].item_id / 1000 == 145)
file.WriteLine("Hat-Pirate ");
if (second.Items[i].item_id / 1000 == 148)
file.WriteLine("Hat-DragonWarrior ");
if (second.Items[i].item_id / 1000 == 170)
file.WriteLine("Hat-WindWalker ");
if (second.Items[i].item_id / 1000 == 142)
file.WriteLine("Hat-Archer ");
if (second.Items[i].item_id / 1000 == 143)
file.WriteLine("Hat-Monk ");
file.WriteLine("------------------------------------------------------------------------------------");
}
file.WriteLine("************************************************************************************");
}
}
public static void RemoveCps(string text)
{
try
{
text = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + text;
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\RemoveCps\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(text);
file.Close();
}
}
catch (Exception ex) { Console.WriteLine(ex); }
}
public static void AddCpsWin(string text)
{
try
{
text = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + text;
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\AddWinCps\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(text);
file.Close();
}
}
catch (Exception ex) { Console.WriteLine(ex); }
}
public static void AddDropLog(String Name, ConquerItem Item)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\droplogs\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
string path = NewPath + "\\" + DateTime.Now.Day + ".txt";
if (!File.Exists(path)) File.AppendAllText(path, "");
string text = "------------------------------------------------------------------------------------"
+ Environment.NewLine + string.Format("Entity {0} HAS DROPPED AN ITEM : {1} -", Name, Item.ToLog())
+ Environment.NewLine + "------------------------------------------------------------------------------------";
File.AppendAllText(path, text);
}
public static void AddTradeLog(Game.ConquerStructures.Trade first, String firstN, Game.ConquerStructures.Trade second, String secondN)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\Tradelogs\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine("************************************************************************************");
file.WriteLine("First Person TradeLog ({0}) -", firstN);
file.WriteLine("Gold Traded: " + first.Money);
file.WriteLine("Conquer Points Traded: " + first.ConquerPoints);
for (int i = 0; i < first.Items.Count; i++)
{
file.WriteLine("------------------------------------------------------------------------------------");
file.WriteLine("Item : " + first.Items[i].ToLog());
file.WriteLine("------------------------------------------------------------------------------------");
}
file.WriteLine("Second Person TradeLog ({0}) -", secondN);
file.WriteLine("Gold Traded: " + second.Money);
file.WriteLine("Conquer Points Traded: " + second.ConquerPoints);
for (int i = 0; i < second.Items.Count; i++)
{
file.WriteLine("------------------------------------------------------------------------------------");
file.WriteLine("Item : " + second.Items[i].ToLog());
file.WriteLine("------------------------------------------------------------------------------------");
}
file.WriteLine("************************************************************************************");
}
}
public static void AddMostafaWarLog(string text)
{
try
{
text = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + text;
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\MostafaWarlogs\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(text);
file.Close();
}
}
catch (Exception ex) { Console.WriteLine(ex); }
}
public static void AddMobLog(string War, string name, uint CPs = 0, uint item = 0)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\MobLogs\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
if (CPs != 0)
file.WriteLine(name + " got " + CPs + " CPs from the [" + War + "] as prize at " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second);
else
file.WriteLine(name + " got " + item + " Item from the [" + War + "] as prize at " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second);
}
}
public static void AddWarLog(string War, string CPs, string name)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\Warlogs\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(name + " got " + CPs + " CPs from the [" + War + "] as prize at " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second);
}
}
static void Application_ThreadException(object sender, UnhandledExceptionEventArgs e)
{
SaveException(e.ExceptionObject as Exception);
}
public static void SaveException(Exception e)
{
Console.WriteLine(e);
var dt = DateTime.Now;
string date = dt.Month + "-" + dt.Day + "//";
if (!Directory.Exists(Application.StartupPath + Constants.UnhandledExceptionsPath))
Directory.CreateDirectory(Application.StartupPath + "\\" + Constants.UnhandledExceptionsPath);
if (!Directory.Exists(Application.StartupPath + "\\" + Constants.UnhandledExceptionsPath + date))
Directory.CreateDirectory(Application.StartupPath + "\\" + Constants.UnhandledExceptionsPath + date);
if (!Directory.Exists(Application.StartupPath + "\\" + Constants.UnhandledExceptionsPath + date + e.TargetSite.Name))
Directory.CreateDirectory(Application.StartupPath + "\\" + Constants.UnhandledExceptionsPath + date + e.TargetSite.Name);
string fullPath = Application.StartupPath + "\\" + Constants.UnhandledExceptionsPath + date + e.TargetSite.Name + "\\";
string date2 = dt.Hour + "-" + dt.Minute;
List<string> Lines = new List<string>();
Lines.Add("----Exception message----");
Lines.Add(e.Message);
Lines.Add("----End of exception message----\r\n");
Lines.Add("----Stack trace----");
Lines.Add(e.StackTrace);
Lines.Add("----End of stack trace----\r\n");
//Lines.Add("----Data from exception----");
//foreach (KeyValuePair<object, object> data in e.Data)
// Lines.Add(data.Key.ToString() + "->" + data.Value.ToString());
//Lines.Add("----End of data from exception----\r\n");
File.WriteAllLines(fullPath + date2 + ".txt", Lines.ToArray());
}
public static void AddpokerCps(string text)
{
try
{
text = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + text;
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\AddpokerCps\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(text);
file.Close();
}
}
catch (Exception ex) { Console.WriteLine(ex); }
}
public static void AddpokerMoney(string text)
{
try
{
text = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" + text;
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\AddpokerMoney\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine(text);
file.Close();
}
}
catch (Exception ex) { Console.WriteLine(ex); }
}
public static void hacker(string Spell, string War, string name)
{
String folderN = DateTime.Now.Year + "-" + DateTime.Now.Month,
Path = "gmlogs\\hackers\\SpellTime\\",
NewPath = System.IO.Path.Combine(Path, folderN);
if (!File.Exists(NewPath + folderN))
{
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(Path, folderN));
}
if (!File.Exists(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
using (System.IO.FileStream fs = System.IO.File.Create(NewPath + "\\" + DateTime.Now.Day + ".txt"))
{
fs.Close();
}
}
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath + "\\" + DateTime.Now.Day + ".txt", true))
{
file.WriteLine("[" + name + "] Hack " + Spell + " Spell No Time wait in Time [" + DateTime.Now.Hour + " :" + DateTime.Now.Minute + ":" + DateTime.Now.Second + "]");
}
}
#endregion
private static void WorkConsole()
{
while (true)
{
try
{
CommandsAI(Console.ReadLine());
}
catch (Exception e) { Console.WriteLine(e); }
}
}
public static DateTime LastRandomReset = DateTime.Now;
public static Network.GamePackets.BlackSpotPacket BlackSpotPacket = new Network.GamePackets.BlackSpotPacket();
public static bool MyPC = true;
#region Commands
public static void CommandsAI(string command)
{
try
{
if (command == null)
return;
string[] data = command.Split(' ');
switch (data[0])
{
case "@testmode":
{
if (TestingMode)
{
TestingMode = false;
Console.WriteLine("Test Mode Off");
}
else
{
TestingMode = true;
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { "Server will exit for 5 min to fix some bugs, please be paitent" }), System.Drawing.Color.Black, 0x7db), Program.Values);
CommandsAI("@save");
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Database.EntityVariableTable.Save(0, Vars);
var WC = Program.Values.ToArray();
foreach (Client.GameState client in WC)
{
if (client.Account.State != AccountTable.AccountState.ProjectManager)
{
client.Send("Server will exit for 5 min to fix some bugs, please be paitent !");
client.Disconnect();
}
}
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Console.WriteLine("Test Mode On");
}
break;
}
case "@reloadnpc":
{
World.ScriptEngine.Check_Updates();
Console.WriteLine("New System's Npc Reloaded.");
break;
}
case "@clear":
{
Console.Clear();
PlayConquer.Console.WriteLine("Consle and program Cleared ");
break;
}
case "@Copra":
case "@EgyArmy":
PlayConquer.Console.WriteLine("Server EgyArmy[Eg] will restart after 5 minutes.");
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 5 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 4 minute 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 4 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 3 minute 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 3 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 2 minute 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 2 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 1 minute 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 1 minute, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The server will be brought down for maintenance in 30 second, Please exit the game now.", System.Drawing.Color.Orange, 0x7db), Program.Values);
PlayConquer.Console.WriteLine("Server EgyArmy[Eg] will exit after 1 minute.");
CommandsAI("@save");
System.Threading.Thread.Sleep(0x7530);
Kernel.SendWorldMessage(new PlayConquer.Network.GamePackets.Message("The Server restarted, Please log in after 5 minutes ", System.Drawing.Color.Orange, 0x7db), Program.Values);
try
{
CommandsAI("@restart");
}
catch
{
PlayConquer.Console.WriteLine("Server cannot exit");
}
break;
case "@flushbans":
{
Database.IPBan.Load();
break;
}
case "@alivetime":
{
DateTime now = DateTime.Now;
TimeSpan t2 = new TimeSpan(StartDate.ToBinary());
TimeSpan t1 = new TimeSpan(now.ToBinary());
Console.WriteLine("The server has been online for " + (int)(t1.TotalHours - t2.TotalHours) + " hours, " + (int)((t1.TotalMinutes - t2.TotalMinutes) % 1) + " minutes.");
break;
}
case "@online":
{
Console.WriteLine("Online Entitys count: " + Kernel.GamePool.Count);
string line = "";
foreach (Client.GameState pClient in Program.Values)
line += pClient.Entity.Name + ",";
if (line != "")
{
line = line.Remove(line.Length - 1);
Console.WriteLine("Online Players: " + line);
}
break;
}
case "@memoryusage":
{
var proc = System.Diagnostics.Process.GetCurrentProcess();
Console.WriteLine("Thread count: " + proc.Threads.Count);
Console.WriteLine("Memory set(MB): " + ((double)((double)proc.WorkingSet64 / 1024)) / 1024);
proc.Close();
break;
}
case "@save":
{
SaveTranslate();
Save();
}
break;
case "@PlayerCap":
{
try
{
PlayerCap = int.Parse(data[1]);
}
catch
{
}
break;
}
case "@skill":
{
Game.Features.Tournaments.TeamElitePk.SkillTeamTournament.Open();
foreach (var clien in Kernel.GamePool.Values)
{
if (clien.Team == null)
clien.Team = new Game.ConquerStructures.Team(clien);
Game.Features.Tournaments.TeamElitePk.SkillTeamTournament.Join(clien, 3);
}
break;
}
case "@team":
{
Game.Features.Tournaments.TeamElitePk.TeamTournament.Open();
foreach (var clien in Kernel.GamePool.Values)
{
if (clien.Team == null)
clien.Team = new Game.ConquerStructures.Team(clien);
Game.Features.Tournaments.TeamElitePk.TeamTournament.Join(clien, 3);
}
break;
}
case "@exit":
{
CommandsAI("@save");
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Database.EntityVariableTable.Save(0, Vars);
var WC = Program.Values.ToArray();
Parallel.ForEach(Program.Values, client =>
{
client.Send(" Server will exit for 5 min to Solve The Problem, please be paitent ");
client.Disconnect();
});
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { " Server will exit for 5 min to Solve The Problem, please be paitent " }), System.Drawing.Color.White, 0x7db), Program.Values);
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Environment.Exit(0);
}
break;
case "serverpass":
{
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
{
cmd.Select("configuration").Where("Server", Constants.ServerName);
using (MySqlReader r = new MySqlReader(cmd))
{
if (r.Read())
Constants.ServerGMPass = r.ReadString("ServerGMPass");
}
}
break;
}
case "@pressure":
{
Console.WriteLine("Genr: " + World.GenericThreadPool.ToString());
Console.WriteLine("Send: " + World.SendPool.ToString());
Console.WriteLine("Recv: " + World.ReceivePool.ToString());
break;
}
case "@restart":
{
try
{
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { "Server Will Be Restart Now !" }), System.Drawing.Color.White, 0x7db), Program.Values);
CommandsAI("@save");
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
var WC = Program.Values.ToArray();
foreach (Client.GameState client in WC)
{
client.Send(" Server Will Be Restart Now ");
client.Disconnect();
}
/*GameServer.Disable();
for (int i = 0; i < AuthServer.Length; i++)
{
AuthServer[i].Disable();
}*/
if (GuildWar.IsWar)
GuildWar.End();
new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("ItemUID", ConquerItem.ItemUID.Now).Where("Server", Constants.ServerName).Execute();
Application.Restart();
Environment.Exit(0);
}
catch (Exception e)
{
Console.WriteLine(e);
Console.ReadLine();
}
}
break;
case "@account":
{
Database.AccountTable account = new AccountTable(data[1]);
account.Password = data[2];
account.State = AccountTable.AccountState.Entity;
account.Save();
}
break;
case "@process":
{
HandleClipboardPacket(command);
break;
}
case "@acp":
{
Controlpanel cp = new Controlpanel();
cp.ShowDialog();
break;
}
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
#endregion
public static void WriteLine(string Line)
{
try
{
Console.WriteLine(Line);
}
catch { }
}
public static void HandleClipboardPacket(string cmd)
{
string[] pData = cmd.Split(' ');
long off = 0, type = 0, val = 0;
if (pData.Length > 1)
{
string[] oData = pData[1].Split(':');
if (oData.Length == 3)
{
off = long.Parse(oData[0]);
type = long.Parse(oData[1]);
if (oData[2] == "u")
val = 1337;
else
val = long.Parse(oData[2]);
}
}
string Data = OSClipboard.GetText();
string[] num = Data.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
byte[] packet = new byte[num.Length + 8];
for (int i = 0; i < num.Length; i++)
packet[i] = byte.Parse(num[i], System.Globalization.NumberStyles.HexNumber);
Writer.WriteUInt16((ushort)(packet.Length - 8), 0, packet);
if (off != 0)
{
switch (type)
{
case 1:
{
packet[(int)off] = (byte)val;
break;
}
case 2:
{
Writer.WriteUInt16((ushort)val, (int)off, packet);
break;
}
case 4:
{
Writer.WriteUInt32((uint)val, (int)off, packet);
break;
}
case 8:
{
Writer.WriteUInt64((ulong)val, (int)off, packet);
break;
}
}
}
foreach (var client in Program.Values)
{
if (val == 1337 && type == 4)
Writer.WriteUInt32(client.Entity.UID, (int)off, packet);
client.Send(packet);
}
}
#region AutchServer
static void GameServer_OnClientReceive(byte[] buffer, int length, ClientWrapper obj)
{
if (obj.Connector == null)
{
obj.Disconnect();
return;
}
Client.GameState Client = obj.Connector as Client.GameState;
if (Client.Exchange)
{
Client.Exchange = false;
Client.Action = 1;
var crypto = new Network.Cryptography.GameCryptography(System.Text.Encoding.Default.GetBytes(Constants.GameCryptographyKey));
byte[] otherData = new byte[length];
Array.Copy(buffer, otherData, length);
crypto.Decrypt(otherData, length);
bool extra = false;
int pos = 0;
if (BitConverter.ToInt32(otherData, length - 140) == 128)//no extra packet
{
pos = length - 140;
Client.Cryptography.Decrypt(buffer, length);
}
else if (BitConverter.ToInt32(otherData, length - 176) == 128)//extra packet
{
pos = length - 176;
extra = true;
Client.Cryptography.Decrypt(buffer, length - 36);
}
int len = BitConverter.ToInt32(buffer, pos); pos += 4;
if (len != 128)
{
Client.Disconnect();
return;
}
byte[] pubKey = new byte[128];
for (int x = 0; x < len; x++, pos++) pubKey[x] = buffer[pos];
string PubKey = System.Text.Encoding.Default.GetString(pubKey);
Client.Cryptography = Client.DHKeyExchange.HandleClientKeyPacket(PubKey, Client.Cryptography);
if (extra)
{
byte[] data = new byte[36];
Buffer.BlockCopy(buffer, length - 36, data, 0, 36);
processData(data, 36, Client);
}
}
else
{
processData(buffer, length, Client);
}
}
private static void processData(byte[] buffer, int length, Client.GameState Client)
{
Client.Cryptography.Decrypt(buffer, length);
Client.Queue.Enqueue(buffer, length);
if (Client.Queue.CurrentLength > 1224)
{
Console.WriteLine("[Disconnect]Reason:The packet size is too big. " + Client.Queue.CurrentLength);
Client.Disconnect();
return;
}
while (Client.Queue.CanDequeue())
{
byte[] data = Client.Queue.Dequeue();
Network.PacketHandler.HandlePacket(data, Client);
}
}
static void GameServer_OnClientConnect(ClientWrapper obj)
{
Client.GameState client = new Client.GameState(obj);
client.Send(client.DHKeyExchange.CreateServerKeyPacket());
obj.Connector = client;
}
static void GameServer_OnClientDisconnect(ClientWrapper obj)
{
if (obj.Connector != null)
(obj.Connector as Client.GameState).Disconnect();
else
obj.Disconnect();
}
static void AuthServer_OnClientReceive(byte[] buffer, int length, ClientWrapper arg3)
{
var Entity = arg3.Connector as Client.AuthClient;
Entity.Cryptographer.Decrypt(buffer, length);
Entity.Queue.Enqueue(buffer, length);
while (Entity.Queue.CanDequeue())
{
byte[] packet = Entity.Queue.Dequeue();
ushort len = BitConverter.ToUInt16(packet, 0);
ushort id = BitConverter.ToUInt16(packet, 2);
if (len == 312)
{
Entity.Info = new Authentication();
Entity.Info.Deserialize(packet);
Entity.Account = new AccountTable(Entity.Info.Username);
msvcrt.msvcrt.srand(Entity.PasswordSeed);
Forward Fw = new Forward();
if (Entity.Account.Password == Entity.Info.Password && Entity.Account.exists)
Fw.Type = Forward.ForwardType.Ready;
else
Fw.Type = Forward.ForwardType.InvalidInfo;
if (IPBan.IsBanned(arg3.IP))
{
Fw.Type = Forward.ForwardType.Banned;
Entity.Send(Fw);
return;
}
if (Fw.Type == Network.AuthPackets.Forward.ForwardType.Ready)
{
Fw.Identifier = Entity.Account.GenerateKey();
Kernel.AwaitingPool[Fw.Identifier] = Entity.Account;
Fw.IP = GameIP;
Fw.Port = GamePort;
}
Entity.Send(Fw);
}
}
}
static void AuthServer_OnClientDisconnect(ClientWrapper obj)
{
obj.Disconnect();
}
static void AuthServer_OnClientConnect(ClientWrapper obj)
{
Client.AuthClient authState;
obj.Connector = (authState = new Client.AuthClient(obj));
authState.Cryptographer = new Network.Cryptography.AuthCryptography();
Network.AuthPackets.PasswordCryptographySeed pcs = new PasswordCryptographySeed();
pcs.Seed = Kernel.Random.Next();
authState.PasswordSeed = pcs.Seed;
authState.Send(pcs);
}
internal static Client.GameState FindClient(string name)
{
return Values.FirstOrDefault(p => p.Entity.Name == name);
}
#endregion
#region Copra Style
static bool thistime = false;
private static void CopraStep(int width, int height, int[] y, int[] l)
{
int x;
thistime = !thistime;
for (x = 0; x < width; ++x)
{
if (x % 11 == 10)
{
if (!thistime)
continue;
System.Console.ForegroundColor = System.ConsoleColor.Black;
}
else
{
System.Console.ForegroundColor = System.ConsoleColor.Black;
System.Console.SetCursorPosition(x, inBoxY(y[x] - 2 - (l[x] / 40 * 2), height));
System.Console.Write(R);
System.Console.ForegroundColor = System.ConsoleColor.Black;
}
System.Console.SetCursorPosition(x, y[x]);
System.Console.Write(R);
y[x] = inBoxY(y[x] + 1, height);
System.Console.SetCursorPosition(x, inBoxY(y[x] - l[x], height));
System.Console.Write(' ');
}
}
private static void Initialize(out int width, out int height, out int[] y, out int[] l)
{
int h1;
int h2 = (h1 = (height = System.Console.WindowHeight) / 2) / 2;
width = System.Console.WindowWidth - 1;
y = new int[width];
l = new int[width];
int x;
System.Console.Clear();
for (x = 0; x < width; ++x)
{
y[x] = r.Next(height);
l[x] = r.Next(h2 * ((x % 11 != 10) ? 2 : 1), h1 * ((x % 11 != 10) ? 2 : 1));
}
}
static Random r = new Random();
public static DateTime KingsTime;
static char R
{
get
{
int t = r.Next(10);
if (t <= 2)
return (char)('0' + r.Next(10));
else if (t <= 4)
return (char)('a' + r.Next(27));
else if (t <= 6)
return (char)('A' + r.Next(27));
else
return (char)(r.Next(32, 255));
}
}
public static int inBoxY(int n, int height)
{
n = n % height;
if (n < 0)
return n + height;
else
return n;
}
#endregion Copra Style
internal static void WriteLine(string p, ushort MsgId, short p_2)
{
throw new NotImplementedException();
}
public static int Carnaval { get; set; }
public static int Carnaval2 { get; set; }
public static int Carnaval3 { get; set; }
public static uint NextItemID { get; set; }
}
#region Copra_Times
public class Copra_Times
{
public static DateTime now
{
get
{
return DateTime.Now;
}
}
public class Start
{
public static bool EliteGW
{
get
{
return (now.Hour == 22 );
}
}
public static bool CTF
{
get
{
return (now.Hour == 19 && now.Minute >= 0);
}
}
public static bool NobiltyWarPole
{
get
{
return (now.Hour == 6 && now.Minute == 10);
}
}
public static bool StatuesWar
{
get
{
return (now.Hour == 20 && now.Minute == 10);
}
}
public static bool GuildScoreWar
{
get
{
return (now.Hour == 12 && now.Minute == 0) || (now.Hour == 22 && now.Minute == 0);
}
}
public static bool ClassWar
{
get
{
return (now.Hour == 21 && now.Minute == 10);
}
}
public static bool HeroOfGame
{
get
{
return (now.Hour == 07 && now.Minute == 05);
}
}
public static int hunterthief = 42;
public static int dashbash = 46;
public static int chase = 45;
public static int dizzy = 49;
public static bool Nobilty
{
get
{
return now.Minute >= 20 && now.Minute <= 24;
}
}
}
public class End
{
public static bool FBSS
{
get
{
return now.Minute >= 28;
}
}
public static int hunterthief = 45;
public static int dashbash = 48;
public static bool Cyclone
{
get
{
return now.Minute == 29;
}
}
public static int chase = 45;
public static int dizzy2 = 50;
public static bool Nobilty
{
get
{
return now.Minute >= 25;
}
}
public static bool EliteGW
{
get
{
return now.Hour == 19;
}
}
public static bool ClanWar
{
get
{
return now.Hour == 15;
}
}
}
}
#endregion
#region rates
public class rates
{
public static uint GuildWar;
public static uint ChangeName;
public static uint king;
public static uint prince;
public static uint EliteGw;
public static uint SkillTeam1;
public static uint SkillTeam2;
public static uint SkillTeam3;
public static uint SkillTeam4;
public static uint WeeklyPk;
public static uint topguild;
public static uint mrconquer;
public static uint uniquepk;
public static uint Portals;
public static uint heroofgame;
public static uint NobilityPrize;
public static uint lastman;
public static uint Daily;
public static uint fbss;
public static uint Poles;
public static uint Clanwarday;
public static uint soulp6;
public static uint soulp7;
public static uint changebody;
public static uint ref6;
public static uint Twar;
public static uint stwar;
public static uint ctf;
public static uint cps;
public static uint ClanwarCity;
public static uint ClassPk;
public static uint DeathMatchs;
public static uint lobby;
public static uint hunter;
public static uint thief;
public static uint housepromete;
public static uint itembox;
public static uint houseupgrade;
public static uint MonthlyPk;
public static uint TopSpouse;
public static uint Bosses;
public static uint Night;
public static uint Broadcast;
public static uint GuildFee;
public static uint TeleportFee;
public static uint DragonBall;
public static uint Meteor;
public static string VoteUrl;
public static string coder = "PlayConquer";
public static uint Reincarnation;
public static uint donationrate;
public static string servername { get { return Constants.ServerName; } }
#endregion
#region LoadRates
public static void Load(IniFile IniFile)
{
DragonBall = IniFile.ReadUInt32("Rates", "DragonBall");
Meteor = IniFile.ReadUInt32("Rates", "Meteor");
GuildWar = IniFile.ReadUInt32("Rates", "GuildWar");
EliteGw = IniFile.ReadUInt32("Rates", "questday");
Bosses = IniFile.ReadUInt32("Rates", "Bosses");
Broadcast = IniFile.ReadUInt32("Rates", "Broadcast");
TeleportFee = IniFile.ReadUInt32("Rates", "TeleportFee");
GuildFee = IniFile.ReadUInt32("Rates", "GuildFee");
king = IniFile.ReadUInt32("Rates", "king");
prince = IniFile.ReadUInt32("Rates", "prince");
Reincarnation = IniFile.ReadUInt32("Rates", "Reincarnation");
MonthlyPk = IniFile.ReadUInt32("Rates", "MonthlyPk");
TopSpouse = IniFile.ReadUInt32("Rates", "TopSpouse");
ChangeName = IniFile.ReadUInt32("Rates", "ChangeName");
housepromete = IniFile.ReadUInt32("Rates", "housepromete");
itembox = IniFile.ReadUInt32("Rates", "itembox");
Night = IniFile.ReadUInt32("Rates", "Night");
VoteUrl = IniFile.ReadString("Rates", "VoteUrl");
Portals = IniFile.ReadUInt32("Rates", "Portals");
coder = IniFile.ReadString("Rates", "coder");
SkillTeam1 = IniFile.ReadUInt32("Rates", "SkillTeam1");
SkillTeam2 = IniFile.ReadUInt32("Rates", "SkillTeam2");
SkillTeam3 = IniFile.ReadUInt32("Rates", "SkillTeam3");
SkillTeam4 = IniFile.ReadUInt32("Rates", "SkillTeam4");
soulp6 = IniFile.ReadUInt32("Rates", "soulp6");
soulp7 = IniFile.ReadUInt32("Rates", "soulp7");
ref6 = IniFile.ReadUInt32("Rates", "ref6");
changebody = IniFile.ReadUInt32("Rates", "changebody");
uniquepk = IniFile.ReadUInt32("Rates", "uniquepk");
WeeklyPk = IniFile.ReadUInt32("Rates", "WeeklyPk");
fbss = IniFile.ReadUInt32("Rates", "fbss");
Poles = IniFile.ReadUInt32("Rates", "Poles");
Clanwarday = IniFile.ReadUInt32("Rates", "Clanwarday");
lastman = IniFile.ReadUInt32("Rates", "lastman");
Daily = IniFile.ReadUInt32("Rates", "Daily");
topguild = IniFile.ReadUInt32("Rates", "topguild");
mrconquer = IniFile.ReadUInt32("Rates", "mrconquer");
NobilityPrize = IniFile.ReadUInt32("Rates", "NobilityPrize");
heroofgame = IniFile.ReadUInt32("Rates", "heroofgame");
Twar = IniFile.ReadUInt32("Rates", "Twar");
stwar = IniFile.ReadUInt32("Rates", "stwar");
ctf = IniFile.ReadUInt32("Rates", "ctf");
cps = IniFile.ReadUInt32("Rates", "cps");
ClanwarCity = IniFile.ReadUInt32("Rates", "ClanwarCity");
ClassPk = IniFile.ReadUInt32("Rates", "ClassPk");
DeathMatchs = IniFile.ReadUInt32("Rates", "DeathMatchs");
lobby = IniFile.ReadUInt32("Rates", "lobby");
hunter = IniFile.ReadUInt32("Rates", "hunter");
thief = IniFile.ReadUInt32("Rates", "thief");
donationrate = IniFile.ReadUInt32("Rates", "donationrate");
}
#endregion
public static Dictionary<int, RefineEffect> ItemsRefineEffects = new Dictionary<int, RefineEffect>();
#region LoadEff
public static void LoadEff()
{
ItemsRefineEffects = new Dictionary<int, RefineEffect>();
using (var memoryStream = new MemoryStream(File.ReadAllBytes(Constants.refine_effect)))
{
using (var streamReader = new StreamReader(memoryStream))
{
var line = string.Empty;
while (!string.IsNullOrEmpty(line = streamReader.ReadLine()))
{
var spliter = line.Split(new string[] { "@@" }, System.StringSplitOptions.RemoveEmptyEntries).ToArray();
if (spliter.Length < 21)
continue;
var refineEffect = new RefineEffect();
refineEffect.Id = int.Parse(spliter[0]);
refineEffect.PhysicalAttack = int.Parse(spliter[1]);
refineEffect.PhysicalDefense = int.Parse(spliter[2]);
refineEffect.MagicAttack = int.Parse(spliter[3]);
refineEffect.MagicDefense = int.Parse(spliter[4]);
refineEffect.ToxinEraserLevel = int.Parse(spliter[5]) % 1;
refineEffect.StrikeLockLevel = int.Parse(spliter[6]) % 1;
refineEffect.LuckyStrike = int.Parse(spliter[7]) % 1;
refineEffect.CalmWind = int.Parse(spliter[8]) % 1;
refineEffect.DrainingTouch = int.Parse(spliter[9]) % 1;
refineEffect.BloodSpawn = int.Parse(spliter[10]) % 1;
refineEffect.LightOfStamina = int.Parse(spliter[11]) % 1;
refineEffect.ShiledBreak = int.Parse(spliter[12]) % 1;
refineEffect.KillingFlash = int.Parse(spliter[13]) % 1;
refineEffect.MirrorOfSin = int.Parse(spliter[14]) % 1;
refineEffect.DivineGuard = int.Parse(spliter[15]) % 1;
refineEffect.CoreStrike = int.Parse(spliter[16]) % 1;
refineEffect.InvisableArrow = int.Parse(spliter[17]) % 1;
refineEffect.FreeSoul = int.Parse(spliter[18]) % 1;
refineEffect.StraightLife = int.Parse(spliter[19]) % 1;
refineEffect.AbsoluteLuck = int.Parse(spliter[20]) % 1;
ItemsRefineEffects.Add(refineEffect.Id, refineEffect);
}
}
}
}
#endregion
#region DoEffects
public static void DoEffects(Game.Entity attacker, Game.Entity attacked, Attack attack, ref uint damage)
{
if (attacker.Perfection != null && attacked != null)
{
var canDO = attacked.Perfection == null || attacked.Owner == null
|| attacked.Owner.Equipment == null ? true : attacker.Owner.Equipment.GetTPL > attacked.Owner.Equipment.GetTPL;
if (canDO)
{
if (attacker.ToxicFogPercent > 0 && Success(attacker.Perfection.ToxinEraserLevel))
{
attacker.ToxicFogPercent /= 2;
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.ToxinEraserLevel), true);
}
else if (Success(attacker.Perfection.LuckyStrike))
{
damage *= 2;
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.LuckyStrike), true);
}
else if (Success(attacker.Perfection.LightOfStamina))
{
byte limit = 0;
if (attacker.HeavenBlessing > 0)
limit = 50;
attacker.Stamina = (byte)(100 + limit);
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.LightOfStamina), true);
}
else if (Success(attacker.Perfection.AbsoluteLuck))
{
damage *= 2;
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.AbsoluteLuck), true);
}
else if (Success(attacker.Perfection.BloodSpawn))
{
attacker.Hitpoints = attacker.MaxHitpoints;
attacker.Mana = attacker.MaxMana;
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.BloodSpawn), true);
}
else if (Success(attacker.Perfection.CalmWind))
{
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.CalmWind), true);
}
else if (Success(attacker.Perfection.LuckyStrike))
{
damage *= 2;
attack.Damage = damage;
Network.Writer.WriteUInt16((ushort)(1 << 10), 36, attack.ToArray());
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.LuckyStrike), true);
return;
}
else if (Success(attacker.Perfection.CoreStrike))
{
damage += ((uint)(attacker.MagicDamageIncrease - attacked.Immunity) * 100);
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.CoreStrike), true);
}
else if (attacked.Perfection != null && Success(attacked.Perfection.DivineGuard))
{
damage -= ((uint)(attacker.Defence * 5) / 100);
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UID, RefineEffects.DivineGuard), true);
}
else if (Success(attacker.Perfection.DrainingTouch))
{
if (Success(80))
{
attacker.Hitpoints = attacker.MaxHitpoints;
attacker.Mana = attacker.MaxMana;
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.DrainingTouch), true);
}
}
else if (attacked.Perfection != null && Success(attacked.Perfection.FreeSoul))
{
if (attacked.ShackleTime > 0)
{
attacked.ShackleTime = 0;
attacked.RemoveFlag2((ulong)Network.GamePackets.Update.Flags2.SoulShackle);
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UID, RefineEffects.FreeSoul), true);
}
}
else if (Success(attacker.Perfection.InvisableArrow))
{
damage += ((uint)(attacker.MagicAttack * 5) / 100);
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.InvisbleArrow), true);
}
else if (Success(attacker.Perfection.KillingFlash))
{
attacker.Experience += attacker.Level >= 140 ? 0 : ((uint)(attacker.Experience * 5) / 100);
attacker.Owner.SendScreen(new CMsgRefineEffect(attacker.UID, RefineEffects.KillingFlash), true);
}
else if (attacked.Perfection != null && Success(attacked.Perfection.MirrorOfSin))
{
attacked.Experience += attacked.Level >= 140 ? 0 : ((uint)(attacked.Experience * 5) / 100);
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UID, RefineEffects.MirrorOfSin), true);
}
else if (attacked.Perfection != null && Success(attacked.Perfection.StraightLife))
{
if (attacked.Dead)
{
attacked.BringToLife();
attacked.Owner.SendScreen(new CMsgRefineEffect(attacked.UID, RefineEffects.ShiledBreak), true);
}
}
}
}
}
private static bool Success(int percent)
{
if (percent == 0) return false;
double value = percent / 8;
return Kernel.ChanceSuccess(value);
}
public class RefineEffect
{
public int Id;
public int PhysicalAttack;
public int PhysicalDefense;
public int MagicAttack;
public int MagicDefense;
public int ToxinEraserLevel;
public int StrikeLockLevel;
public int LuckyStrike;
public int CalmWind;
public int DrainingTouch;
public int BloodSpawn;
public int LightOfStamina;
public int ShiledBreak;
public int KillingFlash;
public int MirrorOfSin;
public int DivineGuard;
public int CoreStrike;
public int InvisableArrow;
public int FreeSoul;
public int StraightLife;
public int AbsoluteLuck;
}
}
public class CMsgRefineEffect
{
private byte[] _packet;
public CMsgRefineEffect(uint UserId, RefineEffects refineEffect)
{
_packet = FinalizeProtoBuf(new RefineEffectProto() { Id = UserId, dwParam = 0, Effect = refineEffect });
}
private static byte[] FinalizeProtoBuf(RefineEffectProto coatStorageArgs)
{
using (var memoryStream = new MemoryStream())
{
Serializer.SerializeWithLengthPrefix(memoryStream, coatStorageArgs, PrefixStyle.Fixed32);
var pkt = new byte[8 + memoryStream.Length];
memoryStream.ToArray().CopyTo(pkt, 0);
Writer.WriteUshort((ushort)memoryStream.Length, 0, pkt);
Writer.WriteUshort(3254, 2, pkt);
return pkt;
}
}
#endregion
public static implicit operator byte[](CMsgRefineEffect effect)
{
return effect._packet;
}
}
[ProtoContract]
public class RefineEffectProto
{
[ProtoMember(1, IsRequired = true)]
public uint Id;
[ProtoMember(2, IsRequired = true)]
public int dwParam;
[ProtoMember(3, IsRequired = true)]
public RefineEffects Effect;
}
public enum RefineEffects
{
ToxinEraserLevel,
StrikeLockLevel,
LuckyStrike,
CalmWind,
DrainingTouch,
BloodSpawn,
LightOfStamina,
ShiledBreak,
KillingFlash,
MirrorOfSin,
DivineGuard,
CoreStrike,
InvisbleArrow,
FreeSoul,
StraightLife,
AbsoluteLuck
}
}
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
سورس PlayConquer | ElSaher | سورسات كونكر | 223 | 2024-10-15 02:18 PM |
سورس PlayConquer بعد تعديلاات كتيرة اوى واضفات وحل مشاكل | osama | سورسات كونكر | 205 | 2024-10-09 05:55 PM |
مشكله في تشغيل سورس اليكس | AliNasser | مشكلات السيرفيرات كونكر الشخصيه | 2 | 2021-08-12 12:38 AM |
مشكله فى تشغيل سورس Rayzo | RevKing | مشكلات السيرفيرات كونكر الشخصيه | 17 | 2019-07-01 01:06 AM |
مشكله بسيطه في تشغيل سورس حازم ممكن مساعده | AliNasser | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2019-06-01 06:08 PM |