Switch to Maven file structure
This commit is contained in:
39
src/main/java/client/keybind/MapleKeyBinding.java
Normal file
39
src/main/java/client/keybind/MapleKeyBinding.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
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 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.keybind;
|
||||
|
||||
public class MapleKeyBinding {
|
||||
private int type, action;
|
||||
|
||||
public MapleKeyBinding(int type, int action) {
|
||||
this.type = type;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getAction() {
|
||||
return action;
|
||||
}
|
||||
}
|
||||
60
src/main/java/client/keybind/MapleQuickslotBinding.java
Normal file
60
src/main/java/client/keybind/MapleQuickslotBinding.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package client.keybind;
|
||||
|
||||
import tools.data.output.MaplePacketLittleEndianWriter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Shavit
|
||||
*/
|
||||
public class MapleQuickslotBinding
|
||||
{
|
||||
public static final int QUICKSLOT_SIZE = 8;
|
||||
|
||||
public static final byte[] DEFAULT_QUICKSLOTS =
|
||||
{
|
||||
0x2A, 0x52, 0x47, 0x49, 0x1D, 0x53, 0x4F, 0x51
|
||||
};
|
||||
|
||||
private byte[] m_aQuickslotKeyMapped;
|
||||
|
||||
// Initializes quickslot object for the user.
|
||||
// aKeys' length has to be 8.
|
||||
public MapleQuickslotBinding(byte[] aKeys)
|
||||
{
|
||||
if(aKeys.length != QUICKSLOT_SIZE)
|
||||
{
|
||||
throw new IllegalArgumentException(String.format("aKeys' size should be %d", QUICKSLOT_SIZE));
|
||||
}
|
||||
|
||||
this.m_aQuickslotKeyMapped = aKeys.clone();
|
||||
}
|
||||
|
||||
public void Encode(MaplePacketLittleEndianWriter oPacket)
|
||||
{
|
||||
// Quickslots are default.
|
||||
// The client will skip them and call CQuickslotKeyMappedMan::DefaultQuickslotKeyMap.
|
||||
if(Arrays.equals(this.m_aQuickslotKeyMapped, DEFAULT_QUICKSLOTS))
|
||||
{
|
||||
oPacket.writeBool(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
oPacket.writeBool(true);
|
||||
|
||||
for(byte nKey : this.m_aQuickslotKeyMapped)
|
||||
{
|
||||
// For some reason Nexon sends these as integers, similar to CFuncKeyMappedMan.
|
||||
// However there's no evidence any key can be above 0xFF anyhow.
|
||||
// Regardless, we need to encode an integer to avoid an error 38 crash; as CFuncKeyMapped::m_aQuickslotKeyMapped is int[8].
|
||||
oPacket.writeInt(nKey);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] GetKeybindings() {
|
||||
return m_aQuickslotKeyMapped;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user