المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : حرب PoleDomntaion مقدمه من HassanEmprator ليكو احبايبي <3


Hassan Emprator
2020-02-20, 03:22 AM
سلام عليكم الفكره دي اولا شوفتها في كام سورسات ززي الاعاب الكبيهر وشوفتها في لعهب اسمها توب كونكر يعني فا كان نفسي جامد في الكويسته دي لغايه اما خت قرار اني اكودها وكودتها الحمد لله

وقررت اني انزلهالكو عشان تلاقو كل حاجه free احبايبي :D:D:D

يله نبدا واحده واحده معايا يض تمام

هتعمل كللاس وهتسميه

PoleDomination


وتضيف فيه

// Created By HassanEmprator(HasssanHany)
// please dont change my information
// Have Fun <3
// 01009045798




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MrHassan.Network.GamePackets;
using MrHassan.Client;


namespace MrHassan.Game
{
using Coordinate = Tuple<ushort, ushort, ushort>;
using System.Drawing;
using MrHassan.Game.ConquerStructures.Society;
using MySql.Data.MySqlClient;
using System.Collections.Concurrent;
using System.IO;

public class PoleDomination
{
public const uint MaxHitPoints = 30000000;
private SobNpcSpawn Pole = new SobNpcSpawn()
{
Hitpoints = MaxHitPoints,
MaxHitpoints = MaxHitPoints,
Mesh = 1137,
ShowName = true,
Type = (Enums.NpcType)10,
Name = "FlameLotus-Pole",
Sort = 21,
UID = 123456
};

private IDisposable Subscriber;
private Coordinate[] Locations = new[]
{
new Coordinate(1002, 402, 255),
new Coordinate(1011, 216, 324),
new Coordinate(1020, 612, 590),
new Coordinate(1000, 508, 709),
new Coordinate(1015, 737, 641)
};
private int currentLocation;
private bool poleKilled;
private Map currentMap;
private Coordinate currentCoordinate;
private uint prize;
private Guild lastKiller;
public uint KillerGuildID { get { if (lastKiller == null) return 0; return lastKiller.ID; } }
private ConcurrentDictionary<Guild, ulong> damages;
private List<string> winners;

public PoleDomination(uint prize)
{
Subscriber = World.Subscribe(work, 1000);
currentLocation = -1;
this.prize = prize;
damages = new ConcurrentDictionary<Guild, ulong>();
winners = new List<string>();
File.Open("database\\poledomination.txt", FileMode.OpenOrCreate).Close();
foreach (var name in File.ReadAllLines("database\\poledomination.txt"))
if (name.Length != 0)
winners.Add(name);
}

private void work(int time)
{
Time32 time32 = new Time32(time);
DateTime time64 = DateTime.Now;
// if (time64.DayOfWeek == DayOfWeek.Tuesday)
{
if (Emprator_Times.Start.PoleDomnation/*time64.Hour == 00*/)
//if (time64.Hour == 17)
{
if (time64.Minute % 12 == 0)
{
if (currentLocation != time64.Minute / 12)
{
ushort ID = 0;
if (currentLocation != -1)
{
ID = currentMap.ID;
removePole();
}
setWinner();
bool killedPole = poleKilled;
poleKilled = false;
lastKiller = null;
currentLocation = time64.Minute / 12;
currentCoordinate = Locations[currentLocation];
if (!Kernel.Maps.ContainsKey(currentCoordinate.Item1) )
new Map(currentCoordinate.Item1, "");
currentMap = Kernel.Maps[currentCoordinate.Item1];
Pole.MapID = currentMap.ID;
Pole.X = currentCoordinate.Item2;
Pole.Y = currentCoordinate.Item3;
currentMap.AddPole(Pole);
Pole.Hitpoints = Pole.MaxHitpoints = MaxHitPoints;
Kernel.Execute((client) =>
{
if (client.Entity.MapID == currentMap.ID)
if (client.Screen.Add(Pole))
client.Send(Pole);
client.MessageOK = (pClient) => { joinClient(pClient); };
client.Send(new NpcReply(NpcReply.MessageBox, "Pole Domination began in " + ((Enums.Maps)currentMap.ID).ToString() + ". Would you like to join?"));
});
currentMap.WasPKFree = Constants.PKFreeMaps.Contains(currentMap.ID);
if (!currentMap.WasPKFree) Constants.PKFreeMaps.Add(currentMap.ID);
if (currentLocation != -1 && (killedPole && lastKiller != null && currentMap != null))
Kernel.SendWorldMessage(new Message("Guild " + lastKiller.Name + " won the pole in " + ((Enums.Maps)ID).ToString() + "!" + "The Pole Domination moved to " + ((Enums.Maps)currentMap.ID).ToString() + "!", Color.Red, Message.Guild));
else
Kernel.SendWorldMessage(new Message("The Pole Domination moved to " + ((Enums.Maps)currentMap.ID).ToString() + "!", Color.Red, Message.Guild));
}
}
if (time64.Second % 5 == 0)
{
var array = damages.OrderByDescending((p) => p.Value);
int Place = 0;
foreach (KeyValuePair<Guild, ulong> entry in array)
{
string str = "No " + (Place + 1).ToString() + ": " + entry.Key.Name + "(" + entry.Value + ")";

Message msg = new Message(str, System.Drawing.Color.Red, Place == 0 ? Message.FirstRightCorner : Message.ContinueRightCorner);
Kernel.SendWorldMessage(msg, Program.Values, (ushort)currentMap.ID);
Place++;
if (Place == 4) break;
}
}
}
else
{
if (Pole.MapID != 0)
{
currentMap = Kernel.Maps[Pole.MapID];
removePole();
currentLocation = -1;
setWinner();
if (poleKilled)
Kernel.SendWorldMessage(new Message("Guild " + lastKiller.Name + " won the pole in " + ((Enums.Maps)currentMap.ID).ToString() + "!", Color.Red, Message.Center));
poleKilled = false;
lastKiller = null;
Pole.MapID = 0;
}
}
}
}
private void setWinner()
{
if (poleKilled)
{
Kernel.SendWorldMessage(new Message("Guild " + lastKiller.Name + " won the pole in " + ((Enums.Maps)currentMap.ID).ToString() + "!", Color.Red, Message.Guild));
winners.Add(lastKiller.Name);
SaveWinners();
}
}

public void SaveWinners()
{
StringBuilder builder = new StringBuilder();
foreach (var line in winners) builder.AppendLine(line);
File.WriteAllText("database\\poledomination.txt", builder.ToString());
}
public uint GetWinnerPrize(string name)
{
return (uint)(prize * winners.Count(p => p == name));
}
public void RemoveWinner(string name)
{
winners.RemoveAll(p => p == name);
}

private void joinClient(GameState client)
{
int x = Kernel.Random.Next(36) - 18, y = Kernel.Random.Next(36) - 18;
int times = 1000;
while (times-- > 0)
{
if (!currentMap.Floor[Pole.X + x, Pole.Y + y, MapObjectType.Entity, null])
{
x = Kernel.Random.Next(36) - 18;
y = Kernel.Random.Next(36) - 18;
}
else break;
}
if (times == 0) return;
client.Entity.Teleport(currentMap.BaseID, (ushort)(Pole.X + x), (ushort)(Pole.Y + y)); ;

}

internal void KillPole()
{
var array = damages.OrderByDescending((p) => p.Value).ToArray();
if (array.Length != 0)
lastKiller = array[0].Key;
Pole.Hitpoints = Pole.MaxHitpoints = MaxHitPoints;
Pole.Name = lastKiller.Name;
Kernel.Execute((client) =>
{
if (client.Entity.MapID == currentMap.ID)
client.Send(Pole);
});
Kernel.SendWorldMessage(new Message("Guild " + lastKiller.Name + " have taken the pole in " + ((Enums.Maps)currentMap.ID).ToString() + "! Are they going to win?", Color.Red, Message.Guild));
poleKilled = true;
damages.Clear();
//prize(killer.Owner);
//poleKilled = true;
}

private void removePole()
{
currentMap.RemovePole(Pole);
Kernel.Execute((client) =>
{
if (client.Entity.MapID == currentMap.ID)
{
client.Screen.Remove(Pole);
client.Send(new Data(true) { UID = Pole.UID, ID = Data.RemoveEntity });
}
});
if (!currentMap.WasPKFree)
Constants.PKFreeMaps.Remove(currentMap.ID);
damages.Clear();
}

internal void AddScore(uint damage, Guild guild)
{
if (guild == null) return;
if (!damages.ContainsKey(guild)) damages[guild] = 0;
damages[guild] += damage;
}
}
}


