|
|
public static void ReceiveAttack(Game.Entity attacker, SobNpcSpawn attacked,
if (attacker.MapID == CaptureTheFlag.MapID)
if (attacker.GuildID != 0 && Program.World.CTF.Bases[attacked.UID].CapturerID != attacker.GuildID)
{
Program.World.CTF.AddScore(damage, attacker.Owner.Guild, attacked);
}
public static bool CanAttack
if (attacker.MapID == CaptureTheFlag.MapID)
{
if (Program.World.CTF.Bases.ContainsKey(attacked.UID))
{
var _base = Program.World.CTF.Bases[attacked.UID];
if (_base.CapturerID == attacker.GuildID)
return false;
}
return true;
}
public static bool CanAttack(Game.Entity attacker, Game.Entity attacked
if (attacked.MonsterInfo.ID == MonsterInformation.ReviverID)
if (attacker.MapID == CaptureTheFlag.MapID)
if (!CaptureTheFlag.Attackable(attacker) || !CaptureTheFlag.Attackable(attacked))
return false;
public void Die(Entity killer)
#region CaptureTheFlag
if (killer.GuildID != 0 && killer.MapID == CaptureTheFlag.MapID && CaptureTheFlag.IsWar)
{
if (GuildID != 0)
{
if (killer.Owner.Guild.Enemy.ContainsKey(GuildID))
killer.Owner.Guild.CTFPoints += 1;
else if (killer.Owner.Guild.Ally.ContainsKey(GuildID))
killer.Owner.Guild.CTFPoints += 1;
}
if (ContainsFlag2(Network.GamePackets.Update.Flags2.CarryingFlag))
{
StaticEntity entity = new StaticEntity((uint)(X * 1000 + Y), X, Y, MapID);
entity.DoFlag();
Owner.Map.AddStaticEntity(entity);
RemoveFlag2(Network.GamePackets.Update.Flags2.CarryingFlag);
Owner.Send(Program.World.CTF.generateTimer(0));
Owner.Send(Program.World.CTF.generateEffect(Owner));
if (killer.GuildID != GuildID)
{
Killer.AddFlag2(Network.GamePackets.Update.Flags2.CarryingFlag);
Time32 end = FlagStamp.AddSeconds(60) - Time32.Now;
killer.FlagStamp = end;
killer.Owner.Send(Program.World.CTF.generateTimer((uint)end.Value));
killer.Owner.Send(Program.World.CTF.generateEffect(killer.Owner));
killer.Owner.Guild.CTFPoints += 3;
}
}
}
#endregion
public unsafe class PacketID
CaptureTheFlag = 2224,
if (UID == 123456)
if (MapID == CaptureTheFlag.MapID)
{
if (Program.World.CTF.Bases.ContainsKey(UID))
{
var _base = Program.World.CTF.Bases[UID];
_base.Capture();
}
}
//////////
public static void HandlePacket(byte[] packet, Client.GameState client)
#region CTF
case 1063:
{
//if (packet[6] == 3)
//{
// client.Send(packet);
// uint m = BitConverter.ToUInt32(packet, 10);
// client.Send(CrossServer.generateRanking(m));
// return;
//}
byte typ = packet[4];
switch (typ)
{
case 0:
{
if (client.Guild == null || client.AsMember == null)
break;
if (!CaptureTheFlag.IsWar)
{
CaptureTheFlag.CTFGuildsRank(client, packet);
}
else
{
CaptureTheFlag.CTFExpolitsRank(client, packet);
}
break;
}
case 1:
{
if (client.Guild == null || client.AsMember == null)
break;
CaptureTheFlag.CTFExpolitsRank2(client, packet);
break;
}
case 3:
{
uint setCTFCps = BitConverter.ToUInt32(packet, 18);
if (client.Guild == null || client.AsMember == null)
break;
if (client.Guild.ConquerPointFund > setCTFCps)
{
client.Guild.ConquerPointFund -= setCTFCps;
client.Guild.CTFdonationCPsold += setCTFCps;
Database.GuildTable.SaveFunds(client.Guild);
}
goto case 0;
}
case 4:
{
uint setCTFMoney = BitConverter.ToUInt32(packet, 22);
if (client.Guild == null || client.AsMember == null)
break;
if (client.Guild.SilverFund > setCTFMoney)
{
client.Guild.SilverFund -= setCTFMoney;
client.Guild.CTFdonationSilverold += setCTFMoney;
Database.GuildTable.SaveFunds(client.Guild);
}
goto case 0;
}
case 5:
{
uint setCTFCps = BitConverter.ToUInt32(packet, 18);
if (client.Guild == null || client.AsMember == null)
break;
if (client.Guild.ConquerPointFund > setCTFCps)
{
client.Guild.ConquerPointFund -= setCTFCps;
client.Guild.CTFdonationCPsold += setCTFCps;
Database.GuildTable.SaveFunds(client.Guild);
}
uint setCTFMoney = BitConverter.ToUInt32(packet, 22);
if (client.Guild.SilverFund > setCTFMoney)
{
client.Guild.SilverFund -= setCTFMoney;
client.Guild.CTFdonationSilverold += setCTFMoney;
Database.GuildTable.SaveFunds(client.Guild);
}
goto case 0;
}
case 8:
{
if (client.Guild == null || client.AsMember == null)
break;
CaptureTheFlag.CTFGuildsRank2(client, packet);
break;
}
case 9:
{
if (client.Guild == null || client.AsMember == null)
break;
if (CaptureTheFlag.IsWar)
{
new CaptureTheFlag.CTF_Rank(client).Send(client);
}
else
{
CaptureTheFlag.CTFsRank(client, packet);
}
break;
}
}
break;
}
case 2224:
{
if (packet[4] == 7)//2
client.Send(Program.World.CTF.generateCTFRanking());
if (CaptureTheFlag.IsWar)
{
byte[] p773 = new byte[] { 60, 0, 176, 8, 11, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 81, 83, 101, 114, 118, 101, 114 };
client.Send(p773);
}
else
client.Send(packet);
break;
}
#endregion
client.lastJumpDistance = Kernel.GetDistance(new_X, new_Y, client.Entity.X, client.Entity.Y);
if (client.Entity.MapID == CaptureTheFlag.MapID)
CheckForFlag(client);
client.SendScreen(generalData, true);
client.Screen.Reload(generalData);
static void PlayerGroundMovment(GroundMovement groundMovement, Client.GameState client)
if (client.Entity.MapID == CaptureTheFlag.MapID)
CheckForFlag(client);
client.SendScreen(groundMovement, true);
client.Screen.Reload(groundMovement);
static void GetSurroundings(Client.GameState client)
if (client.Entity.PreviousMapID == CaptureTheFlag.MapID)
Program.World.CTF.CloseList(client);
#region Reward CTF
case 8713:
{
switch (npcRequest.OptionID)
{
case 0:
{
dialog.Text("Just The Guild Leader will receive the CTF Reward?");
dialog.Option("CTF area.", 2);
dialog.Option("Give Me CTF Reward.", 3);
dialog.Option("I See.", 255);
dialog.Avatar(83);
dialog.Send();
break;
}
case 2:
{
if (client.Entity.Level >= 1)
if (CaptureTheFlag.IsWar)
{
Program.World.CTF.SignUp(client);
}
else
{
dialog.Text("The CTF is not on going at this time. The GuildWar is scheduled to start everyDay at 03:00 .");
dialog.Option("Oh.", 255);
dialog.Send();
}
else
{
dialog.Text("You Should Level 1 .");
dialog.Option("Oh.", 255);
dialog.Send();
}
break;
}
case 3:
{
if (client.Guild != null)
{
if (client.AsMember != null)
{
if (client.AsMember.Rank == Enums.GuildMemberRank.GuildLeader)
{
uint Reaward = (uint)(client.Guild.CTFReward * ServerRates.WarFlag1);
if (Reaward != 0)
{
byte[] messaje = new Network.GamePackets.Message("The Guild Leader " + client.Entity.Name + " of " + client.Guild.Name + " Receive the CTFReward " + Reaward + "", System.Drawing.Color.Red, Network.GamePackets.Message.System).ToArray();
client.Entity.ConquerPoints += Reaward;
client.Guild.CTFReward = 0;
Database.GuildTable.SaveCTFReward(client.Guild);
foreach (var clients in Kernel.GamePool.Values)
{
client.Send(messaje);
}
}
else
{
dialog.Text("You Guild Not Have CTF Points ");
dialog.Option("Oh Sorry.", 255);
dialog.Avatar(83);
dialog.Send();
}
}
else
{
dialog.Text("Just The Guild Leader will receive the CTF Reward ");
dialog.Option("Oh Sorry.", 255);
dialog.Avatar(83);
dialog.Send();
}
break;
}
}
break;
}
}
break;
}
#endregion
public CaptureTheFlag CTF;
public void CreateTournaments()
CTF = new CaptureTheFlag();
private void WorldTournaments(int time)
#region CaptureTheFlag
if (Now64.Hour == 17)
{
if (Now64.Minute == 05 && Now64.Second <= 05)
{
if (!CaptureTheFlag.IsWar)
{
CTF = new CaptureTheFlag();
CaptureTheFlag.IsWar = true;
CaptureTheFlag.StartTime = DateTime.Now;
Kernel.SendWorldMessage(new Message("Capture The Flag has Start !", Color.White, Message.BroadcastMessage), Program.Values);
foreach (var client in Program.Values)
client.MessageBox("Capture The Flag has Start! Would you Like to join ...?",
p => { p.Entity.Teleport(1002, 224, 240); }, null, 60);
foreach (var guild in Kernel.Guilds.Values)
{
guild.CTFFlagScore = 0; guild.CTFPoints = 0;
}
}
}
if (CaptureTheFlag.IsWar)
{
if (CTF != null)
CTF.SpawnFlags();
}
if (Now64.Minute == 59 && Now64.Second == 59)
{
if (CaptureTheFlag.IsWar)
{
Kernel.SendWorldMessage(new Message("Capture The Flag has Ended !", Color.White, Message.BroadcastMessage), Program.Values);
Program.World.CTF.SendUpdates();
CaptureTheFlag.IsWar = false;
CaptureTheFlag.Close();
}
}
}
#endregion
public static void receiveattack(game.entity attacker, sobnpcspawn attacked,
if (attacker.mapid == capturetheflag.mapid)
if (attacker.guildid != 0 && program.world.ctf.bases[attacked.uid].capturerid != attacker.guildid)
{
program.world.ctf.addscore(damage, attacker.owner.guild, attacked);
}
public static bool canattack
if (attacker.mapid == capturetheflag.mapid)
{
if (program.world.ctf.bases.containskey(attacked.uid))
{
var _base = program.world.ctf.bases[attacked.uid];
if (_base.capturerid == attacker.guildid)
return false;
}
return true;
}
public static bool canattack(game.entity attacker, game.entity attacked
if (attacked.monsterinfo.id == monsterinformation.reviverid)
if (attacker.mapid == capturetheflag.mapid)
if (!capturetheflag.attackable(attacker) || !capturetheflag.attackable(attacked))
return false;
public void die(entity killer)
#region capturetheflag
if (killer.guildid != 0 && killer.mapid == capturetheflag.mapid && capturetheflag.iswar)
{
if (guildid != 0)
{
if (killer.owner.guild.enemy.containskey(guildid))
killer.owner.guild.ctfpoints += 1;
else if (killer.owner.guild.ally.containskey(guildid))
killer.owner.guild.ctfpoints += 1;
}
if (containsflag2(network.gamepackets.update.flags2.carryingflag))
{
staticentity entity = new staticentity((uint)(x * 1000 + y), x, y, mapid);
entity.doflag();
owner.map.addstaticentity(entity);
removeflag2(network.gamepackets.update.flags2.carryingflag);
owner.send(program.world.ctf.generatetimer(0));
owner.send(program.world.ctf.generateeffect(owner));
if (killer.guildid != guildid)
{
killer.addflag2(network.gamepackets.update.flags2.carryingflag);
time32 end = flagstamp.addseconds(60) - time32.now;
killer.flagstamp = end;
killer.owner.send(program.world.ctf.generatetimer((uint)end.value));
killer.owner.send(program.world.ctf.generateeffect(killer.owner));
killer.owner.guild.ctfpoints += 3;
}
}
}
#endregion
public unsafe class packetid
capturetheflag = 2224,
if (uid == 123456)
if (mapid == capturetheflag.mapid)
{
if (program.world.ctf.bases.containskey(uid))
{
var _base = program.world.ctf.bases[uid];
_base.capture();
}
}
//////////
public static void handlepacket(byte[] packet, client.gamestate client)
#region ctf
case 1063:
{
//if (packet[6] == 3)
//{
// client.send(packet);
// uint m = bitconverter.touint32(packet, 10);
// client.send(crossserver.generateranking(m));
// return;
//}
byte typ = packet[4];
switch (typ)
{
case 0:
{
if (client.guild == null || client.asmember == null)
break;
if (!capturetheflag.iswar)
{
capturetheflag.ctfguildsrank(client, packet);
}
else
{
capturetheflag.ctfexpolitsrank(client, packet);
}
break;
}
case 1:
{
if (client.guild == null || client.asmember == null)
break;
capturetheflag.ctfexpolitsrank2(client, packet);
break;
}
case 3:
{
uint setctfcps = bitconverter.touint32(packet, 18);
if (client.guild == null || client.asmember == null)
break;
if (client.guild.conquerpointfund > setctfcps)
{
client.guild.conquerpointfund -= setctfcps;
client.guild.ctfdonationcpsold += setctfcps;
database.guildtable.savefunds(client.guild);
}
goto case 0;
}
case 4:
{
uint setctfmoney = bitconverter.touint32(packet, 22);
if (client.guild == null || client.asmember == null)
break;
if (client.guild.silverfund > setctfmoney)
{
client.guild.silverfund -= setctfmoney;
client.guild.ctfdonationsilverold += setctfmoney;
database.guildtable.savefunds(client.guild);
}
goto case 0;
}
case 5:
{
uint setctfcps = bitconverter.touint32(packet, 18);
if (client.guild == null || client.asmember == null)
break;
if (client.guild.conquerpointfund > setctfcps)
{
client.guild.conquerpointfund -= setctfcps;
client.guild.ctfdonationcpsold += setctfcps;
database.guildtable.savefunds(client.guild);
}
uint setctfmoney = bitconverter.touint32(packet, 22);
if (client.guild.silverfund > setctfmoney)
{
client.guild.silverfund -= setctfmoney;
client.guild.ctfdonationsilverold += setctfmoney;
database.guildtable.savefunds(client.guild);
}
goto case 0;
}
case 8:
{
if (client.guild == null || client.asmember == null)
break;
capturetheflag.ctfguildsrank2(client, packet);
break;
}
case 9:
{
if (client.guild == null || client.asmember == null)
break;
if (capturetheflag.iswar)
{
new capturetheflag.ctf_rank(client).send(client);
}
else
{
capturetheflag.ctfsrank(client, packet);
}
break;
}
}
break;
}
case 2224:
{
if (packet[4] == 7)//2
client.send(program.world.ctf.generatectfranking());
if (capturetheflag.iswar)
{
byte[] p773 = new byte[] { 60, 0, 176, 8, 11, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 81, 83, 101, 114, 118, 101, 114 };
client.send(p773);
}
else
client.send(packet);
break;
}
#endregion
client.lastjumpdistance = kernel.getdistance(new_x, new_y, client.entity.x, client.entity.y);
if (client.entity.mapid == capturetheflag.mapid)
checkforflag(client);
client.sendscreen(generaldata, true);
client.screen.reload(generaldata);
static void playergroundmovment(groundmovement groundmovement, client.gamestate client)
if (client.entity.mapid == capturetheflag.mapid)
checkforflag(client);
client.sendscreen(groundmovement, true);
client.screen.reload(groundmovement);
static void getsurroundings(client.gamestate client)
if (client.entity.previousmapid == capturetheflag.mapid)
program.world.ctf.closelist(client);
#region reward ctf
case 8713:
{
switch (npcrequest.optionid)
{
case 0:
{
dialog.text("just the guild leader will receive the ctf reward?");
dialog.option("ctf area.", 2);
dialog.option("give me ctf reward.", 3);
dialog.option("i see.", 255);
dialog.avatar(83);
dialog.send();
break;
}
case 2:
{
if (client.entity.level >= 1)
if (capturetheflag.iswar)
{
program.world.ctf.signup(client);
}
else
{
dialog.text("the ctf is not on going at this time. The guildwar is scheduled to start everyday at 03:00 .");
dialog.option("oh.", 255);
dialog.send();
}
else
{
dialog.text("you should level 1 .");
dialog.option("oh.", 255);
dialog.send();
}
break;
}
case 3:
{
if (client.guild != null)
{
if (client.asmember != null)
{
if (client.asmember.rank == enums.guildmemberrank.guildleader)
{
uint reaward = (uint)(client.guild.ctfreward * serverrates.warflag1);
if (reaward != 0)
{
byte[] messaje = new network.gamepackets.message("the guild leader " + client.entity.name + " of " + client.guild.name + " receive the ctfreward " + reaward + "", system.drawing.color.red, network.gamepackets.message.system).toarray();
client.entity.conquerpoints += reaward;
client.guild.ctfreward = 0;
database.guildtable.savectfreward(client.guild);
foreach (var clients in kernel.gamepool.values)
{
client.send(messaje);
}
}
else
{
dialog.text("you guild not have ctf points ");
dialog.option("oh sorry.", 255);
dialog.avatar(83);
dialog.send();
}
}
else
{
dialog.text("just the guild leader will receive the ctf reward ");
dialog.option("oh sorry.", 255);
dialog.avatar(83);
dialog.send();
}
break;
}
}
break;
}
}
break;
}
#endregion
public capturetheflag ctf;
public void createtournaments()
ctf = new capturetheflag();
private void worldtournaments(int time)
#region capturetheflag
if (now64.hour == 17)
{
if (now64.minute == 05 && now64.second <= 05)
{
if (!capturetheflag.iswar)
{
ctf = new capturetheflag();
capturetheflag.iswar = true;
capturetheflag.starttime = datetime.now;
kernel.sendworldmessage(new message("capture the flag has start !", color.white, message.broadcastmessage), program.values);
foreach (var client in program.values)
client.messagebox("capture the flag has start! Would you like to join ...?",
p => { p.entity.teleport(1002, 224, 240); }, null, 60);
foreach (var guild in kernel.guilds.values)
{
guild.ctfflagscore = 0; guild.ctfpoints = 0;
}
}
}
if (capturetheflag.iswar)
{
if (ctf != null)
ctf.spawnflags();
}
if (now64.minute == 59 && now64.second == 59)
{
if (capturetheflag.iswar)
{
kernel.sendworldmessage(new message("capture the flag has ended !", color.white, message.broadcastmessage), program.values);
program.world.ctf.sendupdates();
capturetheflag.iswar = false;
capturetheflag.close();
}
}
}
#endregion
|
الذين يشاهدون محتوى الموضوع الآن : 4 ( الأعضاء 0 والزوار 4) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
خش شوف لو سمحت | fariswaleed | مشكلات السيرفيرات كونكر الشخصيه | 5 | 2020-04-30 10:25 AM |
خش لو سمحت | fariswaleed | مشكلات السيرفيرات كونكر الشخصيه | 5 | 2020-04-25 04:17 PM |
حل لو سمحت سورس اليكس | tekatop0 | مشكلات السيرفيرات كونكر الشخصيه | 2 | 2020-04-16 02:26 PM |
طلب لودر لو سمحت معلش | nova | مشكلات السيرفيرات كونكر الشخصيه | 1 | 2020-02-14 04:24 PM |
حازم خش لو سمحت | uncelsam | مشكلات السيرفيرات كونكر الشخصيه | 9 | 2019-10-30 01:17 AM |