- Joined
- Oct 10, 2013
- Messages
- 26
- Reaction score
- 0
Hello, does somebody got a working Explosive or Annihilation for Chapter 3?
The .cs files or the content so that i can compile it in the server
My 3 cs files Explosive.cs, RoomData.cs and PlantData.cs:
Room.Data.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Game_Server.Game;
namespace Game_Server.Room_Data
{
class CP_RoomData : Handler
{
internal enum DropType
{
Respawn = 0,
Medic = 1,
Ammo = 2,
Repair = 3
}
public override void Handle(User usr)
{
if (blocks.Length >= 2 && usr.room != null)
{
Room room = usr.room;
int roomSlot = int.Parse(getBlock(0));
int roomId = int.Parse(getBlock(1));
if (roomSlot == usr.roomslot && roomId == room.id)
{
Subtype type = (Subtype)int.Parse(getBlock(3));
object[] sendBlocks = new object[blocks.Length - 1];
Array.Copy(blocks, sendBlocks, sendBlocks.Length);
/* Handle each subtype (if handler is available) */
using (RoomDataHandler handler = Managers.RoomPacketManager.ParsePacket((int)type, sendBlocks))
{
if (handler != null)
{
handler.Handle(usr, room);
/* Send out packet to the room*/
sendBlocks = handler.sendBlocks;
int subtypeId = int.Parse(sendBlocks[3].ToString());
if (handler.sendPacket)
{
if (subtypeId == (int)Subtype.ServerRoomReady)
{
if (!room.firstingame)
{
room.RespawnAllVehicles();
room.firstingame = true;
}
if (room.MapData != null)
{
usr.send(new SP_RoomMapData(room));
usr.send(new SP_RoomInitializeUsers(room));
}
usr.mapLoaded = true;
usr.send(new SP_RoomData(sendBlocks));
}
else if (subtypeId == (int)Subtype.BackToRoom)
{
usr.send(new SP_RoomData(sendBlocks));
}
else if (subtypeId == (int)Subtype.VoteKick)
{
byte[] buffer = (new SP_RoomData(sendBlocks)).GetBytes();
int usrside = room.GetSide(usr);
foreach (User u in room.users.Values)
{
if (room.GetSide(u) == usrside)
{
u.sendBuffer(buffer);
}
}
}
else
{
room.send(new SP_RoomData(sendBlocks));
}
if (handler.lobbychanges)
{
room.ch.UpdateLobby(room);
}
}
}
}
}
}
}
}
class SP_RoomData : Packet
{
public SP_RoomData(params object[] Params)
{
newPacket(30000);
addBlock(1); // Success
Params.ToList().ForEach(r => { addBlock(r); });
}
}
class SP_RoomDataNewRound : Packet
{
public SP_RoomDataNewRound(Room Room, int WinningTeam, bool Prepare)
{
int Code = (Prepare == true ? 6 : 5);
newPacket(30000);
addBlock(1);
addBlock(-1);
addBlock(Room.id);
addBlock(1);
addBlock(Code);
addBlock(0);
addBlock(1);
addBlock(WinningTeam);
addBlock(Room.DerbRounds);
addBlock(Room.NIURounds);
Fill(0, 16);
addBlock("DS05");
}
}
class SP_InitializeNewRound : Packet
{
public SP_InitializeNewRound(Room r)
{
newPacket(30000);
addBlock(1); // Success
addBlock(-1); // ??
addBlock(r.id); // Room ID
addBlock(2);
addBlock(403); // Sub id?
addBlock(0);
addBlock(1);
addBlock(3);
addBlock(363);
addBlock(0);
addBlock(1);
// addBlock(r.mode == (int)RoomMode.Annihilation ? 1 : 0);
Fill(0, 4);
}
}
}
//Final
Explosive.cs:
/*
_____ ___ __ __ _____ _____ ___ _ __ ___ ___ __ __
/__ \ /___\\ \/ / \_ \\_ \ / __\( )/ _\ / __\ /___\ /__\ /__\
/ /\/// // \ / / /\/ / /\// / |/ \ \ / / // /// \// /_\
/ / / \_// / \ /\/ /_/\/ /_ / /___ _\ \ / /___/ \_/// _ \//__
\/ \___/ /_/\_\\____/\____/ \____/ \__/ \____/\___/ \/ \_/\__/
__________________________________________________________________________________
Created by: ToXiiC
Thanks to: CodeDragon, Kill1212, Bubbleshit
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Game_Server.Game;
using Game_Server.Room_Data;
namespace Game_Server.GameModes
{
class Explosive
{
~Explosive()
{
GC.Collect();
}
Room room = null;
public void sendNewRound(int WinningTeam)
{
if (room.waitExplosiveTime >= 5 && !room.EndGamefreeze)
{
List<User> tempPlayers = new List<User>();
tempPlayers.AddRange(room.users.Values);
tempPlayers.AddRange(room.spectators.Values);
WinningTeam = (room.bombPlanted && !room.bombDefused ? (int)Room.Side.Derbaran : (int)Room.Side.NIU);
room.send(new SP_RoomDataNewRound(room, WinningTeam, false));
room.send(new SP_InitializeNewRound(room));
room.updateTime();
room.timespent = 0;
room.timeleft = 180000;
room.bombDefused = false;
room.bombPlanted = false;
room.sleep = false;
room.isNewRound = false;
room.waitExplosiveTime = 0;
room.Placements.Clear();
}
}
public void prepareRound(int WinningTeam)
{
if (room.isNewRound == false)
{
switch (WinningTeam)
{
case (int)Room.Side.Derbaran: room.DerbRounds++; break;
case (int)Room.Side.NIU: room.NIURounds++; break;
}
room.isNewRound = true;
}
if ((WinningTeam == (int)Room.Side.Derbaran && room.DerbRounds >= room.explosiveRounds || WinningTeam == (int)Room.Side.NIU && room.NIURounds >= room.explosiveRounds) && !room.EndGamefreeze)
{
room.EndGame();
}
else
{
room.sleep = true;
room.waitExplosiveTime = 0;
room.send(new SP_RoomDataNewRound(room, WinningTeam, true));
foreach (User usr in room.tempPlayers)
{
usr.isSpawned = false;
usr.throwNades = usr.throwRockets = 0;
}
}
}
public void CheckForNewRound()
{
if (room.mode == 0 && room.channel == 1 && !room.sleep)
{
if (room.AliveDerb == 0 && room.AliveNIU > 0 && room.bombPlanted == false)
{
prepareRound((int)Room.Side.NIU);
}
else if (room.AliveNIU == 0 && room.AliveDerb > 0)
{
prepareRound((int)Room.Side.Derbaran);
}
else if (room.AliveNIU == 0 && room.AliveDerb == 0)
{
prepareRound((room.bombPlanted ? (int)Room.Side.Derbaran : (int)Room.Side.NIU));
}
}
}
public void Update()
{
if (room != null)
{
if (room.users.Count > 1 && room.gameactive)
{
if (room.isNewRound)
{
room.waitExplosiveTime++;
if (room.waitExplosiveTime >= 5)
{
if (room.AliveDerb == 0 && room.AliveNIU > 0 && room.bombPlanted == false)
{
sendNewRound((int)Room.Side.NIU);
}
else if (room.AliveNIU == 0 && room.AliveDerb > 0)
{
sendNewRound((int)Room.Side.Derbaran);
}
else
{
sendNewRound((room.bombPlanted ? (int)Room.Side.Derbaran : (int)Room.Side.NIU));
}
}
}
else
{
if (room.NIURounds >= room.explosiveRounds || room.DerbRounds >= room.explosiveRounds) { room.EndGame(); return; }
if (room.timeleft <= 0) { prepareRound((room.bombPlanted ? (int)Room.Side.Derbaran : (int)Room.Side.NIU)); }
CheckForNewRound();
}
}
}
}
public Explosive(Room room)
{
this.room = room;
}
}
}
RoomPlant.Data.cs:
using Game_Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Game_Server.Game
{
class CP_RoomPlantData : Handler
{
public override void Handle(User usr)
{
int roomslot = int.Parse(getBlock(0));
int Type = int.Parse(getBlock(3));
Room Room = usr.room;
if (Room == null || !Room.gameactive || usr.roomslot != roomslot) return;
//Log.WriteLine(string.Join(" ", getAllBlocks()));
if (Room.GetSide(usr) == (int)Game_Server.Room.Side.NIU && usr.weapon == 118 && Type == 0 && !Room.sleep && usr.IsAlive()) // NIU Defuse
{
if (Room.explosive == null) return;
if (Room.timeleft <= 0) return;
if (Room.bombPlanted == false) { usr.disconnect(); return; }
Room.bombPlanted = false;
Room.bombDefused = true;
Room.explosive.prepareRound((int)Game_Server.Room.Side.NIU);
Room.NIUExplosivePoints += Configs.Server.Experience.OnBombDefuse;
Room.send(new SP_RoomPlantData(getAllBlocks));
}
else if (Room.GetSide(usr) == (int)Game_Server.Room.Side.Derbaran && usr.weapon == 91 && Type == 91 && !Room.sleep && usr.IsAlive()) // Derb Plant
{
if (Room.explosive == null) return;
if (Room.timeleft <= 0) return;
if (Room.bombPlanted == true) { return; }
Room.bombPlanted = true;
Room.DerbExplosivePoints += Configs.Server.Experience.OnBombPlant;
Room.timeleft = 45000;
Room.send(new SP_RoomPlantData(getAllBlocks));using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Game_Server.Game
{
class CP_RoomPlantData : Handler
{
public override void Handle(User usr)
{
int roomslot = int.Parse(getBlock(0));
int Type = int.Parse(getBlock(3));
Room Room = usr.room;
if (Room == null || !Room.gameactive || usr.roomslot != roomslot) return;
//Log.WriteLine(string.Join(" ", getAllBlocks()));
if (Room.GetSide(usr) == (int)Game_Server.Room.Side.NIU && usr.weapon == 118 && Type == 0 && !Room.sleep && usr.IsAlive()) // NIU Defuse
{
if (Room.explosive == null) return;
if (Room.timeleft <= 0) return;
if (Room.bombPlanted == false) { usr.disconnect(); return; }
Room.bombPlanted = false;
Room.bombDefused = true;
Room.explosive.prepareRound((int)Game_Server.Room.Side.NIU);
Room.NIUExplosivePoints += Configs.Server.Experience.OnBombDefuse;
Room.send(new SP_RoomPlantData(getAllBlocks));
}
else if (Room.GetSide(usr) == (int)Game_Server.Room.Side.Derbaran && usr.weapon == 91 && Type == 91 && !Room.sleep && usr.IsAlive()) // Derb Plant
{
if (Room.explosive == null) return;
if (Room.timeleft <= 0) return;
if (Room.bombPlanted == true) { return; }
Room.bombPlanted = true;
Room.DerbExplosivePoints += Configs.Server.Experience.OnBombPlant;
Room.timeleft = 45000;
Room.send(new SP_RoomPlantData(getAllBlocks));
}
//Original
else if ((Type == 80 || Type == 88 || Type == 163) && !Room.sleep && usr.IsAlive())
//Teste
// else if ((Type == 80 || Type == 88 || Type == 163) && !Room.sleep && usr.isSpawned)
//final
{
Room.send(new SP_RoomPlantData(getAllBlocks));
}
}
}
class SP_RoomPlantData : Packet
{
public SP_RoomPlantData(params object[] Params)
{
newPacket(29984);
addBlock(1);
Params.ToList().ForEach(obj => { addBlock(obj); });
}
}
}
class SP_RoomDefuseData : Packet
{
public SP_RoomDefuseData(params object[] Params)
{
newPacket(29985);
addBlock(1);
Params.ToList().ForEach(obj => { addBlock(obj); });
}
}
The .cs files or the content so that i can compile it in the server
My 3 cs files Explosive.cs, RoomData.cs and PlantData.cs:
Room.Data.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Game_Server.Game;
namespace Game_Server.Room_Data
{
class CP_RoomData : Handler
{
internal enum DropType
{
Respawn = 0,
Medic = 1,
Ammo = 2,
Repair = 3
}
public override void Handle(User usr)
{
if (blocks.Length >= 2 && usr.room != null)
{
Room room = usr.room;
int roomSlot = int.Parse(getBlock(0));
int roomId = int.Parse(getBlock(1));
if (roomSlot == usr.roomslot && roomId == room.id)
{
Subtype type = (Subtype)int.Parse(getBlock(3));
object[] sendBlocks = new object[blocks.Length - 1];
Array.Copy(blocks, sendBlocks, sendBlocks.Length);
/* Handle each subtype (if handler is available) */
using (RoomDataHandler handler = Managers.RoomPacketManager.ParsePacket((int)type, sendBlocks))
{
if (handler != null)
{
handler.Handle(usr, room);
/* Send out packet to the room*/
sendBlocks = handler.sendBlocks;
int subtypeId = int.Parse(sendBlocks[3].ToString());
if (handler.sendPacket)
{
if (subtypeId == (int)Subtype.ServerRoomReady)
{
if (!room.firstingame)
{
room.RespawnAllVehicles();
room.firstingame = true;
}
if (room.MapData != null)
{
usr.send(new SP_RoomMapData(room));
usr.send(new SP_RoomInitializeUsers(room));
}
usr.mapLoaded = true;
usr.send(new SP_RoomData(sendBlocks));
}
else if (subtypeId == (int)Subtype.BackToRoom)
{
usr.send(new SP_RoomData(sendBlocks));
}
else if (subtypeId == (int)Subtype.VoteKick)
{
byte[] buffer = (new SP_RoomData(sendBlocks)).GetBytes();
int usrside = room.GetSide(usr);
foreach (User u in room.users.Values)
{
if (room.GetSide(u) == usrside)
{
u.sendBuffer(buffer);
}
}
}
else
{
room.send(new SP_RoomData(sendBlocks));
}
if (handler.lobbychanges)
{
room.ch.UpdateLobby(room);
}
}
}
}
}
}
}
}
class SP_RoomData : Packet
{
public SP_RoomData(params object[] Params)
{
newPacket(30000);
addBlock(1); // Success
Params.ToList().ForEach(r => { addBlock(r); });
}
}
class SP_RoomDataNewRound : Packet
{
public SP_RoomDataNewRound(Room Room, int WinningTeam, bool Prepare)
{
int Code = (Prepare == true ? 6 : 5);
newPacket(30000);
addBlock(1);
addBlock(-1);
addBlock(Room.id);
addBlock(1);
addBlock(Code);
addBlock(0);
addBlock(1);
addBlock(WinningTeam);
addBlock(Room.DerbRounds);
addBlock(Room.NIURounds);
Fill(0, 16);
addBlock("DS05");
}
}
class SP_InitializeNewRound : Packet
{
public SP_InitializeNewRound(Room r)
{
newPacket(30000);
addBlock(1); // Success
addBlock(-1); // ??
addBlock(r.id); // Room ID
addBlock(2);
addBlock(403); // Sub id?
addBlock(0);
addBlock(1);
addBlock(3);
addBlock(363);
addBlock(0);
addBlock(1);
// addBlock(r.mode == (int)RoomMode.Annihilation ? 1 : 0);
Fill(0, 4);
}
}
}
//Final
Explosive.cs:
/*
_____ ___ __ __ _____ _____ ___ _ __ ___ ___ __ __
/__ \ /___\\ \/ / \_ \\_ \ / __\( )/ _\ / __\ /___\ /__\ /__\
/ /\/// // \ / / /\/ / /\// / |/ \ \ / / // /// \// /_\
/ / / \_// / \ /\/ /_/\/ /_ / /___ _\ \ / /___/ \_/// _ \//__
\/ \___/ /_/\_\\____/\____/ \____/ \__/ \____/\___/ \/ \_/\__/
__________________________________________________________________________________
Created by: ToXiiC
Thanks to: CodeDragon, Kill1212, Bubbleshit
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Game_Server.Game;
using Game_Server.Room_Data;
namespace Game_Server.GameModes
{
class Explosive
{
~Explosive()
{
GC.Collect();
}
Room room = null;
public void sendNewRound(int WinningTeam)
{
if (room.waitExplosiveTime >= 5 && !room.EndGamefreeze)
{
List<User> tempPlayers = new List<User>();
tempPlayers.AddRange(room.users.Values);
tempPlayers.AddRange(room.spectators.Values);
WinningTeam = (room.bombPlanted && !room.bombDefused ? (int)Room.Side.Derbaran : (int)Room.Side.NIU);
room.send(new SP_RoomDataNewRound(room, WinningTeam, false));
room.send(new SP_InitializeNewRound(room));
room.updateTime();
room.timespent = 0;
room.timeleft = 180000;
room.bombDefused = false;
room.bombPlanted = false;
room.sleep = false;
room.isNewRound = false;
room.waitExplosiveTime = 0;
room.Placements.Clear();
}
}
public void prepareRound(int WinningTeam)
{
if (room.isNewRound == false)
{
switch (WinningTeam)
{
case (int)Room.Side.Derbaran: room.DerbRounds++; break;
case (int)Room.Side.NIU: room.NIURounds++; break;
}
room.isNewRound = true;
}
if ((WinningTeam == (int)Room.Side.Derbaran && room.DerbRounds >= room.explosiveRounds || WinningTeam == (int)Room.Side.NIU && room.NIURounds >= room.explosiveRounds) && !room.EndGamefreeze)
{
room.EndGame();
}
else
{
room.sleep = true;
room.waitExplosiveTime = 0;
room.send(new SP_RoomDataNewRound(room, WinningTeam, true));
foreach (User usr in room.tempPlayers)
{
usr.isSpawned = false;
usr.throwNades = usr.throwRockets = 0;
}
}
}
public void CheckForNewRound()
{
if (room.mode == 0 && room.channel == 1 && !room.sleep)
{
if (room.AliveDerb == 0 && room.AliveNIU > 0 && room.bombPlanted == false)
{
prepareRound((int)Room.Side.NIU);
}
else if (room.AliveNIU == 0 && room.AliveDerb > 0)
{
prepareRound((int)Room.Side.Derbaran);
}
else if (room.AliveNIU == 0 && room.AliveDerb == 0)
{
prepareRound((room.bombPlanted ? (int)Room.Side.Derbaran : (int)Room.Side.NIU));
}
}
}
public void Update()
{
if (room != null)
{
if (room.users.Count > 1 && room.gameactive)
{
if (room.isNewRound)
{
room.waitExplosiveTime++;
if (room.waitExplosiveTime >= 5)
{
if (room.AliveDerb == 0 && room.AliveNIU > 0 && room.bombPlanted == false)
{
sendNewRound((int)Room.Side.NIU);
}
else if (room.AliveNIU == 0 && room.AliveDerb > 0)
{
sendNewRound((int)Room.Side.Derbaran);
}
else
{
sendNewRound((room.bombPlanted ? (int)Room.Side.Derbaran : (int)Room.Side.NIU));
}
}
}
else
{
if (room.NIURounds >= room.explosiveRounds || room.DerbRounds >= room.explosiveRounds) { room.EndGame(); return; }
if (room.timeleft <= 0) { prepareRound((room.bombPlanted ? (int)Room.Side.Derbaran : (int)Room.Side.NIU)); }
CheckForNewRound();
}
}
}
}
public Explosive(Room room)
{
this.room = room;
}
}
}
RoomPlant.Data.cs:
using Game_Server;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Game_Server.Game
{
class CP_RoomPlantData : Handler
{
public override void Handle(User usr)
{
int roomslot = int.Parse(getBlock(0));
int Type = int.Parse(getBlock(3));
Room Room = usr.room;
if (Room == null || !Room.gameactive || usr.roomslot != roomslot) return;
//Log.WriteLine(string.Join(" ", getAllBlocks()));
if (Room.GetSide(usr) == (int)Game_Server.Room.Side.NIU && usr.weapon == 118 && Type == 0 && !Room.sleep && usr.IsAlive()) // NIU Defuse
{
if (Room.explosive == null) return;
if (Room.timeleft <= 0) return;
if (Room.bombPlanted == false) { usr.disconnect(); return; }
Room.bombPlanted = false;
Room.bombDefused = true;
Room.explosive.prepareRound((int)Game_Server.Room.Side.NIU);
Room.NIUExplosivePoints += Configs.Server.Experience.OnBombDefuse;
Room.send(new SP_RoomPlantData(getAllBlocks));
}
else if (Room.GetSide(usr) == (int)Game_Server.Room.Side.Derbaran && usr.weapon == 91 && Type == 91 && !Room.sleep && usr.IsAlive()) // Derb Plant
{
if (Room.explosive == null) return;
if (Room.timeleft <= 0) return;
if (Room.bombPlanted == true) { return; }
Room.bombPlanted = true;
Room.DerbExplosivePoints += Configs.Server.Experience.OnBombPlant;
Room.timeleft = 45000;
Room.send(new SP_RoomPlantData(getAllBlocks));using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Game_Server.Game
{
class CP_RoomPlantData : Handler
{
public override void Handle(User usr)
{
int roomslot = int.Parse(getBlock(0));
int Type = int.Parse(getBlock(3));
Room Room = usr.room;
if (Room == null || !Room.gameactive || usr.roomslot != roomslot) return;
//Log.WriteLine(string.Join(" ", getAllBlocks()));
if (Room.GetSide(usr) == (int)Game_Server.Room.Side.NIU && usr.weapon == 118 && Type == 0 && !Room.sleep && usr.IsAlive()) // NIU Defuse
{
if (Room.explosive == null) return;
if (Room.timeleft <= 0) return;
if (Room.bombPlanted == false) { usr.disconnect(); return; }
Room.bombPlanted = false;
Room.bombDefused = true;
Room.explosive.prepareRound((int)Game_Server.Room.Side.NIU);
Room.NIUExplosivePoints += Configs.Server.Experience.OnBombDefuse;
Room.send(new SP_RoomPlantData(getAllBlocks));
}
else if (Room.GetSide(usr) == (int)Game_Server.Room.Side.Derbaran && usr.weapon == 91 && Type == 91 && !Room.sleep && usr.IsAlive()) // Derb Plant
{
if (Room.explosive == null) return;
if (Room.timeleft <= 0) return;
if (Room.bombPlanted == true) { return; }
Room.bombPlanted = true;
Room.DerbExplosivePoints += Configs.Server.Experience.OnBombPlant;
Room.timeleft = 45000;
Room.send(new SP_RoomPlantData(getAllBlocks));
}
//Original
else if ((Type == 80 || Type == 88 || Type == 163) && !Room.sleep && usr.IsAlive())
//Teste
// else if ((Type == 80 || Type == 88 || Type == 163) && !Room.sleep && usr.isSpawned)
//final
{
Room.send(new SP_RoomPlantData(getAllBlocks));
}
}
}
class SP_RoomPlantData : Packet
{
public SP_RoomPlantData(params object[] Params)
{
newPacket(29984);
addBlock(1);
Params.ToList().ForEach(obj => { addBlock(obj); });
}
}
}
class SP_RoomDefuseData : Packet
{
public SP_RoomDefuseData(params object[] Params)
{
newPacket(29985);
addBlock(1);
Params.ToList().ForEach(obj => { addBlock(obj); });
}
}
Last edited: