cache: load script key/value pairs too
This commit is contained in:
@@ -22,19 +22,21 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.runelite.cache.definitions;
|
package net.runelite.cache.definitions;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class ScriptDefinition
|
public class ScriptDefinition
|
||||||
{
|
{
|
||||||
private int id;
|
private int id;
|
||||||
private int intStackCount;
|
private int intStackCount;
|
||||||
private int[] instructions;
|
private int[] instructions;
|
||||||
private int[] intOperands;
|
private int[] intOperands;
|
||||||
private String[] stringOperands;
|
private String[] stringOperands;
|
||||||
private int localStringCount;
|
private int localStringCount;
|
||||||
private int stringStackCount;
|
private int stringStackCount;
|
||||||
private int localIntCount;
|
private int localIntCount;
|
||||||
|
private Map<Integer, Integer>[] attributes;
|
||||||
|
|
||||||
public int getId()
|
public int getId()
|
||||||
{
|
{
|
||||||
@@ -115,4 +117,14 @@ public class ScriptDefinition
|
|||||||
{
|
{
|
||||||
this.localIntCount = localIntCount;
|
this.localIntCount = localIntCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Integer, Integer>[] getAttributes()
|
||||||
|
{
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAttributes(Map<Integer, Integer>[] attributes)
|
||||||
|
{
|
||||||
|
this.attributes = attributes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.cache.definitions.loaders;
|
package net.runelite.cache.definitions.loaders;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import net.runelite.cache.definitions.ScriptDefinition;
|
import net.runelite.cache.definitions.ScriptDefinition;
|
||||||
import net.runelite.cache.io.InputStream;
|
import net.runelite.cache.io.InputStream;
|
||||||
|
|
||||||
@@ -46,7 +48,26 @@ public class ScriptLoader
|
|||||||
int intStackCount = in.readUnsignedShort();
|
int intStackCount = in.readUnsignedShort();
|
||||||
int stringStackCount = in.readUnsignedShort();
|
int stringStackCount = in.readUnsignedShort();
|
||||||
|
|
||||||
// XXX There are key/value pairs here
|
int attributeCount = in.readUnsignedByte();
|
||||||
|
if (attributeCount > 0)
|
||||||
|
{
|
||||||
|
Map<Integer, Integer>[] attributes = new Map[attributeCount];
|
||||||
|
def.setAttributes(attributes);
|
||||||
|
|
||||||
|
for (int i = 0; i < attributeCount; ++i)
|
||||||
|
{
|
||||||
|
attributes[i] = new HashMap<>();
|
||||||
|
|
||||||
|
int count = in.readUnsignedShort();
|
||||||
|
while (count-- > 0)
|
||||||
|
{
|
||||||
|
int key = in.readInt();
|
||||||
|
int value = in.readInt();
|
||||||
|
|
||||||
|
attributes[i].put(key, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def.setLocalIntCount(localIntCount);
|
def.setLocalIntCount(localIntCount);
|
||||||
def.setLocalStringCount(localStringCount);
|
def.setLocalStringCount(localStringCount);
|
||||||
|
|||||||
Reference in New Issue
Block a user