Thread: [Galkon's Base]Loading Head Icons(Cache Loading)

Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 119
  1. #1 [Galkon's Base]Loading Head Icons(Cache Loading) 
    Retired. Stop PMing me.


    Galkon's Avatar
    Join Date
    Nov 2007
    Age
    17
    Posts
    7,526
    Thanks given
    1,805
    Thanks received
    2,830
    Rep Power
    5000
    Purpose: To load headicons through the cache.
    Difficulty: 1/10, if you have common sense and basic client/Java knowledge.
    Assumed Knowledge: Basic client knowledge, basic Java knowledge.
    Classes Modified: client.java and Player.java
    Client Base: My renamed/refactored client base.

    I do not give permission for my tutorials to be converted to non-renamed and released.

    Step 1: Configuring Player.java to read the headicon data.
    Find 'public int headIcon;' and below it add:
    Code:
    	public int skullIcon;
    Then find 'headIcon = stream.readUnsignedByte();' and below it add:
    Code:
    		skullIcon = stream.readUnsignedByte();
    Save and close Player.java.


    Step 2: Configuring client.java to load and draw the sprites when needed.
    Find 'private Sprite[] headIcons;', below it add:
    Code:
    	private Sprite[] skullIcons;
    Then find 'headIcons = null;', below that add:
    Code:
    		skullIcons = null;
    Then find 'headIcons = new Sprite[20];', and below it add:
    Code:
    		skullIcons = new Sprite[20];
    Now find 'for(int j4 = 0; j4 < 20; j4++)', and everything in there, replace it with:
    Code:
                    for(int j4 = 0; j4 < 8; j4++)
                        headIcons[j4] = new Sprite(streamLoader_2, "headicons_prayer", j4);
    				for(int j45 = 0; j45 < 3; j45++)
                        skullIcons[j45] = new Sprite(streamLoader_2, "headicons_pk", j45 );
    Next, in 'private void updateEntities()', replace the entire method with:
    Code:
    	private void updateEntities() {
    		try{
    			int anInt974 = 0;
    			for(int j = -1; j < playerCount + npcCount; j++) {
    			Object obj;
    			if(j == -1)
    				obj = myPlayer;
    			else
    			if(j < playerCount)
    				obj = playerArray[playerIndices[j]];
    			else
    				obj = npcArray[npcIndices[j - playerCount]];
    			if(obj == null || !((Entity) (obj)).isVisible())
    				continue;
    			if(obj instanceof NPC) {
    				EntityDef entityDef = ((NPC)obj).desc;
    				if(entityDef.childrenIDs != null)
    					entityDef = entityDef.method161();
    				if(entityDef == null)
    					continue;
    			}
    			if(j < playerCount) {
    				int l = 30;
    				Player player = (Player)obj;
    				if(player.headIcon >= 0) {
    					npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
    					if(spriteDrawX > -1) {
    						if (player.skullIcon < 2) {
    							skullIcons[player.skullIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
    							l += 25;
    						}
    						if (player.headIcon < 7) {
    							headIcons[player.headIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
    							l += 18;
    						}
                        }
                    }
    				if(j >= 0 && anInt855 == 10 && anInt933 == playerIndices[j]) {
    					npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
    					if(spriteDrawX > -1)
    						headIconsHint[player.hintIcon].drawSprite(spriteDrawX - 12, spriteDrawY - l);
    				}
    			} else {
    				EntityDef entityDef_1 = ((NPC)obj).desc;
    				if(entityDef_1.anInt75 >= 0 && entityDef_1.anInt75 < headIcons.length) {
    					npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
    					if(spriteDrawX > -1)
    						headIcons[entityDef_1.anInt75].drawSprite(spriteDrawX - 12, spriteDrawY - 30);
    				}
    				if(anInt855 == 1 && anInt1222 == npcIndices[j - playerCount] && loopCycle % 20 < 10) {
    					npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
    					if(spriteDrawX > -1)
    						headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
    				}
    			}
    			if(((Entity) (obj)).textSpoken != null && (j >= playerCount || publicChatMode == 0 || publicChatMode == 3 || publicChatMode == 1 && isFriendOrSelf(((Player)obj).name)))
    			{
    				npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height);
    				if(spriteDrawX > -1 && anInt974 < anInt975)
    				{
    					anIntArray979[anInt974] = chatTextDrawingArea.method384(((Entity) (obj)).textSpoken) / 2;
    					anIntArray978[anInt974] = chatTextDrawingArea.anInt1497;
    					anIntArray976[anInt974] = spriteDrawX;
    					anIntArray977[anInt974] = spriteDrawY;
    					anIntArray980[anInt974] = ((Entity) (obj)).anInt1513;
    					anIntArray981[anInt974] = ((Entity) (obj)).anInt1531;
    					anIntArray982[anInt974] = ((Entity) (obj)).textCycle;
    					aStringArray983[anInt974++] = ((Entity) (obj)).textSpoken;
    					if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 >= 1 && ((Entity) (obj)).anInt1531 <= 3)
    					{
    						anIntArray978[anInt974] += 10;
    						anIntArray977[anInt974] += 5;
    					}
    					if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 4)
    						anIntArray979[anInt974] = 60;
    					if(anInt1249 == 0 && ((Entity) (obj)).anInt1531 == 5)
    						anIntArray978[anInt974] += 5;
    				}
    			}
    			if(((Entity) (obj)).loopCycleStatus > loopCycle)
    			{
    				try{
    					npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height + 15);
    					if(spriteDrawX > -1)
    					{
    						int i1 = (((Entity) (obj)).currentHealth * 30) / ((Entity) (obj)).maxHealth;
    						if(i1 > 30)
    							i1 = 30;
    						DrawingArea.drawPixels(5, spriteDrawY - 3, spriteDrawX - 15, 65280, i1);
    						DrawingArea.drawPixels(5, spriteDrawY - 3, (spriteDrawX - 15) + i1, 0xff0000, 30 - i1);
    					}
    				}catch(Exception e){ }
    				}
    				for(int j1 = 0; j1 < 4; j1++)
    					if(((Entity) (obj)).hitsLoopCycle[j1] > loopCycle)
    					{
    						npcScreenPos(((Entity) (obj)), ((Entity) (obj)).height / 2);
    						if(spriteDrawX > -1)
    						{
    							if(j1 == 1)
    								spriteDrawY -= 20;
    							if(j1 == 2)
    							{
    								spriteDrawX -= 15;
    								spriteDrawY -= 10;
    							}
    							if(j1 == 3)
    							{
    								spriteDrawX += 15;
    								spriteDrawY -= 10;
    							}
    							hitMarks[((Entity) (obj)).hitMarkTypes[j1]].drawSprite(spriteDrawX - 12, spriteDrawY - 12);
    							smallText.drawText(0, String.valueOf(((Entity) (obj)).hitArray[j1]), spriteDrawY + 4, spriteDrawX);
    							smallText.drawText(0xffffff, String.valueOf(((Entity) (obj)).hitArray[j1]), spriteDrawY + 3, spriteDrawX - 1);
    						}
    					}
    			}
    			for(int k = 0; k < anInt974; k++) {
    				int k1 = anIntArray976[k];
    				int l1 = anIntArray977[k];
    				int j2 = anIntArray979[k];
    				int k2 = anIntArray978[k];
    				boolean flag = true;
    				while(flag) 
    				{
    					flag = false;
    					for(int l2 = 0; l2 < k; l2++)
    						if(l1 + 2 > anIntArray977[l2] - anIntArray978[l2] && l1 - k2 < anIntArray977[l2] + 2 && k1 - j2 < anIntArray976[l2] + anIntArray979[l2] && k1 + j2 > anIntArray976[l2] - anIntArray979[l2] && anIntArray977[l2] - anIntArray978[l2] < l1)
    						{
    							l1 = anIntArray977[l2] - anIntArray978[l2];
    							flag = true;
    						}
    
    				}
    				spriteDrawX = anIntArray976[k];
    				spriteDrawY = anIntArray977[k] = l1;
    				String s = aStringArray983[k];
    				if(anInt1249 == 0)
    				{
    					int i3 = 0xffff00;
    					if(anIntArray980[k] < 6)
    						i3 = anIntArray965[anIntArray980[k]];
    					if(anIntArray980[k] == 6)
    						i3 = anInt1265 % 20 >= 10 ? 0xffff00 : 0xff0000;
    					if(anIntArray980[k] == 7)
    						i3 = anInt1265 % 20 >= 10 ? 65535 : 255;
    					if(anIntArray980[k] == 8)
    						i3 = anInt1265 % 20 >= 10 ? 0x80ff80 : 45056;
    					if(anIntArray980[k] == 9) {
    						int j3 = 150 - anIntArray982[k];
    						if(j3 < 50)
    							i3 = 0xff0000 + 1280 * j3;
    						else
    						if(j3 < 100)
    							i3 = 0xffff00 - 0x50000 * (j3 - 50);
    						else
    						if(j3 < 150)
    							i3 = 65280 + 5 * (j3 - 100);
    					}
    					if(anIntArray980[k] == 10) {
    						int k3 = 150 - anIntArray982[k];
    						if(k3 < 50)
    							i3 = 0xff0000 + 5 * k3;
    						else
    						if(k3 < 100)
    							i3 = 0xff00ff - 0x50000 * (k3 - 50);
    						else
    						if(k3 < 150)
    							i3 = (255 + 0x50000 * (k3 - 100)) - 5 * (k3 - 100);
    					}
    					if(anIntArray980[k] == 11) {
    						int l3 = 150 - anIntArray982[k];
    						if(l3 < 50)
    							i3 = 0xffffff - 0x50005 * l3;
    						else
    						if(l3 < 100)
    							i3 = 65280 + 0x50005 * (l3 - 50);
    						else
    						if(l3 < 150)
    							i3 = 0xffffff - 0x50000 * (l3 - 100);
    					}
    					if(anIntArray981[k] == 0) {
    						chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX);
    						chatTextDrawingArea.drawText(i3, s, spriteDrawY, spriteDrawX);
    					}
    					if(anIntArray981[k] == 1) {
    						chatTextDrawingArea.method386(0, s, spriteDrawX, anInt1265, spriteDrawY + 1);
    						chatTextDrawingArea.method386(i3, s, spriteDrawX, anInt1265, spriteDrawY);
    					}
    					if(anIntArray981[k] == 2) {
    						chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY + 1, 0);
    						chatTextDrawingArea.method387(spriteDrawX, s, anInt1265, spriteDrawY, i3);
    					}
    					if(anIntArray981[k] == 3) {
    						chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY + 1, spriteDrawX, 0);
    						chatTextDrawingArea.method388(150 - anIntArray982[k], s, anInt1265, spriteDrawY, spriteDrawX, i3);
    					}
    					if(anIntArray981[k] == 4) {
    						int i4 = chatTextDrawingArea.method384(s);
    						int k4 = ((150 - anIntArray982[k]) * (i4 + 100)) / 150;
    						DrawingArea.setDrawingArea(334, spriteDrawX - 50, spriteDrawX + 50, 0);
    						chatTextDrawingArea.method385(0, s, spriteDrawY + 1, (spriteDrawX + 50) - k4);
    						chatTextDrawingArea.method385(i3, s, spriteDrawY, (spriteDrawX + 50) - k4);
    						DrawingArea.defaultDrawingAreaSize();
    					}
    					if(anIntArray981[k] == 5) {
    						int j4 = 150 - anIntArray982[k];
    						int l4 = 0;
    						if(j4 < 25)
    							l4 = j4 - 25;
    						else
    						if(j4 > 125)
    							l4 = j4 - 125;
    						DrawingArea.setDrawingArea(spriteDrawY + 5, 0, 512, spriteDrawY - chatTextDrawingArea.anInt1497 - 1);
    						chatTextDrawingArea.drawText(0, s, spriteDrawY + 1 + l4, spriteDrawX);
    						chatTextDrawingArea.drawText(i3, s, spriteDrawY + l4, spriteDrawX);
    						DrawingArea.defaultDrawingAreaSize();
    					}
    				} else {
    					chatTextDrawingArea.drawText(0, s, spriteDrawY + 1, spriteDrawX);
    					chatTextDrawingArea.drawText(0xffff00, s, spriteDrawY, spriteDrawX);
    				}
    			}
    		} catch(Exception e){ }
    	}
    Save, close, and compile.


    Server Sided
    In Player.java find 'public int headIcon', and make sure its:
    Code:
    public int headIcon = -1;
    And below it declare:
    Code:
    public int skullIcon = -1;
    Then find 'playerProps.writeByte(headIcon);', and below it add:
    Code:
    playerProps.writeByte(skullIcon);
    And now you're done. Save, compile, post any errors.

    Attached image
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Feb 2008
    Age
    28
    Posts
    1,080
    Thanks given
    30
    Thanks received
    14
    Rep Power
    574
    Nice job josh! adding now!
    Reply With Quote  
     

  3. #3  
    Codex
    Rowan's Avatar
    Join Date
    Sep 2008
    Age
    28
    Posts
    1,593
    Thanks given
    0
    Thanks received
    20
    Rep Power
    1092
    k then, nice?
    Reply With Quote  
     

  4. #4  
    Donator

    iZAjz's Avatar
    Join Date
    Mar 2007
    Age
    29
    Posts
    3,675
    Thanks given
    105
    Thanks received
    47
    Rep Power
    1882
    Not to sound stupid, but whats the point of this?

    Does it matter if its load trough the cache or client?
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Aug 2007
    Age
    28
    Posts
    432
    Thanks given
    80
    Thanks received
    21
    Rep Power
    0
    Nice work
    Reply With Quote  
     

  6. #6  
    I'm Back

    Stewie's Avatar
    Join Date
    Jul 2008
    Age
    29
    Posts
    7,987
    Thanks given
    1,877
    Thanks received
    1,491
    Rep Power
    5000
    Already had. Nice though


    Reply With Quote  
     

  7. #7  
    Registered Member
    AMG A Bear's Avatar
    Join Date
    Jun 2008
    Posts
    1,157
    Thanks given
    27
    Thanks received
    87
    Rep Power
    945
    Quote Originally Posted by xGTest View Post
    Not to sound stupid, but whats the point of this?

    Does it matter if its load trough the cache or client?
    This is just loading them period, because we have yet to figure out how Runescape loaded them.
    Quote Originally Posted by The Night Life View Post
    Errm. I had a similar idea a very long time ago, about instead of current rs's gameframe, (622) making a rsps with about a 1645 or something. Make it look like you walked outside. I even gathered proffesional computer programmers to help, but bailed on the idea after i realized if we all worked on it non-stop for months at a time, we'd barely get any progress. (unless you wanted to half ass it)
    Reply With Quote  
     

  8. #8  
    Member [Galkon's Base]Loading Head Icons(Cache Loading) Market Banned

    Robin Spud's Avatar
    Join Date
    Aug 2008
    Age
    31
    Posts
    2,338
    Thanks given
    46
    Thanks received
    73
    Rep Power
    1068
    ths is very nice
    ILY Stewie.
    Reply With Quote  
     

  9. #9  
    Retired. Stop PMing me.


    Galkon's Avatar
    Join Date
    Nov 2007
    Age
    17
    Posts
    7,526
    Thanks given
    1,805
    Thanks received
    2,830
    Rep Power
    5000
    Quote Originally Posted by xGTest View Post
    Not to sound stupid, but whats the point of this?

    Does it matter if its load trough the cache or client?
    Loading from cache > adding new sprites.

    This loads from the cache and draws them correctly. The basic 317 client doesn't do either.
    Attached image
    Reply With Quote  
     

  10. #10  
    Respected Member


    Josh's Avatar
    Join Date
    Aug 2008
    Age
    29
    Posts
    2,863
    Thanks given
    6
    Thanks received
    1,342
    Rep Power
    5000
    Isn't This the same thing?...
    Reply With Quote  
     

Page 1 of 12 12311 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •