@@ -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 ;
@@ -393,19 +394,19 @@ public static void updateGameInterface(GameInterface gameInterface) {
393
394
gameInterface .disabledText = English .pleaseWait ;
394
395
gameInterface .actionType = 0 ;
395
396
} else {
396
- int i_4_ = Player . ignoresCount ;
397
+ int i_4_ = Game . ignoreList . getCount () ;
397
398
if (Player .friendListStatus == 0 )
398
399
i_4_ = 0 ;
399
400
if (i_4_ <= type ) {
400
401
gameInterface .actionType = 0 ;
401
402
gameInterface .disabledText = "" ;
402
403
} else {
403
- gameInterface .disabledText = TextUtils .formatName (TextUtils .longToName (Player . ignores [ type ] ));
404
+ gameInterface .disabledText = TextUtils .formatName (TextUtils .longToName (Game . ignoreList . getPlayer ( type ) ));
404
405
gameInterface .actionType = 1 ;
405
406
}
406
407
}
407
408
} else if (type == 503 ) {
408
- gameInterface .scrollHeight = 15 * Player . ignoresCount + 20 ;
409
+ gameInterface .scrollHeight = 15 * Game . ignoreList . getCount () + 20 ;
409
410
if (gameInterface .scrollHeight <= gameInterface .originalHeight )
410
411
gameInterface .scrollHeight = gameInterface .originalHeight + 1 ;
411
412
} else if (type == 324 ) {
@@ -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
}
@@ -1938,11 +1926,11 @@ public static void manageTextInputs() {
1938
1926
));
1939
1927
}
1940
1928
}
1941
- if (anInt876 == 4 && Player . ignoresCount < 100 ) {
1929
+ if (anInt876 == 4 && ! Game . ignoreList . isFull () ) {
1942
1930
long l = MovedStatics .nameToLong (ChatBox .chatMessage );
1943
1931
addIgnore (l );
1944
1932
}
1945
- if (anInt876 == 5 && Player . ignoresCount > 0 ) {
1933
+ if (anInt876 == 5 && ! Game . ignoreList . isEmpty () ) {
1946
1934
long l = MovedStatics .nameToLong (ChatBox .chatMessage );
1947
1935
removeIgnore (l );
1948
1936
}
@@ -2096,27 +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
- for (int i = 0 ; Player .ignoresCount > i ; i ++) {
2110
- if (Player .ignores [i ] == name ) {
2111
- ChatBox .addChatMessage ("" , English .pleaseRemove + username + English .suffixFromYourIgnoreListFirst , 0 );
2112
- return ;
2113
- }
2095
+ if (Game .ignoreList .containsPlayer (name )) {
2096
+ ChatBox .addChatMessage ("" , English .pleaseRemove + username + English .suffixFromYourIgnoreListFirst , 0 );
2097
+ return ;
2114
2098
}
2115
2099
if (!username .equals (Player .localPlayer .playerName )) {
2116
- Player .friendUsernames [Player .friendsCount ] = username ;
2117
- Player .friends [Player .friendsCount ] = name ;
2118
- Player .friendWorlds [Player .friendsCount ] = 0 ;
2119
- Player .friendsCount ++;
2100
+ Game .friendList .addPlayer (name );
2101
+
2120
2102
redrawTabArea = true ;
2121
2103
2122
2104
OutgoingPackets .sendMessage (
@@ -2127,40 +2109,31 @@ private static void addFriend(long name) {
2127
2109
}
2128
2110
2129
2111
private static void removeIgnore (long arg1 ) {
2130
- for (int i = 0 ; i < Player .ignoresCount ; i ++) {
2131
- if (Player .ignores [i ] == arg1 ) {
2132
- redrawTabArea = true ;
2133
- Player .ignoresCount --;
2134
- for (int i_16_ = i ; Player .ignoresCount > i_16_ ; i_16_ ++)
2135
- Player .ignores [i_16_ ] = Player .ignores [1 + i_16_ ];
2112
+ if (Game .ignoreList .removePlayer (arg1 ) != -1 ) {
2113
+ redrawTabArea = true ;
2136
2114
2137
- OutgoingPackets .sendMessage (
2138
- new ModifySocialListOutboundMessage (arg1 , ModifySocialListOutboundMessage .SocialList .IGNORE , ModifySocialListOutboundMessage .SocialListAction .REMOVE ));
2139
- break ;
2140
- }
2115
+ OutgoingPackets .sendMessage (
2116
+ new ModifySocialListOutboundMessage (arg1 , ModifySocialListOutboundMessage .SocialList .IGNORE , ModifySocialListOutboundMessage .SocialListAction .REMOVE ));
2141
2117
}
2142
2118
}
2143
2119
2144
2120
private static void addIgnore (long arg1 ) {
2145
2121
if (arg1 != 0L ) {
2146
- if (Player . ignoresCount >= 100 )
2122
+ if (Game . ignoreList . isFull () )
2147
2123
ChatBox .addChatMessage ("" , English .yourIgnoreListIsFull .toString (), 0 );
2148
2124
else {
2149
2125
String class1 = TextUtils .formatName (TextUtils .longToName (arg1 ));
2150
- for (int i = 0 ; i < Player .ignoresCount ; i ++) {
2151
- if (arg1 == Player .ignores [i ]) {
2152
- ChatBox .addChatMessage ("" , class1 + English .suffixIsAlreadyOnYourIgnoreList , 0 );
2153
- return ;
2154
- }
2126
+ if (Game .ignoreList .containsPlayer (arg1 )) {
2127
+ ChatBox .addChatMessage ("" , class1 + English .suffixIsAlreadyOnYourIgnoreList , 0 );
2128
+ return ;
2155
2129
}
2156
- for (int i = 0 ; Player .friendsCount > i ; i ++) {
2157
- if (Player .friends [i ] == arg1 ) {
2158
- ChatBox .addChatMessage ("" , English .pleaseRemove + class1 + English .fromYourFriendListFirst , 0 );
2159
- return ;
2160
- }
2130
+ if (Game .friendList .containsPlayer (arg1 )) {
2131
+ ChatBox .addChatMessage ("" , English .pleaseRemove + class1 + English .fromYourFriendListFirst , 0 );
2132
+ return ;
2161
2133
}
2162
2134
if (!class1 .equals (Player .localPlayer .playerName )) {
2163
- Player .ignores [Player .ignoresCount ++] = arg1 ;
2135
+ Game .ignoreList .addPlayer (arg1 );
2136
+
2164
2137
redrawTabArea = true ;
2165
2138
2166
2139
OutgoingPackets .sendMessage (
0 commit comments