[Add-On] Clan System with Clan Buffs

Page 1 of 9 123456789 LastLast
Results 1 to 15 of 133
  1. #1
    Account Upgraded | Title Enabled! Sharky is offline
    MemberRank
    Dec 2010 Join Date
    Ur Mom's Pants.Location
    927Posts

    [Add-On] Clan System with Clan Buffs

    First release! [v83+]
    If you are not using MoopleDev, this will be a bit tricky, as you will have to use your brain (and I know how most people hate that).
    This is a Clan System that has been tested with MoopleDev. Fairly easy to figure it out. Each Clan has their own skillBuff, or a certain buff that shows up at a 1/25 chance each time they get hit. All of this is just a base for whatever you want to put inside. You can easily change the clan names and skills.

    Make a file called MapleClans.java inside the client package. Put this inside:
    PHP Code:
    package client;

    /**
    *
    * @author Sharky
    */

    public enum MapleClans {
    None(0"None"0"null"),
    Eagle(100"Eagle"3001003"Focus"),
    Serpent(200"Serpent"3121002"Sharp Eyes"),
    Lion(300"Lion"1001003"Iron Body"), 
    Salamander(400"Salamander"3121008"Concentrate"),
    Roadrunner(500"Roadrunner"4201003"Haste"),
    Shark(600"Shark"1101006"Rage");
    final 
    int clanid;
    final 
    String clanname;
    final 
    int skillBuff;
    final 
    String skillName;

    private 
    MapleClans(int idString nameint skillBString skillN){
    clanid id;
    clanname name;
    skillBuff skillB;
    skillName skillN;
    }

    public static 
    MapleClans getById(int id) {
    for (
    MapleClans mc MapleClans.values()) {
    if (
    mc.getId() == id) {
    return 
    mc;
    }
    }
    return 
    null;
    }

    public 
    int getId(){
    return 
    clanid;
    }

    public 
    String getName(){
    return 
    clanname;
    }

    public 
    int getSkillBuff(){
    return 
    skillBuff;
    }

    public 
    String getSkillName(){
    return 
    skillName;
    }

    Go into MapleCharacter now:
    Add this at the top by the private int's
    PHP Code:
    public MapleClans mapleclan MapleClans.None
    search for:
    PHP Code:
    ret.job MapleJob.BEGINNER
    and put this right below it:
    PHP Code:
    ret.mapleclan MapleClans.None
    Add this method in with the other methods:
    PHP Code:
    public MapleClans getMapleClan(){
    return 
    mapleclan;

    search for:
    PHP Code:
    ret.name rs.getString("name"); 
    add this right below it:
    PHP Code:
    ret.mapleclan MapleClans.getById(rs.getInt("mapleclan")); 
    Remember to use your head and follow the pattern for this next part:
    Search for saveToDB. You will see a two long lines of grey text. Scroll all the way to the right of the first one, and add
    PHP Code:
    mapleclan = ? 
    before
    PHP Code:
    WHERE ID = ? 
    In the second grey line, add
    PHP Code:
    mapleclan
    before
    PHP Code:
    accountid
    and add a question mark to the list of question marks to the right of it.
    Look for something like this a little bit below those two grey lines:
    PHP Code:
    if (update) {
    ps.setInt(57id);
    } else {
    ps.setInt(57accountid);
    ps.setString(58name);
    ps.setInt(59world); 
    Your numbers probably won't read the same as mine, but that doesn't matter.
    What your going to do here, is add a line of code, and push all those numbers back one. Like so:
    PHP Code:
    ps.setInt(57mapleclan.getId());
    if(
    update) {
    ps.setInt(58id);
    } else {
    ps.setInt(58accountid);
    ps.setString(59name);
    ps.setInt(60world); 
    Run this in your MySQL:
    PHP Code:
    ALTER TABLE `YourTable`.`charactersADD COLUMN `mapleclanINTEGER NOT NULL DEFAULT 0
    This next part is ONLY IF you want to add custom rates for Clans:
    Add this method in MapleCharacter:
    PHP Code:
    public int[] getMapleClanRates(){
    int exprate ServerConstants.EXP_RATE;
    int mesorate ServerConstants.EXP_RATE;
    int droprate ServerConstants.DROP_RATE;
    switch(
    getMapleClan().getId()){
    case 
    100// Eagle
    exprate ServerConstants.EXP_RATE;
    mesorate ServerConstants.MESO_RATE;
    droprate ServerConstants.DROP_RATE;
    break;
    case 
    200// Serpent
    exprate ServerConstants.EXP_RATE;
    mesorate ServerConstants.MESO_RATE;
    droprate ServerConstants.DROP_RATE;
    break;
    case 
    300// Lion
    exprate ServerConstants.EXP_RATE;
    mesorate ServerConstants.MESO_RATE;
    droprate ServerConstants.DROP_RATE;
    break;
    case 
    400// Salamander
    exprate ServerConstants.EXP_RATE;
    mesorate ServerConstants.MESO_RATE;
    droprate ServerConstants.DROP_RATE;
    break;
    case 
    500// Roadrunner
    exprate ServerConstants.EXP_RATE;
    mesorate ServerConstants.MESO_RATE;
    droprate ServerConstants.DROP_RATE;
    break;
    case 
    600// Shark
    exprate ServerConstants.EXP_RATE;
    mesorate ServerConstants.MESO_RATE;
    droprate ServerConstants.DROP_RATE;
    break;
    default:
    exprate ServerConstants.EXP_RATE;
    mesorate ServerConstants.MESO_RATE;
    droprate ServerConstants.DROP_RATE;
    break;

    return new 
    int[]{expratemesoratedroprate};

    These rates are all set to 0, but it's very easy to change. Let's say I wanted Eagle's to have a +15 exp rate, I would do this:
    PHP Code:
    exprate ServerConstants.EXP_RATE 15
    Now search for your getExpRate(), getMesoRate(), and getDropRate() methods and replace them with these:
    PHP Code:
    public int getExpRate(){
    return 
    getMapleClanRates()[0];
    }

    public 
    int getMesoRate(){
    return 
    getMapleClanRates()[1];
    }

    public 
    int getDropRate(){
    return 
    getMapleClanRates()[2];

    Now, everybody join in again.

    Go into your NPCConversationManager and add these methods:
    PHP Code:
    public int getMapleClan(){
    return 
    getPlayer().getMapleClan().getId();
    }

    public 
    String getMapleClanName(){
    return 
    getPlayer().getMapleClan().getName();
    }

    public 
    String getMapleClanSB(){
    return 
    getPlayer().getMapleClan().getSkillName();
    }

    public 
    void changeClans(MapleClans mc) {
    getPlayer().mapleclan mc;
    }

    public 
    void setMapleClan(int mc) {
    changeClans(MapleClans.getById(mc));

    Now, aren't you relieved? We're finally done with the hard part.

    If you are using MoopleDev:
    Open up your net.channel.handler.TakeDamageHandler and replace the entire thing with this:
    PHP Code:
    /*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
    Matthias Butz <matze@odinms.de>
    Jan Christian Meyer <vimes@odinms.de>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation version 3 as published by
    the Free Software Foundation. You may not use, modify or distribute
    this program under any other version of the GNU Affero General Public
    License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program. If not, see <http://www.gnu.org/licenses/>.
    */
    package net.channel.handler;

    import client.ISkill;
    import client.MapleBuffStat;
    import client.MapleCharacter;
    import client.MapleClient;
    import client.MapleInventoryType;
    import client.Skill;
    import client.SkillFactory;
    import client.status.MonsterStatus;
    import constants.skills.Corsair;
    import net.AbstractMaplePacketHandler;
    import server.life.MapleMonster;
    import server.life.MobAttackInfo;
    import server.life.MobAttackInfoFactory;
    import server.life.MobSkill;
    import server.life.MobSkillFactory;
    import tools.MaplePacketCreator;
    import tools.data.input.SeekableLittleEndianAccessor;

    public final class 
    TakeDamageHandler extends AbstractMaplePacketHandler {
    public final 
    void handlePacket(SeekableLittleEndianAccessor sleaMapleClient c) {
    MapleCharacter player c.getPlayer();
    slea.readInt();
    int damagefrom slea.readByte();
    slea.readByte(); //Element
    int damage slea.readInt();
    int oid 0;
    int monsteridfrom 0;
    int pgmr 0;
    int direction 0;
    int pos_x 0;
    int pos_y 0;
    int fake 0;
    boolean is_pgmr false;
    boolean is_pg true;
    int mpattack 0;
    MapleMonster attacker null;
    if (
    damagefrom != -3) {
    monsteridfrom slea.readInt();
    oid slea.readInt();
    attacker = (MapleMonsterplayer.getMap().getMapObject(oid);
    if (
    attacker.isBuffed(MonsterStatus.NEUTRALISE)) {
    return;
    }
    if ((
    player.getMap().getMonsterById(monsteridfrom) == null || attacker == null) && monsteridfrom != 9300166) {
    return;
    } else if (
    monsteridfrom == 9300166) {
    if (
    player.haveItem(4031868)) {
    c.getPlayer().getMap().spawnItemDrop(c.getPlayer(), c.getPlayer(), player.getInventory(MapleInventoryType.ETC).findById(4031868), c.getPlayer().getPosition(), truetrue);
    }
    }
    direction slea.readByte();
    }
    if (
    player.getMap().getId() == 922210000 && monsteridfrom == 9500182) {
    player.changeMap(910000000);
    return;
    }
    if (
    damagefrom != -&& damagefrom != -&& attacker != null) {
    MobAttackInfo attackInfo MobAttackInfoFactory.getMobAttackInfo(attackerdamagefrom);
    if (
    attackInfo.isDeadlyAttack()) {
    mpattack player.getMp() - 1;
    }
    mpattack += attackInfo.getMpBurn();
    MobSkill skill MobSkillFactory.getMobSkill(attackInfo.getDiseaseSkill(), attackInfo.getDiseaseLevel());
    if (
    skill != null && damage 0) {
    skill.applyEffect(playerattackerfalse);
    }
    if (
    attacker != null) {
    attacker.setMp(attacker.getMp() - attackInfo.getMpCon());
    if (
    player.getBuffedValue(MapleBuffStat.MANA_REFLECTION) != null && damage && !attacker.isBoss()) {
    int jobid player.getJob().getId();
    if (
    jobid == 212 || jobid == 222 || jobid == 232) {
    int id jobid 10000 2;
    ISkill manaReflectSkill SkillFactory.getSkill(id);
    if (
    player.isBuffFrom(MapleBuffStat.MANA_REFLECTIONmanaReflectSkill) && player.getSkillLevel(manaReflectSkill) > && manaReflectSkill.getEffect(player.getSkillLevel(manaReflectSkill)).makeChanceResult()) {
    int bouncedamage = (damage manaReflectSkill.getEffect(player.getSkillLevel(manaReflectSkill)).getX() / 100);
    if (
    bouncedamage attacker.getMaxHp() / 5) {
    bouncedamage attacker.getMaxHp() / 5;
    }
    player.getMap().damageMonster(playerattackerbouncedamage);
    player.getMap().broadcastMessage(playerMaplePacketCreator.damageMonster(oidbouncedamage), true);
    player.getClient().announce(MaplePacketCreator.showOwnBuffEffect(id5));
    player.getMap().broadcastMessage(playerMaplePacketCreator.showBuffeffect(player.getId(), id5), false);
    }
    }
    }
    }
    }
    if (
    damage == -1) {
    fake 4020002 + (player.getJob().getId() / 10 40) * 100000;
    }
    if (
    damage == 0) {
    player.getAutobanManager().addMiss();
    } else {
    player.getAutobanManager().resetMisses();
    }
    if (
    damage && !player.isHidden()) {
    if (
    attacker != null && !attacker.isBoss()) {
    if (
    damagefrom == -&& player.getBuffedValue(MapleBuffStat.POWERGUARD) != null) {
    int bouncedamage = (int) (damage * (player.getBuffedValue(MapleBuffStat.POWERGUARD).doubleValue() / 100));
    bouncedamage Math.min(bouncedamageattacker.getMaxHp() / 10);
    player.getMap().damageMonster(playerattackerbouncedamage);
    damage -= bouncedamage;
    player.getMap().broadcastMessage(playerMaplePacketCreator.damageMonster(oidbouncedamage), truetrue);
    player.checkMonsterAggro(attacker);
    }
    }
    if (
    damagefrom != -3) {
    int achilles 0;
    ISkill achilles1 null;
    int jobid player.getJob().getId();
    if (
    jobid 200 && jobid 10 == 2) {
    achilles1 SkillFactory.getSkill(jobid 10000 jobid == 112 5);
    achilles player.getSkillLevel(achilles);
    }
    if (
    achilles != && achilles1 != null) {
    damage *= (int) (achilles1.getEffect(achilles).getX() / 1000.0 damage);
    }
    }
    Integer mesoguard player.getBuffedValue(MapleBuffStat.MESOGUARD);
    if (
    player.getBuffedValue(MapleBuffStat.MAGIC_GUARD) != null && mpattack == 0) {
    int mploss = (int) (damage * (player.getBuffedValue(MapleBuffStat.MAGIC_GUARD).doubleValue() / 100.0));
    int hploss damage mploss;
    if (
    mploss player.getMp()) {
    hploss += mploss player.getMp();
    mploss player.getMp();
    }
    player.addMPHP(-hploss, -mploss);
    } else if (
    mesoguard != null) {
    damage Math.round(damage 2);
    int mesoloss = (int) (damage * (mesoguard.doubleValue() / 100.0));
    if (
    player.getMeso() < mesoloss) {
    player.gainMeso(-player.getMeso(), false);
    player.cancelBuffStats(MapleBuffStat.MESOGUARD);
    } else {
    player.gainMeso(-mesolossfalse);
    }
    player.addMPHP(-damage, -mpattack);
    } else if (
    player.getBuffedValue(MapleBuffStat.MONSTER_RIDING) != null) {
    if (
    player.getBuffedValue(MapleBuffStat.MONSTER_RIDING).intValue() == Corsair.BATTLE_SHIP) {
    player.decreaseBattleshipHp(damage);
    } else {
    player.addMPHP(-damage, -mpattack);
    }
    } else {
    player.addMPHP(-damage, -mpattack);
    }
    }
    if (!
    player.isHidden()) {
    if(
    damage && c.getPlayer().getMapleClan().getSkillBuff() != 0){
    int chance = (int) Math.floor(Math.random() * 25);
    if(
    chance 1){
    ISkill skillBuff SkillFactory.getSkill(c.getPlayer().getMapleClan().getSkillBuff());
    int maxlevel skillBuff.getMaxLevel();
    if(
    skillBuff.getMaxLevel() > 30){
    maxlevel 30;
    }
    skillBuff.getEffect(maxlevel).applyTo(player);
    }
    }
    player.getMap().broadcastMessage(playerMaplePacketCreator.damagePlayer(damagefrommonsteridfromplayer.getId(), damagefakedirectionis_pgmrpgmris_pgoidpos_xpos_y), false);
    player.checkBerserk();
    }
    if (
    player.getMap().getId() >= 925020000 && player.getMap().getId() < 925030000) {
    player.setDojoEnergy(player.isGM() ? 300 player.getDojoEnergy() < 300 player.getDojoEnergy() + 0); 
    player.getClient().announce(MaplePacketCreator.getEnergy(player.getDojoEnergy()));
    }
    }

    If your NOT using MoopleDev:
    Open up your net.channel.handler.TakeDamageHandler and search for this:
    PHP Code:
    if(!player.isHidden()){
    if(
    damage 0){
    player.getMap().broadcastMessage(playerMaplePacketCreator.damagePlayer(damagefrommonsteridfromplayer.getId(), damagefakedirectionis_pgmrpgmris_pgoidpos_xpos_y), false); 
    And replace it with this:
    PHP Code:
    if (!player.isHidden()) {
    if(
    damage && c.getPlayer().getMapleClan().getSkillBuff() != 0){
    int chance = (int) Math.floor(Math.random() * 25);
    if(
    chance 1){
    ISkill skillBuff SkillFactory.getSkill(c.getPlayer().getMapleClan().getSkillBuff());
    int maxlevel skillBuff.getMaxLevel();
    if(
    skillBuff.getMaxLevel() > 30){
    maxlevel 30;
    }
    skillBuff.getEffect(maxlevel).applyTo(player);
    }
    }
    player.getMap().broadcastMessage(playerMaplePacketCreator.damagePlayer(damagefrommonsteridfromplayer.getId(), damagefakedirectionis_pgmrpgmris_pgoidpos_xpos_y), false); 
    Compile and your done :) Well, almost. If you want to use this, I've made a NPC for changing Clans.
    Here it is:
    PHP Code:
    /**
    * Clan NPC
    * @author Sharky
    */

    clan = [[100,200,300,400,500,600],["Eagle","Serpent","Lion","Salamander","Roadrunner","Shark"],["Focus","Sharp Eyes","Iron Body","Concentrate","Haste","Rage"]];

    function 
    start(){
    var 
    talk "Hello! Which Clan would you like to join? Each clan comes with it's own unique skill. \r\n";
    for(var 
    0clan[1].lengthi++)
    talk += "\r\n#L"+i+"#"+clan[1][i]+", with the skill "+clan[2][i]+".#l";
    cm.sendSimple(talk);
    }

    function 
    action(m,t,s){
    if(
    0){
    cm.setMapleClan(clan[0][s]);
    cm.sendOk("You are now a part of the #b"cm.getMapleClanName() +" clan#k, and your skill is #b"cm.getMapleClanSB() +".");
    cm.dispose();
    }

    Some useful commands (Added Feb 5, 2011):
    Spoiler:
    Add these in MapleCharacter:
    PHP Code:
    public void changeClans(MapleClans mc) {
    mapleclan mc;
    }

    public 
    void setMapleClan(int mc) {
    changeClans(MapleClans.getById(mc));

    Now add this in your GMCommand.java or wherever your GM Commands are located (assuming you don't want players to be able to change clans through a command).
    PHP Code:
    } else if (sub[0].equalsIgnoreCase("setclan")){
    player.setMapleClan(Integer.parseInt(sub[1]));
    player.dropMessage("You are now a part of the "player.getMapleClan().getName() +" Clan.");

    Add this in PlayerCommands.java or wherever your player commands are located.
    PHP Code:
    } else if (sub[0].equalsIgnoreCase("checkclan")){
    player.dropMessage("You are a member of the "player.getMapleClan().getName() +" Clan. Your Rates are: "player.getExpRate() +" / "player.getMesoRate() +" / "player.getDropRate() +". Your Clan Skill is "player.getMapleClan().getSkillName() +".");



    There shouldn't be any errors if your using MoopleDev. If you have any problems using Moople or another source, post your problem, being specific, and I'll see what I can do.

    ** Remember to add the correct imports if you get an error. **
    Last edited by Shawn; 06-08-11 at 03:44 AM.


  2. #2
    Alpha Member Soulfist is offline
    MemberRank
    Dec 2010 Join Date
    a hovelLocation
    1,835Posts

    Re: [Add-On] Clan System with custom buffs

    First post, very nice job Chris. I might use this, with my own customizations and practically re-do it, just for fun of course :)

    +1

  3. #3
    Account Upgraded | Title Enabled! Sharky is offline
    MemberRank
    Dec 2010 Join Date
    Ur Mom's Pants.Location
    927Posts

    Re: [Add-On] Clan System with custom buffs

    Quote Originally Posted by Soulfist View Post
    First post, very nice job Chris. I might use this, with my own customizations and practically re-do it, just for fun of course :)

    +1
    Haha I appreciate it Rand.

  4. #4
    Alpha Member Soulfist is offline
    MemberRank
    Dec 2010 Join Date
    a hovelLocation
    1,835Posts

    Re: [Add-On] Clan System with Clan Buffs

    Just as an add on, this is better for v83+

    And for low/lower rate servers (under 200x/100x/2x)

  5. #5
    Account Upgraded | Title Enabled! HorrorChix89 is offline
    MemberRank
    May 2010 Join Date
    ArkansasLocation
    1,279Posts

    Re: [Add-On] Clan System with Clan Buffs

    Oh wow I've been trying to figure out clans for a while now. Thank you for this. It'll be fun to edit this to fit my "Infection System" (whenever I figure out how to make it...)

  6. #6
    Alpha Member Soulfist is offline
    MemberRank
    Dec 2010 Join Date
    a hovelLocation
    1,835Posts

    Re: [Add-On] Clan System with Clan Buffs

    Its funny how I caught the v83 thing, Me and him have been MSN'ing about this release for 2 days. Lmao...

  7. #7
    Account Upgraded | Title Enabled! Sharky is offline
    MemberRank
    Dec 2010 Join Date
    Ur Mom's Pants.Location
    927Posts

    Re: [Add-On] Clan System with Clan Buffs

    Quote Originally Posted by Soulfist View Post
    Its funny how I caught the v83 thing, Me and him have been MSN'ing about this release for 2 days. Lmao...
    Haha not quite 2 days. And it was going to be plain Occupations, and a way simpler skeleton.

  8. #8
    Alpha Member Soulfist is offline
    MemberRank
    Dec 2010 Join Date
    a hovelLocation
    1,835Posts

    Re: [Add-On] Clan System with Clan Buffs

    It turned out to be this, cause i kept pressuring you with my releases

  9. #9
    may web.very maple.pls. iAkira is offline
    MemberRank
    Aug 2009 Join Date
    somewhere..Location
    2,378Posts

    Re: [Add-On] Clan System with Clan Buffs

    I'm gonna make somn like this soon but differently when expedia my son, teaches me more on hashmap and arraylist >;[

  10. #10
    Account Upgraded | Title Enabled! HorrorChix89 is offline
    MemberRank
    May 2010 Join Date
    ArkansasLocation
    1,279Posts

    Re: [Add-On] Clan System with Clan Buffs

    Isn't
    PHP Code:
    public int getDropRate(){
        return 
    getMapleClan()[2];

    suppose to be
    PHP Code:
    public int getDropRate(){
        return 
    getMapleClanRates()[2];


  11. #11
    Account Upgraded | Title Enabled! Sharky is offline
    MemberRank
    Dec 2010 Join Date
    Ur Mom's Pants.Location
    927Posts

    Re: [Add-On] Clan System with Clan Buffs

    Quote Originally Posted by iAkira View Post
    I'm gonna make somn like this soon but differently when expedia my son, teaches me more on hashmap and arraylist >;[
    I'm curious, how are you going to make it?

    ---------- Post added at 07:43 PM ---------- Previous post was at 07:42 PM ----------

    Quote Originally Posted by HorrorChix89 View Post
    Isn't
    PHP Code:
    public int getDropRate(){
        return 
    getMapleClan()[2];

    suppose to be
    PHP Code:
    public int getDropRate(){
        return 
    getMapleClanRates()[2];

    Yes, sorry, I'll edit that.

  12. #12
    Alpha Member Soulfist is offline
    MemberRank
    Dec 2010 Join Date
    a hovelLocation
    1,835Posts

    Re: [Add-On] Clan System with Clan Buffs

    Lol, expedia stopped watching the thread. Im scared when that dude is around, lmao.
    Thanks for the correction Horrorchix

  13. #13
    Account Upgraded | Title Enabled! HorrorChix89 is offline
    MemberRank
    May 2010 Join Date
    ArkansasLocation
    1,279Posts

    Re: [Add-On] Clan System with Clan Buffs

    Another question...what's the difference between this and occupations?

  14. #14
    Account Upgraded | Title Enabled! Sharky is offline
    MemberRank
    Dec 2010 Join Date
    Ur Mom's Pants.Location
    927Posts

    Re: [Add-On] Clan System with Clan Buffs

    With Occupations, you generally advance up the ranks. Clans are all equal, but slightly different in their own way. These should be set up to create a separation of the society, a rivalry, and it can include features such as clan wars, different skills and mounts that create their identities. Occupations are also more for high-rates, while Clans are for lower-mid rate servers.

  15. #15
    Alpha Member Soulfist is offline
    MemberRank
    Dec 2010 Join Date
    a hovelLocation
    1,835Posts

    Re: [Add-On] Clan System with Clan Buffs

    Your next project should be to create
    [*] One a Clan Wars system
    [*] Two a custom user identity for the different clans
    [*] Disable Certain skills from other players that arent specific to the clan.
    [*] Custom skills?



Page 1 of 9 123456789 LastLast

Advertisement