package palidino76.rs2.content.minigames;
import palidino76.rs2.players.Player;
import palidino76.rs2.Engine;
import palidino76.rs2.io.*;
public class CastleWars {
public int
Portal = 0,
GameTimer = 600,
SaraTeam = 0,
ZamyTeam = 0,
SaraScore = 0,
ZamyScore = 0;
public boolean
IsSara = false,
IsZamy = false,
IsClean = false,
BlueSafe = false,
RedSafe = false;
public boolean hasBadItem(Player p) {
if (Engine.playerItems.HasItemAmount(p, 1052, 1) //capes
|| Engine.playerItems.HasItemAmount(p, 6570, 1) || Engine.playerItems.HasItemAmount(p, 6568, 1)
|| Engine.playerItems.HasItemAmount(p, 9747, 1) || Engine.playerItems.HasItemAmount(p, 9748, 1)
|| Engine.playerItems.HasItemAmount(p, 9750, 1) || Engine.playerItems.HasItemAmount(p, 9751, 1)
|| Engine.playerItems.HasItemAmount(p, 9753, 1) || Engine.playerItems.HasItemAmount(p, 9754, 1)
|| Engine.playerItems.HasItemAmount(p, 9756, 1) || Engine.playerItems.HasItemAmount(p, 9757, 1)
|| Engine.playerItems.HasItemAmount(p, 9759, 1) || Engine.playerItems.HasItemAmount(p, 9760, 1)
|| Engine.playerItems.HasItemAmount(p, 9762, 1) || Engine.playerItems.HasItemAmount(p, 9763, 1)
|| Engine.playerItems.HasItemAmount(p, 9765, 1) || Engine.playerItems.HasItemAmount(p, 9766, 1)
|| Engine.playerItems.HasItemAmount(p, 9767, 1) || Engine.playerItems.HasItemAmount(p, 9769, 1)
|| Engine.playerItems.HasItemAmount(p, 9771, 1) || Engine.playerItems.HasItemAmount(p, 9772, 1)
|| Engine.playerItems.HasItemAmount(p, 9774, 1) || Engine.playerItems.HasItemAmount(p, 9775, 1)
|| Engine.playerItems.HasItemAmount(p, 9777, 1) || Engine.playerItems.HasItemAmount(p, 9778, 1)
|| Engine.playerItems.HasItemAmount(p, 9780, 1) || Engine.playerItems.HasItemAmount(p, 9781, 1)
|| Engine.playerItems.HasItemAmount(p, 9783, 1) || Engine.playerItems.HasItemAmount(p, 9784, 1)
|| Engine.playerItems.HasItemAmount(p, 9786, 1) || Engine.playerItems.HasItemAmount(p, 9787, 1)
|| Engine.playerItems.HasItemAmount(p, 9789, 1) || Engine.playerItems.HasItemAmount(p, 9790, 1)
|| Engine.playerItems.HasItemAmount(p, 9792, 1) || Engine.playerItems.HasItemAmount(p, 9793, 1)
|| Engine.playerItems.HasItemAmount(p, 9795, 1) || Engine.playerItems.HasItemAmount(p, 9796, 1)
|| Engine.playerItems.HasItemAmount(p, 9798, 1) || Engine.playerItems.HasItemAmount(p, 9799, 1)
|| Engine.playerItems.HasItemAmount(p, 9801, 1) || Engine.playerItems.HasItemAmount(p, 9802, 1)
|| Engine.playerItems.HasItemAmount(p, 9804, 1) || Engine.playerItems.HasItemAmount(p, 9805, 1)
|| Engine.playerItems.HasItemAmount(p, 9807, 1) || Engine.playerItems.HasItemAmount(p, 9808, 1)
|| Engine.playerItems.HasItemAmount(p, 9810, 1) || Engine.playerItems.HasItemAmount(p, 9811, 1)
|| Engine.playerItems.HasItemAmount(p, 9813, 1) //end capes
//hats and helms
|| Engine.playerItems.HasItemAmount(p, 1038, 1) || Engine.playerItems.HasItemAmount(p, 1040, 1)
|| Engine.playerItems.HasItemAmount(p, 1042, 1) || Engine.playerItems.HasItemAmount(p, 1044, 1)
|| Engine.playerItems.HasItemAmount(p, 1046, 1) || Engine.playerItems.HasItemAmount(p, 1048, 1)
|| Engine.playerItems.HasItemAmount(p, 1050, 1) || Engine.playerItems.HasItemAmount(p, 1053, 1)
|| Engine.playerItems.HasItemAmount(p, 1055, 1) || Engine.playerItems.HasItemAmount(p, 1057, 1)
|| Engine.playerItems.HasItemAmount(p, 1149, 1) || Engine.playerItems.HasItemAmount(p, 1155, 1)
|| Engine.playerItems.HasItemAmount(p, 1157, 1) || Engine.playerItems.HasItemAmount(p, 1159, 1)
|| Engine.playerItems.HasItemAmount(p, 1161, 1) || Engine.playerItems.HasItemAmount(p, 1163, 1)
|| Engine.playerItems.HasItemAmount(p, 1165, 1) || Engine.playerItems.HasItemAmount(p, 4716, 1)
|| Engine.playerItems.HasItemAmount(p, 4708, 1) || Engine.playerItems.HasItemAmount(p, 4724, 1)
|| Engine.playerItems.HasItemAmount(p, 4732, 1) || Engine.playerItems.HasItemAmount(p, 4745, 1)
|| Engine.playerItems.HasItemAmount(p, 4753, 1) || Engine.playerItems.HasItemAmount(p, 11335, 1)
|| Engine.playerItems.HasItemAmount(p, 10828, 1) || Engine.playerItems.HasItemAmount(p, 10334, 1)
|| Engine.playerItems.HasItemAmount(p, 10342, 1) || Engine.playerItems.HasItemAmount(p, 10350, 1)
|| Engine.playerItems.HasItemAmount(p, 2639, 1) || Engine.playerItems.HasItemAmount(p, 2641, 1)
|| Engine.playerItems.HasItemAmount(p, 2743, 1) || Engine.playerItems.HasItemAmount(p, 2581, 1)
|| Engine.playerItems.HasItemAmount(p, 12210, 1) || Engine.playerItems.HasItemAmount(p, 12213, 1)
|| Engine.playerItems.HasItemAmount(p, 12216, 1) || Engine.playerItems.HasItemAmount(p, 12219, 1)
|| Engine.playerItems.HasItemAmount(p, 12222, 1) || Engine.playerItems.HasItemAmount(p, 9749, 1)
|| Engine.playerItems.HasItemAmount(p, 9752, 1) || Engine.playerItems.HasItemAmount(p, 9755, 1)
|| Engine.playerItems.HasItemAmount(p, 9758, 1) || Engine.playerItems.HasItemAmount(p, 9761, 1)
|| Engine.playerItems.HasItemAmount(p, 9764, 1) || Engine.playerItems.HasItemAmount(p, 9767, 1)
|| Engine.playerItems.HasItemAmount(p, 9770, 1) || Engine.playerItems.HasItemAmount(p, 9773, 1)
|| Engine.playerItems.HasItemAmount(p, 9776, 1) || Engine.playerItems.HasItemAmount(p, 9779, 1)
|| Engine.playerItems.HasItemAmount(p, 9782, 1) || Engine.playerItems.HasItemAmount(p, 9785, 1)
|| Engine.playerItems.HasItemAmount(p, 9788, 1) || Engine.playerItems.HasItemAmount(p, 9791, 1)
|| Engine.playerItems.HasItemAmount(p, 9794, 1) || Engine.playerItems.HasItemAmount(p, 9797, 1)
|| Engine.playerItems.HasItemAmount(p, 9800, 1) || Engine.playerItems.HasItemAmount(p, 9803, 1)
|| Engine.playerItems.HasItemAmount(p, 9806, 1) || Engine.playerItems.HasItemAmount(p, 9809, 1)
|| Engine.playerItems.HasItemAmount(p, 9812, 1) || Engine.playerItems.HasItemAmount(p, 9814, 1)) {
return true;
} else {
return false;
}
}
public void addGuthix(Player p) {
if (ZamyTeam > SaraTeam) {
addSara(p);
}
if (SaraTeam > ZamyTeam) {
addZamy(p);
}
}
public void addZamy(Player p) {
ZamyTeam += 1;
IsZamy = true;
p.frames.sendMessage(p, "You will fight for Zamorak!");
}
public void addSara(Player p) {
SaraTeam += 1;
IsSara = true;
p.frames.sendMessage(p, "You will fight for Saradomin!");
}
public void handlePortal() {
if (Portal == 1) {
addSara(p);
} else if (Portal == 2) {
addZamy(p);
} else if (Portal == 3) {
addGuthix(p);
}
}
public void checkPlayer(Player p) {
if (p.equipment[1] > 0 && p.equipmentN[1] > 0 || p.equipment[0] > 0 && p.equipmentN[0] > 0 || hasBadItem(p) == true) {
p.frames.sendMessage(p, "You cannot bring capes, hats, or helmets into the game!");
IsClean = false;
} else {
IsClean = true;
handlePortal();
}
}
public void Enter() {
checkPlayer(p);
}
public void inGame(Player p) {
p.frames.setOverlay(p, 58);
if (BlueSafe == false) {
p.frames.setString(p, "Safe", 58, 4);
} else {
p.frames.setString(p, "<col=ff0000>Taken", 58, 4);
}
if (RedSafe == false) {
p.frames.setString(p, "Safe", 58, 5);
} else {
p.frames.setString(p, "<col=ff0000>Taken", 58, 5);
}
p.frames.setString(p, "Zamorak: "+ZamyScore, 58, 0);
p.frames.setString(p, "Saradomin: "+SaraScore, 58, 1);
p.frames.setString(p, ""+GameTimer, 58, 8);
}
}