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

مشاهدة النسخة كاملة : اضافة كوسته عمود جزير الطيور


محمد ياسر
2019-04-24, 08:31 AM
الموضوع طويل شوية ركز عشان دى الاضافة من الاول خالص من الزيرو زي ما بيقولوا ,
..
هي مش موجودة فكل السورسات ,
عشان كدة انا سحبتها من عندى وبنزلها ,

1-الشرح ,
هيا زي الوار بالظبط ..
بس بتكون فماب زي البرد بالظبط بيطلع عمود ,
وبيجيلك اوتو انفيت فالمعاد الخاص بيها ,
..

2- الاضافة ,
أولا أنت هتعمل كلاس جديد بأسم ,
PoleBird
حط فيه دول
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ShaDow.Database;
using ShaDow.Network.GamePackets;
using ShaDow.Game.ConquerStructures.Society;

namespace ShaDow.Game
{
public class PoleBird
{
public static SobNpcSpawn Pole, RightGate, LeftGate;

public static SobNpcSpawn Poles;

public static SafeDictionary<uint, Guild> Scores = new SafeDictionary<uint, Guild>(100);

public static bool IsWar = false, Flame10th = false, FirstRound = false;

public static Time32 ScoreSendStamp, LastWin;

public static Guild PoleKeeperBi, CurrentTopLeader;

private static bool changed = false;

private static string[] scoreMessages;

public static DateTime StartTime;

public static bool Claim
{
get { return Program.Vars["biclaim"]; }
set { Program.Vars["biclaim"] = value; }
}

public static uint KeeperID
{
get { return Program.Vars["bikeeperid"]; }
set { Program.Vars["bikeeperid"] = value; }
}

public static void Initiate()
{
var Map = Kernel.Maps[2075];
Pole = (SobNpcSpawn)Map.Npcs[816];
LeftGate = (SobNpcSpawn)Map.Npcs[516082];
RightGate = (SobNpcSpawn)Map.Npcs[516083];
}

//public static void EliteGwint()
//{
// var Map = Kernel.Maps[2071];
// Poles = (SobNpcSpawn)Map.Npcs[811];
//}

public static void Start()
{
if (LeftGate == null) return;
Scores = new SafeDictionary<uint, Guild>(100);
StartTime = DateTime.Now;
LeftGate.Mesh = (ushort)(240 + LeftGate.Mesh % 10);
RightGate.Mesh = (ushort)(270 + LeftGate.Mesh % 10);
LeftGate.Hitpoints = LeftGate.MaxHitpoints;
RightGate.Hitpoints = RightGate.MaxHitpoints;
Pole.Hitpoints = Pole.MaxHitpoints;
Kernel.SendWorldMessage(new Message("PoleBird war has began!", System.Drawing.Color.Red, Message.Center),
Program.GamePool);
FirstRound = true;
foreach (Guild guild in Kernel.Guilds.Values)
{
guild.BiScore = 0;
}
Update upd = new Update(true);
upd.UID = LeftGate.UID;
upd.Append(Update.Mesh, LeftGate.Mesh);
upd.Append(Update.Hitpoints, LeftGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2075);
upd.Clear();
upd.UID = RightGate.UID;
upd.Append(Update.Mesh, RightGate.Mesh);
upd.Append(Update.Hitpoints, RightGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2075);
Claim = false;
IsWar = true;
}

public static void Reset()
{
Scores = new SafeDictionary<uint, Guild>(100);

LeftGate.Mesh = (ushort)(240 + LeftGate.Mesh % 10);
RightGate.Mesh = (ushort)(270 + LeftGate.Mesh % 10);

LeftGate.Hitpoints = LeftGate.MaxHitpoints;
RightGate.Hitpoints = RightGate.MaxHitpoints;
Pole.Hitpoints = Pole.MaxHitpoints;

Update upd = new Update(true);
upd.UID = LeftGate.UID;
upd.Append(Update.Mesh, LeftGate.Mesh);
upd.Append(Update.Hitpoints, LeftGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2075);
upd.Clear();
upd.UID = RightGate.UID;
upd.Append(Update.Mesh, RightGate.Mesh);
upd.Append(Update.Hitpoints, RightGate.Hitpoints);
Kernel.SendWorldMessage(upd, Program.GamePool, (ushort)2075);

foreach (Guild guild in Kernel.Guilds.Values)
{
guild.BiScore = 0;
}

IsWar = true;
}

public static void FinishRound()
{
if (PoleKeeperBi != null && !FirstRound)
{
if (PoleKeeperBi.Wins == 0)
PoleKeeperBi.Losts++;
else
PoleKeeperBi.Wins--;
Database.GuildTable.UpdateGuildWarStats(PoleKeeper Bi);
}
LastWin = Time32.Now;

FirstRound = false;
SortScores(out PoleKeeperBi);
if (PoleKeeperBi != null)
{
KeeperID = PoleKeeperBi.ID;
Kernel.SendWorldMessage(
new Message(
"The guild, " + PoleKeeperBi.Name + ", owned by " + PoleKeeperBi.LeaderName +
" has won this guild war round!", System.Drawing.Color.Red, Message.Center), Program.GamePool);
Kernel.SendWorldMessage(
new Message("It is generald pardon time. You have 5 minutes to leave, run for your life!",
System.Drawing.Color.White, Message.TopLeft), Program.GamePool, (ushort)6001);

if (PoleKeeperBi.Losts == 0)
PoleKeeperBi.Wins++;
else
PoleKeeperBi.Losts--;
Database.GuildTable.UpdateGuildWarStats(PoleKeeper Bi);
Pole.Name = PoleKeeperBi.Name;
}
Pole.Hitpoints = Pole.MaxHitpoints;
Kernel.SendWorldMessage(Pole, Program.GamePool, (ushort)2075);
Reset();
}

public static void End()
{
if (PoleKeeperBi != null)
{
Kernel.SendWorldMessage(
new Message(
"The Guild War, " + PoleKeeperBi.Name + ", owned by " + PoleKeeperBi.LeaderName +
" has won this guild war!---Guild war has ended!", System.Drawing.Color.White, Message.Center),
Program.GamePool);
Database.GuildTable.UpdatePoleKeeperBi(PoleKeeperB i);
}
else
{
Kernel.SendWorldMessage(
new Message("Guild war has ended and there was no winner!", System.Drawing.Color.Red, Message.Center),
Program.GamePool);
}
IsWar = false;
Claim = true;
UpdatePole(Pole);
}

public static void AddScore(uint addScore, Guild guild)
{
if (guild != null)
{
guild.BiScore += addScore;
changed = true;
if (!Scores.ContainsKey(guild.ID))
Scores.Add(guild.ID, guild);
if ((int)Pole.Hitpoints <= 0)
{
FinishRound();

return;
}
}
}

public static void SendScores()
{
if (scoreMessages == null)
scoreMessages = new string[0];
if (Scores.Count == 0)
return;
if (changed)
SortScores(out CurrentTopLeader);

for (int c = 0; c < scoreMessages.Length; c++)
{
Message msg = new Message(scoreMessages[c], System.Drawing.Color.Red,
c == 0 ? Message.FirstRightCorner : Message.ContinueRightCorner);
Kernel.SendWorldMessage(msg, Program.GamePool, (ushort)2075);
Kernel.SendWorldMessage(msg, Program.GamePool, (ushort)6001);
}
}

private static void SortScores(out Guild winner)
{
winner = null;
List<string> ret = new List<string>();

int Place = 0;
foreach (Guild guild in Scores.Values.OrderByDescending((p) => p.BiScore))
{
if (Place == 0)
winner = guild;
string str = "No " + (Place + 1).ToString() + ": " + guild.Name + "(" + guild.BiScore + ")";
ret.Add(str);
Place++;
if (Place == 4)
break;
}

changed = false;
scoreMessages = ret.ToArray();
}

private static void UpdatePole(SobNpcSpawn pole)
{
new Database.MySqlCommand(ShaDow.Database.MySqlCommand Type.UPDATE)
.Update("sobnpcs").Set("name", pole.Name).Set("life", Pole.Hitpoints).Where("id", pole.UID).Execute();
}
}
}

