Code:
public void giveLife() {
// Set the visual masks of a player
c.isFullHelm = Item.isFullHat(c.playerEquipment[c.playerHat]);
c.isFullMask = Item.isFullMask(c.playerEquipment[c.playerHat]);
c.isFullBody = Item.isFullBody(c.playerEquipment[c.playerChest]);
c.isDead = false;
c.faceUpdate(-1);
c.freezeTimer = 1;
c.setTektonDamageCounter(0);
c.setSkeletalMysticDamageCounter(0);
c.setGlodDamageCounter(0);
c.setIceQueenDamageCounter(0);
c.refreshQuestTab(7);
// If a player is in any of these areas, their items will not be dropped to
// themselves nor others
if (!c.inDuelArena() && !Boundary.isIn(c, Boundary.DUEL_ARENA)&& !Vorkath.inVorkath(c)
&& !Boundary.isIn(c, Boundary.FIGHT_CAVE) && !Boundary.isIn(c, Boundary.LIGHTHOUSE)
&& !Boundary.isIn(c, PestControl.GAME_BOUNDARY) && !c.inSafemode()
&& !Boundary.isIn(c, Boundary.INFERNO) && !Boundary.isIn(c, Zulrah.BOUNDARY)
&& !Boundary.isIn(c, Boundary.CERBERUS_BOSSROOMS) && !Boundary.isIn(c, Boundary.SKOTIZO_BOSSROOM)
&& !Boundary.isIn(c, Boundary.RFD) && !Boundary.isIn(c, Boundary.OLM)
&& !Boundary.isIn(c, Boundary.RAIDS) && Lowpkarena.getState(c) == null
&& Highpkarena.getState(c) == null) {
// If any items are on this list, delete them
for (int itemId : Config.DROP_AND_DELETE_ON_DEATH) {
if (c.getItems().isWearingItem(itemId)) {
int slot = c.getItems().getItemSlot(itemId);
if (slot != -1) {
c.getItems().removeItem(itemId, slot);
}
}
if (c.getItems().playerHasItem(itemId)) {
c.getItems().deleteItem2(itemId, c.getItems().getItemAmount(itemId));
}
}
// Get the killer
Entity killer = c.getKiller();
// Degrade, unequip venomous items
c.getCombat().degradeVenemousItems(killer);
// If a player is not an ultimate ironman, update the items kept on death
if (!c.getMode().isUltimateIronman()) {
c.getItems().resetKeepItems();
c.updateItemsOnDeath();
}
// Handles the items kept on death
for (int item = 0; item < Config.ITEMS_KEPT_ON_DEATH.length; item++) {
int itemId = Config.ITEMS_KEPT_ON_DEATH[item];
int itemAmount = c.getItems().getItemAmount(itemId) + c.getItems().getWornItemAmount(itemId);
if (c.getItems().playerHasItem(itemId) || c.getItems().isWearingItem(itemId)) {
if (c.getMode().isUltimateIronman()) {
Server.itemHandler.createGroundItem(c, itemId, c.getX(), c.getY(), c.heightLevel, itemAmount,
c.getIndex());
} else if (c.inClanWars() || c.inClanWarsSafe()) {
Server.itemHandler.createGroundItem(c, itemId, c.getX(), c.getY(), c.heightLevel, itemAmount,
c.getIndex());
} else {
c.getItems().sendItemToAnyTab(itemId, 1);
}
}
}
// If ultimate ironman, delete all items and drop all of them
if (c.getMode().isUltimateIronman()) {
c.getItems().deleteAllItems();
c.getItems().dropAllItems();
// Otherwise, drop them
} else {
c.getItems().dropAllItems();
c.getItems().deleteAllItems();
// If a player is not skulled he will keep 3 items
if (!c.isSkulled) {
for (int i1 = 0; i1 < 3; i1++) {
if (c.itemKeptId[i1] > 0) {
c.getItems().addItem(c.itemKeptId[i1], 1);
}
}
}
// If protect item is active, one extra item will be kept
if (c.prayerActive[10]) {
if (c.itemKeptId[3] > 0) {
c.getItems().addItem(c.itemKeptId[3], 1);
}
}
c.getItems().resetKeepItems();
}
/*
* } else if (c.inPits) { Server.fightPits.removePlayerFromPits(c.playerId);
* c.pitsStatus = 1;
*/
} else if (Boundary.isIn(c, Boundary.PEST_CONTROL_AREA)) {
c.getPA().movePlayer(2657, 2639, 0);
} else if (Boundary.isIn(c, Boundary.RAIDS)) {
c.getPA().movePlayer(c.getRaids().getStartLocation().getX(),c.getRaids().getStartLocation().getY(),c.getRaids().getHeight(c.getRaids().raidLeader));
c.getRaids().currentRoom=0;
} else if (Boundary.isIn(c, Boundary.OLM)) {
c.getPA().movePlayer(c.getRaids().getStartLocation().getX(),c.getRaids().getStartLocation().getY(),c.getRaids().getHeight(c.getRaids().raidLeader));
}
if (Boundary.isIn(c, PestControl.GAME_BOUNDARY)) {
c.getPA().movePlayer(2656 + Misc.random(2), 2614 - Misc.random(3), 0);
} else if (Boundary.isIn(c, Zulrah.BOUNDARY)) {
c.getPA().movePlayer(Config.START_LOCATION_X, Config.START_LOCATION_X, 0);
InstancedArea instance = c.getZulrahEvent().getInstancedZulrah();
if (instance != null) {
InstancedAreaManager.getSingleton().disposeOf(instance);
}
c.getZulrahLostItems().store();
c.talkingNpc = 2040;
c.getDH().sendNpcChat("It looks like Zulrah beat you.", "I'll give you back your items for 500,000GP.",
"Talk to me when you're ready.");
} else if (Boundary.isIn(c, Boundary.CERBERUS_BOSSROOMS)) {
c.getPA().movePlayer(1309, 1250, 0);
c.getCerberusLostItems().store();
c.talkingNpc = 5870;
c.getDH().sendNpcChat("It looks like Cerberus beat you.", "I'll give you back your items for 500,000GP.",
"Talk to me when you're ready.");
} else if (Boundary.isIn(c, Boundary.SKOTIZO_BOSSROOM)) {
c.getPA().movePlayer(1665, 10045, 0);
c.getSkotizoLostItems().store();
c.talkingNpc = 7283;
c.getDH().sendNpcChat("It looks like Skotizo beat you.", "I'll give you back your items for 500,000GP.",
"Talk to me when you're ready.");
} else if (Boundary.isIn(c, Boundary.DUEL_ARENA)) {
DuelSession duelSession = (DuelSession) Server.getMultiplayerSessionListener().getMultiplayerSession(c,
MultiplayerSessionType.DUEL);
if (Objects.nonNull(duelSession)
&& duelSession.getStage().getStage() == MultiplayerSessionStage.FURTHER_INTERATION) {
Player opponent = duelSession.getWinner().get();
if (opponent != null) {
opponent.getPA().createPlayerHints(10, -1);
duelSession.finish(MultiplayerSessionFinalizeType.GIVE_ITEMS);
}
}
} else if (Boundary.isIn(c, Boundary.LIGHTHOUSE) && c.getDagannothMother() != null) {
c.getDagannothMother().end(DisposeType.INCOMPLETE);
} else if (Boundary.isIn(c, Boundary.RFD) && c.getrecipeForDisaster() != null) {
c.getrecipeForDisaster().end(DisposeTypes.INCOMPLETE);
} else if (Boundary.isIn(c, Boundary.FIGHT_CAVE)) {
c.getFightCave().handleDeath();
} else if (Boundary.isIn(c, Boundary.INFERNO)) {
c.getInfernoMinigame().handleDeath();
} else if (Boundary.isIn(c, Boundary.RAIDS)) {
c.getPA().movePlayer(c.getRaids().getStartLocation().getX(),c.getRaids().getStartLocation().getY(),c.getRaids().getHeight(c.getRaids().raidLeader));
} else if (Boundary.isIn(c, Boundary.OLM)) {
c.getPA().movePlayer(c.getRaids().getStartLocation().getX(),c.getRaids().getStartLocation().getY(),c.getRaids().getHeight(c.getRaids().raidLeader));
} else if (Highpkarena.getState(c) != null) {
Highpkarena.handleDeath(c);
} else if (Lowpkarena.getState(c) != null) {
Lowpkarena.handleDeath(c);
} else if (c.inClanWars() || c.inClanWarsSafe()) {
movePlayer(c.absX, 4759, 0);
} else if (Boundary.isIn(c, Boundary.SAFEPKSAFE)) {
movePlayer(Config.RESPAWN_X, Config.RESPAWN_Y, 0);
c.isSkulled = false;
c.skullTimer = 0;
c.attackedPlayers.clear();
removeAllWindows();
closeAllWindows();
} else {
movePlayer(Config.RESPAWN_X, Config.RESPAWN_Y, 0);
c.isSkulled = false;
c.skullTimer = 0;
c.attackedPlayers.clear();
removeAllWindows();
closeAllWindows();
}
c.getCombat().resetPrayers();
for (int i = 0; i < 20; i++) {
c.playerLevel[i] = getLevelForXP(c.playerXP[i]);
c.getPA().refreshSkill(i);
}
c.startAnimation(65535);
updateLife();
}