在0.2里增加GM命令方法
在0.2里增加GM命令(example: .level ,.buy etc)……
文件: L2_Gameserver\ java\net\sf\l2j\gameserv\clientpacket\ Say2.java 内容来自dedecms
/*
* $Header: /cvsroot/l2j/L2_Gameserver/java/net/sf/l2j/gameserver/
clientpackets/Say2.java,v 1.4 2004/07/04 11:09:02 l2chef Exp $
*
* $Author: l2chef $
* $Date: 2004/07/04 11:09:02 $
* $Revision: 1.4 $
* $Log: Say2.java,v $
* Revision 1.4 2004/07/04 11:09:02 l2chef
* commands removed.
* say is now only local
* shout and trade is global
*
* Revision 1.3 2004/06/29 22:55:35 l2chef
* tell and say works now. say is actually a server broadcast now
*
* Revision 1.2 2004/06/27 08:51:42 jeichhorn
* Added copyright notice
*
*
* 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
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Logger;
import java.util.StringTokenizer;
import net.sf.l2j.gameserver.ClientThread;
import net.sf.l2j.gameserver.Connection;
import net.sf.l2j.gameserver.model.L2PcInstance;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.serverpackets.CreatureSay;
import net.sf.l2j.gameserver.serverpackets.TeleportToLocation;
import net.sf.l2j.gameserver.IdFactory;
import net.sf.l2j.gameserver.NpcTable;
import net.sf.l2j.gameserver.TradeController;
import net.sf.l2j.gameserver.model.L2BuyList;
import net.sf.l2j.gameserver.model.L2DoorInstance;
import net.sf.l2j.gameserver.model.L2NpcInstance;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.serverpackets.BuyList;
import net.sf.l2j.gameserver.serverpackets.DoorInfo;
import net.sf.l2j.gameserver.serverpackets.DoorStatusUpdate;
import net.sf.l2j.gameserver.serverpackets.ItemList;
import net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.serverpackets.NpcInfo; 织梦内容管理系统
import net.sf.l2j.gameserver.serverpackets.StatusUpdate;
import net.sf.l2j.gameserver.serverpackets.UserInfo;
import net.sf.l2j.gameserver.templates.L2Npc;
/**
* This class ...
*
* @version $Revision: 1.4 $ $Date: 2004/07/04 11:09:02 $
*/
public class Say2 extends ClientBasePacket
{
private static final String _C__38_SAY2 = "[C] 38 Say2";
private static Logger _log = Logger.getLogger(Say2.class.getName()); copyright dedecms
copyright dedecms
public final static int ALL = 0;
public final static int SHOUT = 1;
public final static int TELL = 2;
public final static int PARTY = 3;
public final static int CLAN = 4;
public final static int PRIVATE_CHAT_PLAYER = 6; // used for petition
public final static int PRIVATE_CHAT_GM = 7; // used for petition
public final static int TRADE = 8;
public final static int GM_MESSAGE = 9;
copyright dedecms
/**
* packet type id 0x38
* format: cSd (S)
* @param decrypt
*/
public Say2(byte[] decrypt, ClientThread client) throws IOException
{
super(decrypt);
String text = readS();
int type = readD();
String target = null;
if (type == TELL)
{
target = readS();
} 内容来自dedecms
_log.fine("Say type:"+type); 织梦好,好织梦
L2PcInstance activeChar = client.getActiveChar();
Connection con = client.getConnection(); 织梦好,好织梦
try{ //if is not special command,it will be catch (to be a normal talk)
if (text.equals(".help"))
{
NpcHtmlMessage adminCommands = new NpcHtmlMessage(5);
StringBuffer html1 = new StringBuffer("<html><title>AdminCommands</title>");
html1.append("<body>");
html1.append("<br><a action=\"bypass -h spawn_monster\">spawn monster</a>");
// -> causes a 0x21 packet
html1.append("<br><a action=\"bypass -h come_here\">force target to move here</a>");
html1.append("<br><a action=\"bypass -h attack_me\">force target to attack</a>");
html1.append("<br><a action=\"bypass -h stats\">show statistics</a>");
html1.append("</body></html>"); copyright dedecms
adminCommands.setHtml(html1.toString());
con.sendPacket(adminCommands);
}
else if(text.startsWith(".teleport"))
{
StringTokenizer st = new StringTokenizer(text);
st.nextToken();// skip command
String x1 = st.nextToken();
int x = Integer.parseInt(x1);
String y1 = st.nextToken();
int y = Integer.parseInt(y1);
String z1 = st.nextToken();
int z = Integer.parseInt(z1); 内容来自dedecms
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type,
activeChar.getName(), "teleporting to "+ x + " " + y + " "+z);
con.sendPacket(cs); 织梦内容管理系统
TeleportToLocation tele = new TeleportToLocation(activeChar, x,y,z);
con.sendPacket(tele);
activeChar.setX(x);
activeChar.setY(y);
activeChar.setZ(z);
}
else if (text.startsWith(".buy"))
{
int listId = 0;
listId = Integer.parseInt(text.substring(4));
copyright dedecms
L2BuyList list = TradeController.getInstance().getBuyList(listId);
if (list != null)
{
BuyList bl = new BuyList(list, activeChar.getAdena());
con.sendPacket(bl);
}
else
{
System.out.println("no buylist with id:" +listId);
}
}
else if (text.equals(".money"))
{
activeChar.addAdena(100000);
ItemList il = new ItemList(activeChar, true);
con.sendPacket(il);
}
else if (text.equals(".mob"))
{
L2Npc goblin = NpcTable.getInstance().getTemplate(3);
L2NpcInstance mob = new L2NpcInstance(goblin);
mob.setObjectId(IdFactory.getInstance().getNextId());
mob.setX(activeChar.getX());
mob.setY(activeChar.getY());
mob.setZ(activeChar.getZ());
mob.setCurrentHp(80);
mob.setMaxHp(198);
mob.setHeading(activeChar.getHeading());
mob.setUnknown1(1.08);
mob.setUnknown2(0.9983664);
NpcInfo ni = new NpcInfo(mob);
con.sendPacket(ni);
copyright dedecms
L2World.getInstance().storeObject(mob); // this is just a hack
to make the id globally known
}
else if (text.startsWith(".movehere"))
{
L2Object target1 = activeChar.getTarget();
if (target1 instanceof L2NpcInstance)
{
L2NpcInstance temp = (L2NpcInstance) target1;
temp.moveTo(activeChar.getX(), activeChar.getY(), activeChar.getZ(),0);
}
}
else if (text.startsWith(".sethere"))
{
L2Object target1 = activeChar.getTarget();
if (target1 instanceof L2NpcInstance)
{
L2NpcInstance temp = (L2NpcInstance) target1;
temp.setTo(activeChar.getX(), activeChar.getY(), activeChar.getZ(),
activeChar.getHeading());
}
}
else if (text.startsWith(".stopmove"))
{
L2Object target1 = activeChar.getTarget();
if (target1 instanceof L2NpcInstance)
{
L2NpcInstance temp = (L2NpcInstance) target1;
temp.stopMove();
}
}
else if (text.startsWith(".stat"))
{
int val = Integer.parseInt(text.substring(5));
System.out.println("changing stat: "+val); dedecms.com
StatusUpdate su = new StatusUpdate(activeChar.getObjectId());
su.addAttribute(val, 234);
con.sendPacket(su);
}
else if (text.startsWith(".exp"))
{
int val = Integer.parseInt(text.substring(5));
System.out.println("setting exp t "+val);
activeChar.setExp(val);
UserInfo ui = new UserInfo(activeChar);
con.sendPacket(ui);
}
else if (text.startsWith(".level"))
{
int val = Integer.parseInt(text.substring(7));
System.out.println("setting level t "+val);
activeChar.setLevel(val);
UserInfo ui = new UserInfo(activeChar);
con.sendPacket(ui);
}
else if (text.startsWith(".doorinfo"))
{
System.out.println("creating door ");
L2DoorInstance door = new L2DoorInstance();
door.setObjectId(0x48302222);
door.setX(activeChar.getX());
door.setY(activeChar.getY());
door.setZ(activeChar.getZ()); 本文来自织梦
DoorInfo di = new DoorInfo(door);
con.sendPacket(di);
内容来自dedecms
DoorStatusUpdate ds = new DoorStatusUpdate(door);
con.sendPacket(ds);
}
else
{
talk(activeChar, type, text,target);
}
}
catch(Exception e)//if command is input error format , the client will not be crash
{
talk(activeChar, type, text,target);
}
} dedecms.com
/* (non-Javadoc)
* @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
*/
public String getType()
{
return _C__38_SAY2;
} 织梦好,好织梦
/* (non-Javadoc)
* @function normal talk(not specal command)
*/
private void talk(L2PcInstance activeChar,int type,String text,String target)
{
CreatureSay cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
dedecms.com
if (type == TELL)
{
L2PcInstance receiver = L2World.getInstance().getPlayer(target);
if (receiver != null)
{
receiver.sendPacket(cs);
activeChar.sendPacket(cs);
}
else
{
cs = new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(),
"Player '"+target+"' is not online");
activeChar.sendPacket(cs);
}
}
else if (type == SHOUT || type == TRADE)
{
L2PcInstance[] players = L2World.getInstance().getAllPlayers();
for (int i = 0; i < players.length; i++)
{
players[i].sendPacket(cs);
}
}
else if (type == ALL)
{
List players = activeChar.getKnownPlayers();
for (Iterator iter = players.iterator(); iter.hasNext();)
{
L2PcInstance player = (L2PcInstance) iter.next();
player.sendPacket(cs);
}
activeChar.sendPacket(cs); copyright dedecms
1.76精品传奇_1.76天下毁灭_1.76复古传奇_英雄合击_中变靓装传奇_无忧传奇
传奇花屏补丁,花屏补丁,土城花屏补丁,盟重土城花屏补丁下载,土城花屏补丁下载,沙巴克花屏补丁,传奇土城花屏补丁下载
网站每天发布最新、最好的传奇版本下载和与传奇服务端配套开区传奇模版,网游技术教程全部免费下载!
无忧网络是目前唯一家所有的传奇服务端,传奇私服花屏补丁,盟重花屏补丁和传奇客户端下载都经过站长亲自测试并配有真实测试图!
所有的工具软件和传奇版本在发布之前,都会经过站长亲自测试,保证chuanqisf可以进入游戏,所有软件都无毒无插件!
本站声明:本站所有技术资料与下载资源均为网络搜集整理,并不代表本站的观点与立场,如有侵犯您的权益,请来信指出,本站将立即改正Copyright © 2002-2014 无忧网络 版权所有蜀ICP备09041899号