|
26.07.2014, 14:09
|
#1
|
|
|
|
Сержант
|
Регистрация: 29.10.2009
Сообщений: 117
Популярность: 1783
Сказал(а) спасибо: 78
Поблагодарили 242 раз(а) в 79 сообщениях
|
Код для ввода команды Pin code L2J
Реализация внутреннего пароля к игре.
Код подходит для сборок l2j frozen, пользуйтесь)
Код:
### Eclipse Workspace Patch 1.0
#P PinCode
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
@@ -97,6 +97,12 @@
return;
}
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
// Fix enchant transactions
if(activeChar.isProcessingTransaction())
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeRequest.java (working copy)
@@ -48,7 +48,7 @@
L2PcInstance player = getClient().getActiveChar();
if (player == null)
return;
-
+
if (!player.getAccessLevel().allowTransaction())
{
player.sendMessage("Transactions are disable for your Access Level");
@@ -73,6 +73,12 @@
return;
}
+ if (player.isSubmitingPin() || ((L2PcInstance) target).isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if (partner.isAway())
{
player.sendMessage("You can't Request a Trade when partner is Away");
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSendFriendMsg.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSendFriendMsg.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSendFriendMsg.java (working copy)
@@ -60,6 +60,12 @@
activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME));
return;
}
+
+ if (activeChar.isSubmitingPin() || targetPlayer.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if(Config.LOG_CHAT)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestShowMiniMap.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestShowMiniMap.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestShowMiniMap.java (working copy)
@@ -40,6 +40,12 @@
if(activeChar == null)
return;
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
activeChar.sendPacket(new ShowMiniMap(1665));
}
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/Say2.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/Say2.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/Say2.java (working copy)
@@ -143,7 +143,11 @@
activeChar.sendMessage("You may not chat while a chat ban is in effect.");
return;
}
-
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if(activeChar.isInJail() && Config.JAIL_DISABLE_CHAT)
{
if(_type == TELL || _type == SHOUT || _type == TRADE || _type == HERO_VOICE)
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestAquireSkill.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestAquireSkill.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestAquireSkill.java (working copy)
@@ -116,6 +116,12 @@
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to learn skill that he can't!!!", IllegalPlayerAction.PUNISH_KICK);
return;
}
+
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if(player.getSp() >= _requiredSp)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/UseItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/UseItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/UseItem.java (working copy)
@@ -86,6 +86,12 @@
return;
}
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if (activeChar.getPrivateStoreType() != 0)
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE));
Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy)
@@ -37,6 +37,7 @@
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.VersionCmd;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Voting;
import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Wedding;
+import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Pin;
/**
* This class ...
@@ -65,6 +66,7 @@
_datatable = new FastMap<String, IVoicedCommandHandler>();
registerVoicedCommandHandler(new Voting());
+ registerVoicedCommandHandler(new Pin());
if (Config.BANKING_SYSTEM_ENABLED)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestMagicSkillUse.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestMagicSkillUse.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestMagicSkillUse.java (working copy)
@@ -64,6 +64,12 @@
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
+
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if(activeChar.isOutOfControl())
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestStopPledgeWar.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestStopPledgeWar.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestStopPledgeWar.java (working copy)
@@ -46,6 +46,12 @@
if(playerClan == null)
return;
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
L2Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);
if(clan == null)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestPetition.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestPetition.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestPetition.java (working copy)
@@ -47,6 +47,12 @@
L2PcInstance activeChar = getClient().getActiveChar();
if(activeChar == null)
return;
+
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if(!GmListTable.getInstance().isGmOnline(false))
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestExEnchantSkill.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestExEnchantSkill.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestExEnchantSkill.java (working copy)
@@ -116,6 +116,12 @@
Util.handleIllegalPlayerAction(player, "Player " + player.getName() + " tried to learn skill that he can't!!!", IllegalPlayerAction.PUNISH_KICK);
return;
}
+
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if(player.getSp() >= _requiredSp)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -20,6 +20,7 @@
import java.util.Date;
import java.util.logging.Logger;
import java.util.regex.Matcher;
+import javolution.text.TextBuilder;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -297,8 +298,47 @@
// Check player skills
if (Config.CHECK_SKILLS_ON_ENTER && !Config.ALT_GAME_SKILL_LEARN)
if (!activeChar.isAio())
- activeChar.checkAllowedSkills();
+ activeChar.checkAllowedSkills();
+ if (!activeChar.getPincheck())
+ {
+ TextBuilder tb = new TextBuilder();
+ NpcHtmlMessage html = new NpcHtmlMessage(1);
+
+ tb.append("<html><head><title>Character Pin Panel</title></head>");
+ tb.append("<body>");
+ tb.append("<center>");
+ tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
+ tb.append("<tr>");
+ tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
+ tb.append("<td valign=\"top\"><font color=\"FF6600\">Pin Panel</font>");
+ tb.append("<br1><font color=\"00FF00\">" + activeChar.getName() + "</font>, use this interface to enable pin secirity.</td></tr></table></center>");
+ tb.append("<center>");
+ tb.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center><br>");
+ tb.append("</center>");
+ tb.append("<table width=\"350\" cellpadding=\"5\" bgcolor=\"000000\">");
+ tb.append("<tr>");
+ tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"Icon.etc_old_key_i02\" width=\"32\" height=\"32\"></td>");
+ tb.append("<td valign=\"top\">Please enter your PIN:<edit var=\"dapin\" width=80 height=15>");
+ tb.append("<br1>info or something (can delete)</td>");
+ tb.append("</tr>");
+ tb.append("</table>");
+ tb.append("<br>");
+ tb.append("<center>");
+ tb.append("<button value=\"Submit\" action=\"bypass -h enterpin $dapin\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">");
+ tb.append("</center>");
+ tb.append("<center>");
+ tb.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center>");
+ tb.append("<font color=\"FF6600\">By Elfocrash</font>");
+ tb.append("</center>");
+ tb.append("</body></html>");
+
+ html.setHtml(tb.toString());
+ activeChar.sendPacket(html);
+ activeChar.setIsSubmitingPin(true);
+ activeChar.setIsImobilised(true);
+ }
+
PetitionManager.getInstance().checkPetitionMessages(activeChar);
// Send user info again .. just like the real client
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinParty.java (working copy)
@@ -66,6 +66,12 @@
return;
}
+ if (requestor.isSubmitingPin() || target.isSubmitingPin())
+ {
+ requestor.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if ((requestor._inEventDM && (DM.is_teleport() || DM.is_started())) || (target._inEventDM && (DM.is_teleport() || DM.is_started())))
{
requestor.sendMessage("You can't invite that player in party!");
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestConfirmCancelItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestConfirmCancelItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestConfirmCancelItem.java (working copy)
@@ -53,6 +53,12 @@
activeChar.sendPacket(new SystemMessage(SystemMessageId.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM));
return;
}
+
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
int price = 0;
switch(item.getItem().getItemGrade())
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/AllyDismiss.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/AllyDismiss.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/AllyDismiss.java (working copy)
@@ -70,6 +70,12 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if (clan.getClanId() == leaderClan.getClanId())
{
player.sendPacket(new SystemMessage(SystemMessageId.ALLIANCE_LEADER_CANT_WITHDRAW));
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSellItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSellItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSellItem.java (working copy)
@@ -91,6 +91,12 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
// Alt game - Karma punishment
if(!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
return;
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestFriendDel.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestFriendDel.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestFriendDel.java (working copy)
@@ -75,6 +75,12 @@
return;
}
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
try
{
L2PcInstance friend = L2World.getInstance().getPlayer(_name);
Index: head-src/com/l2jfrozen/gameserver/util/IllegalPlayerAction.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/util/IllegalPlayerAction.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/util/IllegalPlayerAction.java (working copy)
@@ -58,7 +58,7 @@
switch (punishment)
{
case PUNISH_KICK:
- _actor.sendMessage("You will be kicked for illegal action, GM informed.");
+ _actor.sendMessage("You will be kicked for illegal action.");
break;
case PUNISH_KICKBAN:
_actor.setAccessLevel(-100);
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/SetPrivateStoreListSell.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/SetPrivateStoreListSell.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/SetPrivateStoreListSell.java (working copy)
@@ -83,6 +83,12 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if (player.isTradeDisabled())
{
player.sendMessage("Trade are disable here. Try in another place.");
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/AllyLeave.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/AllyLeave.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/AllyLeave.java (working copy)
@@ -45,6 +45,12 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
L2Clan clan = player.getClan();
if (clan.getAllyId() == 0)
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDismissAlly.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDismissAlly.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDismissAlly.java (working copy)
@@ -38,6 +38,12 @@
if(activeChar == null)
return;
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if(!activeChar.isClanLeader())
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.FEATURE_ONLY_FOR_ALLIANCE_LEADER));
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDestroyItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDestroyItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDestroyItem.java (working copy)
@@ -92,6 +92,12 @@
return;
}
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
// Cannot discard item that the skill is consumming
if (activeChar.isCastingNow())
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSetAllyCrest.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSetAllyCrest.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSetAllyCrest.java (working copy)
@@ -69,6 +69,12 @@
activeChar.sendMessage("The crest file size was too big (max 192 bytes).");
return;
}
+
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if(activeChar.getAllyId() != 0)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestUserCommand.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestUserCommand.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestUserCommand.java (working copy)
@@ -44,7 +44,13 @@
L2PcInstance player = getClient().getActiveChar();
if(player == null)
return;
-
+
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
IUserCommandHandler handler = UserCommandHandler.getInstance().getUserCommandHandler(_command);
if(handler == null)
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinAlly.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinAlly.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestJoinAlly.java (working copy)
@@ -55,6 +55,12 @@
return;
}
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
L2PcInstance target = (L2PcInstance) L2World.getInstance().findObject(_id);
L2Clan clan = activeChar.getClan();
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeDone.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeDone.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/TradeDone.java (working copy)
@@ -48,6 +48,11 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
TradeList trade = player.getActiveTradeList();
if(trade == null)
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestUnEquipItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestUnEquipItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestUnEquipItem.java (working copy)
@@ -57,6 +57,12 @@
L2PcInstance activeChar = getClient().getActiveChar();
if(activeChar == null)
return;
+
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if(activeChar._haveFlagCTF)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSocialAction.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSocialAction.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestSocialAction.java (working copy)
@@ -62,6 +62,12 @@
return;
}
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if(activeChar.getPrivateStoreType() == 0 && activeChar.getActiveRequester() == null && !activeChar.isAlikeDead() && (!activeChar.isAllSkillsDisabled() || activeChar.isInDuel()) && activeChar.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
{
if(Config.DEBUG)
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/SetPrivateStoreListBuy.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/SetPrivateStoreListBuy.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/SetPrivateStoreListBuy.java (working copy)
@@ -99,6 +99,12 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if (player.isInsideZone(L2Character.ZONE_NOSTORE))
{
player.sendPacket(new PrivateStoreManageListBuy(player));
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
@@ -18,9 +18,15 @@
*/
package com.l2jfrozen.gameserver.network.clientpackets;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
+import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
+import com.l2jfrozen.util.database.L2DatabaseFactory;
import com.l2jfrozen.Config;
import com.l2jfrozen.gameserver.ai.CtrlIntention;
import com.l2jfrozen.gameserver.communitybbs.CommunityBoard;
@@ -61,7 +67,7 @@
@Override
protected void runImpl()
{
- L2PcInstance activeChar = getClient().getActiveChar();
+ final L2PcInstance activeChar = getClient().getActiveChar();
if(activeChar == null)
return;
@@ -319,6 +325,126 @@
{
Olympiad.bypassChangeArena(_command, activeChar);
}
+ else if (_command.startsWith("submitpin"))
+ {
+ try
+ {
+ String value = _command.substring(9);
+ StringTokenizer s = new StringTokenizer(value, " ");
+ int _pin = activeChar.getPin();
+
+ try
+ {
+ if (activeChar.getPincheck())
+ {
+ _pin = Integer.parseInt(s.nextToken());
+
+ if (Integer.toString(_pin).length() != 4)
+ {
+ activeChar.sendMessage("You have to fill the pin box with 4 numbers.Not more, not less.");
+ return;
+ }
+
+ Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("UPDATE characters SET pin=? WHERE obj_id=?");
+
+ statement.setInt(1, _pin);
+ statement.setInt(2, activeChar.getObjectId());
+ statement.execute();
+ statement.close();
+ activeChar.setPincheck(false);
+ activeChar.updatePincheck();
+ activeChar.sendMessage("You successfully submitted your pin code.You will need it in order to login.");
+ activeChar.sendMessage("Your Pin Code is: " + _pin);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ _log.warning("could not set char first login:" + e);
+ }
+ finally
+ {
+ L2DatabaseFactory.close(con);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ activeChar.sendMessage("The Pin Code must be 4 numbers.");
+ }
+ }
+ catch (Exception e)
+ {
+ activeChar.sendMessage("The Pin Code must be 4 numbers.");
+ }
+
+ }
+ else if (_command.startsWith("enterpin"))
+ {
+ try
+ {
+ String value = _command.substring(8);
+ StringTokenizer s = new StringTokenizer(value, " ");
+ int dapin = 0;
+ int pin = 0;
+
+ dapin = Integer.parseInt(s.nextToken());
+
+ Connection con = null;
+ PreparedStatement statement = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+
+ statement = con.prepareStatement("SELECT pin FROM characters WHERE obj_Id=?");
+ statement.setInt(1, activeChar.getObjectId());
+
+ ResultSet rset = statement.executeQuery();
+
+ while (rset.next())
+ {
+ pin = rset.getInt("pin");
+ }
+
+ if (pin == dapin)
+ {
+ activeChar.sendMessage("Pin Code Authenticated Successfully.You are now free to move.");
+ activeChar.setIsImobilised(false);
+ activeChar.setIsSubmitingPin(false);
+ }
+ else
+ {
+ activeChar.sendMessage("Pin Code does not match with the submitted one.You will now get disconnected!");
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ activeChar.logout();
+ }
+ }, 2000);
+ }
+ }
+ catch (Exception e)
+ {
+
+ activeChar.sendMessage("The Pin Code must be 4 numbers.");
+ }
+ finally
+ {
+ L2DatabaseFactory.close(con);
+ }
+ }
+ catch (Exception e)
+ {
+ // e.printStackTrace();
+ activeChar.sendMessage("The Pin Code MUST be 4 numbers.");
+ }
+
+ }
}
catch(Exception e)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestCrystallizeItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestCrystallizeItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestCrystallizeItem.java (working copy)
@@ -79,6 +79,12 @@
activeChar.sendPacket(new SystemMessage(SystemMessageId.CANNOT_TRADE_DISCARD_DROP_ITEM_WHILE_IN_SHOPMODE));
return;
}
+
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
int skillLevel = activeChar.getSkillLevel(L2Skill.SKILL_CRYSTALLIZE);
if(skillLevel <= 0)
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestMakeMacro.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestMakeMacro.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestMakeMacro.java (working copy)
@@ -95,6 +95,13 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
+
if(player.getMacroses().getAllMacroses().length > 24)
{
//You may create up to 24 macros.
Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -460,7 +460,7 @@
/** SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,good,evil,gve_kills FROM characters WHERE obj_id=?. */
//private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pc_point,banchat_time,name_color,title_color,first_log,aio,aio_end FROM characters WHERE obj_id=?";
- private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon,punish_level,punish_timer,"+/* in_jail, jail_timer,*/ "newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pc_point"+/*,banchat_time*/",name_color,title_color,first_log,aio,aio_end FROM characters WHERE obj_id=?";
+ private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon,punish_level,punish_timer,"+/* in_jail, jail_timer,*/ "newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pc_point"+/*,banchat_time*/",name_color,title_color,first_log,aio,aio_end,pinsubmited,pin FROM characters WHERE obj_id=?";
/** The Constant STATUS_DATA_GET. */
private static final String STATUS_DATA_GET = "SELECT hero, noble, donator, hero_end_date FROM characters_custom_data WHERE obj_Id = ?";
@@ -10250,6 +10250,8 @@
player.setHeading(rset.getInt("heading"));
+ player.setPincheck(rset.getInt("pinsubmited"));
+ player.setPin(rset.getInt("pin"));
player.setKarma(rset.getInt("karma"));
player.setPvpKills(rset.getInt("pvpkills"));
player.setPkKills(rset.getInt("pkkills"));
@@ -15713,12 +15715,12 @@
revalidateZone(true);
notifyFriends(false);
-
+
// Fix against exploit on anti-target on login
decayMe();
spawnMe();
broadcastUserInfo();
-
+
}
/**
@@ -20333,7 +20335,7 @@
}
sendSkillList();
}
-
+
public void removeHeroSkills()
{
for (L2Skill s : HeroSkillTable.getHeroSkills())
@@ -20377,4 +20379,69 @@
_currentPetSkill = new SkillDat(currentSkill, ctrlPressed, shiftPressed);
}
+ public boolean _pincheck;
+ public int _pin;
+
+ public void setPincheck(boolean pincheck)
+ {
+ _pincheck = pincheck;
+ }
+
+ public void setPincheck(int pincheck)
+ {
+ _pincheck = false;
+ if (pincheck == 1)
+ {
+ _pincheck = true;
+ }
+ }
+
+ public boolean getPincheck()
+ {
+ return _pincheck;
+ }
+
+ public void setPin(int pin)
+ {
+ _pin = pin;
+ }
+
+ public int getPin()
+ {
+ return _pin;
+ }
+
+ public void updatePincheck()
+ {
+ Connection con = null;
+ try
+ {
+ con = L2DatabaseFactory.getInstance().getConnection();
+ PreparedStatement statement = con.prepareStatement("UPDATE characters SET pinsubmited=? WHERE obj_id=?");
+
+ int _pin;
+ if (getPincheck())
+ {
+ _pin = 1;
+ }
+ else
+ {
+ _pin = 0;
+ }
+ statement.setInt(1, _pin);
+ statement.setInt(2, getObjectId());
+ statement.execute();
+ statement.close();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ _log.warning("could not set char first login:" + e);
+ }
+ finally
+ {
+ L2DatabaseFactory.close(con);
+ }
+ }
+
}
\ No newline at end of file
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestConfirmTargetItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestConfirmTargetItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestConfirmTargetItem.java (working copy)
@@ -84,6 +84,12 @@
return;
}
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
if(activeChar.isParalyzed())
{
activeChar.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_AUGMENT_ITEMS_WHILE_PARALYZED));
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestStartPledgeWar.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestStartPledgeWar.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestStartPledgeWar.java (working copy)
@@ -56,6 +56,7 @@
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
+
else if (!player.isClanLeader())
{
player.sendMessage("You can't declare war. You are not clan leader.");
@@ -63,6 +64,12 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
L2Clan clan = ClanTable.getInstance().getClanByName(_pledgeName);
if (clan == null)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBuyItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBuyItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBuyItem.java (working copy)
@@ -98,6 +98,12 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
// Alt game - Karma punishment
if(!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
return;
Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (working copy)
@@ -11379,4 +11379,16 @@
this.sendPacket(su);
su = null;
}
+
+ public boolean _isSubmitingPin;
+
+ public final void setIsSubmitingPin(boolean value)
+ {
+ _isSubmitingPin = value;
+ }
+
+ public boolean isSubmitingPin()
+ {
+ return _isSubmitingPin;
+ }
}
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/SendWareHouseWithDrawList.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/SendWareHouseWithDrawList.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/SendWareHouseWithDrawList.java (working copy)
@@ -86,7 +86,11 @@
player.sendMessage("You withdrawing items too fast.");
return;
}
-
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
// Like L2OFF you can't confirm a withdraw when you are in trade.
if(player.getActiveTradeList() != null)
{
Index: head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Pin.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Pin.java (revision 0)
+++ head-src/com/l2jfrozen/gameserver/handler/voicedcommandhandlers/Pin.java (revision 0)
@@ -0,0 +1,83 @@
+/*
+ * 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 com.l2jfrozen.gameserver.handler.voicedcommandhandlers;
+
+import javolution.text.TextBuilder;
+
+import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler;
+import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
+
+public class Pin implements IVoicedCommandHandler
+{
+ private static String[] _voicedCommands =
+ {
+ "pin"
+ };
+
+ @Override
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+ {
+ if (command.equalsIgnoreCase("pin"))
+ {
+ if (activeChar.getPincheck())
+ {
+ TextBuilder tb = new TextBuilder();
+ NpcHtmlMessage html = new NpcHtmlMessage(1);
+
+ tb.append("<html><head><title>Character Pin Panel</title></head>");
+ tb.append("<body>");
+ tb.append("<center>");
+ tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
+ tb.append("<tr>");
+ tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
+ tb.append("<td valign=\"top\"><font color=\"FF6600\">Pin Panel</font>");
+ tb.append("<br1><font color=\"00FF00\">" + activeChar.getName() + "</font>, use this interface to enable pin secirity.</td></tr></table></center>");
+ tb.append("<center>");
+ tb.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center><br>");
+ tb.append("</center>");
+ tb.append("<table width=\"350\" cellpadding=\"5\" bgcolor=\"000000\">");
+ tb.append("<tr>");
+ tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"Icon.etc_old_key_i02\" width=\"32\" height=\"32\"></td>");
+ tb.append("<td valign=\"top\">Please enter your PIN:<edit var=\"pin\" width=80 height=15>");
+ tb.append("<br1>info or something (can delete)</td>");
+ tb.append("</tr>");
+ tb.append("</table>");
+ tb.append("<br>");
+ tb.append("<center>");
+ tb.append("<button value=\"Submit\" action=\"bypass -h submitpin $pin\" width=75 height=21 back=\"L2UI_ch3.Btn1_normalOn\" fore=\"L2UI_ch3.Btn1_normal\">");
+ tb.append("</center>");
+ tb.append("<center>");
+ tb.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center>");
+ tb.append("<font color=\"FF6600\">By Elfocrash</font>");
+ tb.append("</center>");
+ tb.append("</body></html>");
+
+ html.setHtml(tb.toString());
+ activeChar.sendPacket(html);
+ }
+ else
+ activeChar.sendMessage("You have already submitted a Pin code");
+
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getVoicedCommandList()
+ {
+ return _voicedCommands;
+ }
+}
\ No newline at end of file
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDropItem.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDropItem.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestDropItem.java (working copy)
@@ -62,11 +62,17 @@
if(activeChar == null || activeChar.isDead())
return;
- if(activeChar.isGM() && activeChar.getAccessLevel().getLevel()>2){ //just head gm and admin can drop items on the ground
+ if(activeChar.isGM() && activeChar.getAccessLevel().getLevel()>=2){ //just head gm and admin can drop items on the ground
sendPacket(SystemMessage.sendString("You have not right to discard anything from inventory"));
return;
}
+ if (activeChar.isSubmitingPin())
+ {
+ activeChar.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
// Fix against safe enchant exploit
if(activeChar.getActiveEnchantItem() != null)
{
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/SendWareHouseDepositList.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/SendWareHouseDepositList.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/SendWareHouseDepositList.java (working copy)
@@ -92,7 +92,12 @@
if(manager == null || !player.isInsideRadius(manager, L2NpcInstance.INTERACTION_DISTANCE, false, false))
return;
-
+
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("deposit"))
{
player.sendMessage("You depositing items too fast.");
Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestAnswerJoinParty.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestAnswerJoinParty.java (revision 1004)
+++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestAnswerJoinParty.java (working copy)
@@ -58,6 +58,12 @@
return;
}
+ if (player.isSubmitingPin())
+ {
+ player.sendMessage("Unable to do any action while PIN is not submitted");
+ return;
+ }
+
requestor.sendPacket(new JoinParty(_response));
if (_response == 1)
________________
Продвижение вашего сайта, увеличение ссылочной массы, продвижение по НЧ-СЧ-ВЧ запросам.
Последний раз редактировалось ISharkI; 26.07.2014 в 14:11.
|
|
|
Ваши права в разделе
|
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения
HTML код Выкл.
|
|
|
Заявление об ответственности / Список мошенников
Часовой пояс GMT +4, время: 02:35.
|
|