當前位置: 首頁>>代碼示例>>Java>>正文


Java CWvsContext.broadcastMsg方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:20,代碼來源:ChatHandler.java

示例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;
}
 
開發者ID:ergothvs,項目名稱:Lucid2.0,代碼行數:45,代碼來源:GMCommand.java


注:本文中的tools.packet.CWvsContext.broadcastMsg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。