From 30ff35e37944360bc665ef764dd2173a38bf5d64 Mon Sep 17 00:00:00 2001 From: James Monger Date: Sat, 23 Jan 2021 00:16:38 +0000 Subject: [PATCH] Add 377 headicon parsing --- src/Rs317.Library.Client/Client.cs | 30 +++++++++++++++++++++--------- src/Rs317.Library.Client/Player.cs | 3 +++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/Rs317.Library.Client/Client.cs b/src/Rs317.Library.Client/Client.cs index 372522b6..bbad7b80 100644 --- a/src/Rs317.Library.Client/Client.cs +++ b/src/Rs317.Library.Client/Client.cs @@ -336,6 +336,7 @@ public int GetInterfaceSettings(int index) private int[] menuActionId; private int[] menuActionData1; protected Sprite[] headIcons; + protected Sprite[] skullIcons; private int anInt1098; private int anInt1099; private int anInt1100; @@ -661,6 +662,7 @@ public Client(ClientConfiguration config, IBufferFactory bufferFactory, IRunnabl menuActionId = new int[500]; menuActionData1 = new int[500]; headIcons = new Sprite[20]; + skullIcons = new Sprite[20]; drawTabIcons = false; chatboxInputNeededString = ""; playerActionText = new String[5]; @@ -2112,6 +2114,7 @@ protected override void cleanUpForQuit() minimapCompassImage = null; hitMarkImage = null; headIcons = null; + skullIcons = null; crosses = null; mapDotItem = null; mapDotNPC = null; @@ -12729,9 +12732,14 @@ protected void InitializeUnpackedMedia(Archive archiveMedia) try { - for (int i = 0; i < 20; i++) + for (int i = 0; i < 8; i++) + { + headIcons[i] = new Sprite(archiveMedia, "headicons_prayer", i, metadataBuffer); + } + + for (int i = 0; i < 3; i++) { - headIcons[i] = new Sprite(archiveMedia, "headicons", i, metadataBuffer); + skullIcons[i] = new Sprite(archiveMedia, "headicons_pk", i, metadataBuffer); } } catch (Exception _ex) @@ -12860,15 +12868,19 @@ private void updateEntities() if(player.headIcon != 0) { calculateEntityScreenPosition(((target)), target.height + 15); - if(spriteDrawX > -1) + if (spriteDrawX > -1) { - for(int icon = 0; icon < 8; icon++) - if((player.headIcon & 1 << icon) != 0) - { - headIcons[icon].drawImage(spriteDrawX - 12, spriteDrawY - height); - height -= 25; - } + if (player.skullIcon < 2) + { + skullIcons[player.skullIcon].drawImage(spriteDrawX - 12, spriteDrawY - height); + height += 25; + } + if (player.headIcon < 7) + { + headIcons[player.headIcon].drawImage(spriteDrawX - 12, spriteDrawY - height); + height -= 25; + } } } diff --git a/src/Rs317.Library.Client/Player.cs b/src/Rs317.Library.Client/Player.cs index 2fea10ad..5a7fc71f 100644 --- a/src/Rs317.Library.Client/Player.cs +++ b/src/Rs317.Library.Client/Player.cs @@ -22,6 +22,7 @@ public sealed class Player : Entity public static Cache mruNodes = new Cache(260); public int combatLevel; public int headIcon; + public int skullIcon; public int modifiedAppearanceStartTime; public int modifiedAppearanceEndTime { get; set; } public int drawHeight2 { get; set; } @@ -322,6 +323,8 @@ public void updatePlayerAppearance(Default317Buffer stream) stream.position = 0; gender = stream.getUnsignedByte(); headIcon = stream.getUnsignedByte(); + skullIcon = stream.getUnsignedByte(); + npcAppearance = null; this.team = 0; for (int slot = 0; slot < 12; slot++)