Gm Shop (.shop)
6 replies323 viewsCurrently viewing: 1
· 11/04/2009, 12:51 PM
у меня сделано что открывает мултисел показывает товар но когда выбираешь товар и нажимаешь да не что не покупает покупает лиш тогда когда я выделю каково та нпс
Просьба помочь дописать гм шоп
вот код
Раскрывающийся текст
/*
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jarchid.gameserver.network.clientpackets;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jarchid.gameserver.cache.HtmCache;
import com.l2jarchid.Config;
import com.l2jarchid.gameserver.ai.CtrlIntention;
import com.l2jarchid.gameserver.communitybbs.CommunityBoard;
import com.l2jarchid.gameserver.datatables.AdminCommandAccessRights;
import com.l2jarchid.gameserver.handler.AdminCommandHandler;
import com.l2jarchid.gameserver.handler.IAdminCommandHandler;
import com.l2jarchid.gameserver.model.GMAudit;
import com.l2jarchid.gameserver.model.L2CharPosition;
import com.l2jarchid.gameserver.model.L2Object;
import com.l2jarchid.gameserver.model.L2World;
import com.l2jarchid.gameserver.model.actor.L2Npc;
import com.l2jarchid.gameserver.model.actor.instance.L2PcInstance;
import com.l2jarchid.gameserver.model.entity.L2Event;
import com.l2jarchid.gameserver.network.serverpackets.ActionFailed;
import com.l2jarchid.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jarchid.gameserver.ai.L2CharacterAI;
import com.l2jarchid.gameserver.datatables.SkillTable;
import com.l2jarchid.gameserver.model.*;
import com.l2jarchid.gameserver.model.actor.instance.*;
import com.l2jarchid.gameserver.network.L2GameClient;
import com.l2jarchid.gameserver.network.serverpackets.*;
import com.l2jarchid.gameserver.network.clientpackets.MultiSellChoose;
/**
* This class ...
*
* @version $Revision: 1.12.4.5 $ $Date: 2005/04/11 10:06:11 $
*/
public final class RequestBypassToServer extends L2GameClientPacket
{
/**
* @param opcode
*/
public RequestBypassToServer(int opcode)
{
super(opcode);
}
private static final String _C__21_REQUESTBYPASSTOSERVER = "[C] 21 RequestBypassToServer";
private static Logger _log = Logger.getLogger(RequestBypassToServer.class
.getName());
// S
private String _command;
/**
* @param decrypt
*/
@Override
protected void readImpl()
{
_command = readS();
}
@Override
protected void runImpl()
{
L2PcInstance activeChar = ((L2GameClient)getClient()).getActiveChar();
if (activeChar == null) {
return;
}
if (!(activeChar.getFloodProtectors().getServerBypass().tryPerformAction("_command")))
{
activeChar.sendPacket(new ActionFailed());
return;
}
try
{
if (_command.startsWith("admin_"))
{
String command = _command.split(" ")[0];
IAdminCommandHandler ach = AdminCommandHandler.getInstance()
.getAdminCommandHandler(command);
if (ach == null)
{
if (activeChar.isGM())
activeChar.sendMessage("The command "
+ command.substring(6) + " does not exist!");
_log.warning("No handler registered for admin command '"
+ command + "'");
return;
}
if (!AdminCommandAccessRights.getInstance().hasAccess(command,
activeChar.getAccessLevel()))
{
activeChar
.sendMessage("You don't have the access right to use this command!");
_log.warning("Character " + activeChar.getName()
+ " tryed to use admin command " + command
+ ", but have no access to it!");
return;
}
if (Config.GMAUDIT)
GMAudit.auditGMAction(activeChar.getName() + " ["
+ activeChar.getObjectId() + "]", _command,
(activeChar.getTarget() != null ? activeChar
.getTarget().getName() : "no-target"));
ach.useAdminCommand(_command, activeChar);
} else if (_command.equals("come_here") && activeChar.isGM())
{
comeHere(activeChar);
} else if (_command.startsWith("menu_multisell"))
{
menu_multisell(activeChar, _command);
} else if (_command.startsWith("player_help "))
{
playerHelp(activeChar, _command.substring(12));
} else if (_command.startsWith("npc_"))
{
if (!activeChar.validateBypass(_command))
return;
int endOfId = _command.indexOf('_', 5);
String id;
if (endOfId > 0)
id = _command.substring(4, endOfId);
else
id = _command.substring(4);
try
{
L2Object object = L2World.getInstance().findObject(
Integer.parseInt(id));
if (_command.substring(endOfId + 1).startsWith(
"event_participate"))
L2Event.inscribePlayer(activeChar);
else if (object != null
&& object instanceof L2Npc
&& endOfId > 0
&& activeChar.isInsideRadius(object,
L2Npc.INTERACTION_DISTANCE, false, false))
{
((L2Npc) object).onBypassFeedback(activeChar, _command
.substring(endOfId + 1));
}
activeChar.sendPacket(new ActionFailed());
} catch (NumberFormatException nfe)
{
}
}
// Draw a Symbol
else if (_command.equals("menu_select?ask=-16&reply=1"))
{
L2Object object = activeChar.getTarget();
if (object instanceof L2Npc)
{
((L2Npc) object).onBypassFeedback(activeChar, _command);
}
} else if (_command.equals("menu_select?ask=-16&reply=2"))
{
L2Object object = activeChar.getTarget();
if (object instanceof L2Npc)
{
((L2Npc) object).onBypassFeedback(activeChar, _command);
}
}
// Navigate throught Manor windows
else if (_command.startsWith("manor_menu_select?"))
{
L2Object object = activeChar.getTarget();
if (object instanceof L2Npc)
{
((L2Npc) object).onBypassFeedback(activeChar, _command);
}
} else if (_command.startsWith("bbs_"))
{
CommunityBoard.getInstance().handleCommands(getClient(),
_command);
} else if (_command.startsWith("_bbs"))
{
CommunityBoard.getInstance().handleCommands(getClient(),
_command);
} else if (_command.startsWith("Quest "))
{
if (!activeChar.validateBypass(_command))
return;
}
L2PcInstance player = getClient().getActiveChar();
if (player == null)
return;
String p = _command.substring(6).trim();
int idx = p.indexOf(' ');
if (idx < 0)
player.processQuestEvent(p, "");
else {
player.processQuestEvent(p.substring(0, idx), p.substring(
idx).trim());
}
} catch (Exception e)
{
_log.log(Level.WARNING, "Bad RequestBypassToServer: ", e);
}
// finally
// {
// activeChar.clearBypass();
// }
}
/**
* @param client
*/
private void menu_multisell(L2PcInstance player, String command)
{
StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
int val = Integer.parseInt(st.nextToken());
L2Multisell.getInstance().SeparateAndSend(val, player, false, 0.0D);
}
private void comeHere(L2PcInstance activeChar)
{
L2Object obj = activeChar.getTarget();
if (obj == null) return;
if (!(obj instanceof L2NpcInstance))
return;
L2NpcInstance temp = (L2NpcInstance)obj;
temp.setTarget(activeChar);
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0));
}
private void playerHelp(L2PcInstance activeChar, String path)
{
if (path.indexOf("..") != -1)
return;
String filename = "data/html/help/" + path;
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile(filename);
activeChar.sendPacket(html);
}
/*
* (non-Javadoc)
*
* @see
* com.l2jarchid.gameserver.network.clientpackets.ClientBasePacket#getType()
*/
@Override
public String getType()
{
return _C__21_REQUESTBYPASSTOSERVER;
}
}
* 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 2, 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package com.l2jarchid.gameserver.network.clientpackets;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jarchid.gameserver.cache.HtmCache;
import com.l2jarchid.Config;
import com.l2jarchid.gameserver.ai.CtrlIntention;
import com.l2jarchid.gameserver.communitybbs.CommunityBoard;
import com.l2jarchid.gameserver.datatables.AdminCommandAccessRights;
import com.l2jarchid.gameserver.handler.AdminCommandHandler;
import com.l2jarchid.gameserver.handler.IAdminCommandHandler;
import com.l2jarchid.gameserver.model.GMAudit;
import com.l2jarchid.gameserver.model.L2CharPosition;
import com.l2jarchid.gameserver.model.L2Object;
import com.l2jarchid.gameserver.model.L2World;
import com.l2jarchid.gameserver.model.actor.L2Npc;
import com.l2jarchid.gameserver.model.actor.instance.L2PcInstance;
import com.l2jarchid.gameserver.model.entity.L2Event;
import com.l2jarchid.gameserver.network.serverpackets.ActionFailed;
import com.l2jarchid.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jarchid.gameserver.ai.L2CharacterAI;
import com.l2jarchid.gameserver.datatables.SkillTable;
import com.l2jarchid.gameserver.model.*;
import com.l2jarchid.gameserver.model.actor.instance.*;
import com.l2jarchid.gameserver.network.L2GameClient;
import com.l2jarchid.gameserver.network.serverpackets.*;
import com.l2jarchid.gameserver.network.clientpackets.MultiSellChoose;
/**
* This class ...
*
* @version $Revision: 1.12.4.5 $ $Date: 2005/04/11 10:06:11 $
*/
public final class RequestBypassToServer extends L2GameClientPacket
{
/**
* @param opcode
*/
public RequestBypassToServer(int opcode)
{
super(opcode);
}
private static final String _C__21_REQUESTBYPASSTOSERVER = "[C] 21 RequestBypassToServer";
private static Logger _log = Logger.getLogger(RequestBypassToServer.class
.getName());
// S
private String _command;
/**
* @param decrypt
*/
@Override
protected void readImpl()
{
_command = readS();
}
@Override
protected void runImpl()
{
L2PcInstance activeChar = ((L2GameClient)getClient()).getActiveChar();
if (activeChar == null) {
return;
}
if (!(activeChar.getFloodProtectors().getServerBypass().tryPerformAction("_command")))
{
activeChar.sendPacket(new ActionFailed());
return;
}
try
{
if (_command.startsWith("admin_"))
{
String command = _command.split(" ")[0];
IAdminCommandHandler ach = AdminCommandHandler.getInstance()
.getAdminCommandHandler(command);
if (ach == null)
{
if (activeChar.isGM())
activeChar.sendMessage("The command "
+ command.substring(6) + " does not exist!");
_log.warning("No handler registered for admin command '"
+ command + "'");
return;
}
if (!AdminCommandAccessRights.getInstance().hasAccess(command,
activeChar.getAccessLevel()))
{
activeChar
.sendMessage("You don't have the access right to use this command!");
_log.warning("Character " + activeChar.getName()
+ " tryed to use admin command " + command
+ ", but have no access to it!");
return;
}
if (Config.GMAUDIT)
GMAudit.auditGMAction(activeChar.getName() + " ["
+ activeChar.getObjectId() + "]", _command,
(activeChar.getTarget() != null ? activeChar
.getTarget().getName() : "no-target"));
ach.useAdminCommand(_command, activeChar);
} else if (_command.equals("come_here") && activeChar.isGM())
{
comeHere(activeChar);
} else if (_command.startsWith("menu_multisell"))
{
menu_multisell(activeChar, _command);
} else if (_command.startsWith("player_help "))
{
playerHelp(activeChar, _command.substring(12));
} else if (_command.startsWith("npc_"))
{
if (!activeChar.validateBypass(_command))
return;
int endOfId = _command.indexOf('_', 5);
String id;
if (endOfId > 0)
id = _command.substring(4, endOfId);
else
id = _command.substring(4);
try
{
L2Object object = L2World.getInstance().findObject(
Integer.parseInt(id));
if (_command.substring(endOfId + 1).startsWith(
"event_participate"))
L2Event.inscribePlayer(activeChar);
else if (object != null
&& object instanceof L2Npc
&& endOfId > 0
&& activeChar.isInsideRadius(object,
L2Npc.INTERACTION_DISTANCE, false, false))
{
((L2Npc) object).onBypassFeedback(activeChar, _command
.substring(endOfId + 1));
}
activeChar.sendPacket(new ActionFailed());
} catch (NumberFormatException nfe)
{
}
}
// Draw a Symbol
else if (_command.equals("menu_select?ask=-16&reply=1"))
{
L2Object object = activeChar.getTarget();
if (object instanceof L2Npc)
{
((L2Npc) object).onBypassFeedback(activeChar, _command);
}
} else if (_command.equals("menu_select?ask=-16&reply=2"))
{
L2Object object = activeChar.getTarget();
if (object instanceof L2Npc)
{
((L2Npc) object).onBypassFeedback(activeChar, _command);
}
}
// Navigate throught Manor windows
else if (_command.startsWith("manor_menu_select?"))
{
L2Object object = activeChar.getTarget();
if (object instanceof L2Npc)
{
((L2Npc) object).onBypassFeedback(activeChar, _command);
}
} else if (_command.startsWith("bbs_"))
{
CommunityBoard.getInstance().handleCommands(getClient(),
_command);
} else if (_command.startsWith("_bbs"))
{
CommunityBoard.getInstance().handleCommands(getClient(),
_command);
} else if (_command.startsWith("Quest "))
{
if (!activeChar.validateBypass(_command))
return;
}
L2PcInstance player = getClient().getActiveChar();
if (player == null)
return;
String p = _command.substring(6).trim();
int idx = p.indexOf(' ');
if (idx < 0)
player.processQuestEvent(p, "");
else {
player.processQuestEvent(p.substring(0, idx), p.substring(
idx).trim());
}
} catch (Exception e)
{
_log.log(Level.WARNING, "Bad RequestBypassToServer: ", e);
}
// finally
// {
// activeChar.clearBypass();
// }
}
/**
* @param client
*/
private void menu_multisell(L2PcInstance player, String command)
{
StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
int val = Integer.parseInt(st.nextToken());
L2Multisell.getInstance().SeparateAndSend(val, player, false, 0.0D);
}
private void comeHere(L2PcInstance activeChar)
{
L2Object obj = activeChar.getTarget();
if (obj == null) return;
if (!(obj instanceof L2NpcInstance))
return;
L2NpcInstance temp = (L2NpcInstance)obj;
temp.setTarget(activeChar);
temp.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(activeChar.getX(), activeChar.getY(), activeChar.getZ(), 0));
}
private void playerHelp(L2PcInstance activeChar, String path)
{
if (path.indexOf("..") != -1)
return;
String filename = "data/html/help/" + path;
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile(filename);
activeChar.sendPacket(html);
}
/*
* (non-Javadoc)
*
* @see
* com.l2jarchid.gameserver.network.clientpackets.ClientBasePacket#getType()
*/
@Override
public String getType()
{
return _C__21_REQUESTBYPASSTOSERVER;
}
}
PS: Спасибкой не обижу
0
· 11/04/2009, 09:02 PM
забыл написать что мне нужно помочь дописать
мне надо сделать так чтоб не надо было наводится на нсп
0
· 11/04/2009, 09:54 PM
Надо исправлять не тут, а в пакете покупки через мультиселл.. Чтоб не требовал обращени к объекту. Зато появится риск, что игроки смогут отловить пакет.. к примеру на покупку заточек - и будут в любом месте мира посылать (будет покупаться).
Only God Can Judge Me
0
· 11/04/2009, 09:58 PM
exT1m: Надо исправлять не тут, а в пакете покупки через мультиселл.. Чтоб не требовал обращени к объекту. Зато появится риск, что игроки смогут отловить пакет.. к примеру на покупку заточек - и будут в любом месте мира посылать (будет покупаться).
можно подробней в каком файле поправить надо?
0
· 11/04/2009, 10:56 PM
/clientpackets/MultiSellChoose.java
Метод doExchange()
Там должно быть что-то вроде:
Код
if (merchant == null)
return;
return;
Удаляем это, по идее должно работать. Проверь сейчас, если не будет работать - отпиши. Если будет работать - отпиши, чтоб знал, спасибку не забудь.
Only God Can Judge Me
0
Topic is closed for replies


