Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Mob problem

Junior Spellweaver
Joined
Feb 18, 2018
Messages
117
Reaction score
10
Hello i'm using Acernis Astral re-pack, i wonder if someone can help me to fix this issue, mobs don't cast Buff/Reflect/Cancel Issues, i don't know if its an OP code and i have to do something in the MobPacket?
i hope someone can guide me :closedeyes:
 
Skilled Illusionist
Joined
Jul 17, 2010
Messages
333
Reaction score
165
i have to do something in the MobPacket?
Yes, you need to replace this
Code:
    public static byte[] moveMonsterResponse(int objectid, short moveid, int currentMp, boolean useSkills, int skillId, int skillLevel) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MOVE_MONSTER_RESPONSE.getValue());
        mplew.writeInt(objectid);
        mplew.writeShort(moveid);
        mplew.write(useSkills ? 1 : 0);
        mplew.writeShort(currentMp);
        mplew.write(skillId);
        mplew.write(skillLevel);
        mplew.writeInt(0);
        mplew.writeShort(0);//new143

        return mplew.getPacket();
    }
with
Code:
    public static byte[] moveMonsterResponse(int objectid, short moveid, int currentMp, boolean useSkills, int skillId, int skillLevel) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.MOVE_MONSTER_RESPONSE.getValue());
        mplew.writeInt(objectid);
        mplew.writeShort(moveid);
        mplew.write(useSkills ? 1 : 0);
        mplew.writeInt(currentMp);
        mplew.write(skillId);
        mplew.write(skillLevel);
        mplew.writeInt(0);

        return mplew.getPacket();
    }
 
Upvote 0
Junior Spellweaver
Joined
Feb 18, 2018
Messages
117
Reaction score
10
Thanks a lot, it seems that my op code is wrong i'll try to find out and test it again :D



Nope, it didn't work... i don't know if there's something else or it is linked with the reason my player don't get stun or blind by monster effects o.o
 
Upvote 0
Skilled Illusionist
Joined
Jul 17, 2010
Messages
333
Reaction score
165
Thanks a lot, it seems that my op code is wrong i'll try to find out and test it again :D



Nope, it didn't work... i don't know if there's something else or it is linked with the reason my player don't get stun or blind by monster effects o.o
I think opcodes are correct.
Code:
MOVE_MONSTER((short) 0x27B),
MOVE_MONSTER_RESPONSE((short) 0x27C),
APPLY_MONSTER_STATUS((short) 0x27E),
CANCEL_MONSTER_STATUS((short) 0x27F),