افتح
Handle.cs

ابحث عن ,
if (attacker.MapID == 2071)

هتضيف فوقيها دول ,
if (attacker.MapID == 2075)
{
if (attacker.GuildID == 0 || !Game.PoleBird.IsWar)
{
if (attacked.UID == 816)
{
return false;
}
}
if (Game.PoleBird.PoleKeeperBi != null)
{
if (Game.PoleBird.PoleKeeperBi == attacker.Owner.Guild)
{
if (attacked.UID == 816)
{
return false;
}
}
else if (attacked.UID == 516083 || attacked.UID == 516082)
{
if (Game.PoleBird.PoleKeeperBi == attacker.Owner.Guild)
{
if (attacker.PKMode == Enums.PKMode.Team)
return false;
}
}
}
}

فـ نفس المكان ابحث عن ,
Game.GuildWar.AddScore(damage, attacker.Owner.Guild);

بعد اخر قوصين ,
ضيف دة
if (attacker.MapID == 2075)
{
if (attacked.UID == 816)
{
if (Game.PoleBird.PoleKeeperBi == attacker.Owner.Guild)
return;
if (attacked.Hitpoints <= damage)
attacked.Hitpoints = 0;
Game.PoleBird.AddScore(damage, attacker.Owner.Guild);
}
}

