Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

AntiKS System

Newbie Spellweaver
Joined
Apr 10, 2009
Messages
91
Reaction score
195
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:
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) {
Add:
PHP:
int antiKS = 0;

After:
Code:
MapleMonster monster = map.getMonsterByOid(oned.getLeft().intValue());

            if (monster != null) {
Add:
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);
Add:
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) {
                }
In MapleMap.java:
Add:
PHP:
public final List<MapleMapObject> getAllMonster() {
        return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
    }
In MapleMonster.java:
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:
Newbie Spellweaver
Joined
Aug 28, 2009
Messages
80
Reaction score
50
I like this system emily :) Il be using this thank you :)
 
Experienced Elementalist
Joined
Aug 20, 2009
Messages
272
Reaction score
49
This is really cool.
 

owl

Newbie Spellweaver
Joined
Aug 21, 2010
Messages
64
Reaction score
4
Emily codes better than 90% of the rz community, including me ):

You strike once again, Emily! :):
 
bleh....
Loyal Member
Joined
Oct 15, 2008
Messages
2,898
Reaction score
1,129
duck you. :sleep:

Why? Because what he said is true? Emily is a great coder. He/She actually knows his/her poop and is one of the few "good coders" that help people in this community.

OnTopic: Great release Emily. I've always wondered why something like this was never introduced considering one of the biggest problems with private servers (and the real MS) is Kill Stealing.
 
Last edited:
Joined
Mar 17, 2010
Messages
835
Reaction score
136
Why? Because what he said is true? Emily is a great coder. He/She actually knows his/her poop and is one of the few "good coders" that help people in this community.

OnTopic: Great release Emily. I've always wondered why something like this was never introduced considering one of the biggest problems with private servers (and the real MS) is Kill Stealing.

Emily.. I know that he/she is a great coder, but I can't believe he said, "including me".

Shawn aka Devons, learn to read properly in future.
 
Custom Title Activated
Loyal Member
Joined
Apr 29, 2008
Messages
1,297
Reaction score
509
Aw, what if I wanted to kill a super high hp boss and it's a no rebirth server :(. i r get ksed :(
 
Newbie Spellweaver
Joined
Apr 10, 2009
Messages
91
Reaction score
195
Zakum, horntail.

Emily, make a boss-check.

Easy edit,
Increase time for bosses:
MapleMonster.java, setBelongsTo():
PHP:
        endBelong = System.currentTimeMillis() + (isBoss() ? 300000 : 30000); //30 seconds for the person to kill it. 5 Minutes to kill boss. Edit at your leisure.

Disable on Bosses:
MapleMonster.java, setBelongsTo():
PHP:
public void setBelongsTo(MapleCharacter chr) { //Only let it be controlled once.
        if (belongsTo != -1) {
            return;
        }
        if (isBoss()) {
            belongsTo = -2;
            return;
        }
        belongsTo = chr.getId();
        endBelong = System.currentTimeMillis() + 30000; //30 seconds for the person to kill it.
    }
 
Last edited:
Newbie Spellweaver
Joined
Apr 10, 2009
Messages
91
Reaction score
195
-cough- parties? -cough-

Easy Edit, AbstractDealDamageHandler.java:
Change:
PHP:
if (monster.getBelongsToSomeone() && monster.getBelongsTo() != player.getId() && !player.isGM()) {
    player.dropMessage("You cannot hit this monster because it belongs to someone else.");
    continue;
}

to

PHP:
if (monster.getBelongsToSomeone() && monster.getBelongsTo() != player.getId() && (player.getParty() == null || player.getParty().getMemberById(monster.getBelongsTo()) == null) && !player.isGM()) {
    player.dropMessage("You cannot hit this monster because it belongs to someone else.");
    continue;
}
 
Last edited:
Legendary Battlemage
Loyal Member
Joined
Dec 7, 2007
Messages
622
Reaction score
11
Awesome Release ;D
I've always wanted this on my server :]
 
Last edited:
bleh....
Loyal Member
Joined
Oct 15, 2008
Messages
2,898
Reaction score
1,129
I should be the one asking you, to me you are being stupid when you say yourself a pro and feels that you are 90% better than the community.

o_0 I actually read it properly. His statement did not imply he was "pro". It stated she can code better than him. Please don't fault him for you taking it as arrogance. So, if I say someone can code better than others, including myself, does that mean I think I'm pro? You have to learn to read it for what it says, not what you think it says.

Regardless, let's drop the shenanigans. This is one of the few great releases and doesn't deserve to be closed because of moronic bickering.
 
Back
Top