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;
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:
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:
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;
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 i = 0; i < clan[1].length; i++) talk += "\r\n#L"+i+"#"+clan[1][i]+", with the skill "+clan[2][i]+".#l"; cm.sendSimple(talk); }
function action(m,t,s){ if(m > 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. **
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...)
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.
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?