افتح Guild.cs

ابحث عن ,
public uint WarScore;

وضيف تحته
public uint BiScore;

فنفس المكان ,
وابحث عن
public Guild(string leadername)

فوقيها ضيف دة ,
public bool PoleKeeperBi
{
get
{
return PoleBird.Pole.Name == Name;
}
}

افتح GuildTable.cs
وبحث عن ,
guild.SendGuildLevel();

ضيف تحتها دة ,
if (reader.ReadUInt32("PoleKeeperBi") == 1)
{
Game.PoleBird.PoleKeeperBi = guild;
}

افتح PacketHandler.cs
بحث عن ,
if (client.Entity.MapID == 1038 && ShaDow.Game.GuildWar.IsWar ||

طبعا مش هتلاقيها عشان اسم البروجيكت مختلف ,
غير بأسم البروجكت بتاعك ,
وهتضيف جمبها ,
|| client.Map.BaseID == 2075 && ShaDow.Game.PoleBird.IsWar

مش تنسا تغير اسم البروجيكت بردو ,
..
ابحث عن
if (client.Map.BaseID != 6001 && client.Map.BaseID != 6004 && !client.Entity.Dead && req.OptionID == 249 && client.Map.BaseID != 700)

وبعد اخر قوص فيها ,
هتضيف دة ,
if (client.Map.BaseID != 6001 && client.Map.BaseID != 6004 && !client.Entity.Dead && req.OptionID == 244 && client.Map.BaseID != 700)//PoleBird
{
client.Entity.Teleport(2075, 737, 650);
}

وضيف دة تحت اى شفرة عندك عشان تقدر تفتح وتقفل البولا ,
case "PBird":
{
switch (Data[1])
{
case "on":
PoleBird.Start();
break;
case "off":
PoleBird.End();
break;
}
break;

كمل وافتح ,
Cpanl لو مش عندك , افتح Rates
وضيف دة ,
PoleBird = reader.ReadUInt32("PoleBird");

وبحث بردو عن ,
public static uint GuildWar;

ضيف تحته ,
public static uint PoleBird;

Programe.cs
ضيف دة
Game.PoleBird.Initiate();


وده كمان
Console.WriteLine("PoleBird War initilizated.");

World.cs
ضيف الانفيت
#region PoleBird

if (PoleBird.IsWar)
{
if (Time32.Now > PoleBird.ScoreSendStamp.AddSeconds(3))
{
PoleBird.ScoreSendStamp = Time32.Now;
PoleBird.SendScores();
}
}
if ((Now64.Hour >= 01 && Now64.Hour <= 21) && Now64.DayOfWeek == DayOfWeek.Wednesday)
{
if (!PoleBird.IsWar)
{
PoleBird.Start();
}
}
if (Now64.Hour == 21 && Now64.Minute == 00 && Now64.Second == 00 && PoleBird.IsWar)
{
foreach (var client in Program.GamePool)
if (client.Entity.GuildID != 0 && client.Entity.MapID != 6004)
client.MessageBox("PoleBird War has begun! Would you like to join?",
p => { p.Entity.Teleport(1002, 224, 237); }, null);
}
if (PoleBird.IsWar)
{
if (Now64.Hour == 22 && Now64.Minute == 00 && Now64.Second == 00)
{
PoleBird.End();
}
}

#endregion

Npcs.cs
#region PoleBird
#region Pole

case 816:
{
dialog.Text("Please, don't hurt me!.");
dialog.Option("Sorry.", 255);
dialog.Send();
break;
}

#endregion
#region ClaimGuildPrize
case 4482119:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text(
"Hello there. Do you want to Claim PoleBird Prize you can only Claim it 1 Time if you won PT.");
dialog.Option("Leme Claim.", 1);
dialog.Option("Just Passing By!", 255);
dialog.Send();
break;
}
case 1:
{
if (client.Guild != null)
{
if (client.Guild.PoleKeeperBi && client.Guild != null &&
client.AsMember.Rank ==
ShaDow.Game.Enums.GuildMemberRank.GuildLeader)
{
dialog.Text("Are you sure you want to Claim your Prize?");
dialog.Option("Yes.", 2);
dialog.Option("Ah, nevermind.", 255);
dialog.Send();
}
else
{
dialog.Text(
"Sorry only GuildLeader of the Winner Guild can Claim The Prize After PoleBird End.");
dialog.Option("Ahh.", 255);
dialog.Send();
}
}
else
{
dialog.Text("Sorry You are not Member in any guild yet");
dialog.Option("Ahh.", 255);
dialog.Send();
}
break;
}
case 2:
{
if (DateTime.Now.DayOfWeek == DayOfWeek.Wednesday && DateTime.Now.Hour <= 22 &&
!PoleBird.IsWar && PoleBird.Claim && client.Guild != null &&
client.Entity.GuildID == PoleBird.KeeperID &&
client.Entity.GuildRank == (ushort)Game.Enums.GuildMemberRank.GuildLeader)
{
#warning GUILD WAR PRIZE
Program.AddWarLog("PoleBird", +Database.CPanel.PoleBird + "",
client.Entity.Name);
PoleBird.Claim = false;
PoleBird.KeeperID = 0;
client.Entity.ConquerPoints += Database.CPanel.PoleBird;
//client.RacePoints += Database.ServerRates.gwpts;
//ClassPk.AddGl();
client.Inventory.Add(723467, 0, 1);
//client.Entity.AddTopStatus(Update.Flags.TopGuildLe ader,
// DateTime.Now.AddDays(7));
ShaDow.Kernel.SendWorldMessage(
new Message(
"Congratulations! " + client.Entity.Name + " Leader of " +
client.Guild.PoleKeeperBi +
" The winner guild has Claimed PoleBird Prize " +
Database.CPanel.PoleBird +
" cps and LordToken And 1000 GW Points!", System.Drawing.Color.White,
Message.TopLeft), Program.GamePool);
}
else
{
dialog.Text(
"Sorry you dont have Any Prize to claim only GL of the winner guild can claim Prize After PT");
dialog.Option("Ahh.", 255);
dialog.Send();
}
break;
}
}
break;
}
#endregion
#region Gates