بعديها سيرش هنا

public static bool CanAttack(Game.Entity attacker, SobNpcSpawn attacked,


تحت الكودين دول

if (attacked.UID == 123456)
if (attacked.Hitpoints > 0)


تحته ضيف

if (attacker.GuildID != 0 && attacker.GuildID != Program.World.PoleDomination.KillerGuildID)
return true;


بعديها سيرش عاا

سيرش هنا

public void Die(Game.Entity killer)

هتلاقي دا فيه

if (UID == 123456)


جواه ضيف

Program.World.PoleDomination.KillPole();


الانبي سي

#region PoleDomination
case 123:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Hello champ! Are you here to claim your prize in the Pole Domination war?");
dialog.Option("Yes sir!", 1);
dialog.Send();
break;
}
case 1:
{
if (client.Entity.GuildID == 0)
{
dialog.Text("You do not belong to a guild!");
dialog.Option("Ahh!", 255);
dialog.Send();
return;
}
if (client.Entity.GuildRank != (int)Game.Enums.GuildMemberRank.GuildLeader)
{
dialog.Text("You have to be the guild leader!");
dialog.Option("Ahh!", 255);
dialog.Send();
return;
}
uint prize = Program.World.PoleDomination.GetWinnerPrize(client .Guild.Name);
if (prize == 0)
{
dialog.Text("There is no prize to be claimed!");
dialog.Option("Ahh!", 255);
dialog.Send();
return;
}
client.Entity.ConquerPoints += 50000000;
Program.World.PoleDomination.RemoveWinner(client.G uild.Name);

dialog.Text("You have claimed " + prize + " Conquer Points! Congratulations!");
dialog.Option("Thank you!", 255);
dialog.Send();
break;
}
}
break;
}
#endregion champ


