- Joined
- Jul 22, 2007
- Messages
- 9
- Reaction score
- 0
Intro: Well this is my first release so no flaming guys. Please!
This basically lets you award points to users for something(such as website events, ingame events, reported a hacker etc) This is stored in a separate SQL Column in accounts table. Hence points can be awarded for website events as well. Now these points can be used for giving out unique stuff etc...
now to the code
First Execute this Query in your database:
then go to MapleCharacter.java
Scroll down till you see this:
and below that add:
now ctrl+f(Search) for :
and insert the following code immediately below it
Now scroll down till you see this:
and below that add:
Thats it.. your MapleCharacter is done
Now go to NPCConversationManager.java in net.sf.odinms.scripting.npc
scroll down till you see:
and add the following below it
The basis of it is done.. now you can close your NPCConversationManager.java
If you do want the commands for gm for adding and removing points.... scroll down
Open your CommandProcessor.java
GM Commands are:
!addpoints <Character Name> <No of points>
!addpoints is used to credit points into a user's account.
!removepoints <Character Name> <No of points>
!removepoints is used to remove points from a user's account.
Enjoy!
This basically lets you award points to users for something(such as website events, ingame events, reported a hacker etc) This is stored in a separate SQL Column in accounts table. Hence points can be awarded for website events as well. Now these points can be used for giving out unique stuff etc...
now to the code
First Execute this Query in your database:
Code:
ALTER TABLE `accounts` ADD COLUMN `points` int(11) DEFAULT '0';
Scroll down till you see this:
Code:
private int rank;
private int rankMove;
private int jobRank;
private int jobRankMove;
and below that add:
Code:
private int points;
now ctrl+f(Search) for :
Code:
ps.close();
and insert the following code immediately below it
Code:
ps = con.prepareStatement("SELECT * FROM accounts WHERE points = ?");
ps.setInt(1, ret.points);
rs = ps.executeQuery();
while (rs.next()) {
ret.points = rs.getInt("points");
}
Now scroll down till you see this:
Code:
public boolean isGM() {
return gm;
}
Code:
public int getPoints() {
return points;
}
public void addPoints(int addpoints) {
points += addpoints;
}
public void removePoints(int removepoints) {
if (points <= 0) {
points = 0;
} else if (removepoints >= points) {
points = 0;
} else {
points -= removepoints;
}
}
Now go to NPCConversationManager.java in net.sf.odinms.scripting.npc
scroll down till you see:
Code:
public void gainExp(int gain) {
getPlayer().gainExp(gain, true, true);
}
Code:
public int getPoints() {
return getPlayer().getPoints();
}
public void addPoints(int points) {
getPlayer().addPoints(points);
}
public void removePoints(int points) {
getPlayer().removePoints(points);
}
If you do want the commands for gm for adding and removing points.... scroll down
Open your CommandProcessor.java
Code:
else if(splitted[0].equals("!addpoints")) {
if(splitted.length == 3) {
try { MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
int points = Integer.parseInt(splitted[2]);
victim.addPoints(points);
mc.dropMessage(victim.getName()+" successfully credited with "+points+" points");
} catch(NumberFormatException ioerror) {
mc.dropMessage("A number should be given o.o");
}
} else {
mc.dropMessage("Syntax: !addpoints <Charname> <amt of points>");
}
} else if (splitted[0].equals("!removepoints")) {
if(splitted.length == 3) {
try { MapleCharacter victim = cserv.getPlayerStorage().getCharacterByName(splitted[1]);
int repoints = Integer.parseInt(splitted[2]);
victim.removePoints(repoints);
mc.dropMessage(repoints+" points removed from "+victim.getName()+"'s account");
} catch(NumberFormatException ioerror1) {
mc.dropMessage("A number should be given o.o");
}
} else {
mc.dropMessage("Syntax: !removepoints <Charname> <points>");
}
}
!addpoints <Character Name> <No of points>
!addpoints is used to credit points into a user's account.
!removepoints <Character Name> <No of points>
!removepoints is used to remove points from a user's account.
Enjoy!
Last edited: