Cpq1 ,2 add linguas

This commit is contained in:
Diego Armando de Freitas Matos
2019-03-07 22:37:00 -03:00
parent 90ad58f17f
commit 0a8efa4238
7 changed files with 75 additions and 15 deletions

View File

@@ -9598,7 +9598,6 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
private MapleFitness fitness;
private MapleOla ola;
private long snowballattack;
private int lingua = 0;// 0 PTB 1 ESP 2 ENG
public static final List<String> itens = new ArrayList();
public static final List<Item> item = new ArrayList();
@@ -10174,12 +10173,24 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
this.challenged = challenged;
}
public void setLingua(int a) {
this.lingua = a;
public void setLingua(int num) {
getClient().setLingua(num);
try {
Connection con = DatabaseConnection.getConnection();
try (PreparedStatement ps = con.prepareStatement("UPDATE accounts SET lingua = ? WHERE id = ?")) {
ps.setInt(1, num);
ps.setInt(2, getClient().getAccID());
ps.executeUpdate();
} finally {
con.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public int getLingua() {
return lingua;
return getClient().getLingua();
}
public void setItens(String item) {

View File

@@ -124,6 +124,7 @@ public class MapleClient {
private int visibleWorlds;
private long lastNpcClick;
private long sessionId;
private int lingua = 0;
public MapleClient(MapleAESOFB send, MapleAESOFB receive, IoSession session) {
this.send = send;
@@ -535,7 +536,7 @@ public class MapleClient {
ResultSet rs = null;
try {
con = DatabaseConnection.getConnection();
ps = con.prepareStatement("SELECT id, password, gender, banned, pin, pic, characterslots, tos FROM accounts WHERE name = ?");
ps = con.prepareStatement("SELECT id, password, gender, banned, pin, pic, characterslots, tos, lingua FROM accounts WHERE name = ?");
ps.setString(1, login);
rs = ps.executeQuery();
if (rs.next()) {
@@ -546,6 +547,7 @@ public class MapleClient {
pic = rs.getString("pic");
gender = rs.getByte("gender");
characterSlots = rs.getByte("characterslots");
lingua = rs.getInt("lingua");
String passhash = rs.getString("password");
byte tos = rs.getByte("tos");
@@ -1528,4 +1530,12 @@ public class MapleClient {
public boolean canBypassPic() {
return MapleLoginBypassCoordinator.getInstance().canLoginBypass(getNibbleHWID(), accId, true);
}
public int getLingua() {
return lingua;
}
public void setLingua(int lingua) {
this.lingua = lingua;
}
}

View File

@@ -178,6 +178,7 @@ public class CommandsExecutor {
addCommand("uptime", UptimeCommand.class);
addCommand("gacha", GachaCommand.class);
addCommand("dispose", DisposeCommand.class);
addCommand("changel", ChangeLinguaCommand.class);
addCommand("equiplv", EquipLvCommand.class);
addCommand("showrates", ShowRatesCommand.class);
addCommand("rates", RatesCommand.class);

View File

@@ -0,0 +1,42 @@
/*
This file is part of the HeavenMS MapleStory Server, commands OdinMS-based
Copyleft (L) 2016 - 2018 RonanLana
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/>.
*/
/*
@Author: Arthur L - Refactored command content into modules
*/
package client.command.commands.gm0;
import client.command.Command;
import client.MapleClient;
public class ChangeLinguaCommand extends Command {
{
setDescription("");
}
@Override
public void execute(MapleClient c, String[] params) {
if (params.length < 1) {
c.getPlayer().yellowMessage("Syntax: !changel <0=ptb, 1=esp, 2=eng>");
return;
}
c.setLingua(Integer.parseInt(params[0]));
}
}