Rename and clean up MapleKeyBinding
This commit is contained in:
@@ -28,7 +28,7 @@ import client.inventory.*;
|
||||
import client.inventory.Equip.StatUpgrade;
|
||||
import client.inventory.manipulator.CashIdGenerator;
|
||||
import client.inventory.manipulator.InventoryManipulator;
|
||||
import client.keybind.MapleKeyBinding;
|
||||
import client.keybind.KeyBinding;
|
||||
import client.keybind.MapleQuickslotBinding;
|
||||
import client.newyear.NewYearCardRecord;
|
||||
import client.processor.action.PetAutopotProcessor;
|
||||
@@ -188,7 +188,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
private Map<MapleDisease, Long> diseaseExpires = new LinkedHashMap<>();
|
||||
private Map<Integer, Map<MapleBuffStat, MapleBuffStatValueHolder>> buffEffects = new LinkedHashMap<>(); // non-overriding buffs thanks to Ronan
|
||||
private Map<Integer, Long> buffExpires = new LinkedHashMap<>();
|
||||
private Map<Integer, MapleKeyBinding> keymap = new LinkedHashMap<>();
|
||||
private Map<Integer, KeyBinding> keymap = new LinkedHashMap<>();
|
||||
private Map<Integer, MapleSummon> summons = new LinkedHashMap<>();
|
||||
private Map<Integer, MapleCoolDownValueHolder> coolDowns = new LinkedHashMap<>();
|
||||
private EnumMap<MapleDisease, Pair<MapleDiseaseValueHolder, MobSkill>> diseases = new EnumMap<>(MapleDisease.class);
|
||||
@@ -395,7 +395,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
for (int i = 0; i < selectedKey.length; i++) {
|
||||
ret.keymap.put(selectedKey[i], new MapleKeyBinding(selectedType[i], selectedAction[i]));
|
||||
ret.keymap.put(selectedKey[i], new KeyBinding(selectedType[i], selectedAction[i]));
|
||||
}
|
||||
|
||||
|
||||
@@ -1203,7 +1203,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
sendPacket(packet);
|
||||
}
|
||||
|
||||
public void changeKeybinding(int key, MapleKeyBinding keybinding) {
|
||||
public void changeKeybinding(int key, KeyBinding keybinding) {
|
||||
if (keybinding.getType() != 0) {
|
||||
keymap.put(Integer.valueOf(key), keybinding);
|
||||
} else {
|
||||
@@ -5157,7 +5157,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
return job.getId() / 1000;
|
||||
}
|
||||
|
||||
public Map<Integer, MapleKeyBinding> getKeymap() {
|
||||
public Map<Integer, KeyBinding> getKeymap() {
|
||||
return keymap;
|
||||
}
|
||||
|
||||
@@ -7376,7 +7376,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
int key = rs.getInt("key");
|
||||
int type = rs.getInt("type");
|
||||
int action = rs.getInt("action");
|
||||
ret.keymap.put(key, new MapleKeyBinding(type, action));
|
||||
ret.keymap.put(key, new KeyBinding(type, action));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8514,8 +8514,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
try (PreparedStatement psKey = con.prepareStatement("INSERT INTO keymap (characterid, `key`, `type`, `action`) VALUES (?, ?, ?, ?)")) {
|
||||
psKey.setInt(1, id);
|
||||
|
||||
Set<Entry<Integer, MapleKeyBinding>> keybindingItems = Collections.unmodifiableSet(keymap.entrySet());
|
||||
for (Entry<Integer, MapleKeyBinding> keybinding : keybindingItems) {
|
||||
Set<Entry<Integer, KeyBinding>> keybindingItems = Collections.unmodifiableSet(keymap.entrySet());
|
||||
for (Entry<Integer, KeyBinding> keybinding : keybindingItems) {
|
||||
psKey.setInt(2, keybinding.getKey());
|
||||
psKey.setInt(3, keybinding.getValue().getType());
|
||||
psKey.setInt(4, keybinding.getValue().getAction());
|
||||
@@ -9107,7 +9107,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
|
||||
// autopot on HPMP deplete... thanks shavit for finding out D. Roar doesn't trigger autopot request
|
||||
if (hpchange < 0) {
|
||||
MapleKeyBinding autohpPot = this.getKeymap().get(91);
|
||||
KeyBinding autohpPot = this.getKeymap().get(91);
|
||||
if (autohpPot != null) {
|
||||
int autohpItemid = autohpPot.getAction();
|
||||
float autohpAlert = this.getAutopotHpAlert();
|
||||
@@ -9122,7 +9122,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
||||
}
|
||||
|
||||
if (mpchange < 0) {
|
||||
MapleKeyBinding autompPot = this.getKeymap().get(92);
|
||||
KeyBinding autompPot = this.getKeymap().get(92);
|
||||
if (autompPot != null) {
|
||||
int autompItemid = autompPot.getAction();
|
||||
float autompAlert = this.getAutopotMpAlert();
|
||||
|
||||
@@ -21,10 +21,11 @@
|
||||
*/
|
||||
package client.keybind;
|
||||
|
||||
public class MapleKeyBinding {
|
||||
private int type, action;
|
||||
public class KeyBinding {
|
||||
private final int type;
|
||||
private final int action;
|
||||
|
||||
public MapleKeyBinding(int type, int action) {
|
||||
public KeyBinding(int type, int action) {
|
||||
this.type = type;
|
||||
this.action = action;
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import client.MapleClient;
|
||||
import client.Skill;
|
||||
import client.SkillFactory;
|
||||
import client.inventory.InventoryType;
|
||||
import client.keybind.MapleKeyBinding;
|
||||
import client.keybind.KeyBinding;
|
||||
import constants.game.GameConstants;
|
||||
import net.AbstractPacketHandler;
|
||||
import net.packet.InPacket;
|
||||
@@ -61,7 +61,7 @@ public final class KeymapChangeHandler extends AbstractPacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
c.getPlayer().changeKeybinding(key, new MapleKeyBinding(type, action));
|
||||
c.getPlayer().changeKeybinding(key, new KeyBinding(type, action));
|
||||
}
|
||||
} else if(mode == 1) { // Auto HP Potion
|
||||
int itemID = p.readInt();
|
||||
@@ -69,14 +69,14 @@ public final class KeymapChangeHandler extends AbstractPacketHandler {
|
||||
c.disconnect(false, false); // Don't let them send a packet with a use item they dont have.
|
||||
return;
|
||||
}
|
||||
c.getPlayer().changeKeybinding(91, new MapleKeyBinding(7, itemID));
|
||||
c.getPlayer().changeKeybinding(91, new KeyBinding(7, itemID));
|
||||
} else if(mode == 2) { // Auto MP Potion
|
||||
int itemID = p.readInt();
|
||||
if(itemID != 0 && c.getPlayer().getInventory(InventoryType.USE).findById(itemID) == null) {
|
||||
c.disconnect(false, false); // Don't let them send a packet with a use item they dont have.
|
||||
return;
|
||||
}
|
||||
c.getPlayer().changeKeybinding(92, new MapleKeyBinding(7, itemID));
|
||||
c.getPlayer().changeKeybinding(92, new KeyBinding(7, itemID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ package net.server.channel.handlers;
|
||||
|
||||
import client.*;
|
||||
import client.inventory.*;
|
||||
import client.keybind.MapleKeyBinding;
|
||||
import client.keybind.KeyBinding;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import net.AbstractPacketHandler;
|
||||
@@ -225,10 +225,10 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
||||
player.sendMacros();
|
||||
|
||||
// pot bindings being passed through other characters on the account detected thanks to Croosade dev team
|
||||
MapleKeyBinding autohpPot = player.getKeymap().get(91);
|
||||
KeyBinding autohpPot = player.getKeymap().get(91);
|
||||
player.sendPacket(PacketCreator.sendAutoHpPot(autohpPot != null ? autohpPot.getAction() : 0));
|
||||
|
||||
MapleKeyBinding autompPot = player.getKeymap().get(92);
|
||||
KeyBinding autompPot = player.getKeymap().get(92);
|
||||
player.sendPacket(PacketCreator.sendAutoMpPot(autompPot != null ? autompPot.getAction() : 0));
|
||||
|
||||
player.getMap().addPlayer(player);
|
||||
|
||||
@@ -24,7 +24,7 @@ import client.*;
|
||||
import client.MapleCharacter.SkillEntry;
|
||||
import client.inventory.*;
|
||||
import client.inventory.Equip.ScrollResult;
|
||||
import client.keybind.MapleKeyBinding;
|
||||
import client.keybind.KeyBinding;
|
||||
import client.keybind.MapleQuickslotBinding;
|
||||
import client.newyear.NewYearCardRecord;
|
||||
import client.status.MonsterStatus;
|
||||
@@ -3468,11 +3468,11 @@ public class PacketCreator {
|
||||
return p;
|
||||
}
|
||||
|
||||
public static Packet getKeymap(Map<Integer, MapleKeyBinding> keybindings) {
|
||||
public static Packet getKeymap(Map<Integer, KeyBinding> keybindings) {
|
||||
final OutPacket p = OutPacket.create(SendOpcode.KEYMAP);
|
||||
p.writeByte(0);
|
||||
for (int x = 0; x < 90; x++) {
|
||||
MapleKeyBinding binding = keybindings.get(x);
|
||||
KeyBinding binding = keybindings.get(x);
|
||||
if (binding != null) {
|
||||
p.writeByte(binding.getType());
|
||||
p.writeInt(binding.getAction());
|
||||
|
||||
Reference in New Issue
Block a user