Add mappings and api for DMM player names

- Add mappings for DMM player names and methods using them
- Create class with DMM player name rendering masks
- Create mapping for cleanName from player
- Create mapping for setting name to player

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-03-28 12:21:11 +02:00
committed by Adam
parent 24e6b24200
commit 7c233a096c
6 changed files with 83 additions and 0 deletions

View File

@@ -350,4 +350,8 @@ public interface Client extends GameEngine
World createWorld();
SpritePixels drawInstanceMap(int z);
void setPlayerNameMask(int mask);
int getPlayerNameMask();
}

View File

@@ -31,6 +31,10 @@ public interface Player extends Actor
@Override
int getCombatLevel();
String getCleanName();
void setName(String name);
PlayerComposition getPlayerComposition();
Polygon[] getPolygons();

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.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;
public class PlayerNameMask
{
public static final int DRAW_FRIEND_NAME = 1;
public static final int DRAW_CLAN_NAME = 2;
public static final int DRAW_ALL_EXCEPT_OWN_NAME = 4;
public static final int DRAW_OWN_NAME = 8;
}

View File

@@ -66,6 +66,34 @@ public abstract class RSPlayerMixin implements RSPlayer
return name.replace('\u00A0', ' ');
}
@Inject
@Override
public String getCleanName()
{
final RSName rsName = getRsName();
if (rsName == null)
{
return null;
}
return rsName.getCleanName();
}
@Inject
@Override
public void setName(String name)
{
final RSName rsName = getRsName();
if (rsName == null)
{
return;
}
rsName.setName(name);
}
@Inject
@Override
public Polygon[] getPolygons()

View File

@@ -549,4 +549,12 @@ public interface RSClient extends RSGameEngine, Client
@Import("drawObject")
void drawObject(int z, int x, int y, int randomColor1, int randomColor2);
@Import("playerNameMask")
@Override
void setPlayerNameMask(int mask);
@Import("playerNameMask")
@Override
int getPlayerNameMask();
}

View File

@@ -30,4 +30,10 @@ public interface RSName
{
@Import("name")
String getName();
@Import("cleanName")
String getCleanName();
@Import("name")
void setName(String name);
}