mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-06 16:49:07 +00:00
8af938548b
- Dwarf cannon can now be seen by anyone and not just the person who sets it down (they can also see the rotation now) - Fixed doors being removed when clicking them - Removed banking command for regular players - Fixed nulodion now only gives if you have space - Updated nulodion message so it doesnt say to find him at home - Npcs wont follow you if you turn on the cantAttack comamand (for admins - Fixed gate at KBD - Fixed the gates at Ice giants in wildy #closes 132 #closes 203 #closes 211 #closes 6 also this one should be closed from previous patch #closes 219
128 lines
2.4 KiB
Java
128 lines
2.4 KiB
Java
package com.rebotted.game.npcs;
|
|
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.util.List;
|
|
|
|
import com.rebotted.util.XStreamUtil;
|
|
|
|
public class NPCDefinition {
|
|
|
|
private static NPCDefinition[] definitions = null;
|
|
|
|
public static void init() throws IOException {
|
|
@SuppressWarnings("unchecked")
|
|
List<NPCDefinition> defs = (List<NPCDefinition>) XStreamUtil.getXStream().fromXML(new FileInputStream("data/cfg/npcDefinitions.xml"));
|
|
definitions = new NPCDefinition[3790];
|
|
for (NPCDefinition def : defs) {
|
|
definitions[def.getId()] = def;
|
|
}
|
|
}
|
|
|
|
public static NPCDefinition forId(int id) {
|
|
NPCDefinition d = definitions[id];
|
|
if (d == null) {
|
|
d = produceDefinition(id);
|
|
}
|
|
return d;
|
|
}
|
|
|
|
private int id;
|
|
private String name, examine;
|
|
private int respawn = 0, combat = 0, hitpoints = 1, maxHit = 0, size = 1, attackSpeed = 4000, attackAnim = 422, defenceAnim = 404, deathAnim = 2304, attackBonus = 20, defenceMelee = 20, defenceRange = 20, defenceMage = 20;
|
|
|
|
private boolean attackable = false;
|
|
private boolean aggressive = false;
|
|
private boolean retreats = false;
|
|
private boolean poisonous = false;
|
|
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public String getExamine() {
|
|
return examine;
|
|
}
|
|
|
|
public int getRespawn() {
|
|
return respawn;
|
|
}
|
|
|
|
public int getCombat() {
|
|
return combat;
|
|
}
|
|
|
|
public int getHitpoints() {
|
|
return hitpoints;
|
|
}
|
|
|
|
public int getMaxHit() {
|
|
return maxHit;
|
|
}
|
|
|
|
public int getSize() {
|
|
return size;
|
|
}
|
|
|
|
public boolean isAggressive() {
|
|
return aggressive;
|
|
}
|
|
|
|
public boolean retreats() {
|
|
return retreats;
|
|
}
|
|
|
|
public boolean isPoisonous() {
|
|
return poisonous;
|
|
}
|
|
|
|
public static NPCDefinition produceDefinition(int id) {
|
|
NPCDefinition def = new NPCDefinition();
|
|
def.id = id;
|
|
def.name = "NPC #" + def.id;
|
|
def.examine = "It's an NPC.";
|
|
return def;
|
|
}
|
|
|
|
public int getAttackSpeed() {
|
|
return attackSpeed;
|
|
}
|
|
|
|
public int getAttackAnimation() {
|
|
return attackAnim;
|
|
}
|
|
|
|
public int getDefenceAnimation() {
|
|
return defenceAnim;
|
|
}
|
|
|
|
public int getDeathAnimation() {
|
|
return deathAnim;
|
|
}
|
|
|
|
public boolean isAttackable() {
|
|
return attackable;
|
|
}
|
|
|
|
public int getAttackBonus() {
|
|
return attackBonus;
|
|
}
|
|
|
|
public int getDefenceRange() {
|
|
return defenceRange;
|
|
}
|
|
|
|
public int getDefenceMelee() {
|
|
return defenceMelee;
|
|
}
|
|
|
|
public int getDefenceMage() {
|
|
return defenceMage;
|
|
}
|
|
|
|
}
|