runelite-api: add headicon enum
This commit is contained in:
32
runelite-api/src/main/java/net/runelite/api/HeadIcon.java
Normal file
32
runelite-api/src/main/java/net/runelite/api/HeadIcon.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
public enum HeadIcon
|
||||||
|
{
|
||||||
|
MELEE,
|
||||||
|
RANGED,
|
||||||
|
MAGIC;
|
||||||
|
}
|
||||||
@@ -48,5 +48,5 @@ public interface NPCComposition
|
|||||||
|
|
||||||
int getSize();
|
int getSize();
|
||||||
|
|
||||||
int getOverheadIcon();
|
HeadIcon getOverheadIcon();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,5 +41,5 @@ public interface Player extends Actor
|
|||||||
|
|
||||||
boolean isFriend();
|
boolean isFriend();
|
||||||
|
|
||||||
int getOverheadIcon();
|
HeadIcon getOverheadIcon();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,10 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.mixins;
|
package net.runelite.mixins;
|
||||||
|
|
||||||
|
import net.runelite.api.HeadIcon;
|
||||||
|
import static net.runelite.api.HeadIcon.MAGIC;
|
||||||
|
import static net.runelite.api.HeadIcon.MELEE;
|
||||||
|
import static net.runelite.api.HeadIcon.RANGED;
|
||||||
import net.runelite.api.events.NpcActionChanged;
|
import net.runelite.api.events.NpcActionChanged;
|
||||||
import net.runelite.api.mixins.FieldHook;
|
import net.runelite.api.mixins.FieldHook;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
@@ -34,6 +38,23 @@ import net.runelite.rs.api.RSNPCComposition;
|
|||||||
@Mixin(RSNPCComposition.class)
|
@Mixin(RSNPCComposition.class)
|
||||||
public abstract class RSNpcCompositionMixin implements RSNPCComposition
|
public abstract class RSNpcCompositionMixin implements RSNPCComposition
|
||||||
{
|
{
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public HeadIcon getOverheadIcon()
|
||||||
|
{
|
||||||
|
switch (getRsOverheadIcon())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return MELEE;
|
||||||
|
case 1:
|
||||||
|
return RANGED;
|
||||||
|
case 2:
|
||||||
|
return MAGIC;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@FieldHook("actions")
|
@FieldHook("actions")
|
||||||
@Inject
|
@Inject
|
||||||
public void actionsHook(int idx)
|
public void actionsHook(int idx)
|
||||||
|
|||||||
@@ -27,16 +27,20 @@ package net.runelite.mixins;
|
|||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import net.runelite.api.HeadIcon;
|
||||||
|
import static net.runelite.api.HeadIcon.MAGIC;
|
||||||
|
import static net.runelite.api.HeadIcon.MELEE;
|
||||||
|
import static net.runelite.api.HeadIcon.RANGED;
|
||||||
import net.runelite.api.Model;
|
import net.runelite.api.Model;
|
||||||
import net.runelite.api.Perspective;
|
import net.runelite.api.Perspective;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.mixins.Copy;
|
import net.runelite.api.mixins.Copy;
|
||||||
import net.runelite.api.mixins.Replace;
|
|
||||||
import net.runelite.api.model.Triangle;
|
|
||||||
import net.runelite.api.model.Vertex;
|
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
|
import net.runelite.api.mixins.Replace;
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.api.model.Triangle;
|
||||||
|
import net.runelite.api.model.Vertex;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSModel;
|
import net.runelite.rs.api.RSModel;
|
||||||
import net.runelite.rs.api.RSName;
|
import net.runelite.rs.api.RSName;
|
||||||
@@ -72,6 +76,23 @@ public abstract class RSPlayerMixin implements RSPlayer
|
|||||||
return name.replace('\u00A0', ' ');
|
return name.replace('\u00A0', ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public HeadIcon getOverheadIcon()
|
||||||
|
{
|
||||||
|
switch (getRsOverheadIcon())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return MELEE;
|
||||||
|
case 1:
|
||||||
|
return RANGED;
|
||||||
|
case 2:
|
||||||
|
return MAGIC;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public Polygon[] getPolygons()
|
public Polygon[] getPolygons()
|
||||||
|
|||||||
@@ -74,6 +74,5 @@ public interface RSNPCComposition extends NPCComposition
|
|||||||
int getSize();
|
int getSize();
|
||||||
|
|
||||||
@Import("headIcon")
|
@Import("headIcon")
|
||||||
@Override
|
int getRsOverheadIcon();
|
||||||
int getOverheadIcon();
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,5 @@ public interface RSPlayer extends RSActor, Player
|
|||||||
boolean isFriend();
|
boolean isFriend();
|
||||||
|
|
||||||
@Import("overheadIcon")
|
@Import("overheadIcon")
|
||||||
@Override
|
int getRsOverheadIcon();
|
||||||
int getOverheadIcon();
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user