Hmm could you please clarify how it doesn't work? like, mobs won't use skills / mobs use skills but never get buffs (or players won't get debuffs) / mob disease attacks also won't give debuffs to players.
 
Upvote 0
Junior Spellweaver
Joined
Feb 18, 2018
Messages
117
Reaction score
10
I think opcodes are correct.
Code:
MOVE_MONSTER((short) 0x27B),
MOVE_MONSTER_RESPONSE((short) 0x27C),
APPLY_MONSTER_STATUS((short) 0x27E),
CANCEL_MONSTER_STATUS((short) 0x27F),

Hmm could you please clarify how it doesn't work? like, mobs won't use skills / mobs use skills but never get buffs (or players won't get debuffs) / mob disease attacks also won't give debuffs to players.

Hmmm okay mobs use skills and all but never get buffs and wont cast Weapon reflect, cancel weapon ,and magic etc (it shows skill effect), and player don't get any debuff (stun, poison, seduce), etc :$: and yep my opcodes are fine :blink:
 
Upvote 0
Skilled Illusionist
Joined
Jul 17, 2010
Messages
333
Reaction score
165
Hmmm okay mobs use skills and all but never get buffs and wont cast Weapon reflect, cancel weapon ,and magic etc (it shows skill effect), and player don't get any debuff (stun, poison, seduce), etc :$: and yep my opcodes are fine :blink:
let's try modify the mob handler
Code:
........
        final int skill2 = rh.readByte() & 0xFF;
........
        int realskill = 0;
        int level = 0;
        if (useSkill) {
            final byte size = monster.getNoSkills();
            boolean used = false;
            if (size > 0) {
                final Pair<Integer, Integer> skillToUse = monster.getSkills().get((byte) Randomizer.nextInt(size));
                realskill = skillToUse.getLeft();
                level = skillToUse.getRight();
                // Skill ID and Level
                final MobSkill mobSkill = MobSkillFactory.getMobSkill(realskill, level);
                if (!mobSkill.checkCurrentBuff(chr, monster)) {
                    final long now = System.currentTimeMillis();
                    final long ls = monster.getLastSkillUsed(realskill);
                    if (ls == 0 || ((now - ls) > mobSkill.getCoolTime())) {
                        final int reqHp = (int) (((float) monster.getHp() / monster.getMobMaxHp()) * 100); // In case this monster have 2.1b and above HP
                        if (reqHp <= mobSkill.getHP()) {
                            monster.setLastSkillUsed(realskill, now, mobSkill.getCoolTime());
                            used = true;
                        }
                    }
                }
            }
            if (!used) {
                realskill = 0;
                level = 0;
            }
        }
        if (skill >= 60 && skill <= 91 && skill1 >= 100 && skill1 <= 205 && monster.hasSkill(skill1, skill2)) {//should check range
            final MobSkill skillData = MobSkillFactory.getMobSkill(skill1, skill2);
            if (skillData != null) {
                skillData.applyEffect(c.getPlayer(), monster, true);
            }
        }
........
 
Last edited:
Upvote 0
Junior Spellweaver
Joined
Feb 18, 2018
Messages
117
Reaction score
10
let's try modify the mob handler
Code:
........
        final int skill2 = rh.readByte() & 0xFF;
........
        int realskill = 0;
        int level = 0;
        if (useSkill) {
            final byte size = monster.getNoSkills();
            boolean used = false;
            if (size > 0) {
                final Pair<Integer, Integer> skillToUse = monster.getSkills().get((byte) Randomizer.nextInt(size));
                realskill = skillToUse.getLeft();
                level = skillToUse.getRight();
                // Skill ID and Level
                final MobSkill mobSkill = MobSkillFactory.getMobSkill(realskill, level);
                if (!mobSkill.checkCurrentBuff(chr, monster)) {
                    final long now = System.currentTimeMillis();
                    final long ls = monster.getLastSkillUsed(realskill);
                    if (ls == 0 || ((now - ls) > mobSkill.getCoolTime())) {
                        final int reqHp = (int) (((float) monster.getHp() / monster.getMobMaxHp()) * 100); // In case this monster have 2.1b and above HP
                        if (reqHp <= mobSkill.getHP()) {
                            monster.setLastSkillUsed(realskill, now, mobSkill.getCoolTime());
                            used = true;
                        }
                    }
                }
            }
            if (!used) {
                realskill = 0;
                level = 0;
            }
        }
        if (skill >= 60 && skill <= 91 && skill1 >= 100 && skill1 <= 205 && monster.hasSkill(skill1, skill2)) {//should check range
            final MobSkill skillData = MobSkillFactory.getMobSkill(skill1, skill2);
            if (skillData != null) {
                skillData.applyEffect(c.getPlayer(), monster, true);
            }
        }
........
Nope, it didn't work but thanks i'll still looking for a solution :/
 
Upvote 0
Skilled Illusionist
Joined
Jul 17, 2010
Messages
333
Reaction score
165
OMG Who the f*** did this
Code:
    public MobSkill(int skillId, int level) {
        [B]skillId = skillId;[/B]//NOOOOOOOO
        skillLevel = level;
    }
caused skillId=0 and thus it didn't apply any effects.


Also
Code:
    public static byte[] applyMonsterStatus(int oid, Map<MonsterStatus, Integer> stati, List<Integer> reflection, MobSkill skil) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.APPLY_MONSTER_STATUS.getValue());
        mplew.writeInt(oid);
        PacketHelper.writeMask(mplew, stati.keySet());

        for (Map.Entry mse : stati.entrySet()) {
            mplew.writeInt(((Integer) mse.getValue()).intValue());
            //[STRIKE]mplew.writeInt(skil.getSkillId());[/STRIKE]//this is mob skill...
            [B]mplew.writeShort(skil.getSkillId());
            mplew.writeShort(skil.getSkillLevel());[/B]
            mplew.writeShort((short) skil.getDuration());
        }

        for (Integer ref : reflection) {
            mplew.writeInt(ref.intValue());
        }
        mplew.writeLong(0L);
        mplew.writeShort(0);

        int size = stati.size();
        if (reflection.size() > 0) {
            size /= 2;
        }
        mplew.write(size);
        return mplew.getPacket();
    }
and the last
Code:
    public static byte[] cancelMonsterStatus(int oid, MonsterStatus stat) {
        MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();

        mplew.writeShort(SendPacketOpcode.CANCEL_MONSTER_STATUS.getValue());
        mplew.writeInt(oid);
        PacketHelper.writeSingleMask(mplew, stat);
        /*[STRIKE]mplew.write(5);
        mplew.writeZeroBytes(5);  // v145+
        mplew.write(2);
        mplew.writeZeroBytes(30); // v145+[/STRIKE]*/
        //too long. just simplified
        [B]mplew.write(0);
        mplew.write(0);[/B]//in case it's moveaffected skill

        return mplew.getPacket();
    }
 
Upvote 0
Junior Spellweaver
Joined
Feb 18, 2018
Messages
117
Reaction score
10
Oh my bad the problem was in the applyMonsterBuff maplemonster function i didn't realize of that function duh! haha :eek:tt:, just one thing, all buffs shows except the reflect one what could be the problem there...
 
Upvote 0
Skilled Illusionist
Joined
Jul 17, 2010
Messages
333
Reaction score
165
Oh my bad the problem was in the applyMonsterBuff maplemonster function i didn't realize of that function duh! haha :eek:tt:, just one thing, all buffs shows except the reflect one what could be the problem there...
I have no idea. cuz I didn't touch anything other than that I had wrote above but it showed the reflect buff properly.
 
Upvote 0
Back
Top