widget: Expose widget model getters and setters

This commit also adds these widget properties to the widget inspector
dev tool.
This commit is contained in:
Jordan Atwood
2020-03-18 17:53:34 -07:00
parent 023860f928
commit 95556aadc7
3 changed files with 123 additions and 3 deletions

View File

@@ -243,11 +243,91 @@ public interface Widget
/**
* Gets the model ID displayed in the widget.
*
* @return the model ID
*/
int getModelId();
/**
* Sets the model ID displayed in the widget.
*
* @param modelId the new model ID
*/
void setModelId(int modelId);
/**
* Gets the model type of the widget.
*
* @see WidgetModelType
*/
int getModelType();
/**
* Sets the model type of the widget.
*
* @param type the new model type
* @see WidgetModelType
*/
void setModelType(int type);
/**
* Gets the x rotation of the model displayed in the widget.
* 0 = no rotation, 2047 = full rotation
*/
int getRotationX();
/**
* Sets the x rotation of the model displayed in the widget.
* <br>
* Note: Setting this value outside of the input range defined by {@link Widget#getRotationX()} will cause a client
* crash.
*
* @param modelX the new model x rotation value
*/
void setRotationX(int modelX);
/**
* Gets the y rotation of the model displayed in the widget.
* 0 = no rotation, 2047 = full rotation
*/
int getRotationY();
/**
* Sets the y rotation of the model displayed in the widget.
* <br>
* Note: Setting this value outside of the input range defined by {@link Widget#getRotationY()} will cause a client
* crash.
*
* @param modelY the new model y rotation value
*/
void setRotationY(int modelY);
/**
* Gets the z rotation of the model displayed in the widget.
* 0 = no rotation, 2047 = full rotation
*/
int getRotationZ();
/**
* Sets the z rotation of the model displayed in the widget.
* <br>
* Note: Setting this value outside of the input range defined by {@link Widget#getRotationZ()} will cause a client
* crash.
*
* @param modelZ the new model z rotation value
*/
void setRotationZ(int modelZ);
/**
* Gets the amount zoomed in on the model displayed in the widget.
*/
int getModelZoom();
/**
* Sets the amount zoomed in on the model displayed in the widget.
*
* @param modelZoom the new model zoom value
*/
void setModelZoom(int modelZoom);
/**
* Gets the sprite ID displayed in the widget.
*

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 2020, Jordan <nightfirecat@protonmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api.widgets;
public class WidgetModelType
{
public static final int NULL = 0;
public static final int MODEL = 1;
public static final int NPC_CHATHEAD = 2;
public static final int LOCAL_PLAYER_CHATHEAD = 3;
public static final int ITEM = 4;
public static final int PLAYER = 5;
}

View File

@@ -155,7 +155,12 @@ public class WidgetInfoTableModel extends AbstractTableModel
out.add(new WidgetField<>("ItemId", Widget::getItemId, Widget::setItemId, Integer.class));
out.add(new WidgetField<>("ItemQuantity", Widget::getItemQuantity, Widget::setItemQuantity, Integer.class));
out.add(new WidgetField<>("ItemQuantityMode", Widget::getItemQuantityMode, Widget::setItemQuantityMode, Integer.class));
out.add(new WidgetField<>("ModelId", Widget::getModelId));
out.add(new WidgetField<>("ModelId", Widget::getModelId, Widget::setModelId, Integer.class));
out.add(new WidgetField<>("ModelType", Widget::getModelType, Widget::setModelType, Integer.class));
out.add(new WidgetField<>("RotationX", Widget::getRotationX, Widget::setRotationX, Integer.class));
out.add(new WidgetField<>("RotationY", Widget::getRotationY, Widget::setRotationY, Integer.class));
out.add(new WidgetField<>("RotationZ", Widget::getRotationZ, Widget::setRotationZ, Integer.class));
out.add(new WidgetField<>("ModelZoom", Widget::getModelZoom, Widget::setModelZoom, Integer.class));
out.add(new WidgetField<>("SpriteId", Widget::getSpriteId, Widget::setSpriteId, Integer.class));
out.add(new WidgetField<>("BorderType", Widget::getBorderType, Widget::setBorderType, Integer.class));
out.add(new WidgetField<>("IsIf3", Widget::isIf3));