ariantpq + correct use catch item
This commit is contained in:
@@ -88,6 +88,7 @@ import constants.ServerConstants;
|
||||
import java.util.TimeZone;
|
||||
import net.server.coordinator.MapleSessionCoordinator;
|
||||
import server.CashShop.CashItemFactory;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MapleSkillbookInformationProvider;
|
||||
import server.ThreadManager;
|
||||
import server.TimerManager;
|
||||
@@ -924,6 +925,7 @@ public class Server {
|
||||
//MapleItemInformationProvider.getInstance().getAllItems(); //unused, rofl
|
||||
|
||||
CashItemFactory.getSpecialCashItems();
|
||||
MapleItemInformationProvider.getInstance().getAllItems();
|
||||
System.out.println("Items loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds");
|
||||
|
||||
timeToTake = System.currentTimeMillis();
|
||||
|
||||
@@ -34,7 +34,6 @@ import constants.GameConstants;
|
||||
import constants.ItemConstants;
|
||||
import constants.ServerConstants;
|
||||
import constants.skills.Aran;
|
||||
import constants.skills.Corsair;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.Collections;
|
||||
@@ -44,6 +43,7 @@ import java.util.List;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import server.MapleStatEffect;
|
||||
import server.life.MapleLifeFactory;
|
||||
import server.life.MapleLifeFactory.loseItem;
|
||||
import server.life.MapleMonster;
|
||||
import server.life.MobAttackInfo;
|
||||
@@ -87,15 +87,19 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (attacker != null) {
|
||||
if (attacker != null || monsteridfrom == 9300166) {
|
||||
List<loseItem> loseItems;
|
||||
|
||||
if (attacker.isBuffed(MonsterStatus.NEUTRALISE)) {
|
||||
if (monsteridfrom != 9300166 && attacker.isBuffed(MonsterStatus.NEUTRALISE)) {
|
||||
return;
|
||||
}
|
||||
if (damage > 0) {
|
||||
MapleMonster assaulter = map.getMonsterById(monsteridfrom);
|
||||
|
||||
if (monsteridfrom == 9300166) {
|
||||
assaulter = MapleLifeFactory.getMonster(monsteridfrom);
|
||||
}
|
||||
|
||||
if(assaulter != null) {
|
||||
loseItems = assaulter.getStats().loseItem();
|
||||
if (loseItems != null) {
|
||||
@@ -106,8 +110,14 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
|
||||
for (loseItem loseItem : loseItems) {
|
||||
type = ItemConstants.getInventoryType(loseItem.getId());
|
||||
for (byte b = 0; b < loseItem.getX(); b++) {//LOL?
|
||||
boolean buffAtivo = false;
|
||||
if (Randomizer.nextInt(100) < loseItem.getChance()) {
|
||||
if (chr.haveItem(loseItem.getId())) {
|
||||
for (Integer inteiro : chr.getAvailableBuffs()) {
|
||||
if (inteiro == -2022269) {
|
||||
buffAtivo = true;
|
||||
}
|
||||
}
|
||||
if (chr.haveItem(loseItem.getId()) && !buffAtivo) {
|
||||
pos.x = (int) (playerpos + ((d % 2 == 0) ? (25 * (d + 1) / 2) : -(25 * (d / 2))));
|
||||
MapleInventoryManipulator.removeById(c, type, loseItem.getId(), 1, false, false);
|
||||
map.spawnItemDrop(chr, chr, new Item(loseItem.getId(), (short) 0, (short) 1), map.calcDropPos(pos, chr.getPosition()), true, true);
|
||||
@@ -118,7 +128,9 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
map.removeMapObject(attacker);
|
||||
if(monsteridfrom != 9300166) {
|
||||
map.removeMapObject(attacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/*
|
||||
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 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 as
|
||||
published by the Free Software Foundation 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 free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation 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.
|
||||
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/>.
|
||||
*/
|
||||
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.server.channel.handlers;
|
||||
|
||||
import client.MapleCharacter;
|
||||
@@ -29,6 +29,7 @@ import constants.ItemConstants;
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import net.server.Server;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.life.MapleMonster;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
@@ -38,6 +39,7 @@ import tools.data.input.SeekableLittleEndianAccessor;
|
||||
* @author kevintjuh93
|
||||
*/
|
||||
public final class UseCatchItemHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
@@ -48,140 +50,37 @@ public final class UseCatchItemHandler extends AbstractMaplePacketHandler {
|
||||
int itemId = slea.readInt();
|
||||
int monsterid = slea.readInt();
|
||||
|
||||
int itemGanho = MapleItemInformationProvider.getInstance().getCreatItem(itemId);
|
||||
int mobItem = MapleItemInformationProvider.getInstance().getMobItem(itemId);
|
||||
int timeCatch = MapleItemInformationProvider.getInstance().getUseDelay(itemId);
|
||||
int mobHp = MapleItemInformationProvider.getInstance().getMobHP(itemId);
|
||||
|
||||
MapleMonster mob = chr.getMap().getMonsterByOid(monsterid);
|
||||
if (chr.getInventory(ItemConstants.getInventoryType(itemId)).countById(itemId) <= 0) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (mob == null) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
switch (itemId) {
|
||||
case 2270000:
|
||||
if (mob.getId() == 9300101) {
|
||||
|
||||
if (itemGanho != 0 && mobItem == mob.getId()) {
|
||||
if (timeCatch != 0 && (abm.getLastSpam(10) + timeCatch) < currentServerTime()) {
|
||||
if (mobHp != 0 && mob.getHp() < ((mob.getMaxHp() / 100) * mobHp)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 1902000, (short) 1, "", -1);
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270001:
|
||||
if (mob.getId() == 9500197) {
|
||||
if ((abm.getLastSpam(10) + 1000) < currentServerTime()) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 4031830, (short) 1, "", -1);
|
||||
} else {
|
||||
abm.spam(10);
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
MapleInventoryManipulator.addById(c, itemGanho, (short) 1, "", -1);
|
||||
if (itemGanho == 4031868) {
|
||||
chr.updateAriantScore();
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
break;
|
||||
case 2270002:
|
||||
if (mob.getId() == 9300157) {
|
||||
if ((abm.getLastSpam(10) + 800) < currentServerTime()) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
|
||||
if (Math.random() < 0.5) { // 50% chance
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 4031868, (short) 1, "", -1);
|
||||
} else {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 0));
|
||||
}
|
||||
abm.spam(10);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
break;
|
||||
case 2270003:
|
||||
if (mob.getId() == 9500320) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 4031887, (short) 1, "", -1);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270005:
|
||||
if (mob.getId() == 9300187) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 2109001, (short) 1, "", -1);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270006:
|
||||
if (mob.getId() == 9300189) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 2109002, (short) 1, "", -1);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270007:
|
||||
if (mob.getId() == 9300191) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 2109003, (short) 1, "", -1);
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270004:
|
||||
if (mob.getId() == 9300175) {
|
||||
if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 4001169, (short) 1, "", -1);
|
||||
} else {
|
||||
} else if (mobHp != 0 && mob.getId() != 9500336) {
|
||||
abm.spam(10);
|
||||
c.announce(MaplePacketCreator.catchMessage(0));
|
||||
}
|
||||
} else if (mob.getId() == 9500336) {
|
||||
chr.message("You cannot use the Fishing Net yet.");
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
break;
|
||||
case 2270008:
|
||||
if (mob.getId() == 9500336) {
|
||||
if ((abm.getLastSpam(10) + 3000) < currentServerTime()) {
|
||||
abm.spam(10);
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.catchMonster(monsterid, itemId, (byte) 1));
|
||||
mob.getMap().killMonster(mob, null, false);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.USE, itemId, 1, true, true);
|
||||
MapleInventoryManipulator.addById(c, 2022323, (short) 1, "", -1);
|
||||
} else {
|
||||
chr.message("You cannot use the Fishing Net yet.");
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// System.out.println("UseCatchItemHandler: \r\n" + slea.toString());
|
||||
}
|
||||
}
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user