设为首页
加入收藏
联系本站
游戏秘籍 游戏文学游戏沙龙游戏攻略游戏资讯网游秘籍游戏战报私服学院游戏贴图
您的位置: 无限游戏 >> >> 私服学院 >> 天堂私服制作 >>
天堂私服制作热点
·天2服务端简略安装说明!
·在0.2里增加GM命令方法
·天堂II S级装备代码
·天堂2java服务端0.1+JAVA平台 +完整安装说明
·2000架设天2指南
·教你添加 B/A/S 级套装效果
·修改装备的简单方法
·职业,种族,属性!
·天堂2游戏不顺畅的解决方法
·人类战士部分技能代码
推荐广告

在0.2里增加GM命令方法

作者:      来源:     时间:2005-9-16 10:24:44




在0.2里增加GM命令方法(2) {
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);

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));

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);

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);
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);

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);
}
}


/* (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);

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++)
在0.2里增加GM命令方法相关文章:
在0.2里增加GM命令方法相关软件:
分页:
共3页 首页 上一页 [1] [2] [3下一页 尾页>
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员我们经快给予更正
[打印本页] [关闭窗口] 转载请注明来源:无限游戏网