当前位置: 首页>>代码示例>>Java>>正文


Java LittleEndianAccessor.readMapleAsciiString方法代码示例

本文整理汇总了Java中tools.data.LittleEndianAccessor.readMapleAsciiString方法的典型用法代码示例。如果您正苦于以下问题:Java LittleEndianAccessor.readMapleAsciiString方法的具体用法?Java LittleEndianAccessor.readMapleAsciiString怎么用?Java LittleEndianAccessor.readMapleAsciiString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tools.data.LittleEndianAccessor的用法示例。


在下文中一共展示了LittleEndianAccessor.readMapleAsciiString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ProfessionInfo

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void ProfessionInfo(final LittleEndianAccessor slea, final MapleClient c) { //so pointless
    try {
        String skillid = slea.readMapleAsciiString();
        int level1 = slea.readInt();
        int level2 = slea.readInt();
        int rate;
        if (skillid.startsWith("9200") || skillid.startsWith("9201")) {
            rate = 100;
        } else if (skillid.equals("honorLeveling")) {
            c.getSession().write(CWvsContext.updateSpecialStat(skillid, level1, level2, c.getPlayer().getHonourNextExp()));
            return;
        } else if (skillid.equals("hyper")) {
            c.getSession().write(CWvsContext.updateSpecialStat(skillid, level1, level2, 0));
            return;
        } else {
            rate = Math.max(0, 100 - ((level1 + 1) - c.getPlayer().getProfessionLevel(Integer.parseInt(skillid))) * 20);
        }
        c.getSession().write(CWvsContext.updateSpecialStat(skillid, level1, level2, rate));
    } catch (NumberFormatException nfe) {
    }
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:22,代码来源:ItemMakerHandler.java

示例2: handle

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.CHANGE_MAP_SPECIAL)
public static void handle(MapleClient c, LittleEndianAccessor lea) {
       lea.skip(1);
       String portalName = lea.readMapleAsciiString();
       
       if ((c.getPlayer() == null) || (c.getPlayer().getMap() == null)) {
		return;
	}
	
       MaplePortal portal = c.getPlayer().getMap().getPortal(portalName);
       
	if (portal == null && c.getPlayer().hasBlockedInventory()) {
		c.getSession().write(CWvsContext.enableActions());
		return;
	}
	
	portal.enterPortal(c);
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:19,代码来源:ChangeMapSpecialHandler.java

示例3: handle

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.USE_INNER_PORTAL)
public static void handle(MapleClient c, LittleEndianAccessor lea) {
	lea.skip(1);
	if (c.getPlayer() == null || c.getPlayer().getMap() == null) {
		return;
	}
	String portalName = lea.readMapleAsciiString();
	MaplePortal portal = c.getPlayer().getMap().getPortal(portalName);

	if (portal == null) {
		return;
	}
	//That "22500" should not be hard coded in this manner
	if (portal.getPosition().distanceSq(c.getPlayer().getTruePosition()) > 22500.0D && !c.getPlayer().isGM()) {
		return;
	}
	
	int toX = lea.readShort();
	int toY = lea.readShort();
	
	//Are there not suppose to be checks here? Can players not just PE any x and y value they want?
	
	c.getPlayer().getMap().movePlayer(c.getPlayer(), new Point(toX, toY));
	c.getPlayer().checkFollow();
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:26,代码来源:UseInnerPortalHandler.java

示例4: ChangeSkillMacro

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void ChangeSkillMacro(LittleEndianAccessor slea, MapleCharacter chr) {
	int num = slea.readByte();

	for (int i = 0; i < num; i++) {
		String name = slea.readMapleAsciiString();
		int shout = slea.readByte();
		int skill1 = slea.readInt();
		int skill2 = slea.readInt();
		int skill3 = slea.readInt();

		SkillMacro macro = new SkillMacro(skill1, skill2, skill3, name, shout, i);
		chr.updateMacros(i, macro);
	}
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:15,代码来源:PlayerHandler.java

示例5: CraftEffect

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static final void CraftEffect(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
    if (chr.getMapId() != 910001000 && chr.getMap().getExtractorSize() <= 0) {
        return; //ardent mill
    }
    final String effect = slea.readMapleAsciiString();
    final Integer profession = craftingEffects.get(effect);
    if (profession != null && (c.getPlayer().getProfessionLevel(profession.intValue()) > 0 || (profession == 92040000 && chr.getMap().getExtractorSize() > 0))) {
        int time = slea.readInt();
        if (time > 6000 || time < 3000) {
            time = 4000;
        }
        c.getSession().write(EffectPacket.showOwnCraftingEffect(effect, (byte) chr.getDirection(), time, effect.endsWith("Extract") ? 1 : 0));
        chr.getMap().broadcastMessage(chr, EffectPacket.showCraftingEffect(chr.getId(), effect, (byte) chr.getDirection(), time, effect.endsWith("Extract") ? 1 : 0), false);
    }
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:16,代码来源:ItemMakerHandler.java

示例6: RenameFamiliar

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static final void RenameFamiliar(LittleEndianAccessor slea, MapleClient c, MapleCharacter chr) {
    MonsterFamiliar mf = (MonsterFamiliar) c.getPlayer().getFamiliars().get(Integer.valueOf(slea.readInt()));
    String newName = slea.readMapleAsciiString();
    if ((mf != null) && (mf.getName().equals(mf.getOriginalName())) && (MapleCharacterUtil.isEligibleCharName(newName, false))) {
        mf.setName(newName);
        c.getSession().write(CField.renameFamiliar(mf));
    } else {
        chr.dropMessage(1, "Name was not eligible.");
    }
    c.getSession().write(CWvsContext.enableActions());
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:12,代码来源:MobHandler.java

示例7: Note

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void Note(final LittleEndianAccessor slea, final MapleCharacter chr) {
    final byte type = slea.readByte();

    switch (type) {
        case 0:
            String name = slea.readMapleAsciiString();
            String msg = slea.readMapleAsciiString();
            boolean fame = slea.readByte() > 0;
            slea.readInt(); //0?
            Item itemz = chr.getCashInventory().findByCashId((int) slea.readLong());
            if (itemz == null || !itemz.getGiftFrom().equalsIgnoreCase(name) || !chr.getCashInventory().canSendNote(itemz.getUniqueId())) {
                return;
            }
            try {
                chr.sendNote(name, msg, fame ? 1 : 0);
                chr.getCashInventory().sendedNote(itemz.getUniqueId());
            } catch (Exception e) {
            }
            break;
        case 1:
            short num = slea.readShort();
            if (num < 0) { // note overflow, shouldn't happen much unless > 32767 
                num = 32767;
            }
            slea.skip(1); // first byte = wedding boolean? 
            for (int i = 0; i < num; i++) {
                final int id = slea.readInt();
                chr.deleteNote(id, slea.readByte() > 0 ? 1 : 0);
            }
            break;
        default:
            System.out.println("Unhandled note action, " + type + "");
    }
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:35,代码来源:PlayersHandler.java

示例8: TransformPlayer

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void TransformPlayer(final LittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
    // D9 A4 FD 00
    // 11 00
    // A0 C0 21 00
    // 07 00 64 66 62 64 66 62 64
	slea.skip(4); // update tick
    final byte slot = (byte) slea.readShort();
    final int itemId = slea.readInt();
    final String target = slea.readMapleAsciiString();

    final Item toUse = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot);

    if (toUse == null || toUse.getQuantity() < 1 || toUse.getItemId() != itemId) {
        c.getSession().write(CWvsContext.enableActions());
        return;
    }
    switch (itemId) {
        case 2212000:
            final MapleCharacter search_chr = chr.getMap().getCharacterByName(target);
            if (search_chr != null) {
                MapleItemInformationProvider.getInstance().getItemEffect(2210023).applyTo(search_chr);
                search_chr.dropMessage(6, chr.getName() + " has played a prank on you!");
                MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.USE, slot, (short) 1, false);
            }
            break;
    }
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:28,代码来源:PlayersHandler.java

示例9: updateSpecialStat

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void updateSpecialStat(final LittleEndianAccessor slea, final MapleClient c) {
    String stat = slea.readMapleAsciiString();
    int array = slea.readInt();
    int mode = slea.readInt();
    switch (stat) {
        case "honorLeveling":
            c.getSession().write(CWvsContext.updateSpecialStat(stat, array, mode, c.getPlayer().getHonourNextExp()));
            break;
        case "hyper":
            c.getSession().write(CWvsContext.updateSpecialStat(stat, array, mode, 0));
            break;
    }
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:14,代码来源:PlayersHandler.java

示例10: DeleteChar

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void DeleteChar(final LittleEndianAccessor lea, final MapleClient c) {
    String Secondpw_Client = lea.readMapleAsciiString();
    if (Secondpw_Client == null) {
        if (lea.readByte() > 0) { // Specific if user have second password or not
            Secondpw_Client = lea.readMapleAsciiString();
        }
        lea.readMapleAsciiString();
    }

    final int Character_ID = lea.readInt();

    if (!c.login_Auth(Character_ID) || !c.isLoggedIn() || loginFailCount(c)) {
        c.getSession().close();
        return; // Attempting to delete other character
    }
    byte state = 0;

    if (c.getSecondPassword() != null) { // On the server, there's a second password
        if (Secondpw_Client == null) { // Client's hacking
            c.getSession().close();
            return;
        } else {
            if (!c.CheckSecondPassword(Secondpw_Client)) { // Wrong Password
                state = 20;
            }
        }
    }

    if (state == 0) {
        state = (byte) c.deleteCharacter(Character_ID);
    }
    c.getSession().write(LoginPacket.deleteCharResponse(Character_ID, state));
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:34,代码来源:CharLoginHandler.java

示例11: handle

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.AUTH_SECOND_PASSWORD)
public static void handle(MapleClient c, LittleEndianAccessor lea) {
	
	final String password = lea.readMapleAsciiString();
       final int charId = lea.readInt();
       lea.readByte();
       /*if (view) {
           c.setChannel(1);
           c.setWorld(slea.readInt());
       }*/
       
       // || loginFailCount(c)
       if (!c.isLoggedIn() || c.getSecondPassword() == null || !c.login_Auth(charId) || ChannelServer.getInstance(c.getChannel()) == null || !WorldOption.isExists(c.getWorld())) {
           c.getSession().close();
           return;
       }
       c.updateMacs(lea.readMapleAsciiString());
       if (c.CheckSecondPassword(password) && password.length() >= 6 && password.length() <= 16 || c.isGm()) {
           if (c.getIdleTask() != null) {
               c.getIdleTask().cancel(true);
           }

           final String s = c.getSessionIPAddress();
           LoginServer.putLoginAuth(charId, s.substring(s.indexOf('/') + 1, s.length()), c.getTempIP(), c.getChannel());
           c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, s);
           c.getSession().write(CField.getServerIP(c, Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]), charId));
       } else {
           c.getSession().write(LoginPacket.secondPwError((byte) 0x14));
       }
       
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:32,代码来源:CharacterWithSecondPassword.java

示例12: handle

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static void handle(MapleClient c, LittleEndianAccessor lea) {
	final int charId = lea.readInt();
	lea.readByte(); // 1? 
       lea.readByte(); // 1?
	
       final String currentpw = c.getSecondPassword();
       
       if (!c.isLoggedIn() || (currentpw != null && (!currentpw.equals(""))) || !c.login_Auth(charId) || ChannelServer.getInstance(c.getChannel()) == null || !WorldOption.isExists(c.getWorld())) {
           System.out.println("The session wants to close");
       	c.getSession().close();
           return;
       }
       c.updateMacs(lea.readMapleAsciiString());
       if (lea.available() != 0) {
           final String setpassword = lea.readMapleAsciiString();

           if (setpassword.length() >= 6 && setpassword.length() <= 16) {
               c.setSecondPassword(setpassword);
               c.updateSecondPassword();
           } else {
               c.getSession().write(LoginPacket.secondPwError((byte) 0x14));
               return;
           }
       } 
       if (c.getIdleTask() != null) {
           c.getIdleTask().cancel(true);
       }
       final String s = c.getSessionIPAddress();
       LoginServer.putLoginAuth(charId, s.substring(s.indexOf('/') + 1, s.length()), c.getTempIP(), c.getChannel());
       c.updateLoginState(MapleClient.LOGIN_SERVER_TRANSITION, s);
       c.getSession().write(CField.getServerIP(c, Integer.parseInt(ChannelServer.getInstance(c.getChannel()).getIP().split(":")[1]), charId));
   
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:34,代码来源:CreateWithoutSecondPassword.java

示例13: handle

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.CHECK_CHAR_NAME)
public static void handle(MapleClient c, LittleEndianAccessor lea) {
	String name = lea.readMapleAsciiString();
	
	LoginInformationProvider li = LoginInformationProvider.getInstance();
       boolean nameUsed = true;
       if (MapleCharacterUtil.canCreateChar(name, c.isGm())) {
           nameUsed = false;
       }
       if (li.isForbiddenName(name) && !c.isGm()) {
           nameUsed = false;
       }
       c.getSession().write(LoginPacket.charNameResponse(name, nameUsed));
	
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:16,代码来源:CheckCharacterName.java

示例14: handle

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
@PacketHandler(opcode = RecvPacketOpcode.GENERAL_CHAT)
public static void handle(MapleClient c, LittleEndianAccessor slea){
	if (c.getPlayer() == null || c.getPlayer().getMap() == null){
		return;
	}
	slea.skip(4); // update tick
	String text = slea.readMapleAsciiString();
	byte balloon = slea.readByte();

	if (CommandProcessor.processCommand(c, text, CommandType.NORMAL)){
		return;
	}
	if (text.length() < 1 || (!c.getPlayer().isIntern() && text.length() >= 80)) {
		return;
	}
	if (!c.getPlayer().getCanTalk()){
		c.getSession().write(CWvsContext.broadcastMsg(6, "You have been muted and are therefore unable to talk."));
		return;
	}
	if (!c.getPlayer().isHidden()){
		c.getPlayer().getMap().broadcastMessage(CField.getChatText(c.getPlayer().getId(), text, false, balloon));
		c.getPlayer().getMap().broadcastMessage(CField.getChatText(c.getPlayer().getId(), text, c.getPlayer().isSuperGM(), 1));
		return;
	}
	// Note: This patch is needed to prevent chat packet from being broadcast to people who might be packet sniffing.
	if (c.getPlayer().isIntern() && !c.getPlayer().isSuperGM() && balloon == 0) {
		c.getPlayer().getMap().broadcastGMMessage(c.getPlayer(), CField.getChatText(c.getPlayer().getId(), text, c.getPlayer().isSuperGM(), (byte) 1), true);
		c.getPlayer().getMap().broadcastGMMessage(c.getPlayer(), CWvsContext.broadcastMsg(2, c.getPlayer().getName() + " : " + text), true);
	} else {
		c.getPlayer().getMap().broadcastGMMessage(c.getPlayer(), CField.getChatText(c.getPlayer().getId(), text, c.getPlayer().isSuperGM(), balloon), true);
	}
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:33,代码来源:GeneralChatHandler.java

示例15: UseTeleRock

import tools.data.LittleEndianAccessor; //导入方法依赖的package包/类
public static final boolean UseTeleRock(LittleEndianAccessor lea, MapleClient c, int itemId) {
    boolean used = false;
    if (itemId == 5040004) {
        lea.readByte();
    } 
    if ((itemId == 5040004) || itemId == 5041001)
    {
        if(lea.readByte() == 0)
        {
            final MapleMap target = c.getChannelServer().getMapFactory().getMap(lea.readInt());
            if (target != null){ //Premium and Hyper rocks are allowed to go anywhere. Blocked maps are checked below. 
                if (!FieldLimitType.VipRock.check(c.getPlayer().getMap().getFieldLimit()) && !FieldLimitType.VipRock.check(target.getFieldLimit()) && !c.getPlayer().isInBlockedMap()) { //Makes sure this map doesn't have a forced return map
                    c.getPlayer().changeMap(target, target.getPortal(0));
                    if(itemId == 5041001) used = true;
                } else {
                    c.getPlayer().dropMessage(1, "You cannot go to that place.");
                }
            } else {
                c.getPlayer().dropMessage(1, "The place you want to go to does not exist."); 
            }  
        } else {
            final String name = lea.readMapleAsciiString();
            final MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(name);
            if (victim != null && !victim.isIntern() && c.getPlayer().getEventInstance() == null && victim.getEventInstance() == null) {
                if (!FieldLimitType.VipRock.check(c.getPlayer().getMap().getFieldLimit()) && !FieldLimitType.VipRock.check(c.getChannelServer().getMapFactory().getMap(victim.getMapId()).getFieldLimit()) && !victim.isInBlockedMap() && !c.getPlayer().isInBlockedMap()) {
                    c.getPlayer().changeMap(victim.getMap(), victim.getMap().findClosestPortal(victim.getTruePosition()));
                    if(itemId == 5041001) used = true;
                } else {
                    c.getPlayer().dropMessage(1, "You cannot go to where that person is.");
                }
            } else {
                if(victim == null) {
                    c.getPlayer().dropMessage(1, "(" +name + ") is either offline or in a different channel.");
                }
                else {
                    c.getPlayer().dropMessage(1, "(" +name + ") is currently difficult to locate, so the teleport will not take place.");
                }
            }
        }
    } else {
        if (itemId == 5040004) {
            c.getPlayer().dropMessage(1, "You are not able to use this teleport rock.");
        }
        else{
            c.getPlayer().dropMessage(1, "This teleport rock is currently disabled.");
        }
    }
    return used;
}
 
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:50,代码来源:InventoryHandler.java


注:本文中的tools.data.LittleEndianAccessor.readMapleAsciiString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。