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:
@@ -39,7 +39,7 @@ public class PlayerBuffStorage {
|
||||
public void addBuffsToStorage(int chrid, List<PlayerBuffValueHolder> toStore) {
|
||||
mutex.lock();
|
||||
try {
|
||||
buffs.put(chrid, toStore);//Old one will be replace if it's in here.
|
||||
buffs.put(chrid, toStore);//Old one will be replaced if it's in here.
|
||||
} finally {
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
@@ -88,9 +88,9 @@ public class PlayerStorage {
|
||||
public final void disconnectAll() {
|
||||
wlock.lock();
|
||||
try {
|
||||
final Iterator<MapleCharacter> chrit = storage.values().iterator();
|
||||
final Iterator<MapleCharacter> chrit = storage.values().iterator();
|
||||
while (chrit.hasNext()) {
|
||||
chrit.next().getClient().disconnect(true, false);
|
||||
chrit.next().getClient().disconnect(true, false);
|
||||
chrit.remove();
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.List;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
@@ -80,6 +81,11 @@ public final class Channel {
|
||||
private List<MapleExpeditionType> expedType = new ArrayList<>();
|
||||
private MapleEvent event;
|
||||
private boolean finishedShutdown = false;
|
||||
private int usedDojo = 0;
|
||||
private int[] dojoStage;
|
||||
private long[] dojoFinishTime;
|
||||
private ScheduledFuture<?>[] dojoTask;
|
||||
private Map<Integer, Integer> dojoParty = new HashMap<>();
|
||||
|
||||
public Channel(final int world, final int channel) {
|
||||
this.world = world;
|
||||
@@ -104,6 +110,15 @@ public final class Channel {
|
||||
}
|
||||
eventSM.init();
|
||||
|
||||
dojoStage = new int[20];
|
||||
dojoFinishTime = new long[20];
|
||||
dojoTask = new ScheduledFuture<?>[20];
|
||||
for(int i = 0; i < 20; i++) {
|
||||
dojoStage[i] = 0;
|
||||
dojoFinishTime[i] = 0;
|
||||
dojoTask[i] = null;
|
||||
}
|
||||
|
||||
System.out.println(" Channel " + getId() + ": Listening on port " + port);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -312,4 +327,134 @@ public final class Channel {
|
||||
public void setStoredVar(int key, int val) {
|
||||
this.storedVars.put(key, val);
|
||||
}
|
||||
|
||||
public synchronized int lookupPartyDojo(MapleParty party) {
|
||||
if(party == null) return -1;
|
||||
|
||||
Integer i = dojoParty.get(party.hashCode());
|
||||
return (i != null) ? i : -1;
|
||||
}
|
||||
|
||||
public int getAvailableDojo(boolean isPartyDojo) {
|
||||
return getAvailableDojo(isPartyDojo, null);
|
||||
}
|
||||
|
||||
public synchronized int getAvailableDojo(boolean isPartyDojo, MapleParty party) {
|
||||
int dojoList = this.usedDojo;
|
||||
int range, slot = 0;
|
||||
|
||||
if(!isPartyDojo) {
|
||||
dojoList = dojoList >> 5;
|
||||
range = 15;
|
||||
} else {
|
||||
range = 5;
|
||||
}
|
||||
|
||||
while((dojoList & 1) != 0) {
|
||||
dojoList = (dojoList >> 1);
|
||||
slot++;
|
||||
}
|
||||
|
||||
if(slot < range) {
|
||||
if(party != null) {
|
||||
if(dojoParty.containsKey(party.hashCode())) return -2;
|
||||
dojoParty.put(party.hashCode(), slot);
|
||||
}
|
||||
|
||||
this.usedDojo |= (1 << ((!isPartyDojo ? 5 : 0) + slot));
|
||||
return slot;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private void freeDojoSlot(int slot, MapleParty party) {
|
||||
int mask = 0b11111111111111111111;
|
||||
mask ^= (1 << slot);
|
||||
|
||||
usedDojo &= mask;
|
||||
if(party != null) dojoParty.remove(party.hashCode());
|
||||
}
|
||||
|
||||
private int getDojoSlot(int dojoMapId) {
|
||||
return (dojoMapId % 100) + ((dojoMapId / 10000 == 92502) ? 5 : 0);
|
||||
}
|
||||
|
||||
public void resetDojoMap(int fromMapId) {
|
||||
for(int i = 0; i < (((fromMapId / 100) % 100 <= 36) ? 5 : 2); i++) {
|
||||
this.getMapFactory().getMap(fromMapId + (100 * i)).resetMapObjects();
|
||||
}
|
||||
}
|
||||
|
||||
public void resetDojo(int dojoMapId) {
|
||||
resetDojo(dojoMapId, 0);
|
||||
}
|
||||
|
||||
public void resetDojo(int dojoMapId, int thisStg) {
|
||||
int slot = getDojoSlot(dojoMapId);
|
||||
this.dojoStage[slot] = thisStg;
|
||||
|
||||
if(this.dojoTask[slot] != null) {
|
||||
this.dojoTask[slot].cancel(false);
|
||||
this.dojoTask[slot] = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void startDojoSchedule(final int dojoMapId) {
|
||||
final int slot = getDojoSlot(dojoMapId);
|
||||
final int stage = (dojoMapId / 100) % 100;
|
||||
if(stage <= dojoStage[slot]) return;
|
||||
|
||||
long clockTime = (stage > 36 ? 15 : stage / 6 + 5) * 60000;
|
||||
this.dojoTask[slot] = TimerManager.getInstance().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final int delta = (dojoMapId) % 100;
|
||||
final int dojoBaseMap = (slot < 5) ? 925030000 : 925020000;
|
||||
MapleParty party = null;
|
||||
|
||||
for (int i = 0; i < 5; i++) { //only 32 stages, but 38 maps
|
||||
for(MapleCharacter chr: getMapFactory().getMap(dojoBaseMap + (100 * (stage + i)) + delta).getAllPlayers()) {
|
||||
if(chr.getMap().isDojoMap()) {
|
||||
chr.timeoutFromDojo();
|
||||
}
|
||||
party = chr.getParty();
|
||||
}
|
||||
}
|
||||
|
||||
freeDojoSlot(slot, party);
|
||||
}
|
||||
}, clockTime + 3000); // let the TIMES UP display for 3 seconds, then warp
|
||||
|
||||
dojoFinishTime[slot] = System.currentTimeMillis() + clockTime;
|
||||
}
|
||||
|
||||
public void dismissDojoSchedule(int dojoMapId, MapleParty party) {
|
||||
int slot = getDojoSlot(dojoMapId);
|
||||
int stage = (dojoMapId / 100) % 100;
|
||||
if(stage <= dojoStage[slot]) return;
|
||||
|
||||
if(this.dojoTask[slot] != null) {
|
||||
this.dojoTask[slot].cancel(false);
|
||||
this.dojoTask[slot] = null;
|
||||
}
|
||||
|
||||
freeDojoSlot(slot, party);
|
||||
}
|
||||
|
||||
public boolean setDojoProgress(int dojoMapId) {
|
||||
int slot = getDojoSlot(dojoMapId);
|
||||
int dojoStg = (dojoMapId / 100) % 100;
|
||||
|
||||
if(this.dojoStage[slot] < dojoStg) {
|
||||
this.dojoStage[slot] = dojoStg;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public long getDojoFinishTime(int dojoMapId) {
|
||||
return dojoFinishTime[getDojoSlot(dojoMapId)];
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,12 @@ public final class CancelChairHandler extends AbstractMaplePacketHandler {
|
||||
int id = slea.readShort();
|
||||
if (id == -1) { // Cancel Chair
|
||||
c.getPlayer().setChair(0);
|
||||
c.getPlayer().stopChairTask();
|
||||
c.announce(MaplePacketCreator.cancelChair(-1));
|
||||
c.getPlayer().getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.showChair(c.getPlayer().getId(), 0), false);
|
||||
} else { // Use In-Map Chair
|
||||
c.getPlayer().setChair(id);
|
||||
c.getPlayer().startChairTask();
|
||||
c.announce(MaplePacketCreator.cancelChair(id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
|
||||
mi.removeSlot(item.getPosition());
|
||||
c.announce(MaplePacketCreator.putIntoCashInventory(item, c.getAccID()));
|
||||
} else if (action == 0x1D) { //crush ring (action 28)
|
||||
slea.readInt();//Birthday
|
||||
slea.readInt();//Birthday
|
||||
// if (checkBirthday(c, birthday)) { //We're using a default birthday, so why restrict rings to only people who know of it?
|
||||
int toCharge = slea.readInt();
|
||||
int SN = slea.readInt();
|
||||
@@ -317,40 +317,6 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
|
||||
public static boolean canBuy(CashItem item, int cash) {
|
||||
return item != null && item.isOnSale() && item.getPrice() <= cash && !blocked(item.getItemId());
|
||||
}
|
||||
|
||||
public static boolean blocked(int id){
|
||||
switch(id){ //All 2x exp cards
|
||||
case 5211000:
|
||||
case 5211004:
|
||||
case 5211005:
|
||||
case 5211006:
|
||||
case 5211007:
|
||||
case 5211008:
|
||||
case 5211009:
|
||||
case 5211010:
|
||||
case 5211011:
|
||||
case 5211012:
|
||||
case 5211013:
|
||||
case 5211014:
|
||||
case 5211015:
|
||||
case 5211016:
|
||||
case 5211017:
|
||||
case 5211018:
|
||||
case 5211037:
|
||||
case 5211038:
|
||||
case 5211039:
|
||||
case 5211040:
|
||||
case 5211041:
|
||||
case 5211042:
|
||||
case 5211043:
|
||||
case 5211044:
|
||||
case 5211045:
|
||||
case 5211049:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return item != null && item.isOnSale() && item.getPrice() <= cash;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import tools.data.input.SeekableLittleEndianAccessor;
|
||||
* @author Ronan
|
||||
*/
|
||||
public final class DoorHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
int ownerid = slea.readInt();
|
||||
boolean mode = (slea.readByte() == 0); // specifies if backwarp or not, 1 town to target, 0 target to town
|
||||
|
||||
@@ -44,7 +44,8 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
if (!ServerConstants.USE_MTS){
|
||||
return;
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
if (!chr.isAlive()) {
|
||||
|
||||
@@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.server.channel.handlers;
|
||||
|
||||
import tools.LogHelper;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
@@ -33,50 +32,49 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
public final class GeneralChatHandler extends net.AbstractMaplePacketHandler {
|
||||
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
String s = slea.readMapleAsciiString();
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
if(chr.getAutobanManager().getLastSpam(7) + 200 > System.currentTimeMillis()) {
|
||||
return;
|
||||
}
|
||||
if (s.length() > Byte.MAX_VALUE && !chr.isGM()) {
|
||||
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit in General Chat.");
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to send text with length of " + s.length() + "\r\n");
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
char heading = s.charAt(0);
|
||||
if (heading == '/' || heading == '!' || heading == '@') {
|
||||
String[] sp = s.split(" ");
|
||||
sp[0] = sp[0].toLowerCase().substring(1);
|
||||
if (!Commands.executePlayerCommand(c, sp, heading)) {
|
||||
if (chr.isGM()) {
|
||||
if (!Commands.executeGMCommand(c, sp, heading)) {
|
||||
Commands.executeAdminCommand(c, sp, heading);
|
||||
}
|
||||
String command = "";
|
||||
for (String used : sp) {
|
||||
command += used + " ";
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm");
|
||||
FilePrinter.print(FilePrinter.USED_COMMANDS, c.getPlayer().getName() + " used: " + heading + command + "on " + sdf.format(Calendar.getInstance().getTime()) + "\r\n");
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
String s = slea.readMapleAsciiString();
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
if(chr.getAutobanManager().getLastSpam(7) + 200 > System.currentTimeMillis()) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
if (s.length() > Byte.MAX_VALUE && !chr.isGM()) {
|
||||
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit in General Chat.");
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to send text with length of " + s.length() + "\r\n");
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
char heading = s.charAt(0);
|
||||
if (heading == '/') {
|
||||
String[] sp = s.split(" ");
|
||||
sp[0] = sp[0].toLowerCase().substring(1);
|
||||
|
||||
if(Commands.executeSolaxiaPlayerCommand(c, sp, heading)) {
|
||||
String command = "";
|
||||
for (String used : sp) {
|
||||
command += used + " ";
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm");
|
||||
FilePrinter.print(FilePrinter.USED_COMMANDS, c.getPlayer().getName() + " used: " + heading + command + "on " + sdf.format(Calendar.getInstance().getTime()) + "\r\n");
|
||||
}
|
||||
} else {
|
||||
int show = slea.readByte();
|
||||
if(chr.getMap().isMuted() && !chr.isGM()) {
|
||||
chr.dropMessage(5, "The map you are in is currently muted. Please try again later.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!chr.isHidden()) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.getChatText(chr.getId(), s, chr.getWhiteChat(), show));
|
||||
} else {
|
||||
chr.getMap().broadcastGMMessage(MaplePacketCreator.getChatText(chr.getId(), s, chr.getWhiteChat(), show));
|
||||
}
|
||||
|
||||
chr.getAutobanManager().spam(7);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int show = slea.readByte();
|
||||
if(chr.getMap().isMuted() && !chr.isGM()) {
|
||||
chr.dropMessage(5, "The map you are in is currently muted. Please try again later.");
|
||||
return;
|
||||
}
|
||||
if (!chr.isHidden()) {
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.getChatText(chr.getId(), s, chr.getWhiteChat(), show));
|
||||
} else {
|
||||
chr.getMap().broadcastGMMessage(MaplePacketCreator.getChatText(chr.getId(), s, chr.getWhiteChat(), show));
|
||||
}
|
||||
}
|
||||
chr.getAutobanManager().spam(7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public final class PartyOperationHandler extends AbstractMaplePacketHandler {
|
||||
player.setParty(party);
|
||||
player.setMPC(partyplayer);
|
||||
player.silentPartyUpdate();
|
||||
c.announce(MaplePacketCreator.partyCreated(partyplayer));
|
||||
c.announce(MaplePacketCreator.partyCreated(partyplayer));
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.serverNotice(5, "You can't create a party as you are already in one."));
|
||||
}
|
||||
|
||||
@@ -54,12 +54,14 @@ public final class SpecialMoveHandler extends AbstractMaplePacketHandler {
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
chr.getAutobanManager().setTimestamp(4, slea.readInt(), 3);
|
||||
int skillid = slea.readInt();
|
||||
/*
|
||||
if ((!GameConstants.isPQSkillMap(c.getPlayer().getMapId()) && GameConstants.isPqSkill(skillid)) || (!c.getPlayer().isGM() && GameConstants.isGMSkills(skillid)) || (!GameConstants.isInJobTree(skillid, c.getPlayer().getJob().getId()) && !c.getPlayer().isGM())) {
|
||||
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit skills.");
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to use skill " + skillid + " without it being in their job.\r\n");
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
Point pos = null;
|
||||
int __skillLevel = slea.readByte();
|
||||
Skill skill = SkillFactory.getSkill(skillid);
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
|
||||
byte slot = slea.readByte();
|
||||
if (slot < 0 || slot > storage.getSlots()) { // removal starts at zero
|
||||
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with storage.");
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to work with storage slot " + slot + "\r\n");
|
||||
FilePrinter.print(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to work with storage slot " + slot + "\r\n");
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
|
||||
if (MapleInventoryManipulator.checkSpace(c, item.getItemId(), item.getQuantity(), item.getOwner())) {
|
||||
item = storage.takeOut(slot);//actually the same but idc
|
||||
String itemName = MapleItemInformationProvider.getInstance().getName(item.getItemId());
|
||||
FilePrinter.printError(FilePrinter.STORAGE + c.getAccountName() + ".txt", c.getPlayer().getName() + " took out " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")\r\n");
|
||||
FilePrinter.print(FilePrinter.STORAGE + c.getAccountName() + ".txt", c.getPlayer().getName() + " took out " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")\r\n");
|
||||
if ((item.getFlag() & ItemConstants.KARMA) == ItemConstants.KARMA) {
|
||||
item.setFlag((byte) (item.getFlag() ^ ItemConstants.KARMA)); //items with scissors of karma used on them are reset once traded
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
|
||||
MapleInventory Inv = chr.getInventory(slotType);
|
||||
if (slot < 1 || slot > Inv.getSlotLimit()) { //player inv starts at one
|
||||
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with storage.");
|
||||
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to store item at slot " + slot + "\r\n");
|
||||
FilePrinter.print(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to store item at slot " + slot + "\r\n");
|
||||
c.disconnect(true, false);
|
||||
return;
|
||||
}
|
||||
@@ -124,7 +124,7 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
|
||||
storage.store(item);
|
||||
storage.sendStored(c, ii.getInventoryType(itemId));
|
||||
String itemName = MapleItemInformationProvider.getInstance().getName(item.getItemId());
|
||||
FilePrinter.printError(FilePrinter.STORAGE + c.getAccountName() + ".txt", c.getPlayer().getName() + " stored " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")\r\n");
|
||||
FilePrinter.print(FilePrinter.STORAGE + c.getAccountName() + ".txt", c.getPlayer().getName() + " stored " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")\r\n");
|
||||
}
|
||||
}
|
||||
} else if (mode == 7) { // meso
|
||||
@@ -145,7 +145,7 @@ public final class StorageHandler extends AbstractMaplePacketHandler {
|
||||
}
|
||||
storage.setMeso(storageMesos - meso);
|
||||
chr.gainMeso(meso, false, true, false);
|
||||
FilePrinter.printError(FilePrinter.STORAGE + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + (meso > 0 ? " took out " : " stored ") + Math.abs(meso) + " mesos\r\n");
|
||||
FilePrinter.print(FilePrinter.STORAGE + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + (meso > 0 ? " took out " : " stored ") + Math.abs(meso) + " mesos\r\n");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public final class WhisperHandler extends AbstractMaplePacketHandler {
|
||||
if (player != null) {
|
||||
player.getClient().announce(MaplePacketCreator.getWhisper(c.getPlayer().getName(), c.getChannel(), text));
|
||||
|
||||
if(player.isHidden() && player.gmLevel() > c.getPlayer().gmLevel()) {
|
||||
if(player.isHidden() && player.gmLevel() >= c.getPlayer().gmLevel()) {
|
||||
c.announce(MaplePacketCreator.getWhisperReply(recipient, (byte) 0));
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.getWhisperReply(recipient, (byte) 1));
|
||||
@@ -71,7 +71,7 @@ public final class WhisperHandler extends AbstractMaplePacketHandler {
|
||||
world.whisper(c.getPlayer().getName(), recipient, c.getChannel(), text);
|
||||
|
||||
player = world.getPlayerStorage().getCharacterByName(recipient);
|
||||
if(player.isHidden() && player.gmLevel() > c.getPlayer().gmLevel())
|
||||
if(player.isHidden() && player.gmLevel() >= c.getPlayer().gmLevel())
|
||||
c.announce(MaplePacketCreator.getWhisperReply(recipient, (byte) 0));
|
||||
else
|
||||
c.announce(MaplePacketCreator.getWhisperReply(recipient, (byte) 1));
|
||||
@@ -97,7 +97,7 @@ public final class WhisperHandler extends AbstractMaplePacketHandler {
|
||||
ps.setString(1, recipient);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
if (rs.next()) {
|
||||
if (rs.getInt("gm") > c.getPlayer().gmLevel()) {
|
||||
if (rs.getInt("gm") >= c.getPlayer().gmLevel()) {
|
||||
c.announce(MaplePacketCreator.getWhisperReply(recipient, (byte) 0));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,11 +25,19 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Map;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class MapleParty {
|
||||
private int leaderId;
|
||||
private List<MaplePartyCharacter> members = new LinkedList<MaplePartyCharacter>();
|
||||
private List<MaplePartyCharacter> pqMembers = null;
|
||||
|
||||
private Map<Integer, Integer> histMembers = new HashMap<>();
|
||||
private int nextEntry = 0;
|
||||
|
||||
private int id;
|
||||
|
||||
public MapleParty(int id, MaplePartyCharacter chrfor) {
|
||||
@@ -43,10 +51,15 @@ public class MapleParty {
|
||||
}
|
||||
|
||||
public void addMember(MaplePartyCharacter member) {
|
||||
histMembers.put(member.getId(), nextEntry);
|
||||
nextEntry++;
|
||||
|
||||
members.add(member);
|
||||
}
|
||||
|
||||
public void removeMember(MaplePartyCharacter member) {
|
||||
histMembers.remove(member.getId());
|
||||
|
||||
members.remove(member);
|
||||
}
|
||||
|
||||
@@ -110,6 +123,26 @@ public class MapleParty {
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte getPartyDoor(int cid) {
|
||||
List<Entry<Integer, Integer>> histList = new LinkedList<>(histMembers.entrySet());
|
||||
Collections.sort(histList, new Comparator<Entry<Integer, Integer>>()
|
||||
{
|
||||
@Override
|
||||
public int compare( Entry<Integer, Integer> o1, Entry<Integer, Integer> o2 )
|
||||
{
|
||||
return ( o1.getValue() ).compareTo( o2.getValue() );
|
||||
}
|
||||
});
|
||||
|
||||
byte slot = 0;
|
||||
for(Entry<Integer, Integer> e: histList) {
|
||||
if(e.getKey() == cid) break;
|
||||
slot++;
|
||||
}
|
||||
|
||||
return slot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
||||
Reference in New Issue
Block a user