Rename and clean up MapleKeyBinding

This commit is contained in:
P0nk
2021-09-09 20:58:28 +02:00
parent 065ef632ac
commit 280e28163c
5 changed files with 24 additions and 23 deletions

View File

@@ -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));
}
}
}

View File

@@ -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);