本文整理汇总了Java中tools.packet.CWvsContext.broadcastMsg方法的典型用法代码示例。如果您正苦于以下问题:Java CWvsContext.broadcastMsg方法的具体用法?Java CWvsContext.broadcastMsg怎么用?Java CWvsContext.broadcastMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools.packet.CWvsContext
的用法示例。
在下文中一共展示了CWvsContext.broadcastMsg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AdminChat
import tools.packet.CWvsContext; //导入方法依赖的package包/类
public static void AdminChat(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
if (!c.getPlayer().isGM()) {//if ( (signed int)CWvsContext::GetAdminLevel((void *)v294) > 2 )
return;
}
byte mode = slea.readByte();
//not saving slides...
byte[] packet = CWvsContext.broadcastMsg(slea.readByte(), slea.readMapleAsciiString());//maybe I should make a check for the slea.readByte()... but I just hope gm's don't fuck things up :)
switch (mode) {
case 0:// /alertall, /noticeall, /slideall
World.Broadcast.broadcastMessage(packet);
break;
case 1:// /alertch, /noticech, /slidech
c.getChannelServer().broadcastMessage(packet);
break;
case 2:// /alertm /alertmap, /noticem /noticemap, /slidem /slidemap
c.getPlayer().getMap().broadcastMessage(packet);
break;
}
}
示例2: execute
import tools.packet.CWvsContext; //导入方法依赖的package包/类
@Override
public int execute(MapleClient c, String[] splitted) {
int joinmod = 1;
int range = -1;
switch (splitted[1]) {
case "m":
range = 0;
break;
case "c":
range = 1;
break;
case "w":
range = 2;
break;
}
int tfrom = 2;
if (range == -1) {
range = 2;
tfrom = 1;
}
int type = getNoticeType(splitted[tfrom]);
if (type == -1) {
type = 0;
joinmod = 0;
}
StringBuilder sb = new StringBuilder();
if (splitted[tfrom].equals("nv")) {
sb.append("[Notice]");
} else {
sb.append("");
}
joinmod += tfrom;
sb.append(StringUtil.joinStringFrom(splitted, joinmod));
byte[] packet = CWvsContext.broadcastMsg(type, sb.toString());
if (range == 0) {
c.getPlayer().getMap().broadcastMessage(packet);
} else if (range == 1) {
ChannelServer.getInstance(c.getChannel()).broadcastPacket(packet);
} else if (range == 2) {
World.Broadcast.broadcastMessage(packet);
}
return 1;
}