void Load(SpritesNPCManager mgr, int NPCIndex) { SpriteNPC t = mgr.mapNPCs.get(NPCIndex); txtSpriteSet.setValue(t.bSpriteSet & 0xFF); txtBehavior1.setText(Byte.toString(t.bBehavior1)); txtBehavior2.setText(Byte.toString(t.bBehavior2)); chkIsTrainer.setSelected(t.bIsTrainer == 1); txtTrainerLOS.setText(Byte.toString(t.bTrainerLOS)); txtScript.setText(String.format("%X", ((int) t.pScript))); txtiFlag.setText(BitConverter.toHexString(t.iFlag)); }
void Save(SpritesNPCManager mgr) { try { SpriteNPC t = mgr.mapNPCs.get(myIndex); mgr.mapNPCs.get(myIndex).bSpriteSet = (byte) ((int) ((Integer) txtSpriteSet.getValue())); mgr.mapNPCs.get(myIndex).bBehavior1 = Byte.parseByte(txtBehavior1.getText()); mgr.mapNPCs.get(myIndex).bBehavior2 = Byte.parseByte(txtBehavior2.getText()); mgr.mapNPCs.get(myIndex).bIsTrainer = (byte) (chkIsTrainer.isSelected() ? 1 : 0); mgr.mapNPCs.get(myIndex).bTrainerLOS = Byte.parseByte(txtTrainerLOS.getText()); mgr.mapNPCs.get(myIndex).pScript = Integer.parseInt(txtScript.getText(), 16); mgr.mapNPCs.get(myIndex).iFlag = Integer.parseInt(txtiFlag.getText()); } catch (Exception e) { } MainGUI.eventEditorPanel.Redraw = true; MainGUI.eventEditorPanel.repaint(); }
private static byte getByteData(String byte1Str) throws Exception { byte data_LC; byte byte1 = Byte.parseByte(byte1Str); // byte byte2 = Byte.parseByte(byte2Str); data_LC = byte1; // data_LC[1] = byte2; return data_LC; }