في WORLD ضيف
public PoleDomination PoleDomination;


سيرش هنا

public void CreateTournaments()


ضيف

PoleDomination = new PoleDomination(500000000)

سيرش هنا

public static void ReceiveAttack(Game.Entity attacker, SobNpcSpawn attacked,


هتلاقي دا فيه

if (attacked.UID == 123456)


ضيف

if (Program.World.PoleDomination.KillerGuildID == attacker.Owner.Guild.ID)
return;
Program.World.PoleDomination.AddScore(damage, attacker.Owner.Guild);


وخش bin/debug/database وحمل دا وضيفه

عفواً لايمكن عرض الروابط في الإرشيف


معلش بس عشان نسيت اضافه

هتبحث عن

public class Start


ضيف فيها

public static bool PoleDomnation
{
get
{
return (now.Hour == 5 || now.Hour == 17);
}
}
مناسبه وقت الكويستت بيتعدل من 3 اماكن خلي بالك !

من هنا

if (time64.Minute % 12 == 0)


وهنا

if (currentLocation != time64.Minute / 12)


وهنا

currentLocation = time64.Minute / 12;


دا معناه انو هيشتغل عا دقيقه 12 تمام !!!!

وفي وقت لو عايز تخليها مثلبا الساعه 7 كدا اهو انا عاملهولك هنا

//if (time64.Hour == 17)

وبكدا هيتم تشغيل الكويست بنجاح الكويستت بقا عباره عن اي الي مش فاهمها

عباره عن عامود بيظهر في كل مدينه والي يكسب العمود دا ياخد سيبي في الاخر بتبقا حرب كبيره عليها تبتقا مدعكه

بس استنونا في شغل كتير الفتره الجاييه سلاموزز :)

ElSaher
2020-02-20, 04:01 AM
طيب معاد الكوستة امتا يا حج حسن

ElSaher
2020-02-20, 04:18 AM
;););)

Hassan Emprator
2020-02-20, 12:13 PM
بنسبت ان في ناس هيجيلها ايرور في emprator_times

هيمسح السطر كلو

if (emprator_times.start.poledomnation/*time64.hour == 00*/)

ويبدلو بي دا

if (time64.hour == 00)

ههه لا صح نستني كود هضيفه ناو
+ وقت الحرب من الكلاس يعما !

وقت الكلاس ضفته في الموضوع وانت هتعرف يبجم تمام :d:d

ElSaher
2020-02-20, 08:25 PM
ههه لا صح نستني كود هضيفه ناو
+ وقت الحرب من الكلاس يعما !

وقت الكلاس ضفته في الموضوع وانت هتعرف يبجم تمام :d:d

عليه الطلاق ما فهمتك فين كود التعديل يا صح

Hassan Emprator
2020-02-20, 08:27 PM
عليه الطلاق ما فهمتك فين كود التعديل يا صح

بس يحمار هفهمك لما اكلمك فيس

MaZzGanGYy
2020-02-20, 08:31 PM
هخهخهخخه
يبني دي نزلة بقالها 5 سنين
تكويدك اي وبتاع اي
دي موجودة ف كل السورسات بس مفيش حد بيستعملها

Hassan Emprator
2020-02-20, 08:37 PM
هخهخهخخه
يبني دي نزلة بقالها 5 سنين
تكويدك اي وبتاع اي
دي موجودة ف كل السورسات بس مفيش حد بيستعملها

انا مكنتش موجوده عندي :)

وكودتها من الصفر :)

midoazoz
2020-02-20, 11:30 PM
قلي كده فكرتها عشان مكسل ابص ع الاكواد 😂😂 وعاش

Hassan Emprator
2020-02-20, 11:47 PM
قلي كده فكرتها عشان مكسل ابص ع الاكواد 😂😂 وعاش

عباره عن عامود بيظهر في كل مدينه في وقت محدد بس العمود بيظهر عشوائي يعني في اي منطقه زي تاوم سيتي زي الديسرت كدا في مكان معين فهمتني !