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