the following is for OdinTeh, while this was ported from Vana.. I believe this was cause of how it was coded by Danner back in the days.. further clarification by Vana Developers has revealed that the monster skills in earlier Vana version was wrong and they have now fixed the issue..
so pretty much everyone who are using Lithium/Odin has Wrong Monster skills.. and is inaccurate
while the monster attack now works fine to gms alike the skills isnt working properlyCode:Vana: The code in every other source is based on my old code. Vana: My old code was stupid, yes, but that's because I didn't understand what it was doing. Vana: Took quite a bit of effort to figure it out.
anyone with clue can provide who can help me can either pm me or help me out.
Bugs :
No Disease On Player ( Seduce,Stun) By Mob (?)
Code:/* This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc> Matthias Butz <matze@odinms.de> Jan Christian Meyer <vimes@odinms.de> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation. You may not use, modify or distribute this program under any other version of the GNU Affero General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.odinms.net.channel.handler; import java.awt.Point; import java.util.List; import java.util.Random; import java.util.concurrent.TimeUnit; import net.sf.odinms.client.MapleClient; import net.sf.odinms.net.MaplePacket; import net.sf.odinms.server.TimerManager; import net.sf.odinms.server.life.MapleMonster; import net.sf.odinms.server.life.MobSkill; import net.sf.odinms.server.life.MobSkillFactory; import net.sf.odinms.server.maps.MapleMapObject; import net.sf.odinms.server.maps.MapleMapObjectType; import net.sf.odinms.server.movement.LifeMovementFragment; import net.sf.odinms.tools.CollectionUtil; import net.sf.odinms.tools.MaplePacketCreator; import net.sf.odinms.tools.Pair; import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MoveLifeHandler extends AbstractMovementPacketHandler { private static Logger log = LoggerFactory.getLogger(MoveLifeHandler.class); @Override public void handlePacket(SeekableLittleEndianAccessor slea, final MapleClient c) { int objectid = slea.readInt(); short moveid = slea.readShort(); MapleMapObject mmo = c.getPlayer().getMap().getMapObject(objectid); if (mmo == null || mmo.getType() != MapleMapObjectType.MONSTER) { return; } final MapleMonster monster = (MapleMonster) mmo; List<LifeMovementFragment> res = null; byte pNibbles = slea.readByte(); byte rawActivity = slea.readByte(); byte useSkillId = slea.readByte(); byte useSkillLevel = slea.readByte(); short pOption = slea.readShort(); byte parsedActivity = rawActivity; if (parsedActivity >= 0) { parsedActivity = (byte) (parsedActivity & 0xFF >> 1); } boolean isAttack = CollectionUtil.inRangeInclusive(parsedActivity, 12, 20); boolean isSkill = CollectionUtil.inRangeInclusive(parsedActivity, 21, 25); byte attackId = (byte) (isAttack ? parsedActivity - 12 : -1); boolean nextMovementCouldBeSkill = (pNibbles & 0x0F) != 0; boolean pUnk = (pNibbles & 0xF0) != 0; MobSkill toUse = null; Random mRandom = new Random(); if (isSkill && useSkillId > 0 && monster.getNoSkills() > 0) { if (nextMovementCouldBeSkill) { System.out.println("nextMovementCouldBeSkill: " + nextMovementCouldBeSkill); int Random = mRandom.nextInt(monster.getNoSkills()); Pair<Integer, Integer> skillToUse = monster.getSkills().get(Random); int nextCastSkill = skillToUse.getLeft(); int nextCastSkillLevel = skillToUse.getRight(); long currentTime = System.currentTimeMillis(); long lastSkillUsed = monster.getLastSkillUsed(nextCastSkill); toUse = MobSkillFactory.getMobSkill(nextCastSkill, nextCastSkillLevel); toUse.applyEffect(c.getPlayer(), monster, true); // Apply Skill To Use if (lastSkillUsed == 0 || ((currentTime - lastSkillUsed) > toUse.getCoolTime()) || toUse.checkCurrentBuff(c.getPlayer(), monster)) { monster.setLastSkillUsed(nextCastSkill, currentTime, toUse.getCoolTime()); toUse = null; System.out.println("Skill On Cool Down.."); } } } slea.skip(1); slea.skip(4); int start_x = slea.readShort(); // hmm.. startpos? int start_y = slea.readShort(); // hmm... Point startPos = new Point(start_x, start_y); res = parseMovement(slea); if (monster.getController() != c.getPlayer()) { if (monster.isAttackedBy(c.getPlayer())) { // aggro and controller // change monster.switchController(c.getPlayer(), true); } else { return; } } else { if (parsedActivity == -1 && monster.isControllerKnowsAboutAggro() && !monster.isMobile() && !monster.isFirstAttack()) { monster.setControllerHasAggro(false); monster.setControllerKnowsAboutAggro(false); } } boolean aggro = monster.isControllerHasAggro(); if (aggro) { monster.setControllerKnowsAboutAggro(true); monster.setControllerHasAggro(true); } if (isAttack) { c.getSession().write( MaplePacketCreator.moveMonsterResponse(objectid, moveid, monster.getMp(), aggro, useSkillId, useSkillLevel)); } else { c.getSession().write( MaplePacketCreator.moveMonsterResponse(objectid, moveid, monster.getMp(), aggro)); } if (res != null) { return; } MaplePacket packet = MaplePacketCreator.moveMonster(objectid, nextMovementCouldBeSkill, rawActivity, useSkillId, useSkillLevel, pOption, startPos, res); c.getPlayer().getMap() .broadcastMessage(c.getPlayer(), packet, monster.getPosition()); updatePosition(res, monster, -1); c.getPlayer().getMap().moveMonster(monster, monster.getPosition()); c.getPlayer().getCheatTracker().checkMoveMonster(monster.getPosition()); } }
Code:public static boolean inRangeInclusive(Byte pVal, Integer pMin, Integer pMax) { return !(pVal < pMin) || (pVal > pMax); }
while I have tried everything to fixed it :\ Im out of ideas..



Reply With Quote

