Savior Commit
Fixed some bugs regarding dojo, updated drop data, minor tweaks on Mystic Doors, added expeditions for Showa Manor, Zakum and Pink Bean, smart search for item slots on quest/npc rewarding system, attempt on boss HPbar to focus on player's current target, quests with selectable rewards now hands the item correctly, after the first PQ instance next ones are loaded more smoothly.
This commit is contained in:
@@ -41,9 +41,9 @@ public enum MapleBuffStat {
|
||||
HAMSTRING(0x800L),
|
||||
BLIND(0x1000L),
|
||||
CONCENTRATE(0x2000L),
|
||||
//4000L
|
||||
HPREC(0x4000L),
|
||||
ECHO_OF_HERO(0x8000L),
|
||||
//10000L
|
||||
MPREC(0x10000L),
|
||||
GHOST_MORPH(0x20000L),
|
||||
AURA(0x40000L),
|
||||
CONFUSE(0x80000L),
|
||||
@@ -63,7 +63,7 @@ public enum MapleBuffStat {
|
||||
BERSERK_FURY(0x8000000L),
|
||||
DIVINE_BODY(0x10000000L),
|
||||
SPARK(0x20000000L),
|
||||
//40000000L
|
||||
//0x40000000L
|
||||
FINALATTACK(0x80000000L),
|
||||
BATTLESHIP(0xA00000040L), // weird one
|
||||
WATK(0x100000000L),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -69,6 +69,7 @@ import scripting.quest.QuestActionManager;
|
||||
import scripting.quest.QuestScriptManager;
|
||||
import server.MapleMiniGame;
|
||||
import server.MaplePlayerShop;
|
||||
import server.life.MapleMonster;
|
||||
import server.MapleTrade;
|
||||
import server.TimerManager;
|
||||
import server.maps.*;
|
||||
@@ -1165,6 +1166,25 @@ public class MapleClient {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void announceBossHpBar(MapleMonster mm, final int mobHash, final byte[] packet) {
|
||||
long timeNow = System.currentTimeMillis();
|
||||
int targetHash = player.getTargetHpBarHash();
|
||||
|
||||
if(mobHash != targetHash) {
|
||||
if(timeNow - player.getTargetHpBarTime() >= 5 * 1000) {
|
||||
// is there a way to INTERRUPT this annoying thread running on the client that drops the boss bar after some time at every attack?
|
||||
announce(packet);
|
||||
|
||||
player.setTargetHpBarHash(mobHash);
|
||||
player.setTargetHpBarTime(timeNow);
|
||||
}
|
||||
} else {
|
||||
announce(packet);
|
||||
|
||||
player.setTargetHpBarTime(timeNow);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void announce(final byte[] packet) {//MINA CORE IS A FUCKING BITCH AND I HATE IT <3
|
||||
session.write(packet);
|
||||
|
||||
34
src/client/MapleDiseaseValueHolder.java
Normal file
34
src/client/MapleDiseaseValueHolder.java
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
This file is part of the OdinMS Maple Story Server
|
||||
Copyright (C) 2008 ~ 2010 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 client;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author anybody can do this
|
||||
*/
|
||||
public class MapleDiseaseValueHolder {
|
||||
public long startTime, length;
|
||||
|
||||
public MapleDiseaseValueHolder(long start, long length) {
|
||||
this.startTime = start;
|
||||
this.length = length;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -134,9 +134,9 @@ public enum ItemFactory {
|
||||
public synchronized void saveItems(List<Pair<Item, MapleInventoryType>> items, int id, Connection con) throws SQLException {
|
||||
PreparedStatement ps = null;
|
||||
PreparedStatement pse = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
lock.lock();
|
||||
ResultSet rs = null;
|
||||
|
||||
lock.lock();
|
||||
|
||||
try {
|
||||
StringBuilder query = new StringBuilder();
|
||||
|
||||
@@ -27,16 +27,19 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Map;
|
||||
|
||||
import tools.Pair;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import constants.ItemConstants;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MapleInventoryManipulator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Matze
|
||||
* @author Matze, Ronan
|
||||
*/
|
||||
public class MapleInventory implements Iterable<Item> {
|
||||
private MapleCharacter owner;
|
||||
@@ -101,6 +104,37 @@ public class MapleInventory implements Iterable<Item> {
|
||||
}
|
||||
return qty;
|
||||
}
|
||||
|
||||
public int freeSlotCountById(int itemId, int required) {
|
||||
List<Item> itemList = listById(itemId);
|
||||
int openSlot = 0;
|
||||
|
||||
if(!ItemConstants.isRechargable(itemId)) {
|
||||
for (Item item : itemList) {
|
||||
required -= item.getQuantity();
|
||||
|
||||
if(required >= 0) {
|
||||
openSlot++;
|
||||
if(required == 0) return openSlot;
|
||||
} else {
|
||||
return openSlot;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Item item : itemList) {
|
||||
required -= 1;
|
||||
|
||||
if(required >= 0) {
|
||||
openSlot++;
|
||||
if(required == 0) return openSlot;
|
||||
} else {
|
||||
return openSlot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public List<Item> listById(int itemId) {
|
||||
List<Item> ret = new ArrayList<>();
|
||||
@@ -218,6 +252,10 @@ public class MapleInventory implements Iterable<Item> {
|
||||
public boolean isFull(int margin) {
|
||||
return inventory.size() + margin >= slotLimit;
|
||||
}
|
||||
|
||||
public boolean isFullAfterSomeItems(int margin, int used) {
|
||||
return inventory.size() + margin >= slotLimit - used;
|
||||
}
|
||||
|
||||
public short getNextFreeSlot() {
|
||||
if (isFull()) {
|
||||
@@ -250,25 +288,42 @@ public class MapleInventory implements Iterable<Item> {
|
||||
}
|
||||
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items) {
|
||||
int equipSlot = 0, useSlot = 0, setupSlot = 0, etcSlot = 0, cashSlot = 0;
|
||||
for (Pair<Item, MapleInventoryType> item : items) {
|
||||
if (item.getRight().getType() == MapleInventoryType.EQUIP.getType())
|
||||
equipSlot++;
|
||||
if (item.getRight().getType() == MapleInventoryType.USE.getType())
|
||||
useSlot++;
|
||||
if (item.getRight().getType() == MapleInventoryType.SETUP.getType())
|
||||
setupSlot++;
|
||||
if (item.getRight().getType() == MapleInventoryType.ETC.getType())
|
||||
etcSlot++;
|
||||
if (item.getRight().getType() == MapleInventoryType.CASH.getType())
|
||||
cashSlot++;
|
||||
List<Integer> zeroedList = new ArrayList<>(5);
|
||||
for(byte i = 0; i < 5; i++) zeroedList.add(0);
|
||||
|
||||
return checkSpots(chr, items, zeroedList);
|
||||
}
|
||||
|
||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, List<Integer> typesSlotsUsed) {
|
||||
// assumption: no "UNDEFINED" or "EQUIPPED" items shall be tested here, all counts are >= 0.
|
||||
|
||||
Map<Integer, Short> rcvItems = new LinkedHashMap<>();
|
||||
Map<Integer, Byte> rcvTypes = new LinkedHashMap<>();
|
||||
|
||||
for (Pair<Item, MapleInventoryType> item : items) {
|
||||
Integer itemId = item.left.getItemId();
|
||||
Short qty = rcvItems.get(itemId);
|
||||
|
||||
if(qty == null) {
|
||||
rcvItems.put(itemId, item.left.getQuantity());
|
||||
rcvTypes.put(itemId, item.right.getType());
|
||||
} else {
|
||||
rcvItems.put(itemId, (short)(qty + item.left.getQuantity()));
|
||||
}
|
||||
}
|
||||
|
||||
if (chr.getInventory(MapleInventoryType.EQUIP).isFull(equipSlot - 1)) return false;
|
||||
else if (chr.getInventory(MapleInventoryType.USE).isFull(useSlot - 1)) return false;
|
||||
else if (chr.getInventory(MapleInventoryType.SETUP).isFull(setupSlot - 1)) return false;
|
||||
else if (chr.getInventory(MapleInventoryType.ETC).isFull(etcSlot - 1)) return false;
|
||||
else if (chr.getInventory(MapleInventoryType.CASH).isFull(cashSlot - 1)) return false;
|
||||
|
||||
MapleClient c = chr.getClient();
|
||||
for(Entry<Integer, Short> it: rcvItems.entrySet()) {
|
||||
int itemType = rcvTypes.get(it.getKey()) - 1;
|
||||
int usedSlots = typesSlotsUsed.get(itemType);
|
||||
|
||||
int result = MapleInventoryManipulator.checkSpaceProgressively(c, it.getKey(), it.getValue(), "", usedSlots);
|
||||
boolean hasSpace = ((result % 2) != 0);
|
||||
|
||||
if(!hasSpace) return false;
|
||||
typesSlotsUsed.set(itemType, (result >> 1));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user