Implementation:
If a person has @antiks active and they hit a monster, they will have 30 seconds to kill the monster before anyone else can damage it. After this period, the monster cannot be controlled again, and is available for everyone to hit.
If the person leaves the map, he loses antiks on all monsters on the map.
You can only gain control of 3 monsters per attack.
You can only control a maximum of 10 monsters.
Command:
Add to MapleCharacter.java
In AbstractDealDamageHandler.java:
Before:
Add:
After:
Add:
In MapleCharacter.java, in changeMapInternal() in the Runnable:
After
Add:
In MapleMap.java:
Add:
In MapleMonster.java:
Add:
Needs to be tested though. Enjoy~
Edit: Fixed one error. You may want to disable this in events =P
Edit2: Implementation Details.
Edit3: Include Parties: http://forum.ragezone.com/f427/antiks-system-687972/#post5865765
Edits for Bosses: http://forum.ragezone.com/f427/antiks-system-687972/#post5865743
Edit4: Bug Fix.
If a person has @antiks active and they hit a monster, they will have 30 seconds to kill the monster before anyone else can damage it. After this period, the monster cannot be controlled again, and is available for everyone to hit.
If the person leaves the map, he loses antiks on all monsters on the map.
You can only gain control of 3 monsters per attack.
You can only control a maximum of 10 monsters.
Command:
PHP:
else if (splitted[0].equals("@antiks")) {
MapleCharacter player = c.getPlayer();
if (player.getAntiKS()) {
player.dropMessage("AntiKS deactivated.");
} else {
player.dropMessage("AntiKS activated.");
}
player.setAntiKS(!player.getAntiKS());
}
Add to MapleCharacter.java
PHP:
private boolean antiKS = false;
public boolean getAntiKS() {
return antiKS;
}
public void setAntiKS(boolean b) {
antiKS = b;
}
private byte numAntiKSMonsters = 0;
public byte getNumAntiKSMonsters() {
return numAntiKSMonsters;
}
public void incAntiKSNum() {
numAntiKSMonsters++;
}
public void decAntiKSNum() {
if (numAntiKSMonsters > 0)
numAntiKSMonsters--;
}
}
In AbstractDealDamageHandler.java:
Before:
Code:
for (Pair<Integer, List<Integer>> oned : attack.allDamage) {
PHP:
int antiKS = 0;
After:
Code:
MapleMonster monster = map.getMonsterByOid(oned.getLeft().intValue());
if (monster != null) {
PHP:
if (monster.getBelongsToSomeone() && monster.getBelongsTo() != player.getId() && !player.isGM()) {
player.dropMessage("You cannot hit this monster because it belongs to someone else.");
continue;
}
if (player.getAntiKS() && antiKS < 3 && monster.getCanBelong() && player.getNumAntiKSMonsters() < 10) {
monster.setBelongsTo(player);
antiKS++;
player.incAntiKSNum();
}
In MapleCharacter.java, in changeMapInternal() in the Runnable:
After
Code:
map.removePlayer(MapleCharacter.this);
PHP:
try {
List<MapleMapObject> monsters = map.getAllMonster();
for (MapleMapObject mmo : monsters) {
MapleMonster m = (MapleMonster) mmo;
if (m.getBelongsTo() == getId()) {
decAntiKSNum();
m.expireAntiKS();
}
}
} catch (Exception e) {
}
Add:
PHP:
public final List<MapleMapObject> getAllMonster() {
return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
}
Add:
PHP:
private int belongsTo = -1;
private long endBelong;
public boolean getBelongsToSomeone() {
return belongsTo != -1 && endBelong > System.currentTimeMillis();
}
public int getBelongsTo() {
return belongsTo;
}
public long getBelongTimeLeft() {
if (getBelongsToSomeone()) {
return endBelong - System.currentTimeMillis();
} else {
return 0;
}
}
public boolean getCanBelong() {
return belongsTo == -1;
}
public void expireAntiKS() {
belongsTo = -2;
//endBelong = System.currentTimeMillis();
}
public void setBelongsTo(MapleCharacter chr) { //Only let it be controlled once.
if (belongsTo != -1) {
return;
}
belongsTo = chr.getId();
endBelong = System.currentTimeMillis() + 30000; //30 seconds for the person to kill it.
}
Needs to be tested though. Enjoy~
Edit: Fixed one error. You may want to disable this in events =P
Edit2: Implementation Details.
Edit3: Include Parties: http://forum.ragezone.com/f427/antiks-system-687972/#post5865765
Edits for Bosses: http://forum.ragezone.com/f427/antiks-system-687972/#post5865743
Edit4: Bug Fix.
Last edited: