Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2020-06-12 11:47:08 +02:00
14 changed files with 1484 additions and 224 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -36,4 +36,10 @@ public interface TileItem extends Entity
int getId();
int getQuantity();
/**
* Time in game ticks when the item spawned (relative to us)
* @return
*/
int getSpawnTime();
}

View File

@@ -31,6 +31,8 @@ import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.WordUtils;
import org.apache.commons.text.similarity.JaroWinklerDistance;
@@ -38,6 +40,7 @@ import org.apache.commons.text.similarity.JaroWinklerDistance;
public class Text
{
private static final StringBuilder SB = new StringBuilder(64);
private static final Pattern TAG_REGEXP = Pattern.compile("<[^>]*>");
public static final JaroWinklerDistance DISTANCE = new JaroWinklerDistance();
public static final Splitter COMMA_SPLITTER = Splitter
.on(",")
@@ -150,6 +153,32 @@ public class Text
return removeTags(str, false);
}
/**
* Remove tags from the given string, except for &lt;lt&gt; and &lt;gt&gt;
*
* @param str The string to remove formatting tags from.
* @return The given string with all formatting tags removed from it.
*/
public static String removeFormattingTags(String str)
{
StringBuilder stringBuilder = new StringBuilder();
Matcher matcher = TAG_REGEXP.matcher(str);
while (matcher.find())
{
matcher.appendReplacement(stringBuilder, "");
String match = matcher.group(0);
switch (match)
{
case "<lt>":
case "<gt>":
stringBuilder.append(match);
break;
}
}
matcher.appendTail(stringBuilder);
return stringBuilder.toString();
}
/**
* In addition to removing all tags, replaces nbsp with space, trims string and lowercases it

View File

@@ -250,6 +250,16 @@ public interface Widget
*/
int getSpriteId();
/**
* Gets if sprites are repeated or stretched
*/
boolean getSpriteTiling();
/**
* Sets if sprites are repeated or stretched
*/
void setSpriteTiling(boolean tiling);
/**
* Sets the sprite ID displayed in the widget.
*
@@ -288,18 +298,18 @@ public interface Widget
int getIndex();
/**
* Gets the model ID displayed in the widget.
* Gets the Model/NPC/Item ID displayed in the widget.
*
* @return the model ID
* @see WidgetModelType
*/
int getModelId();
/**
* Sets the model ID displayed in the widget
* Sets the Model/NPC/Item ID displayed in the widget.
*
* @param modelId the new model ID
* @see WidgetModelType
*/
void setModelId(int modelId);
void setModelId(int id);
/**
* Gets the model type of the widget.
@@ -316,6 +326,20 @@ public interface Widget
*/
void setModelType(int type);
/**
* Gets the sequence ID used to animate the model in the widget
*
* @see net.runelite.api.AnimationID
*/
int getAnimationId();
/**
* Sets the sequence ID used to animate the model in the widget
*
* @see net.runelite.api.AnimationID
*/
void setAnimationId(int animationId);
/**
* Gets the x rotation of the model displayed in the widget
*