|
المشاركات 1,940 |
+التقييم 0.95 |
تاريخ التسجيل Apr 2019 |
الاقامة Egypt |
نظام التشغيل windows 7 |
رقم العضوية 1 |
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(PoleKeeperBi);
}
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(PoleKeeperBi);
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(PoleKeeperBi);
}
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.MySqlCommandType.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;
}
}
guild.SendGuildLevel();
if (reader.ReadUInt32("PoleKeeperBi") == 1)
{
Game.PoleBird.PoleKeeperBi = guild;
}
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;
PoleBird = reader.ReadUInt32("PoleBird");
public static uint GuildWar;
public static uint PoleBird;
Game.PoleBird.Initiate();
Console.WriteLine("PoleBird War initilizated.");
#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
#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.TopGuildLeader,
// 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
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
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
أدوات الموضوع | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
طلب كوسته | Amr Khalid | مشكلات السيرفيرات كونكر الشخصيه | 1 | 2020-05-06 04:25 AM |
عندى مشكلة ف عمود الجيلد وار | abdocoder | مشكلات السيرفيرات كونكر الشخصيه | 4 | 2020-04-03 10:52 PM |
مشكلة في عمود الوار | ElSaher | مشكلات السيرفيرات كونكر الشخصيه | 6 | 2020-03-09 01:34 PM |
طلب كوسته | Amr Khalid | مشكلات السيرفيرات كونكر الشخصيه | 1 | 2019-11-26 08:52 AM |
صنع كوسته بتيم | محمد ياسر | تطوير سيرفرات كونكر | 1 | 2019-09-14 01:05 PM |