Make sprite and widget sprite overrides more flexible

- Expose NodeCache interface in RuneLite
- Expose Client.getWidgetSpriteCache and reset method on it
- Change setters for sprite and widget overrides to be getters

This allows for more than 1 plugin to use the widget/sprite override API
in future.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-09-04 18:05:41 +02:00
parent 0fe6d4be3a
commit ac5ef045b7
7 changed files with 69 additions and 28 deletions

View File

@@ -1394,24 +1394,20 @@ public interface Client extends GameEngine
void queueChangedSkill(Skill skill);
/**
* Sets a mapping of sprites to override.
* Gets a mapping of sprites to override.
* <p>
* The key value in the map corresponds to the ID of the sprite,
* and the value the sprite to replace it with.
*
* @param overrides the sprites to override
*/
void setSpriteOverrides(Map<Integer, SpritePixels> overrides);
Map<Integer, SpritePixels> getSpriteOverrides();
/**
* Sets a mapping of widget sprites to override.
* Gets a mapping of widget sprites to override.
* <p>
* The key value in the map corresponds to the packed widget ID,
* and the value the sprite to replace the widgets sprite with.
*
* @param overrides the sprites to override
*/
void setWidgetSpriteOverrides(Map<Integer, SpritePixels> overrides);
Map<Integer, SpritePixels> getWidgetSpriteOverrides();
/**
* Sets the compass sprite.
@@ -1420,6 +1416,13 @@ public interface Client extends GameEngine
*/
void setCompass(SpritePixels spritePixels);
/**
* Returns widget sprite cache, to be used with {@link Client#getSpriteOverrides()}
*
* @return the cache
*/
NodeCache getWidgetSpriteCache();
/**
* Gets the current server tick count.
*

View File

@@ -0,0 +1,36 @@
/*
* 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;
/**
* Represents a doubly linked node cache.
*/
public interface NodeCache
{
/**
* Resets cache.
*/
void reset();
}