- Joined
- Jun 27, 2008
- Messages
- 148
- Reaction score
- 0
NOTE: THIS IS NOT TESTED. IF YOU WANT TO BE SAFE, USE GOOFY'S ORIGINAL SCRIPT. THIS WAS MAINLY MADE TO FIX THE BUG WHERE
THE PLAYER CAN LOG OFF AND BE UNMUTED. I HAVEN'T TESTED IT AS I DO NOT HAVE THE COMMAND ADDED TO MY SERVER. IF ANYONE CAN
TEST IT, PLEASE REMEMBER TO BACK UP YOUR FILES FIRST, THEN MAKE THE FOLLOWING EDITS. I WILL NOT TAKE RESPONSIBILITY IN MESSING
UP YOUR FILES.
Execute this Query:
In client.MapleCharacter.java, Find:
Under, Place:
Underneath:
Place:
Before the last closing bracket:
Under Add:
Same file, find:
Under add:
Same file, find:
Under add:
Same file, find:
Under add:
Same file, Find and Replace:
With:
In the same file, right under, find:
Replace it with:
Open channel.handler.GeneralchatHandler.java and replace all with:
Now finally, open client.messages.CommandProcessor.java and add:
Credits to iGoofy for the original, and me for the bug fix, hope this works and helps. :3
Be sure to add Goofy's first. D; I stole Goofy's post and added it here.
THE PLAYER CAN LOG OFF AND BE UNMUTED. I HAVEN'T TESTED IT AS I DO NOT HAVE THE COMMAND ADDED TO MY SERVER. IF ANYONE CAN
TEST IT, PLEASE REMEMBER TO BACK UP YOUR FILES FIRST, THEN MAKE THE FOLLOWING EDITS. I WILL NOT TAKE RESPONSIBILITY IN MESSING
UP YOUR FILES.
Execute this Query:
Code:
ALTER TABLE `characters` ADD COLUMN `muted` INTEGER UNSIGNED NOT NULL DEFAULT 0 AFTER `messengerposition`;
In client.MapleCharacter.java, Find:
Code:
private boolean canDoor = true;
Code:
private boolean canTalk;
Underneath:
Code:
private MapleCharacter() {
Place:
Code:
canTalk = true;
Before the last closing bracket:
PHP:
public boolean getCanTalk() {
return this.canTalk;
}
public boolean canTalk(boolean talk) {
return this.canTalk = talk;
}
Code:
private int guildid;
private int guildrank;
private MapleGuildCharacter mgc = null;
Code:
private int muted;
Same file, find:
Code:
ret.jobRankMove = rs.getInt("jobRankMove");
Code:
ret.muted = rs.getInt("muted");
Same file, find:
Code:
ret.buddylist = new BuddyList(25);
Code:
ret.muted = 0;
Same file, find:
Code:
public BuddyList getBuddylist() {
return buddylist;
}
Under add:
Code:
public int getMuted() {
return muted;
}
public void setMuted(int muted) {
this.muted = muted;
}
Same file, Find and Replace:
Code:
public void saveToDB(boolean update) {
Connection con = DatabaseConnection.getConnection();
try {
// clients should not be able to log back before their old state is saved (see MapleClient#getLoginState) so we are save to switch to a very low isolation level here
con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
// connections are thread local now, no need to
// synchronize anymore =)
con.setAutoCommit(false);
PreparedStatement ps;
if (update) {
ps = con.prepareStatement("UPDATE characters "
+ "SET level = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, "
+ "exp = ?, hp = ?, mp = ?, maxhp = ?, maxmp = ?, sp = ?, ap = ?, "
+ "gm = ?, skincolor = ?, gender = ?, job = ?, hair = ?, face = ?, map = ?, "
+ "meso = ?, hpApUsed = ?, mpApUsed = ?, spawnpoint = ?, party = ?, buddyCapacity = ?, messengerid = ?, messengerposition = ? WHERE id = ?");
} else {
ps = con
.prepareStatement("INSERT INTO characters ("
+ "level, fame, str, dex, luk, `int`, exp, hp, mp, "
+ "maxhp, maxmp, sp, ap, gm, skincolor, gender, job, hair, face, map, meso, hpApUsed, mpApUsed, spawnpoint, party, buddyCapacity, messengerid, messengerposition, accountid, name, world"
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
}
Code:
public void saveToDB(boolean update) {
Connection con = DatabaseConnection.getConnection();
try {
// clients should not be able to log back before their old state is saved (see MapleClient#getLoginState) so we are save to switch to a very low isolation level here
con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
// connections are thread local now, no need to
// synchronize anymore =)
con.setAutoCommit(false);
PreparedStatement ps;
if (update) {
ps = con.prepareStatement("UPDATE characters "
+ "SET level = ?, fame = ?, str = ?, dex = ?, luk = ?, `int` = ?, "
+ "exp = ?, hp = ?, mp = ?, maxhp = ?, maxmp = ?, sp = ?, ap = ?, "
+ "gm = ?, skincolor = ?, gender = ?, job = ?, hair = ?, face = ?, map = ?, "
+ "meso = ?, hpApUsed = ?, mpApUsed = ?, spawnpoint = ?, party = ?, buddyCapacity = ?, messengerid = ?, messengerposition = ?, muted = ? WHERE id = ?");
} else {
ps = con
.prepareStatement("INSERT INTO characters ("
+ "level, fame, str, dex, luk, `int`, exp, hp, mp, "
+ "maxhp, maxmp, sp, ap, gm, skincolor, gender, job, hair, face, map, meso, hpApUsed, mpApUsed, spawnpoint, party, buddyCapacity, messengerid, messengerposition, muted, accountid, name, world"
+ ") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
}
Code:
else {
ps.setInt(27, 0);
ps.setInt(28, 4);
}
if (update) {
ps.setInt(29, id);
} else {
ps.setInt(29, accountid);
ps.setString(30, name);
ps.setInt(31, world); // TODO store world somewhere ;)
}
Code:
else {
ps.setInt(27, 0);
ps.setInt(28, 4);
}
ps.setInt(29, muted);
if (update) {
ps.setInt(30, id);
} else {
ps.setInt(30, accountid);
ps.setString(31, name);
ps.setInt(32, world); // TODO store world somewhere ;)
}
Open channel.handler.GeneralchatHandler.java and replace all with:
Code:
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <[email protected]>
Matthias Butz <[email protected]>
Jan Christian Meyer <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License 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.sf.odinms.net.channel.handler;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.client.messages.CommandProcessor;
import net.sf.odinms.net.AbstractMaplePacketHandler;
import net.sf.odinms.tools.MaplePacketCreator;
import net.sf.odinms.tools.StringUtil;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
public class GeneralchatHandler extends AbstractMaplePacketHandler {
@Override
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
String text = slea.readMapleAsciiString();
boolean warning;
if (!CommandProcessor.getInstance().processCommand(c, text)) {
if (StringUtil.countCharacters(text, '@') > 4 || StringUtil.countCharacters(text, '%') > 4 ||
StringUtil.countCharacters(text, '+') > 6 || StringUtil.countCharacters(text, '$') > 6 ||
StringUtil.countCharacters(text, '&') > 6 || StringUtil.countCharacters(text, '~') > 6 ||
StringUtil.countCharacters(text, 'W') > 6) {
text = "DISREGARD THAT, MY SERVER OWNER IS A LEECHING NOOB IF THIS ISN'T CHANGED.";
}
if (c.getPlayer().getCanTalk() == true && c.getPlayer().getMuted() == 0) {
c.getPlayer().getMap().broadcastMessage(MaplePacketCreator.getChatText(c.getPlayer().getId(), text));
} else {
c.getPlayer().getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been muted and are therefore unable to talk. :D"));
}
}
}
}
Now finally, open client.messages.CommandProcessor.java and add:
Code:
else if (splitted[0].equals("!stfu")) {
try {
int set = Integer.parseInt(splitted[2]);
MapleCharacter d = c.getPlayer().getClient().getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]);
if (set == 1) {
if (d.getCanTalk() == true) {
d.canTalk(false);
d.setMuted(1);
d.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been muted."));
mc.dropMessage(d.getName() + " has been muted.");
} else {
mc.dropMessage(d.getName() + " has already been muted");
}
}
if (set == 0) {
if (d.getCanTalk() == false) {
d.canTalk(true);
d.setMuted(0);
d.getClient().getChannelServer().broadcastPacket(MaplePacketCreator.serverNotice(6, "You have been unmuted."));
mc.dropMessage(d.getName() + " has been unmuted");
} else {
mc.dropMessage(d.getName() + " can already talk.");
}
}
} catch
(ArrayIndexOutOfBoundsException e) {
mc.dropMessage("Syntax helper: !mute <Victim's name> <1 or 0 | 1 = Mute, 0 = Unmute.>");
}
catch (NullPointerException e) {
mc.dropMessage("Could not find " + splitted[1] + ".");
}
}
Credits to iGoofy for the original, and me for the bug fix, hope this works and helps. :3
Be sure to add Goofy's first. D; I stole Goofy's post and added it here.
Last edited:

