Created
June 25, 2015 14:23
-
-
Save u3games/67e9f9bfce36c911bcdf to your computer and use it in GitHub Desktop.
L2JServer - Add/Change email system - Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Eclipse Workspace Patch 1.0 | |
#P L2Dev_ChangeEmail_Data | |
Index: dist/sql/login/custom/email.sql | |
=================================================================== | |
--- dist/sql/login/custom/email.sql (revision 0) | |
+++ dist/sql/login/custom/email.sql (working copy) | |
@@ -0,0 +1 @@ | |
+ALTER TABLE `accounts` ADD `email` VARCHAR(255) NULL DEFAULT NULL ; | |
\ No newline at end of file | |
Index: dist/game/data/html/mods/ChangeEmail.htm | |
=================================================================== | |
--- dist/game/data/html/mods/ChangeEmail.htm (revision 0) | |
+++ dist/game/data/html/mods/ChangeEmail.htm (working copy) | |
@@ -0,0 +1,10 @@ | |
+<html><body> | |
+<center> | |
+<td> | |
+<tr>Current Email:</tr><tr><edit type="email" var="oldemail" width=150></tr><br> | |
+<tr>New Email</tr><tr><edit type="email" var="newemail" width=150></tr><br> | |
+<tr>Repeat New Email</tr><tr><edit type="email" var="repeatnewemail" width=150></tr><br> | |
+<td> | |
+<button value="Change Email" action="bypass -h voice .email $oldemail $newemail $repeatnewemail" width=160 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df"> | |
+</center> | |
+</body></html> | |
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/ChangeEmail.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/voicedcommandhandlers/ChangeEmail.java (revision 0) | |
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/ChangeEmail.java (working copy) | |
@@ -0,0 +1,107 @@ | |
+/* | |
+ * This program is free software: you can redistribute it and/or modify it under | |
+ * the terms of the GNU General Public License as published by the Free Software | |
+ * Foundation, either version 3 of the License, or (at your option) any later | |
+ * version. | |
+ * | |
+ * 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 General Public License for more | |
+ * details. | |
+ * | |
+ * You should have received a copy of the GNU General Public License along with | |
+ * this program. If not, see <http://www.gnu.org/licenses/>. | |
+ */ | |
+ | |
+package handlers.voicedcommandhandlers; | |
+ | |
+import java.util.StringTokenizer; | |
+import java.util.logging.Level; | |
+ | |
+import com.l2jserver.gameserver.LoginServerThread; | |
+import com.l2jserver.gameserver.cache.HtmCache; | |
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler; | |
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; | |
+ | |
+public class ChangeEmail implements IVoicedCommandHandler | |
+{ | |
+ private static final String[] _voicedCommands = | |
+ { | |
+ "email" | |
+ }; | |
+ | |
+ @Override | |
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) | |
+ { | |
+ if (target != null) | |
+ { | |
+ final StringTokenizer st = new StringTokenizer(target); | |
+ try | |
+ { | |
+ String curpass = null, newpass = null, repeatnewpass = null; | |
+ if (st.hasMoreTokens()) | |
+ { | |
+ curpass = st.nextToken(); | |
+ } | |
+ if (st.hasMoreTokens()) | |
+ { | |
+ newpass = st.nextToken(); | |
+ } | |
+ if (st.hasMoreTokens()) | |
+ { | |
+ repeatnewpass = st.nextToken(); | |
+ } | |
+ | |
+ if (!((curpass == null) || (newpass == null) || (repeatnewpass == null))) | |
+ { | |
+ if (!newpass.equals(repeatnewpass)) | |
+ { | |
+ activeChar.sendMessage("The new email doesn't match with the repeated one!"); | |
+ return false; | |
+ } | |
+ if (newpass.length() < 3) | |
+ { | |
+ activeChar.sendMessage("The new email is shorter than 3 chars! Please try with a longer one."); | |
+ return false; | |
+ } | |
+ if (newpass.length() > 30) | |
+ { | |
+ activeChar.sendMessage("The new email is longer than 30 chars! Please try with a shorter one."); | |
+ return false; | |
+ } | |
+ | |
+ LoginServerThread.getInstance().sendChangeEmail(activeChar.getAccountName(), activeChar.getName(), curpass, newpass); | |
+ } | |
+ else | |
+ { | |
+ activeChar.sendMessage("Invalid email data! You have to fill all boxes."); | |
+ return false; | |
+ } | |
+ } | |
+ catch (Exception e) | |
+ { | |
+ activeChar.sendMessage("A problem occured while changing email!"); | |
+ _log.log(Level.WARNING, "", e); | |
+ } | |
+ } | |
+ else | |
+ { | |
+ // showHTML(activeChar); | |
+ String html = HtmCache.getInstance().getHtm("en", "data/html/mods/ChangeEmail.htm"); | |
+ if (html == null) | |
+ { | |
+ html = "<html><body><br><br><center><font color=LEVEL>404:</font> File Not Found</center></body></html>"; | |
+ } | |
+ activeChar.sendPacket(new NpcHtmlMessage(html)); | |
+ return true; | |
+ } | |
+ return true; | |
+ } | |
+ | |
+ @Override | |
+ public String[] getVoicedCommandList() | |
+ { | |
+ return _voicedCommands; | |
+ } | |
+} | |
Index: .classpath | |
=================================================================== | |
--- .classpath (revision 21974) | |
+++ .classpath (working copy) | |
@@ -1,8 +1,8 @@ | |
<?xml version="1.0" encoding="UTF-8"?> | |
<classpath> | |
- <classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts" /> | |
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8" /> | |
- <classpathentry combineaccessrules="false" kind="src" path="/L2J_Server" /> | |
- <classpathentry kind="lib" path="/L2J_Server/dist/libs/mmocore.jar" /> | |
- <classpathentry kind="output" path="bin" /> | |
-</classpath> | |
\ No newline at end of file | |
+ <classpathentry including="**/*.java" kind="src" path="dist/game/data/scripts"/> | |
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | |
+ <classpathentry combineaccessrules="false" kind="src" path="/L2Dev_ChangeEmail_Core"/> | |
+ <classpathentry kind="lib" path="/L2Dev_ChangeEmail_Core/dist/libs/mmocore.jar"/> | |
+ <classpathentry kind="output" path="bin"/> | |
+</classpath> | |
Index: dist/game/data/scripts/handlers/MasterHandler.java | |
=================================================================== | |
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 21974) | |
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy) | |
@@ -249,6 +249,7 @@ | |
import handlers.usercommandhandlers.Time; | |
import handlers.usercommandhandlers.Unstuck; | |
import handlers.voicedcommandhandlers.Banking; | |
+import handlers.voicedcommandhandlers.ChangeEmail; | |
import handlers.voicedcommandhandlers.ChangePassword; | |
import handlers.voicedcommandhandlers.ChatAdmin; | |
import handlers.voicedcommandhandlers.Debug; | |
@@ -531,6 +532,7 @@ | |
(Config.L2JMOD_CHAT_ADMIN ? ChatAdmin.class : null), | |
(Config.L2JMOD_MULTILANG_ENABLE && Config.L2JMOD_MULTILANG_VOICED_ALLOW ? Lang.class : null), | |
(Config.L2JMOD_DEBUG_VOICE_COMMAND ? Debug.class : null), | |
+ (Config.L2JMOD_ALLOW_CHANGE_EMAIL ? ChangeEmail.class : null), | |
(Config.L2JMOD_ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null), | |
}, | |
{ | |
Index: dist/sql/login/custom/email.sql | |
=================================================================== | |
--- dist/sql/login/custom/email.sql (revision 0) | |
+++ dist/sql/login/custom/email.sql (working copy) | |
@@ -0,0 +1 @@ | |
+ALTER TABLE `accounts` ADD `email` VARCHAR(255) NULL DEFAULT NULL ; | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useless and not safe to give them a chance to change the e-mail