case 516082:
{
if (client.Guild != null)
{
if (client.Guild.PoleKeeperBi)
{
switch (npcRequest.OptionID)
{
case 0:
dialog.Text("Select the option you want to pursue.");
if (client.AsMember.Rank !=
ShaDow.Game.Enums.GuildMemberRank.Member)
{
dialog.Option("Open gate.", 1);
dialog.Option("Close gate.", 2);
}
dialog.Option("Get inside.", 3);
dialog.Option("Nothing.", 255);
dialog.Send();
break;
case 1:
{
ShaDow.Game.PoleBird.LeftGate.Mesh =
(ushort)
(250 + ShaDow.Game.PoleBird.LeftGate.Mesh % 10);

Update upd = new Update(true);
upd.UID = ShaDow.Game.PoleBird.LeftGate.UID;
upd.Append(Update.Mesh,
ShaDow.Game.PoleBird.LeftGate.Mesh);
client.SendScreen(upd, true);
break;
}
case 2:
{
Game.PoleBird.LeftGate.Mesh =
(ushort)(240 + Game.PoleBird.LeftGate.Mesh % 10);
if (PoleBird.LeftGate.Hitpoints < 100)
PoleBird.LeftGate.Hitpoints = PoleBird.LeftGate.MaxHitpoints;
Update upd = new Update(true);
upd.UID = ShaDow.Game.PoleBird.LeftGate.UID;
upd.Append(Update.Mesh,
ShaDow.Game.PoleBird.LeftGate.Mesh);
upd.Append(Update.Hitpoints,
ShaDow.Game.PoleBird.LeftGate.Hitpoints);
client.SendScreen(upd, true);
break;
}
case 3:
{
client.Entity.Teleport(2075, 737, 601);
break;
}
}
}
}
break;
}
case 516083:
{
if (client.Guild != null)
{
if (client.Guild.PoleKeeperBi)
{
switch (npcRequest.OptionID)
{
case 0:
dialog.Text("Select the option you want to pursue.");
if (client.AsMember.Rank !=
ShaDow.Game.Enums.GuildMemberRank.Member)
{
dialog.Option("Open gate.", 1);
dialog.Option("Close gate.", 2);
}
dialog.Option("Get inside.", 3);
dialog.Option("Nothing.", 255);
dialog.Send();
break;
case 1:
{
ShaDow.Game.PoleBird.RightGate.Mesh =
(ushort)
(280 + ShaDow.Game.PoleBird.RightGate.Mesh % 10);

Update upd = new Update(true);
upd.UID = ShaDow.Game.PoleBird.RightGate.UID;
upd.Append(Update.Mesh,
ShaDow.Game.PoleBird.RightGate.Mesh);
client.SendScreen(upd, true);
break;
}
case 2:
{
ShaDow.Game.PoleBird.RightGate.Mesh =
(ushort)
(270 + ShaDow.Game.PoleBird.RightGate.Mesh % 10);
if (PoleBird.RightGate.Hitpoints < 100)
Game.PoleBird.RightGate.Hitpoints =
Game.PoleBird.RightGate.MaxHitpoints;
Update upd = new Update(true);
upd.UID = ShaDow.Game.PoleBird.RightGate.UID;
upd.Append(Update.Mesh,
ShaDow.Game.PoleBird.RightGate.Mesh);
upd.Append(Update.Hitpoints,
ShaDow.Game.PoleBird.RightGate.Hitpoints);
client.SendScreen(upd, true);
break;
}
case 3:
{
client.Entity.Teleport(2075, 765, 571);
break;
}
}
}
}
break;
}

#endregion
#endregion

وافتح
النافى كات وكمل معايا ,
..
افتح Cpanl
فالقاعدة , أو Rates زي ما قولنا , لو مش عندك سى بانل ,
واعمل DesingTable
وحط السطر دة ,
كود:
PoleBird int 45 0 0 0 0 0 0 0 0 0 0

2075 1015 7 0
816 ShaDowz 10 1137 2075 724 573 30000000 30000000 0 17 1 0
516082 ii 26 251 2075 735 617 10000000 10000000 24 21 0 0
516083 ii 26 277 2075 781 569 10000000 10000000 27 21 0 0

كدة تمام 100% والحمد لله ,