@@ -335,7 +335,7 @@ public static void updateGameInterface(GameInterface gameInterface) {
335
335
gameInterface .actionType = 0 ;
336
336
gameInterface .disabledText = English .pleaseWait ;
337
337
} else {
338
- int fCount = Player . friendsCount ;
338
+ int fCount = Game . friendList . getCount () ;
339
339
if (type > 700 )
340
340
type -= 601 ;
341
341
else
@@ -346,7 +346,7 @@ public static void updateGameInterface(GameInterface gameInterface) {
346
346
gameInterface .disabledText = "" ;
347
347
gameInterface .actionType = 0 ;
348
348
} else {
349
- gameInterface .disabledText = Player . friendUsernames [ type ] ;
349
+ gameInterface .disabledText = Game . friendList . getPlayerUsername ( type ) ;
350
350
gameInterface .actionType = 1 ;
351
351
}
352
352
}
@@ -355,30 +355,31 @@ public static void updateGameInterface(GameInterface gameInterface) {
355
355
type -= 101 ;
356
356
else
357
357
type -= 701 ;
358
- int count = Player . friendsCount ;
358
+ int count = Game . friendList . getCount () ;
359
359
if (Player .friendListStatus != 2 )
360
360
count = 0 ;
361
361
if (type >= count ) {
362
362
gameInterface .disabledText = "" ;
363
363
gameInterface .actionType = 0 ;
364
364
} else {
365
- if (Player .friendWorlds [type ] == 0 ) {
365
+ int world = Game .friendList .getPlayerWorld (type );
366
+ if (world == 0 ) {
366
367
gameInterface .disabledText = Native .red + English .offline ;
367
- } else if (Player . friendWorlds [ type ] < 5000 ) {
368
- if (Player . friendWorlds [ type ] == Player .worldId ) {
369
- gameInterface .disabledText = Native .green + English .world + Player . friendWorlds [ type ] ;
368
+ } else if (world < 5000 ) {
369
+ if (world == Player .worldId ) {
370
+ gameInterface .disabledText = Native .green + English .world + world ;
370
371
} else {
371
- gameInterface .disabledText = Native .yellow + English .world + Player . friendWorlds [ type ] ;
372
+ gameInterface .disabledText = Native .yellow + English .world + world ;
372
373
}
373
- } else if (Player .worldId == Player . friendWorlds [ type ] ) {
374
- gameInterface .disabledText = Native .green + English .classic + (-5000 + Player . friendWorlds [ type ] );
374
+ } else if (Player .worldId == world ) {
375
+ gameInterface .disabledText = Native .green + English .classic + (-5000 + world );
375
376
} else {
376
- gameInterface .disabledText = Native .yellow + English .classic + (Player . friendWorlds [ type ] + -5000 );
377
+ gameInterface .disabledText = Native .yellow + English .classic + (world + -5000 );
377
378
}
378
379
gameInterface .actionType = 1 ;
379
380
}
380
381
} else if (type == 203 ) {
381
- int count = Player . friendsCount ;
382
+ int count = Game . friendList . getCount () ;
382
383
if (Player .friendListStatus != 2 )
383
384
count = 0 ;
384
385
gameInterface .scrollHeight = 20 + 15 * count ;
@@ -949,21 +950,17 @@ public static void processMenuActions(int arg1) {
949
950
int i_18_ = class1 .indexOf (Native .white );
950
951
if (i_18_ != -1 ) {
951
952
long l = TextUtils .nameToLong (class1 .substring (i_18_ + 5 ).trim ());
952
- int i_19_ = -1 ;
953
- for (int i_20_ = 0 ; i_20_ < Player .friendsCount ; i_20_ ++) {
954
- if (Player .friends [i_20_ ] == l ) {
955
- i_19_ = i_20_ ;
956
- break ;
957
- }
958
- }
959
- if (i_19_ != -1 && Player .friendWorlds [i_19_ ] > 0 ) {
953
+
954
+ int i_19_ = Game .friendList .getPlayerIndex (l );
955
+
956
+ if (i_19_ != -1 && Game .friendList .getPlayerWorld (i_19_ ) > 0 ) {
960
957
anInt876 = 3 ;
961
958
ChatBox .redrawChatbox = true ;
962
959
ChatBox .inputType = 0 ;
963
960
ChatBox .chatMessage = "" ;
964
961
ChatBox .messagePromptRaised = true ;
965
- sendingMessageTo = Player . friends [ i_19_ ] ;
966
- Native .enterPlayerNameHeader = English .prefixEnterMessageToSendTo + Player . friendUsernames [ i_19_ ] ;
962
+ sendingMessageTo = l ;
963
+ Native .enterPlayerNameHeader = English .prefixEnterMessageToSendTo + Game . friendList . getPlayerUsername ( i_19_ ) ;
967
964
}
968
965
}
969
966
}
@@ -1855,21 +1852,12 @@ public static void runClientScriptsForInterface(int minY, int arg1, int scrollWi
1855
1852
1856
1853
public static void removeFriend (long nameAsLong ) {
1857
1854
if (nameAsLong != 0 ) {
1858
- int i = 0 ;
1859
- for (/**/ ; Player .friendsCount > i ; i ++) {
1860
- if (Player .friends [i ] == nameAsLong ) {
1861
- Player .friendsCount --;
1862
- redrawTabArea = true ;
1863
- for (int i_13_ = i ; i_13_ < Player .friendsCount ; i_13_ ++) {
1864
- Player .friendUsernames [i_13_ ] = Player .friendUsernames [1 + i_13_ ];
1865
- Player .friendWorlds [i_13_ ] = Player .friendWorlds [i_13_ + 1 ];
1866
- Player .friends [i_13_ ] = Player .friends [1 + i_13_ ];
1867
- }
1868
1855
1869
- OutgoingPackets .sendMessage (
1870
- new ModifySocialListOutboundMessage (nameAsLong , ModifySocialListOutboundMessage .SocialList .FRIEND , ModifySocialListOutboundMessage .SocialListAction .REMOVE ));
1871
- break ;
1872
- }
1856
+ if (Game .friendList .removePlayer (nameAsLong ) != -1 ) {
1857
+ redrawTabArea = true ;
1858
+
1859
+ OutgoingPackets .sendMessage (
1860
+ new ModifySocialListOutboundMessage (nameAsLong , ModifySocialListOutboundMessage .SocialList .FRIEND , ModifySocialListOutboundMessage .SocialListAction .REMOVE ));
1873
1861
}
1874
1862
}
1875
1863
}
@@ -1917,7 +1905,7 @@ public static void manageTextInputs() {
1917
1905
long l = MovedStatics .nameToLong (ChatBox .chatMessage );
1918
1906
addFriend (l );
1919
1907
}
1920
- if (anInt876 == 2 && Player . friendsCount > 0 ) {
1908
+ if (anInt876 == 2 && ! Game . friendList . isEmpty () ) {
1921
1909
long l = MovedStatics .nameToLong (ChatBox .chatMessage );
1922
1910
removeFriend (l );
1923
1911
}
@@ -2096,25 +2084,21 @@ public static void manageTextInputs() {
2096
2084
2097
2085
private static void addFriend (long name ) {
2098
2086
if (name != 0L ) {
2099
- if (Player . friendsCount >= 100 && MovedStatics . anInt1049 != 1 || Player . friendsCount >= 200 ) {
2087
+ if (Game . friendList . isFull () ) {
2100
2088
ChatBox .addChatMessage ("" , English .friendsListIsFull , 0 );
2101
2089
} else {
2102
2090
String username = TextUtils .formatName (TextUtils .longToName (name ));
2103
- for (int i = 0 ; Player .friendsCount > i ; i ++) {
2104
- if (Player .friends [i ] == name ) {
2105
- ChatBox .addChatMessage ("" , username + English .isAlreadyOnYourFriendList , 0 );
2106
- return ;
2107
- }
2091
+ if (Game .friendList .containsPlayer (name )) {
2092
+ ChatBox .addChatMessage ("" , username + English .isAlreadyOnYourFriendList , 0 );
2093
+ return ;
2108
2094
}
2109
2095
if (Game .ignoreList .containsPlayer (name )) {
2110
2096
ChatBox .addChatMessage ("" , English .pleaseRemove + username + English .suffixFromYourIgnoreListFirst , 0 );
2111
2097
return ;
2112
2098
}
2113
2099
if (!username .equals (Player .localPlayer .playerName )) {
2114
- Player .friendUsernames [Player .friendsCount ] = username ;
2115
- Player .friends [Player .friendsCount ] = name ;
2116
- Player .friendWorlds [Player .friendsCount ] = 0 ;
2117
- Player .friendsCount ++;
2100
+ Game .friendList .addPlayer (name );
2101
+
2118
2102
redrawTabArea = true ;
2119
2103
2120
2104
OutgoingPackets .sendMessage (
@@ -2143,11 +2127,9 @@ private static void addIgnore(long arg1) {
2143
2127
ChatBox .addChatMessage ("" , class1 + English .suffixIsAlreadyOnYourIgnoreList , 0 );
2144
2128
return ;
2145
2129
}
2146
- for (int i = 0 ; Player .friendsCount > i ; i ++) {
2147
- if (Player .friends [i ] == arg1 ) {
2148
- ChatBox .addChatMessage ("" , English .pleaseRemove + class1 + English .fromYourFriendListFirst , 0 );
2149
- return ;
2150
- }
2130
+ if (Game .friendList .containsPlayer (arg1 )) {
2131
+ ChatBox .addChatMessage ("" , English .pleaseRemove + class1 + English .fromYourFriendListFirst , 0 );
2132
+ return ;
2151
2133
}
2152
2134
if (!class1 .equals (Player .localPlayer .playerName )) {
2153
2135
Game .ignoreList .addPlayer (arg1 );
0 commit comments