Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Description: Client.java
Submitted on July 29, 2014 at 04:09 PM

Section 1 (Text)

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

import java.applet.AppletContext;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.Method;

import sign.signlink;

import javax.swing.*;

public class client extends RSApplet {
	/**
	 * inventoryhover
	 */
	private static final long serialVersionUID = 1L;

	public final int titleColor(final int i) {
		switch (i) {
		case 1: // red
			return 255;
		case 2: // green
			return 32768;
		case 3: // blue
			return 16711680;
		}
		return 0;
	}

	/* Staff tab */
	private String showedName = "";
	private String fixedName = "";
	private boolean StaffTabInUse = true;
	private int StaffTabSelected = -1;
	private boolean writingOnStaffTab = false;
	private String staffTabInput = "";

	public static boolean adminMode = false;
	public boolean staffTabOpen = false;
	public int colorOfSplat = 0;
	public String hitText = "";
	public Sprite hitSprite = null;
	public int splatX = 0;
	public int splatY = 0;
	public int fadeOffset = 0;
	public int hitmarkWait = 0;
	public boolean addY = false;
	private Sprite loginHover;
	private Sprite check;
	private boolean RememberMe = true;
	private boolean readRemember = false;

	public Sprite[] bigSplats = new Sprite[3];
	// public Sprite[] combatIcons = new Sprite[10];
	// public Sprite[] combatIcons = new Sprite[4];

	public boolean is459 = false, is474 = false, is480 = false, is508 = false,
			is525 = false, is562 = true, idToggle = false, hitbarToggle = true,
			menuToggle = true, namesToggle = false, hitmarks = true;
	public static boolean newDamage = true, normalLogin = false,// KEEP TRUE!
			newHits = true;

	// public static boolean newDamage = true, newHits = true, normalLogin =
	// true;
	public int getXPForLevel(int i) {
		int j = 0;
		int k = 0;
		for (int l = 1; l <= i; l++) {
			j = (int) ((double) j + Math.floor((double) l + 300D
					* Math.pow(2D, (double) l / 7D)));
			if (l >= i)
				return k;
			k = (int) Math.floor(j / 4);
		}

		return 0;
	}

	public String skillNames[] = { "Attack", "Hitpoints", "Mining", "Strength",
			"Agility", "Smithing", "Defence", "Herblore", "Fishing", "Range",
			"Thieving", "Cooking", "Prayer", "Crafting", "Firemaking", "Magic",
			"Fletching", "Woodcutting", "Rune", "Slayer", "Farming",
			"Construction", "Hunter", "Summoning", "Dungeoneering" };
	public TextDrawingArea newSmallFont;
	public TextDrawingArea newRegularFont;
	public TextDrawingArea newBoldFont;
	public TextDrawingArea newFancyFont;
	public Sprite[] chatImages = new Sprite[7];
	public AlertHandler alertHandler;
	public Sprite alertBack;
	public Sprite alertBorder;
	public Sprite alertBorderH;

	public int followPlayer = 0;
	public int followNPC = 0;
	public int followDistance = 1;
	public boolean selectAction;
	public int isClicked;
	public Sprite[] LOGIN = new Sprite[27];
	public Sprite[] combatIcons = new Sprite[4];
	public Sprite qc;

	public String indexLocation(int cacheIndex, int index) {
		return signlink.findcachedir() + "index" + cacheIndex + "/"
				+ (index != -1 ? index + ".gz" : "");
	}

	public void repackCacheIndex(int cacheIndex) {
		System.out.println("Started repacking index " + cacheIndex + ".");
		int indexLength = new File(indexLocation(cacheIndex, -1)).listFiles().length;
		File[] file = new File(indexLocation(cacheIndex, -1)).listFiles();
		try {
			for (int index = 0; index < indexLength; index++) {
				int fileIndex = Integer
						.parseInt(getFileNameWithoutExtension(file[index]
								.toString()));
				byte[] data = fileToByteArray(cacheIndex, fileIndex);
				if (data != null && data.length > 0) {
					decompressors[cacheIndex].method234(data.length, data,
							fileIndex);
					System.out.println("Repacked " + fileIndex + ".");
				} else {
					System.out.println("Unable to locate index " + fileIndex
							+ ".");
				}
			}
		} catch (Exception e) {
			System.out.println("Error packing cache index " + cacheIndex + ".");
		}
		System.out.println("Finished repacking " + cacheIndex + ".");
	}

	public byte[] fileToByteArray(int cacheIndex, int index) {
		try {
			if (indexLocation(cacheIndex, index).length() <= 0
					|| indexLocation(cacheIndex, index) == null) {
				return null;
			}
			File file = new File(indexLocation(cacheIndex, index));
			byte[] fileData = new byte[(int) file.length()];
			FileInputStream fis = new FileInputStream(file);
			fis.read(fileData);
			fis.close();
			return fileData;
		} catch (Exception e) {
			return null;
		}
	}

	public void welcome() {
	}

	public void addLoginScreenHover(Sprite[] spriteName, int spriteId,
			int Xpos, int Ypos, int hoverId) {
		spriteName[spriteId].drawSprite(Xpos, Ypos);
		if (super.mouseX >= Xpos
				&& super.mouseX <= Xpos + spriteName[spriteId].myWidth
				&& super.mouseY >= Ypos + 3
				&& super.mouseY <= Ypos + spriteName[spriteId].myHeight + 2) {
			spriteName[hoverId].drawSprite(Xpos, Ypos);
		}
	}

	public void setSidebarInterface(int sidebarID, int interfaceID) {
		tabInterfaceIDs[sidebarID] = interfaceID;
		tabID = sidebarID;
		tabAreaAltered = true;
	}

	public int positions[] = new int[2000];
	public int landScapes[] = new int[2000];
	public int objects[] = new int[2000];

	@SuppressWarnings("resource")
	public void setNewMaps() {
		try {
			BufferedReader in = new BufferedReader(new FileReader(
					signlink.findcachedir() + "Maps/mapConfig.txt"));
			String s;
			int D = 0;
			while ((s = in.readLine()) != null) {
				positions[D] = Integer.parseInt(s.substring(s.indexOf("=") + 1,
						s.indexOf("(")));
				landScapes[D] = Integer.parseInt(s.substring(
						s.indexOf("(") + 1, s.indexOf(")")));
				objects[D] = Integer.parseInt(s.substring(s.indexOf("[") + 1,
						s.indexOf("]")));
				D++;
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static String capitalize(String s) {
		for (int i = 0; i < s.length(); i++) {
			if (i == 0) {
				s = String.format("%s%s", Character.toUpperCase(s.charAt(0)),
						s.substring(1));
			}
			if (!Character.isLetterOrDigit(s.charAt(i))) {
				if (i + 1 < s.length()) {
					s = String.format("%s%s%s", s.subSequence(0, i + 1),
							Character.toUpperCase(s.charAt(i + 1)),
							s.substring(i + 2));
				}
			}
		}
		return s;
	}

	public int MapX, MapY;
	public static int spellID = 0;

	private static String intToKOrMilLongName(int i) {
		String s = String.valueOf(i);
		for (int k = s.length() - 3; k > 0; k -= 3)
			s = s.substring(0, k) + "," + s.substring(k);
		// if(j != 0)
		// aBoolean1224 = !aBoolean1224;
		if (s.length() > 8)
			s = "@blu@" + s.substring(0, s.length() - 8) + " million @whi@("
					+ s + ")";
		else if (s.length() > 4)
			s = "@cya@" + s.substring(0, s.length() - 4) + "K @whi@(" + s + ")";
		return " " + s;
	}

	public final String methodR(/* int i, */int j) {
		// if(i <= 0)
		// pktType = inStream.readUnsignedByte();
		if (j >= 0 && j < 10000)
			return String.valueOf(j);
		if (j >= 10000 && j < 10000000)
			return j / 1000 + "K";
		if (j >= 10000000 && j < 999999999)
			return j / 1000000 + "M";
		if (j >= 999999999)
			return "*";
		else
			return "?";
	}

	public void models() {
		for (int ModelIndex = 0; ModelIndex < 50000; ModelIndex++) {
			byte[] abyte0 = getModel(ModelIndex);
			if (abyte0 != null && abyte0.length > 0) {

				decompressors[1].method234(abyte0.length, abyte0, ModelIndex);
				pushMessage("Model added successfully!", 0, "");
			}
		}
	}

	public byte[] getModel(int Index) {
		try {
			File Model = new File(signlink.findcachedir() + "/Raw/" + Index
					+ ".gz");// there we go.
			byte[] aByte = new byte[(int) Model.length()];
			FileInputStream fis = new FileInputStream(Model);
			fis.read(aByte);
			pushMessage("aByte = [" + aByte + "]!", 0, "");
			fis.close();

			return aByte;
		} catch (Exception e) {
			return null;
		}
	}

	private boolean menuHasAddFriend(int j) {
		if (j < 0)
			return false;
		int k = menuActionID[j];
		if (k >= 2000)
			k -= 2000;
		return k == 337;
	}

	public static final byte[] ReadFile(String s, boolean antiLeech) {
		try {
			byte abyte0[];
			File file = new File(s);
			int i = (int) file.length();
			abyte0 = new byte[i];
			DataInputStream datainputstream = new DataInputStream(
					new BufferedInputStream(new FileInputStream(s)));
			datainputstream.readFully(abyte0, 0, i);
			datainputstream.close();
			return abyte0;
		} catch (Exception e) {
			System.out.println((new StringBuilder()).append("Read Error: ")
					.append(s).toString());
			return null;
		}
	}

	public void drawChannelButtons() {
		if (is459) {
			aTextDrawingArea_1271.method389(true, 25, 0xffffff, "Public chat",
					142);
			aTextDrawingArea_1271.method389(true, 150, 0xffffff,
					"Private chat", 142);
			aTextDrawingArea_1271.method389(true, 285, 0xffffff,
					"Trade/compete", 142);
			aTextDrawingArea_1271.method389(true, 422, 0xffffff,
					"Report Abuse", 147);
			if (publicChatMode == 0)
				aTextDrawingArea_1271.method382(65280, 55, "On", 153, true);
			if (publicChatMode == 1)
				aTextDrawingArea_1271.method382(0xffff00, 55, "Friends", 153,
						true);
			if (publicChatMode == 2)
				aTextDrawingArea_1271.method382(0xff0000, 55, "Off", 153, true);
			if (publicChatMode == 3)
				aTextDrawingArea_1271.method382(65535, 55, "Hide", 153, true);
			if (privateChatMode == 0)
				aTextDrawingArea_1271.method382(65280, 180, "On", 153, true);
			if (privateChatMode == 1)
				aTextDrawingArea_1271.method382(0xffff00, 180, "Friends", 153,
						true);
			if (privateChatMode == 2)
				aTextDrawingArea_1271
						.method382(0xff0000, 180, "Off", 153, true);
			if (tradeMode == 0)
				aTextDrawingArea_1271.method382(65280, 324, "On", 153, true);
			if (tradeMode == 1)
				aTextDrawingArea_1271.method382(0xffff00, 324, "Friends", 153,
						true);
			if (tradeMode == 2)
				aTextDrawingArea_1271
						.method382(0xff0000, 324, "Off", 153, true);
		} else if (is480 || is508 || is525 || is562) {
			String text[] = { "On", "Friends", "Off", "Hide" };
			int disabledColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
			switch (cButtonCPos) {
			case 0:
				chatButtons[1].drawSprite(5, 142);
				break;
			case 1:
				chatButtons[1].drawSprite(62, 142);
				break;
			case 2:
				chatButtons[1].drawSprite(119, 142);
				break;
			case 3:
				chatButtons[1].drawSprite(176, 142);
				break;
			case 4:
				chatButtons[1].drawSprite(233, 142);
				break;
			case 5:
				chatButtons[1].drawSprite(290, 142);
				break;
			case 6:
				chatButtons[1].drawSprite(347, 142);
				break;
			}
			if (cButtonHPos == cButtonCPos) {
				switch (cButtonHPos) {
				case 0:
					chatButtons[2].drawSprite(5, 142);
					break;
				case 1:
					chatButtons[2].drawSprite(62, 142);
					break;
				case 2:
					chatButtons[2].drawSprite(119, 142);
					break;
				case 3:
					chatButtons[2].drawSprite(176, 142);
					break;
				case 4:
					chatButtons[2].drawSprite(233, 142);
					break;
				case 5:
					chatButtons[2].drawSprite(290, 142);
					break;
				case 7:
					chatButtons[2].drawSprite(347, 142);
					break;
				case 6:
					chatButtons[3].drawSprite(404, 142);
					break;
				}
			} else {
				switch (cButtonHPos) {
				case 0:
					chatButtons[2].drawSprite(5, 142);
					break;
				case 1:
					chatButtons[2].drawSprite(62, 142);
					break;
				case 2:
					chatButtons[2].drawSprite(119, 142);
					break;
				case 3:
					chatButtons[2].drawSprite(176, 142);
					break;
				case 4:
					chatButtons[2].drawSprite(233, 142);
					break;
				case 5:
					chatButtons[2].drawSprite(290, 142);
					break;
				case 7:
					chatButtons[2].drawSprite(347, 142);
					break;
				case 6:
					chatButtons[3].drawSprite(404, 142);
					break;
				}
			}
			smallText.method389(true, 425, 0xffffff, "Report Abuse", 157);
			smallText.method389(true, 26, 0xffffff, "All", 157);
			smallText.method389(true, 76, 0xffffff, "Game", 157);
			smallText.method389(true, 131, 0xffffff, "Public", 153);
			smallText.method389(true, 184, 0xffffff, "Private", 153);
			smallText.method389(true, 249, 0xffffff, "Clan", 153);
			smallText.method389(true, 304, 0xffffff, "Trade", 153);
			smallText.method389(true, 359, 0xffffff, "Assist", 153);

			smallText.method382(disabledColor[publicChatMode], 147,
					text[publicChatMode], 164, true);
			smallText.method382(disabledColor[privateChatMode], 203,
					text[privateChatMode], 164, true);
			smallText.method382(disabledColor[clanChatMode], 261,
					text[clanChatMode], 164, true);
			smallText.method382(disabledColor[tradeMode], 318, text[tradeMode],
					164, true);
			smallText.method382(0xff0000, 374, "Off", 164, true);
		} else if (is474) {
			String text[] = { "On", "Friends", "Off", "Hide" };
			int disabledColor[] = { 65280, 0xffff00, 0xff0000, 65535 };
			switch (cButtonCPos) {
			case 0:
				chatButtons[1].drawSprite(5, 142);
				break;
			case 1:
				chatButtons[1].drawSprite(71, 142);
				break;
			case 2:
				chatButtons[1].drawSprite(137, 142);
				break;
			case 3:
				chatButtons[1].drawSprite(203, 142);
				break;
			case 4:
				chatButtons[1].drawSprite(269, 142);
				break;
			case 5:
				chatButtons[1].drawSprite(335, 142);
				break;
			}
			if (cButtonHPos == cButtonCPos) {
				switch (cButtonHPos) {
				case 0:
					chatButtons[2].drawSprite(5, 142);
					break;
				case 1:
					chatButtons[2].drawSprite(71, 142);
					break;
				case 2:
					chatButtons[2].drawSprite(137, 142);
					break;
				case 3:
					chatButtons[2].drawSprite(203, 142);
					break;
				case 4:
					chatButtons[2].drawSprite(269, 142);
					break;
				case 5:
					chatButtons[2].drawSprite(335, 142);
					break;
				case 6:
					chatButtons[3].drawSprite(404, 142);
					break;
				}
			} else {
				switch (cButtonHPos) {
				case 0:
					chatButtons[0].drawSprite(5, 142);
					break;
				case 1:
					chatButtons[0].drawSprite(71, 142);
					break;
				case 2:
					chatButtons[0].drawSprite(137, 142);
					break;
				case 3:
					chatButtons[0].drawSprite(203, 142);
					break;
				case 4:
					chatButtons[0].drawSprite(269, 142);
					break;
				case 5:
					chatButtons[0].drawSprite(335, 142);
					break;
				case 6:
					chatButtons[3].drawSprite(404, 142);
					break;
				}
			}
			smallText.method389(true, 425, 0xffffff, "Report Abuse", 157);
			smallText.method389(true, 26, 0xffffff, "All", 157);
			smallText.method389(true, 86, 0xffffff, "Game", 157);
			smallText.method389(true, 150, 0xffffff, "Public", 152);
			smallText.method389(true, 212, 0xffffff, "Private", 152);
			smallText.method389(true, 286, 0xffffff, "Clan", 152);
			smallText.method389(true, 349, 0xffffff, "Trade", 152);
			smallText.method382(disabledColor[publicChatMode], 164,
					text[publicChatMode], 163, true);
			smallText.method382(disabledColor[privateChatMode], 230,
					text[privateChatMode], 163, true);
			smallText.method382(disabledColor[clanChatMode], 296,
					text[clanChatMode], 163, true);
			smallText.method382(disabledColor[tradeMode], 362, text[tradeMode],
					163, true);
		}
		if (menuOpen) {
			drawMenu(0, 338);
		}
	}

	private void drawChatArea() {
		chatBackImage.initDrawingArea();
		Texture.anIntArray1472 = anIntArray1180;
		chatArea[getSpriteID()].drawSprite(0, 0);
		if (spriteChanged) {
			inputTaken = true;
		}

		if (backDialogID == 26500 || backDialogID == 26600
				|| backDialogID == 26700) {
			DrawingArea.method336(7, 7, 505, 85, 0);
			DrawingArea.method336(7, 7 + 85, 505, 129 - 85, 0);
		}
		if (is459) {
			RSFont textDrawingArea = aTextDrawingArea_1271;
			if (messagePromptRaised) {
				newBoldFont.drawCenteredString(aString1121, 239, 60, 0, -1);
				newBoldFont.drawCenteredString(promptInput + "*", 239, 80, 128,
						-1);
			} else if (inputDialogState == 1) {
				newBoldFont.drawCenteredString("Enter amount:", 239, 60, 0, -1);
				newBoldFont.drawCenteredString(amountOrNameInput + "*", 239,
						80, 128, -1);
			} else if (inputDialogState == 2) {
				newBoldFont.drawCenteredString("Enter name:", 239, 60, 0, -1);
				newBoldFont.drawCenteredString(amountOrNameInput + "*", 239,
						80, 128, -1);
			} else if (aString844 != null) {
				newBoldFont.drawCenteredString(aString844, 239, 60, 0, -1);
				newBoldFont.drawCenteredString("Click to continue", 239, 80,
						128, -1);
			} else if (backDialogID != -1) {
				drawInterface(0, 16, RSInterface.interfaceCache[backDialogID],
						20);
			} else if (dialogID != -1) {
				drawInterface(0, 16, RSInterface.interfaceCache[dialogID], 20);
			} else {
				int j77 = 0;
				int j = 0;
				DrawingArea.setDrawingArea(93 + 5, 0, 463, 22);
				for (int k = 0; k < 100; k++)
					if (chatMessages[k] != null) {
						int chatType = chatTypes[k];
						int yPos = (88 - j77 * 14) + anInt1089 + 5;
						String s1 = chatNames[k];
						byte byte0 = 0;
						if (s1 != null && s1.startsWith("@cr0@")) {
							s1 = s1.substring(5);
							byte0 = 1;
						} else if (s1 != null && s1.startsWith("@cr1@")) {
							s1 = s1.substring(5);
							byte0 = 2;
						} else if (s1 != null && s1.startsWith("@cr2@")) {
							s1 = s1.substring(5);
							byte0 = 3;
						} else if (s1 != null && s1.startsWith("@cr3@")) {
							s1 = s1.substring(5);
							byte0 = 4;
						} else if (s1 != null && s1.startsWith("@cr4@")) {
							s1 = s1.substring(5);
							byte0 = 5;
						} else if (s1 != null && s1.startsWith("@cr5@")) {
							s1 = s1.substring(5);
							byte0 = 6;
						} else if (s1 != null && s1.startsWith("@cr6@")) {
							s1 = s1.substring(5);
							byte0 = 7;
						} else if (s1 != null && s1.startsWith("@cr7@")) {
							s1 = s1.substring(5);
							byte0 = 8;
						}
						/* Draws Chat Colored Messages */
						if (chatType == 0) {
							if (chatTypeView == 5 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110)
									newRegularFont.drawBasicString(
											chatMessages[k], 19, yPos, 0, -1);
								j++;
								j77++;
							}
						}
						/* Draws clickable URL text into chatarea */
						if (chatType == 9) {
							if (chatTypeView == 5 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110)
									newRegularFont.drawBasicString(
											chatMessages[k] + " <col=13989119>"
													+ s1, 19, yPos, 0x7e3200,
											-1);
								j++;
								j77++;
							}
						}
						if ((chatType == 1 || chatType == 2)
								&& (chatType == 1 || publicChatMode == 0 || publicChatMode == 1
										&& isFriendOrSelf(s1))) {
							if (chatTypeView == 1 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110) {
									int xPos = 19;
									switch (byte0) {
									case 1:
										modIcons[0].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 2:
										modIcons[1].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 3:
										modIcons[2].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 4:
										modIcons[3].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 5:
										modIcons[4].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 6:
										modIcons[5].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 7:
										modIcons[6].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 8:
										modIcons[7].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									}
									newRegularFont.drawBasicString(s1 + ":",
											xPos, yPos, 0, -1);
									xPos += newRegularFont.getTextWidth(s1) + 8;
									newRegularFont.drawBasicString(
											chatMessages[k], xPos, yPos, 255,
											-1);
								}
								j++;
								j77++;
							}
						}
						if ((chatType == 3 || chatType == 7)
								&& (splitPrivateChat == 0 || chatTypeView == 2)
								&& (chatType == 7 || privateChatMode == 0 || privateChatMode == 1
										&& isFriendOrSelf(s1))) {
							if (chatTypeView == 2 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110) {
									int k1 = 4;
									newRegularFont.drawBasicString("From", k1,
											yPos, 0, -1);
									k1 += newRegularFont.getTextWidth("From ");
									switch (byte0) {
									case 1:
										modIcons[0].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 2:
										modIcons[1].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 3:
										modIcons[2].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 4:
										modIcons[3].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 5:
										modIcons[4].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 6:
										modIcons[5].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 7:
										modIcons[6].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 8:
										modIcons[7].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									}
									newRegularFont.drawBasicString(s1 + ":",
											k1, yPos, 0, -1);
									k1 += newRegularFont.getTextWidth(s1) + 8;
									newRegularFont.drawBasicString(
											chatMessages[k], k1, yPos,
											0x800000, -1);
								}
								j++;
								j77++;
							}
						}
						if (chatType == 4
								&& (tradeMode == 0 || tradeMode == 1
										&& isFriendOrSelf(s1))) {
							if (chatTypeView == 3 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110)
									newRegularFont.drawBasicString(s1 + " "
											+ chatMessages[k], 19, yPos,
											0x800080, -1);
								j++;
								j77++;
							}
						}
						if (chatType == 5 && splitPrivateChat == 0
								&& privateChatMode < 2) {
							if (chatTypeView == 2 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110)
									newRegularFont.drawBasicString(
											chatMessages[k], 19, yPos,
											0x800000, -1);
								j++;
								j77++;
							}
						}
						if (chatType == 6
								&& (splitPrivateChat == 0 || chatTypeView == 2)
								&& privateChatMode < 2) {
							if (chatTypeView == 2 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110) {
									newRegularFont.drawBasicString("To " + s1
											+ ":", 11, yPos, 0, -1);
									newRegularFont.drawBasicString(
											chatMessages[k],
											12 + newRegularFont
													.getTextWidth("To :" + s1),
											yPos, 0x800000, -1);
								}
								j++;
								j77++;
							}
						}
						if (chatType == 8
								&& (tradeMode == 0 || tradeMode == 1
										&& isFriendOrSelf(s1))) {
							if (chatTypeView == 3 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110)
									newRegularFont.drawBasicString(s1 + " "
											+ chatMessages[k], 19, yPos,
											0x7e3200, -1);
								j++;
								j77++;
							}
							if (chatType == 11 && (clanChatMode == 0)) {
								if (chatTypeView == 11) {
									if (yPos > 0 && yPos < 110)
										newRegularFont.drawBasicString(s1 + " "
												+ chatMessages[k], 19, yPos,
												0x7e3200, -1);
									j++;
									j77++;
								}
							}
						}
						if (chatType == 16) {
							int j2 = 40 + 11;
							int clanNameWidth = textDrawingArea.getTextWidth(capitalize(clanname.toLowerCase()));
							if (chatTypeView == 11 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110)
									switch (chatRights[k]) {
									case 1:
										j2 += clanNameWidth;
										modIcons[0].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 2:
										j2 += clanNameWidth;
										modIcons[1].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 3:
										j2 += clanNameWidth;
										modIcons[2].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 4:
										j2 += clanNameWidth;
										modIcons[3].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 5:
										j2 += clanNameWidth;
										modIcons[4].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 6:
										j2 += clanNameWidth;
										modIcons[5].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 7:
										j2 += clanNameWidth;
										modIcons[6].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 8:
										j2 += clanNameWidth;
										modIcons[7].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									default:
										j2 += clanNameWidth;
										break;
									}
								newRegularFont.drawBasicString("[", 19, yPos,
										0, -1);
								newRegularFont.drawBasicString("]",
										clanNameWidth + 16 + 11, yPos, 0, -1);
								newRegularFont.drawBasicString(""
										+ capitalize(clanname) + "", 25, yPos,
										255, -1);
								newRegularFont.drawBasicString(
										capitalize(chatNames[k]) + ":",
										j2 - 17, yPos);
								j2 += newRegularFont.getTextWidth(chatNames[k]) + 7;
								newRegularFont.drawBasicString(
										capitalize(chatMessages[k]), j2 - 16,
										yPos, 0x800000, -1);

								j++;
								j77++;
							}
						}
					}
				DrawingArea.defaultDrawingAreaSize();
				anInt1211 = j * 14 + 7;
				if (anInt1211 < 78)
					anInt1211 = 78;
				drawScrollbar(77, anInt1211 - anInt1089 - 77, 20, 480,
						anInt1211);
				String s;
				int colour = titleColor(myPlayer.chatGlow);
				String glow = colour > 0 ? "<shad=" + colour + ">" : "";
				if (myPlayer != null && myPlayer.name != null)
					s = playerTitle(myPlayer.skill) + myPlayer.name;
				else
					s = TextClass.fixName(capitalize(myUsername));

				String glowingName = "<col=13132800>"
						+ playerTitle(myPlayer.skill) + "</col>" + glow
						+ TextClass.fixName(capitalize(myUsername));

				newRegularFont.drawLeftAlignedString(glowingName + ":", 19,
						110, 0, -1, true);
				newRegularFont.drawLeftAlignedString(inputString + ("*"),
						20 + textDrawingArea.getTextWidth(s + ": "), 110, 255,
						-1, false);
				DrawingArea.method339(97, 0x000000, 479, 17);
			}
		} else if (is474 || is480 || is508 || is525 || is562) {
			RSFont textDrawingArea = aTextDrawingArea_1271;
			if (messagePromptRaised) {
				newBoldFont.drawCenteredString(aString1121, 259, 60, 0, -1);
				newBoldFont.drawCenteredString(promptInput + "*", 259, 80, 128,
						-1);
			} else if (inputDialogState == 1) {
				newBoldFont.drawCenteredString("Enter amount:", 259, 60, 0, -1);
				newBoldFont.drawCenteredString(amountOrNameInput + "*", 259,
						80, 128, -1);
			} else if (inputDialogState == 2) {
				newBoldFont.drawCenteredString("Enter name:", 259, 60, 0, -1);
				newBoldFont.drawCenteredString(amountOrNameInput + "*", 259,
						80, 128, -1);
			} else if (aString844 != null) {
				newBoldFont.drawCenteredString(aString844, 259, 60, 0, -1);
				newBoldFont.drawCenteredString("Click to continue", 259, 80,
						128, -1);
			} else if (backDialogID != -1) {
				drawInterface(0, 20, RSInterface.interfaceCache[backDialogID],
						20);
			} else if (dialogID != -1) {
				drawInterface(0, 20, RSInterface.interfaceCache[dialogID], 20);
			} else {
				int j77 = -3;
				int j = 0;
				DrawingArea.setDrawingArea(122, 8, 497, 7);
				for (int k = 0; k < 500; k++)
					if (chatMessages[k] != null) {
						int chatType = chatTypes[k];
						int yPos = (70 - j77 * 14) + anInt1089 + 5;
						String s1 = chatNames[k];
						byte byte0 = 0;
						if (s1 != null && s1.startsWith("@cr0@")) {
							s1 = s1.substring(5);
							byte0 = 1;
						} else if (s1 != null && s1.startsWith("@cr1@")) {
							s1 = s1.substring(5);
							byte0 = 2;
						} else if (s1 != null && s1.startsWith("@cr2@")) {
							s1 = s1.substring(5);
							byte0 = 3;
						} else if (s1 != null && s1.startsWith("@cr3@")) {
							s1 = s1.substring(5);
							byte0 = 4;
						} else if (s1 != null && s1.startsWith("@cr4@")) {
							s1 = s1.substring(5);
							byte0 = 5;
						} else if (s1 != null && s1.startsWith("@cr5@")) {
							s1 = s1.substring(5);
							byte0 = 6;
						} else if (s1 != null && s1.startsWith("@cr6@")) {
							s1 = s1.substring(5);
							byte0 = 7;
						} else if (s1 != null && s1.startsWith("@cr7@")) {
							s1 = s1.substring(5);
							byte0 = 8;
						}
						/* Draws Chat Colored Messages */
						if (chatType == 0) {
							if (chatTypeView == 5 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 210)
									newRegularFont.drawBasicString(
											chatMessages[k], 11, yPos, 0, -1);
								j++;
								j77++;
							}
						}
						/* Draws clickable URL text into chatarea */
						if (chatType == 9) {
							if (chatTypeView == 5 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 210)
									newRegularFont
											.drawBasicString(chatMessages[k]
													+ " <col=255>" + s1, 11,
													yPos, 0x7e3200, -1);
								j++;
								j77++;
							}
						}
						if ((chatType == 1 || chatType == 2)
								&& (chatType == 1 || publicChatMode == 0 || publicChatMode == 1
										&& isFriendOrSelf(s1))) {
							if (chatTypeView == 1 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 210) {
									int xPos = 11;
									switch (byte0) {
									case 1:
										modIcons[0].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 2:
										modIcons[1].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 3:
										modIcons[2].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 4:
										modIcons[3].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 5:
										modIcons[4].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 6:
										modIcons[5].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 7:
										modIcons[6].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									case 8:
										modIcons[7].drawSprite(xPos, yPos - 12);
										xPos += 14;
										break;
									}
									newRegularFont.drawBasicString(s1 + ":",
											xPos, yPos, 0, -1);
									xPos += newRegularFont.getTextWidth(s1) + 8;
									newRegularFont.drawBasicString(
											chatMessages[k], xPos, yPos, 255,
											-1);
								}
								j++;
								j77++;
							}
						}
						if ((chatType == 3 || chatType == 7)
								&& (splitPrivateChat == 0 || chatTypeView == 2)
								&& (chatType == 7 || privateChatMode == 0 || privateChatMode == 1
										&& isFriendOrSelf(s1))) {
							if (chatTypeView == 2 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110) {
									int k1 = 4;
									newRegularFont.drawBasicString("From", k1,
											yPos, 0, -1);
									k1 += newRegularFont.getTextWidth("From ");
									switch (byte0) {
									case 1:
										modIcons[0].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 2:
										modIcons[1].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 3:
										modIcons[2].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 4:
										modIcons[3].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 5:
										modIcons[4].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 6:
										modIcons[5].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 7:
										modIcons[6].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									case 8:
										modIcons[7].drawSprite(k1, yPos - 12);
										k1 += 14;
										break;
									}
									newRegularFont.drawBasicString(s1 + ":",
											k1, yPos, 0, -1);
									k1 += newRegularFont.getTextWidth(s1) + 8;
									newRegularFont.drawBasicString(
											chatMessages[k], k1, yPos,
											0x800000, -1);
								}
								j++;
								j77++;
							}
						}
						if (chatType == 4
								&& (tradeMode == 0 || tradeMode == 1
										&& isFriendOrSelf(s1))) {
							if (chatTypeView == 3 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 210)
									newRegularFont.drawBasicString(s1 + " "
											+ chatMessages[k], 11, yPos,
											0x800080, -1);
								j++;
								j77++;
							}
						}
						if (chatType == 5 && splitPrivateChat == 0
								&& privateChatMode < 2) {
							if (chatTypeView == 2 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 210)
									newRegularFont.drawBasicString(
											chatMessages[k], 11, yPos,
											0x800000, -1);
								j++;
								j77++;
							}
						}
						if (chatType == 6
								&& (splitPrivateChat == 0 || chatTypeView == 2)
								&& privateChatMode < 2) {
							if (chatTypeView == 2 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 210) {
									newRegularFont.drawBasicString("To " + s1
											+ ":", 11, yPos, 0, -1);
									newRegularFont.drawBasicString(
											chatMessages[k],
											15 + newRegularFont
													.getTextWidth("To :" + s1),
											yPos, 0x800000, -1);
								}
								j++;
								j77++;
							}
						}
						if (chatType == 8
								&& (tradeMode == 0 || tradeMode == 1
										&& isFriendOrSelf(s1))) {
							if (chatTypeView == 3 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 210)
									newRegularFont.drawBasicString(s1 + " "
											+ chatMessages[k], 11, yPos,
											0x7e3200, -1);
								j++;
								j77++;
							}
							if (chatType == 11 && (clanChatMode == 0)) {
								if (chatTypeView == 11) {
									if (yPos > 0 && yPos < 210)
										newRegularFont.drawBasicString(s1 + " "
												+ chatMessages[k], 11, yPos,
												0x7e3200, -1);
									j++;
									j77++;
								}
							}
						}
						if (chatType == 12) {
							if (chatTypeView == 11 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 210) {
									String title = "<col=0000FF>"
											+ clanTitles[k] + "</col>";
									String username = (chatRights[k] > 0 ? "<img="
											+ (chatRights[k] - 1) + ">"
											: "")
											+ TextClass.fixName(chatNames[k]);
									String message = "<col=800000>"
											+ chatMessages[k] + "</col>";
									newRegularFont.drawBasicString("[" + title
											+ "] " + username + ": " + message,
											11, yPos, 0, -1);
								}
								j++;
								j77++;
							}
						}
						if (chatType == 16) {
							int j2 = 40 + 11;
							int clanNameWidth = textDrawingArea.getTextWidth(capitalize(clanname.toLowerCase()));
							if (chatTypeView == 11 || chatTypeView == 0) {
								if (yPos > 0 && yPos < 110)
									switch (chatRights[k]) {
									case 1:
										j2 += clanNameWidth;
										modIcons[0].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 2:
										j2 += clanNameWidth;
										modIcons[1].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 3:
										j2 += clanNameWidth;
										modIcons[2].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 4:
										j2 += clanNameWidth;
										modIcons[3].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 5:
										j2 += clanNameWidth;
										modIcons[4].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 6:
										j2 += clanNameWidth;
										modIcons[5].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 7:
										j2 += clanNameWidth;
										modIcons[6].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									case 8:
										j2 += clanNameWidth;
										modIcons[7].drawSprite(j2 - 18,
												yPos - 12);
										j2 += 15;
										break;
									default:
										j2 += clanNameWidth;
										break;
									}
								newRegularFont.drawBasicString("[", 8, yPos, 0,
										-1);
								newRegularFont.drawBasicString("]",
										clanNameWidth + 16, yPos, 0, -1);
								newRegularFont.drawBasicString(""
										+ capitalize(clanname) + "", 14, yPos,
										255, -1);
								newRegularFont.drawBasicString(
										capitalize(chatNames[k]) + ":",
										j2 - 17, yPos);
								j2 += newRegularFont.getTextWidth(chatNames[k]) + 7;
								newRegularFont.drawBasicString(
										capitalize(chatMessages[k]), j2 - 16,
										yPos, 0x800000, -1);

								j++;
								j77++;
							}
						}
					}
				DrawingArea.defaultDrawingAreaSize();
				anInt1211 = j * 14 + 7 + 5;
				if (anInt1211 < 111)
					anInt1211 = 111;
				drawScrollbar(114, anInt1211 - anInt1089 - 113, 7, 496,
						anInt1211);
				String s;
				int colour = titleColor(myPlayer.chatGlow);
				String glow = colour > 0 ? "<shad=" + colour + ">" : "";
				if (myPlayer != null && myPlayer.name != null)
					s = playerTitle(myPlayer.skill) + myPlayer.name;
				else
					s = TextClass.fixName(capitalize(myUsername));

				String glowingName = "<col=13132800>"
						+ playerTitle(myPlayer.skill) + "</col>" + glow
						+ TextClass.fixName(capitalize(myUsername));

				if (is508) {
					qc.drawSprite(textDrawingArea.getTextWidth(s) + 11, 123);
					newRegularFont.drawBasicString(glowingName, 11, 133, 0, -1);
					newRegularFont.drawBasicString(":",
							(25 + textDrawingArea.getTextWidth(s)), 133, 0, -1);
					newRegularFont.drawBasicString(inputString
							+ ((loopCycle % 40 < 20) ? "<col=0>|" : ""),
							23 + textDrawingArea.getTextWidth(s + ": "), 133,
							255, -1);
					DrawingArea.method339(121, 0x807660, 506, 7);
				} else {
					newRegularFont.drawBasicString(glowingName + ":", 11, 133,
							0, -1);
					newRegularFont.drawBasicString(inputString + ("*"),
							12 + textDrawingArea.getTextWidth(s + ": "), 133,
							255, -1);
					DrawingArea.method339(121, 0x807660, 506, 7);
				}
			}
		}
		drawChannelButtons();
		chatBackImage.drawGraphics(338, super.graphics, 0);
		inGameScreen.initDrawingArea();
		Texture.anIntArray1472 = anIntArray1182;
	}

	public void init() {
		try {
			System.out.println("Masterscape is loading..");
			nodeID = 10;// friends list order
			portOff = 0;
			setHighMem();
			isMembers = true;
			signlink.startpriv(InetAddress.getLocalHost());
			instance = this;
			initClientFrame(503, 765);// this it? 510 770
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void drawTabHover() {
		if (tabHPos == 0 && tabInterfaceIDs[0] != -1)
			tabHover.drawSprite(3 + 3, 0);
		else if (tabHPos == 1 && tabInterfaceIDs[1] != -1)
			tabHover.drawSprite(33 + 3, 0);
		else if (tabHPos == 2 && tabInterfaceIDs[2] != -1)
			tabHover.drawSprite(63 + 3, 0);
		else if (tabHPos == 3 && tabInterfaceIDs[14] != -1)
			tabHover.drawSprite(93 + 3, 0);
		else if (tabHPos == 4 && tabInterfaceIDs[3] != -1)
			tabHover.drawSprite(123 + 3, 0);
		else if (tabHPos == 5 && tabInterfaceIDs[4] != -1)
			tabHover.drawSprite(153 + 3, 0);
		else if (tabHPos == 6 && tabInterfaceIDs[5] != -1)
			tabHover.drawSprite(183 + 3, 0);
		else if (tabHPos == 7 && tabInterfaceIDs[6] != -1)
			tabHover.drawSprite(213 + 3, 0);
		else if (tabHPos == 15 && tabInterfaceIDs[16] != -1)
			tabHover.drawSprite(3 + 3, 298);
		else if (tabHPos == 8 && tabInterfaceIDs[9] != -1)
			tabHover.drawSprite(33 + 3, 298);
		else if (tabHPos == 9 && tabInterfaceIDs[8] != -1)
			tabHover.drawSprite(63 + 3, 298);
		else if (tabHPos == 10 && tabInterfaceIDs[7] != -1)
			tabHover.drawSprite(93 + 3, 298);
		else if (tabHPos == 11 && tabInterfaceIDs[11] != -1)
			tabHover.drawSprite(123 + 3, 298);
		else if (tabHPos == 12 && tabInterfaceIDs[12] != -1)
			tabHover.drawSprite(153 + 3, 298);
		else if (tabHPos == 13 && tabInterfaceIDs[13] != -1)
			tabHover.drawSprite(183 + 3, 298);
		else if (tabHPos == 14 && tabInterfaceIDs[15] != -1)
			tabHover.drawSprite(213 + 3, 298);
	}

	public void startRunnable(Runnable runnable, int i) {
		if (i > 10)
			i = 10;
		if (signlink.mainapp != null) {
			signlink.startthread(runnable, i);
		} else {
			super.startRunnable(runnable, i);

		}
	}

	public Socket openSocket(int port) throws IOException {
		return new Socket(InetAddress.getByName(server), port);
	}

	private void processMenuClick() {
		if (activeInterfaceType != 0)
			return;
		int j = super.clickMode3;
		if (spellSelected == 1 && super.saveClickX >= 503
				&& super.saveClickY >= 160 && super.saveClickX <= 765
				&& super.saveClickY <= 205)
			j = 0;
		if (menuOpen) {
			if (j != 1) {
				int k = super.mouseX;
				int j1 = super.mouseY;
				if (menuScreenArea == 0) {
					k -= 4;
					j1 -= 4;
				}
				if (menuScreenArea == 1) {
					k -= 516;// 519
					j1 -= 168;
				}
				if (menuScreenArea == 2) {
					k -= 5;
					j1 -= 338;
				}
				if (menuScreenArea == 3) {
					k -= 516;// 519
					j1 -= 0;
				}
				if (k < menuOffsetX - 10 || k > menuOffsetX + menuWidth + 10
						|| j1 < menuOffsetY - 10
						|| j1 > menuOffsetY + menuHeight + 10) {
					menuOpen = false;
					if (menuScreenArea == 1) {
					}
					if (menuScreenArea == 2)
						inputTaken = true;
				}
			}
			if (j == 1) {
				int l = menuOffsetX;
				int k1 = menuOffsetY;
				int i2 = menuWidth;
				int k2 = super.saveClickX;
				int l2 = super.saveClickY;
				if (menuScreenArea == 0) {
					k2 -= 4;
					l2 -= 4;
				}
				if (menuScreenArea == 1) {
					k2 -= 516;// 519
					l2 -= 168;
				}
				if (menuScreenArea == 2) {
					k2 -= 5;// 17
					l2 -= 338;
				}
				if (menuScreenArea == 3) {
					k2 -= 516;// 519
					l2 -= 0;
				}
				int i3 = -1;
				for (int j3 = 0; j3 < menuActionRow; j3++) {
					int k3 = k1 + 31 + (menuActionRow - 1 - j3) * 15;
					if (k2 > l && k2 < l + i2 && l2 > k3 - 13 && l2 < k3 + 3)
						i3 = j3;
				}
				System.out.println(i3);
				if (i3 != -1)
					doAction(i3);
				menuOpen = false;
				if (menuScreenArea == 1) {
				}
				if (menuScreenArea == 2) {
					inputTaken = true;
				}
			}
		} else {
			if (j == 1 && menuActionRow > 0) {
				int i1 = menuActionID[menuActionRow - 1];
				if (i1 == 632 || i1 == 78 || i1 == 867 || i1 == 431 || i1 == 53
						|| i1 == 74 || i1 == 454 || i1 == 539 || i1 == 493
						|| i1 == 847 || i1 == 447 || i1 == 1125) {
					int l1 = menuActionCmd2[menuActionRow - 1];
					int j2 = menuActionCmd3[menuActionRow - 1];
					RSInterface class9 = RSInterface.interfaceCache[j2];
					if (class9.allowSwapItems || class9.deletesTargetSlot) {
						aBoolean1242 = false;
						anInt989 = 0;
						anInt1084 = j2;
						anInt1085 = l1;
						activeInterfaceType = 2;
						anInt1087 = super.saveClickX;
						anInt1088 = super.saveClickY;
						if (RSInterface.interfaceCache[j2].parentID == openInterfaceID)
							activeInterfaceType = 1;
						if (RSInterface.interfaceCache[j2].parentID == backDialogID)
							activeInterfaceType = 3;
						return;
					}
				}
			}
			if (j == 1
					&& (anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1))
					&& menuActionRow > 2)
				j = 2;
			if (j == 1 && menuActionRow > 0)
				doAction(menuActionRow - 1);
			if (j == 2 && menuActionRow > 0)
				determineMenuSize();

		}
	}

	public static int totalRead = 0;

	public static String getFileNameWithoutExtension(String fileName) {
		File tmpFile = new File(fileName);
		tmpFile.getName();
		int whereDot = tmpFile.getName().lastIndexOf('.');
		if (0 < whereDot && whereDot <= tmpFile.getName().length() - 2) {
			return tmpFile.getName().substring(0, whereDot);
		}
		return "";
	}

	public void preloadModels() {
		File file = new File(signlink.findcachedir() + "Raw/");
		File[] fileArray = file.listFiles();
		for (int y = 0; y < fileArray.length; y++) {
			String s = fileArray[y].getName();
			byte[] buffer = ReadFile(signlink.findcachedir() + "Raw/" + s);
			Model.method460(buffer,
					Integer.parseInt(getFileNameWithoutExtension(s)));
		}
	}

	public static final byte[] ReadFile(String s) {
		try {
			byte abyte0[];
			File file = new File(s);
			int i = (int) file.length();
			abyte0 = new byte[i];
			DataInputStream datainputstream = new DataInputStream(
					new BufferedInputStream(new FileInputStream(s)));
			datainputstream.readFully(abyte0, 0, i);
			datainputstream.close();
			return abyte0;
		} catch (Exception e) {
			System.out.println((new StringBuilder()).append("Read Error: ")
					.append(s).toString());
			return null;
		}
	}

	public static void writeFile(byte[] data, String fileName)
			throws IOException {
		OutputStream out = new FileOutputStream(fileName);
		out.write(data);
		out.close();
	}

	public final void method22() {
		try {
			anInt985 = -1;
			aClass19_1056.removeAll();
			aClass19_1013.removeAll();
			Texture.method366();
			unlinkMRUNodes();
			worldController.initToNull();
			System.gc();
			for (int i = 0; i < 4; i++)
				aClass11Array1230[i].method210();
			for (int l = 0; l < 4; l++) {
				for (int k1 = 0; k1 < 104; k1++) {
					for (int j2 = 0; j2 < 104; j2++)
						byteGroundArray[l][k1][j2] = 0;
				}
			}
			ObjectManager objectManager = new ObjectManager(byteGroundArray,
					intGroundArray);
			int k2 = aByteArrayArray1183.length;
			int k18 = 64;
			for (int A = 0; A < k2; A++)
				for (int B = 0; B < 2000; B++)
					if (anIntArray1234[A] == positions[B]) {
						anIntArray1235[A] = landScapes[B];
						anIntArray1236[A] = objects[B];
					}
			stream.createFrame(0);
			if (!aBoolean1159) {
				for (int i3 = 0; i3 < k2; i3++) {
					int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
					int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
					byte abyte0[] = aByteArrayArray1183[i3];
					if (FileOperations.FileExists(signlink.findcachedir()
							+ "Maps/Maps/" + anIntArray1235[i3] + ".dat"))
						abyte0 = FileOperations.ReadFile(signlink
								.findcachedir()
								+ "Maps/Maps/"
								+ anIntArray1235[i3] + ".dat");
					if (abyte0 != null)
						objectManager.method180(abyte0, k5, i4,
								(anInt1069 - 6) * 8, (anInt1070 - 6) * 8,
								aClass11Array1230);
				}
				for (int j4 = 0; j4 < k2; j4++) {
					int l5 = (anIntArray1234[j4] >> 8) * k18 - baseX;
					int k7 = (anIntArray1234[j4] & 0xff) * k18 - baseY;
					byte abyte2[] = aByteArrayArray1183[j4];
					if (abyte2 == null && anInt1070 < 800)
						objectManager.method174(k7, 64, 64, l5);
				}
				anInt1097++;
				if (anInt1097 > 160) {
					anInt1097 = 0;
					stream.createFrame(238);
					stream.writeWordBigEndian(96);
				}
				stream.createFrame(0);
				for (int i6 = 0; i6 < k2; i6++) {
					byte abyte1[] = aByteArrayArray1247[i6];
					if (FileOperations.FileExists(signlink.findcachedir()
							+ "Maps/Maps/" + anIntArray1236[i6] + ".dat"))
						abyte1 = FileOperations.ReadFile(signlink
								.findcachedir()
								+ "Maps/Maps/"
								+ anIntArray1236[i6] + ".dat");
					if (abyte1 != null) {
						int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
						int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
						objectManager.method190(l8, aClass11Array1230, k9,
								worldController, abyte1);
					}
				}
			}
			if (aBoolean1159) {
				for (int j3 = 0; j3 < 4; j3++) {
					for (int k4 = 0; k4 < 13; k4++) {
						for (int j6 = 0; j6 < 13; j6++) {
							int l7 = anIntArrayArrayArray1129[j3][k4][j6];
							if (l7 != -1) {
								int i9 = l7 >> 24 & 3;
								int l9 = l7 >> 1 & 3;
								int j10 = l7 >> 14 & 0x3ff;
								int l10 = l7 >> 3 & 0x7ff;
								int j11 = (j10 / 8 << 8) + l10 / 8;
								for (int l11 = 0; l11 < anIntArray1234.length; l11++) {
									if (anIntArray1234[l11] != j11
											|| aByteArrayArray1183[l11] == null)
										continue;
									objectManager.method179(i9, l9,
											aClass11Array1230, k4 * 8,
											(j10 & 7) * 8,
											aByteArrayArray1183[l11],
											(l10 & 7) * 8, j3, j6 * 8);
									break;
								}

							}
						}

					}

				}
				for (int l4 = 0; l4 < 13; l4++) {
					for (int k6 = 0; k6 < 13; k6++) {
						int i8 = anIntArrayArrayArray1129[0][l4][k6];
						if (i8 == -1)
							objectManager.method174(k6 * 8, 8, 8, l4 * 8);
					}
				}
				stream.createFrame(0);
				for (int l6 = 0; l6 < 4; l6++) {
					for (int j8 = 0; j8 < 13; j8++) {
						for (int j9 = 0; j9 < 13; j9++) {
							int i10 = anIntArrayArrayArray1129[l6][j8][j9];
							if (i10 != -1) {
								int k10 = i10 >> 24 & 3;
								int i11 = i10 >> 1 & 3;
								int k11 = i10 >> 14 & 0x3ff;
								int i12 = i10 >> 3 & 0x7ff;
								int j12 = (k11 / 8 << 8) + i12 / 8;
								for (int k12 = 0; k12 < anIntArray1234.length; k12++) {
									if (anIntArray1234[k12] != j12
											|| aByteArrayArray1247[k12] == null)
										continue;
									objectManager.method183(aClass11Array1230,
											worldController, k10, j8 * 8,
											(i12 & 7) * 8, l6,
											aByteArrayArray1247[k12],
											(k11 & 7) * 8, i11, j9 * 8);
									break;
								}
							}
						}
					}
				}
			}
			stream.createFrame(0);
			objectManager.method171(aClass11Array1230, worldController);
			inGameScreen.initDrawingArea();
			stream.createFrame(0);
			int k3 = ObjectManager.anInt145;
			if (k3 > plane)
				k3 = plane;
			if (k3 < plane - 1)
				k3 = plane - 1;
			if (lowMem)
				worldController.method275(ObjectManager.anInt145);
			else
				worldController.method275(0);
			for (int i5 = 0; i5 < 104; i5++) {
				for (int i7 = 0; i7 < 104; i7++)
					spawnGroundItem(i5, i7);
			}
			anInt1051++;
			if (anInt1051 > 98) {
				anInt1051 = 0;
				stream.createFrame(150);
			}
			method63();
		} catch (Exception exception) {
		}
		ObjectDef.mruNodes1.unlinkAll();
		if (super.gameFrame != null) {
			stream.createFrame(210);
			stream.writeDWord(0x3f008edd);
		}
		System.gc();
		Texture.method367();
		onDemandFetcher.method566();
		int k = (anInt1069 - 6) / 8 - 1;
		int j1 = (anInt1069 + 6) / 8 + 1;
		int i2 = (anInt1070 - 6) / 8 - 1;
		int l2 = (anInt1070 + 6) / 8 + 1;
		if (aBoolean1141) {
			k = 49;
			j1 = 50;
			i2 = 49;
			l2 = 50;
		}
		for (int l3 = k; l3 <= j1; l3++) {
			for (int j5 = i2; j5 <= l2; j5++)
				if (l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
					int j7 = onDemandFetcher.method562(0, j5, l3);
					if (j7 != -1)
						onDemandFetcher.method560(j7, 3);
					int k8 = onDemandFetcher.method562(1, j5, l3);
					if (k8 != -1)
						onDemandFetcher.method560(k8, 3);
				}
		}
	}

	private void unlinkMRUNodes() {
		ObjectDef.mruNodes1.unlinkAll();
		ObjectDef.mruNodes2.unlinkAll();
		EntityDef.mruNodes.unlinkAll();
		ItemDef.mruNodes2.unlinkAll();
		ItemDef.mruNodes1.unlinkAll();
		Player.mruNodes.unlinkAll();
		SpotAnim.aMRUNodes_415.unlinkAll();
	}

	private void method24(int i) {
		int ai[] = aSprite_1263.myPixels;
		int j = ai.length;
		for (int k = 0; k < j; k++)
			ai[k] = 0;

		for (int l = 1; l < 103; l++) {
			int i1 = 24628 + (103 - l) * 512 * 4;
			for (int k1 = 1; k1 < 103; k1++) {

				if ((byteGroundArray[i][k1][l] & 0x18) == 0)
					worldController.method309(ai, i1, i, k1, l);
				if (i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
					worldController.method309(ai, i1, i + 1, k1, l);
				i1 += 4;
			}

		}

		int j1 = ((238 + (int) (Math.random() * 20D)) - 10 << 16)
				+ ((238 + (int) (Math.random() * 20D)) - 10 << 8)
				+ ((238 + (int) (Math.random() * 20D)) - 10);
		int l1 = (238 + (int) (Math.random() * 20D)) - 10 << 16;
		aSprite_1263.method343();
		for (int i2 = 1; i2 < 103; i2++) {
			for (int j2 = 1; j2 < 103; j2++) {
				if ((byteGroundArray[i][j2][i2] & 0x18) == 0)
					method50(i2, j1, j2, l1, i);
				if (i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
					method50(i2, j1, j2, l1, i + 1);
			}

		}

		inGameScreen.initDrawingArea();
		anInt1071 = 0;
		for (int k2 = 0; k2 < 104; k2++) {
			for (int l2 = 0; l2 < 104; l2++) {
				int i3 = worldController.method303(plane, k2, l2);
				if (i3 != 0) {
					i3 = i3 >> 14 & 0x7fff;
					int j3 = ObjectDef.forID(i3).anInt746;
					if (j3 >= 0) {
						int k3 = k2;
						int l3 = l2;
						if (j3 != 22 && j3 != 29 && j3 != 34 && j3 != 36
								&& j3 != 46 && j3 != 47 && j3 != 48) {
							byte byte0 = 104;
							byte byte1 = 104;
							int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
							for (int i4 = 0; i4 < 10; i4++) {
								int j4 = (int) (Math.random() * 4D);
								if (j4 == 0 && k3 > 0 && k3 > k2 - 3
										&& (ai1[k3 - 1][l3] & 0x1280108) == 0)
									k3--;
								if (j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3
										&& (ai1[k3 + 1][l3] & 0x1280180) == 0)
									k3++;
								if (j4 == 2 && l3 > 0 && l3 > l2 - 3
										&& (ai1[k3][l3 - 1] & 0x1280102) == 0)
									l3--;
								if (j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3
										&& (ai1[k3][l3 + 1] & 0x1280120) == 0)
									l3++;
							}

						}
						aSpriteArray1140[anInt1071] = mapFunctions[j3];
						anIntArray1072[anInt1071] = k3;
						anIntArray1073[anInt1071] = l3;
						anInt1071++;
					}
				}
			}

		}

	}

	private void spawnGroundItem(int i, int j) {
		NodeList class19 = groundArray[plane][i][j];
		if (class19 == null) {
			worldController.method295(plane, i, j);
			return;
		}
		int k = 0xfa0a1f01;
		Object obj = null;
		for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
				.reverseGetNext()) {
			ItemDef itemDef = ItemDef.forID(item.ID);
			int l = itemDef.value;
			if (itemDef.stackable)
				l *= item.anInt1559 + 1;
			// notifyItemSpawn(item, i + baseX, j + baseY);
			if (l > k) {
				k = l;
				obj = item;
			}
		}
		class19.insertTail(((Node) (obj)));
		Object obj1 = null;
		Object obj2 = null;
		for (Item class30_sub2_sub4_sub2_1 = (Item) class19.reverseGetFirst(); class30_sub2_sub4_sub2_1 != null; class30_sub2_sub4_sub2_1 = (Item) class19
				.reverseGetNext()) {
			if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
					&& obj1 == null)
				obj1 = class30_sub2_sub4_sub2_1;
			if (class30_sub2_sub4_sub2_1.ID != ((Item) (obj)).ID
					&& class30_sub2_sub4_sub2_1.ID != ((Item) (obj1)).ID
					&& obj2 == null)
				obj2 = class30_sub2_sub4_sub2_1;
		}
		int i1 = i + (j << 7) + 0x60000000;
		worldController.method281(i, i1, ((Animable) (obj1)),
				method42(plane, j * 128 + 64, i * 128 + 64),
				((Animable) (obj2)), ((Animable) (obj)), plane, j);
	}

	private void method26(boolean flag) {
		for (int j = 0; j < npcCount; j++) {
			NPC npc = npcArray[npcIndices[j]];
			int k = 0x20000000 + (npcIndices[j] << 14);
			if (npc == null || !npc.isVisible() || npc.desc.aBoolean93 != flag)
				continue;
			int l = npc.x >> 7;
			int i1 = npc.y >> 7;
			if (l < 0 || l >= 104 || i1 < 0 || i1 >= 104)
				continue;
			if (npc.anInt1540 == 1 && (npc.x & 0x7f) == 64
					&& (npc.y & 0x7f) == 64) {
				if (anIntArrayArray929[l][i1] == anInt1265)
					continue;
				anIntArrayArray929[l][i1] = anInt1265;
			}
			if (!npc.desc.aBoolean84)
				k += 0x80000000;
			worldController
					.method285(plane, npc.anInt1552,
							method42(plane, npc.y, npc.x), k, npc.y,
							(npc.anInt1540 - 1) * 64 + 60, npc.x, npc,
							npc.aBoolean1541);
		}
	}

	public void drawHoverBox(int xPos, int yPos, String text) {
		String[] results = text.split("\n");
		int height = (results.length * 16) + 3;
		int width;
		width = aTextDrawingArea_1271.getTextWidth(results[0]) + 6;
		for (int i = 1; i < results.length; i++)
			if (width <= aTextDrawingArea_1271.getTextWidth(results[i]) + 6)
				width = aTextDrawingArea_1271.getTextWidth(results[i]) + 6;
		DrawingArea.drawPixels(height, yPos, xPos, 0xFFFFA0, width);
		DrawingArea.fillPixels(xPos, width, height, 0, yPos);
		yPos += 14;
		for (int i = 0; i < results.length; i++) {
			aTextDrawingArea_1271.method389(false, xPos + 3, 0, results[i],
					yPos);
			yPos += 16;
		}
	}

	public void drawBlackBox(int xPos, int yPos) {
		DrawingArea.drawPixels(71, yPos - 1, xPos - 2, 0x726451, 1);
		DrawingArea.drawPixels(69, yPos, xPos + 174, 0x726451, 1);
		DrawingArea.drawPixels(1, yPos - 2, xPos - 2, 0x726451, 178);
		DrawingArea.drawPixels(1, yPos + 68, xPos, 0x726451, 174);
		DrawingArea.drawPixels(71, yPos - 1, xPos - 1, 0x2E2B23, 1);
		DrawingArea.drawPixels(71, yPos - 1, xPos + 175, 0x2E2B23, 1);
		DrawingArea.drawPixels(1, yPos - 1, xPos, 0x2E2B23, 175);
		DrawingArea.drawPixels(1, yPos + 69, xPos, 0x2E2B23, 175);
		DrawingArea.method335(0, yPos, 174, 68, 220, xPos);
	}

	private void buildInterfaceMenu(int i, RSInterface class9, int k, int l,
			int i1, int j1) {
		if (class9.interfaceType != 0 || class9.children == null
				|| class9.interfaceShown)
			return;
		if (k < i || i1 < l || k > i + class9.width || i1 > l + class9.height)
			return;
		int k1 = class9.children.length;
		for (int l1 = 0; l1 < k1; l1++) {
			int i2 = class9.childX[l1] + i;
			int j2 = (class9.childY[l1] + l) - j1;
			RSInterface class9_1 = RSInterface.interfaceCache[class9.children[l1]];
			i2 += class9_1.xOffset;
			j2 += class9_1.yOffset;
			if ((class9_1.hoverType >= 0 || class9_1.disabledHoverColor != 0)
					&& k >= i2 && i1 >= j2 && k < i2 + class9_1.width
					&& i1 < j2 + class9_1.height)
				if (class9_1.hoverType >= 0)
					anInt886 = class9_1.hoverType;
				else
					anInt886 = class9_1.id;
			if (class9_1.interfaceType == 8 && k >= i2 && i1 >= j2
					&& k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
				anInt1315 = class9_1.id;
			}
			if (class9_1.interfaceType == 0) {
				buildInterfaceMenu(i2, class9_1, k, j2, i1,
						class9_1.scrollPosition);
				if (class9_1.scrollMax > class9_1.height)
					method65(i2 + class9_1.width, class9_1.height, k, i1,
							class9_1, j2, true, class9_1.scrollMax);
			} else {
				if (class9_1.atActionType == 1 && k >= i2 && i1 >= j2
						&& k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
					boolean flag = false;
					if (class9_1.contentType != 0)
						flag = buildFriendsListMenu(class9_1);
					if (!flag) {
						// System.out.println("1"+class9_1.tooltip + ", " +
						// class9_1.interfaceID);
						if (idToggle == true) {
							menuActionName[menuActionRow] = class9_1.tooltip
									+ ", " + class9_1.id;
							menuActionID[menuActionRow] = 315;
							menuActionCmd3[menuActionRow] = class9_1.id;
							menuActionRow++;
						} else {
							menuActionName[menuActionRow] = class9_1.tooltip;
							menuActionID[menuActionRow] = 315;
							menuActionCmd3[menuActionRow] = class9_1.id;
							menuActionRow++;
						}
					}
				}
				if (class9_1.atActionType == 2 && spellSelected == 0 && k >= i2
						&& i1 >= j2 && k < i2 + class9_1.width
						&& i1 < j2 + class9_1.height) {
					String s = class9_1.selectedActionName;
					if (s.indexOf("") != -1)
						s = s.substring(0, s.indexOf(" "));
					if (class9_1.spellName.endsWith("Rush")
							|| class9_1.spellName.endsWith("Burst")
							|| class9_1.spellName.endsWith("Blitz")
							|| class9_1.spellName.endsWith("Barrage")
							|| class9_1.spellName.endsWith("strike")
							|| class9_1.spellName.endsWith("bolt")
							|| class9_1.spellName.equals("Crumble undead")
							|| class9_1.spellName.endsWith("blast")
							|| class9_1.spellName.endsWith("wave")
							|| class9_1.spellName.equals("Claws of Guthix")
							|| class9_1.spellName.equals("Flames of Zamorak")
							|| class9_1.spellName.equals("Magic Dart")) {
						menuActionName[menuActionRow] = "Autocast @gre@"
								+ class9_1.spellName;
						menuActionID[menuActionRow] = 104;
						menuActionCmd3[menuActionRow] = class9_1.id;
						menuActionRow++;
					}
					menuActionName[menuActionRow] = s + " @gre@"
							+ class9_1.spellName;
					menuActionID[menuActionRow] = 626;
					menuActionCmd3[menuActionRow] = class9_1.id;
					menuActionRow++;
				}
				if (class9_1.atActionType == 3 && k >= i2 && i1 >= j2
						&& k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
					menuActionName[menuActionRow] = "Close";
					menuActionID[menuActionRow] = 200;
					menuActionCmd3[menuActionRow] = class9_1.id;
					menuActionRow++;
				}
				if (class9_1.atActionType == 4 && k >= i2 && i1 >= j2
						&& k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
					// System.out.println("2"+class9_1.tooltip + ", " +
					// class9_1.interfaceID);
					if (idToggle == true) {
						menuActionName[menuActionRow] = class9_1.tooltip + ", "
								+ class9_1.id;
						menuActionID[menuActionRow] = 169;
						menuActionCmd3[menuActionRow] = class9_1.id;
						menuActionRow++;
					} else {
						menuActionName[menuActionRow] = class9_1.tooltip;
						menuActionID[menuActionRow] = 169;
						menuActionCmd3[menuActionRow] = class9_1.id;
						menuActionRow++;
					}
					if (class9_1.hoverText != null) {
						// drawHoverBox(k, l, class9_1.hoverText);
						// System.out.println("DRAWING INTERFACE: " +
						// class9_1.hoverText);
					}
				}
				if (class9_1.atActionType == 5 && k >= i2 && i1 >= j2
						&& k < i2 + class9_1.width && i1 < j2 + class9_1.height) {
					// System.out.println("3"+class9_1.tooltip + ", " +
					// class9_1.interfaceID);
					if (idToggle == true) {
						menuActionName[menuActionRow] = class9_1.tooltip + ", "
								+ class9_1.id;
						menuActionID[menuActionRow] = 646;
						menuActionCmd3[menuActionRow] = class9_1.id;
						menuActionRow++;
					} else {
						menuActionName[menuActionRow] = class9_1.tooltip;
						menuActionID[menuActionRow] = 646;
						menuActionCmd3[menuActionRow] = class9_1.id;
						menuActionRow++;
					}
				}
				if (class9_1.atActionType == 6 && !aBoolean1149 && k >= i2
						&& i1 >= j2 && k < i2 + class9_1.width
						&& i1 < j2 + class9_1.height) {
					// System.out.println("4"+class9_1.tooltip + ", " +
					// class9_1.interfaceID);
					if (idToggle == true) {
						menuActionName[menuActionRow] = class9_1.tooltip + ", "
								+ class9_1.id;
						menuActionID[menuActionRow] = 679;
						menuActionCmd3[menuActionRow] = class9_1.id;
						menuActionRow++;
					} else {
						menuActionName[menuActionRow] = class9_1.tooltip;
						menuActionID[menuActionRow] = 679;
						menuActionCmd3[menuActionRow] = class9_1.id;
						menuActionRow++;
					}
				}
				if (k >= i2 && i1 >= j2
						&& k < i2 + (class9_1.type == 4 ? 100 : class9_1.width)
						&& i1 < j2 + class9_1.height) {
					if (class9_1.actions != null) {
						if (class9_1.type == 4
								&& class9_1.disabledMessage.length() > 0
								|| class9_1.type == 5) {
							for (int action = class9_1.actions.length - 1; action >= 0; action--) {
								if (class9_1.actions[action] != null) {
									String kl = class9_1.actions[action]
											+ (class9_1.type == 4 ? " " : "");
									menuActionName[menuActionRow] = kl;
									menuActionID[menuActionRow] = 647;
									menuActionCmd2[menuActionRow] = action;
									menuActionCmd3[menuActionRow] = class9_1.id;
									menuActionRow++;
								}
							}
						}
					}
				}
				if (class9_1.interfaceType == 2) {
					int k2 = 0;
					for (int l2 = 0; l2 < class9_1.height; l2++) {
						for (int i3 = 0; i3 < class9_1.width; i3++) {
							int j3 = i2 + i3 * (32 + class9_1.invSpritePadX);
							int k3 = j2 + l2 * (32 + class9_1.invSpritePadY);
							if (k2 < 20) {
								j3 += class9_1.spritesX[k2];
								k3 += class9_1.spritesY[k2];
							}
							if (k >= j3 && i1 >= k3 && k < j3 + 32
									&& i1 < k3 + 32) {
								mouseInvInterfaceIndex = k2;
								lastActiveInvInterface = class9_1.id;
								if (class9_1.inventory[k2] > 0) {
									ItemDef itemDef = ItemDef
											.forID(class9_1.inventory[k2] - 1);
									if (itemSelected == 1
											&& class9_1.isInventoryInterface) {
										if (class9_1.id != anInt1284
												|| k2 != anInt1283) {
											menuActionName[menuActionRow] = "Use "
													+ selectedItemName
													+ " -> @lre@"
													+ itemDef.name;
											menuActionID[menuActionRow] = 870;
											menuActionCmd1[menuActionRow] = itemDef.ID;
											menuActionCmd2[menuActionRow] = k2;
											menuActionCmd3[menuActionRow] = class9_1.id;
											menuActionRow++;
										}
									} else if (spellSelected == 1
											&& class9_1.isInventoryInterface) {
										if ((spellUsableOn & 0x10) == 16) {
											menuActionName[menuActionRow] = spellTooltip
													+ " @lre@" + itemDef.name;
											menuActionID[menuActionRow] = 543;
											menuActionCmd1[menuActionRow] = itemDef.ID;
											menuActionCmd2[menuActionRow] = k2;
											menuActionCmd3[menuActionRow] = class9_1.id;
											menuActionRow++;
										}
									} else {
										if (class9_1.isInventoryInterface) {
											for (int l3 = 4; l3 >= 3; l3--)
												if (itemDef.actions != null
														&& itemDef.actions[l3] != null) {
													menuActionName[menuActionRow] = itemDef.actions[l3]
															+ " @lre@"
															+ itemDef.name;
													if (l3 == 3)
														menuActionID[menuActionRow] = 493;
													if (l3 == 4)
														menuActionID[menuActionRow] = 847;
													menuActionCmd1[menuActionRow] = itemDef.ID;
													menuActionCmd2[menuActionRow] = k2;
													menuActionCmd3[menuActionRow] = class9_1.id;
													menuActionRow++;
												} else if (l3 == 4) {
													menuActionName[menuActionRow] = "Drop @lre@"
															+ itemDef.name;
													menuActionID[menuActionRow] = 847;
													menuActionCmd1[menuActionRow] = itemDef.ID;
													menuActionCmd2[menuActionRow] = k2;
													menuActionCmd3[menuActionRow] = class9_1.id;
													menuActionRow++;
												}

										}
										if (class9_1.usableItemInterface) {
											menuActionName[menuActionRow] = "Use @lre@"
													+ itemDef.name;
											menuActionID[menuActionRow] = 447;
											menuActionCmd1[menuActionRow] = itemDef.ID;
											// k2 = inventory spot
											// System.out.println(k2);
											menuActionCmd2[menuActionRow] = k2;
											menuActionCmd3[menuActionRow] = class9_1.id;
											menuActionRow++;
										}
										if (class9_1.isInventoryInterface
												&& itemDef.actions != null) {
											for (int i4 = 2; i4 >= 0; i4--)
												if (itemDef.actions[i4] != null) {
													menuActionName[menuActionRow] = itemDef.actions[i4]
															+ " @lre@"
															+ itemDef.name;
													if (i4 == 0)
														menuActionID[menuActionRow] = 74;
													if (i4 == 1)
														menuActionID[menuActionRow] = 454;
													if (i4 == 2)
														menuActionID[menuActionRow] = 539;
													menuActionCmd1[menuActionRow] = itemDef.ID;
													menuActionCmd2[menuActionRow] = k2;
													menuActionCmd3[menuActionRow] = class9_1.id;
													menuActionRow++;
												}

										}
										if (class9_1.actions != null) {
											for (int j4 = 4; j4 >= 0; j4--)
												if (class9_1.actions[j4] != null) {
													menuActionName[menuActionRow] = class9_1.actions[j4]
															+ " @lre@"
															+ itemDef.name;
													if (j4 == 0)
														menuActionID[menuActionRow] = 632;
													if (j4 == 1)
														menuActionID[menuActionRow] = 78;
													if (j4 == 2)
														menuActionID[menuActionRow] = 867;
													if (j4 == 3)
														menuActionID[menuActionRow] = 431;
													if (j4 == 4)
														menuActionID[menuActionRow] = 53;
													menuActionCmd1[menuActionRow] = itemDef.ID;
													menuActionCmd2[menuActionRow] = k2;
													menuActionCmd3[menuActionRow] = class9_1.id;
													menuActionRow++;
												}

										}
										if (idToggle == true) {
											menuActionName[menuActionRow] = "Examine @lre@"
													+ itemDef.name
													+ " @gre@(@whi@"
													+ (class9_1.inventory[k2] - 1)
													+ "@gre@)";
										} else {
											menuActionName[menuActionRow] = "Examine @lre@"
													+ itemDef.name;
										}
										menuActionID[menuActionRow] = 1125;
										menuActionCmd1[menuActionRow] = itemDef.ID;
										menuActionCmd2[menuActionRow] = k2;
										menuActionCmd3[menuActionRow] = class9_1.id;
										menuActionRow++;
									}
								}
							}
							k2++;
						}

					}

				}
			}
		}

	}

	public void drawScrollbar(int j, int k, int l, int i1, int j1) {
		if (is474 || is480 || is508 || is525 || is562) {
			scrollBar1.drawSprite(i1, l);
			scrollBar2.drawSprite(i1, (l + j) - 16);
			DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 16);
			DrawingArea.drawPixels(j - 32, l + 16, i1, 0x3d3426, 15);
			DrawingArea.drawPixels(j - 32, l + 16, i1, 0x342d21, 13);
			DrawingArea.drawPixels(j - 32, l + 16, i1, 0x2e281d, 11);
			DrawingArea.drawPixels(j - 32, l + 16, i1, 0x29241b, 10);
			DrawingArea.drawPixels(j - 32, l + 16, i1, 0x252019, 9);
			DrawingArea.drawPixels(j - 32, l + 16, i1, 0x000001, 1);
			int k1 = ((j - 32) * j) / j1;
			if (k1 < 8)
				k1 = 8;
			int l1 = ((j - 32 - k1) * k) / (j1 - j);
			DrawingArea.drawPixels(k1, l + 16 + l1, i1, barFillColor, 16);
			DrawingArea.method341(l + 16 + l1, 0x000001, k1, i1);
			DrawingArea.method341(l + 16 + l1, 0x817051, k1, i1 + 1);
			DrawingArea.method341(l + 16 + l1, 0x73654a, k1, i1 + 2);
			DrawingArea.method341(l + 16 + l1, 0x6a5c43, k1, i1 + 3);
			DrawingArea.method341(l + 16 + l1, 0x6a5c43, k1, i1 + 4);
			DrawingArea.method341(l + 16 + l1, 0x655841, k1, i1 + 5);
			DrawingArea.method341(l + 16 + l1, 0x655841, k1, i1 + 6);
			DrawingArea.method341(l + 16 + l1, 0x61553e, k1, i1 + 7);
			DrawingArea.method341(l + 16 + l1, 0x61553e, k1, i1 + 8);
			DrawingArea.method341(l + 16 + l1, 0x5d513c, k1, i1 + 9);
			DrawingArea.method341(l + 16 + l1, 0x5d513c, k1, i1 + 10);
			DrawingArea.method341(l + 16 + l1, 0x594e3a, k1, i1 + 11);
			DrawingArea.method341(l + 16 + l1, 0x594e3a, k1, i1 + 12);
			DrawingArea.method341(l + 16 + l1, 0x514635, k1, i1 + 13);
			DrawingArea.method341(l + 16 + l1, 0x4b4131, k1, i1 + 14);
			DrawingArea.method339(l + 16 + l1, 0x000001, 15, i1);
			DrawingArea.method339(l + 17 + l1, 0x000001, 15, i1);
			DrawingArea.method339(l + 17 + l1, 0x655841, 14, i1);
			DrawingArea.method339(l + 17 + l1, 0x6a5c43, 13, i1);
			DrawingArea.method339(l + 17 + l1, 0x6d5f48, 11, i1);
			DrawingArea.method339(l + 17 + l1, 0x73654a, 10, i1);
			DrawingArea.method339(l + 17 + l1, 0x76684b, 7, i1);
			DrawingArea.method339(l + 17 + l1, 0x7b6a4d, 5, i1);
			DrawingArea.method339(l + 17 + l1, 0x7e6e50, 4, i1);
			DrawingArea.method339(l + 17 + l1, 0x817051, 3, i1);
			DrawingArea.method339(l + 17 + l1, 0x000001, 2, i1);
			DrawingArea.method339(l + 18 + l1, 0x000001, 16, i1);
			DrawingArea.method339(l + 18 + l1, 0x564b38, 15, i1);
			DrawingArea.method339(l + 18 + l1, 0x5d513c, 14, i1);
			DrawingArea.method339(l + 18 + l1, 0x625640, 11, i1);
			DrawingArea.method339(l + 18 + l1, 0x655841, 10, i1);
			DrawingArea.method339(l + 18 + l1, 0x6a5c43, 7, i1);
			DrawingArea.method339(l + 18 + l1, 0x6e6046, 5, i1);
			DrawingArea.method339(l + 18 + l1, 0x716247, 4, i1);
			DrawingArea.method339(l + 18 + l1, 0x7b6a4d, 3, i1);
			DrawingArea.method339(l + 18 + l1, 0x817051, 2, i1);
			DrawingArea.method339(l + 18 + l1, 0x000001, 1, i1);
			DrawingArea.method339(l + 19 + l1, 0x000001, 16, i1);
			DrawingArea.method339(l + 19 + l1, 0x514635, 15, i1);
			DrawingArea.method339(l + 19 + l1, 0x564b38, 14, i1);
			DrawingArea.method339(l + 19 + l1, 0x5d513c, 11, i1);
			DrawingArea.method339(l + 19 + l1, 0x61553e, 9, i1);
			DrawingArea.method339(l + 19 + l1, 0x655841, 7, i1);
			DrawingArea.method339(l + 19 + l1, 0x6a5c43, 5, i1);
			DrawingArea.method339(l + 19 + l1, 0x6e6046, 4, i1);
			DrawingArea.method339(l + 19 + l1, 0x73654a, 3, i1);
			DrawingArea.method339(l + 19 + l1, 0x817051, 2, i1);
			DrawingArea.method339(l + 19 + l1, 0x000001, 1, i1);
			DrawingArea.method339(l + 20 + l1, 0x000001, 16, i1);
			DrawingArea.method339(l + 20 + l1, 0x4b4131, 15, i1);
			DrawingArea.method339(l + 20 + l1, 0x544936, 14, i1);
			DrawingArea.method339(l + 20 + l1, 0x594e3a, 13, i1);
			DrawingArea.method339(l + 20 + l1, 0x5d513c, 10, i1);
			DrawingArea.method339(l + 20 + l1, 0x61553e, 8, i1);
			DrawingArea.method339(l + 20 + l1, 0x655841, 6, i1);
			DrawingArea.method339(l + 20 + l1, 0x6a5c43, 4, i1);
			DrawingArea.method339(l + 20 + l1, 0x73654a, 3, i1);
			DrawingArea.method339(l + 20 + l1, 0x817051, 2, i1);
			DrawingArea.method339(l + 20 + l1, 0x000001, 1, i1);
			DrawingArea.method341(l + 16 + l1, 0x000001, k1, i1 + 15);
			DrawingArea.method339(l + 15 + l1 + k1, 0x000001, 16, i1);
			DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 15, i1);
			DrawingArea.method339(l + 14 + l1 + k1, 0x3f372a, 14, i1);
			DrawingArea.method339(l + 14 + l1 + k1, 0x443c2d, 10, i1);
			DrawingArea.method339(l + 14 + l1 + k1, 0x483e2f, 9, i1);
			DrawingArea.method339(l + 14 + l1 + k1, 0x4a402f, 7, i1);
			DrawingArea.method339(l + 14 + l1 + k1, 0x4b4131, 4, i1);
			DrawingArea.method339(l + 14 + l1 + k1, 0x564b38, 3, i1);
			DrawingArea.method339(l + 14 + l1 + k1, 0x000001, 2, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 16, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x443c2d, 15, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x4b4131, 11, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x514635, 9, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x544936, 7, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x564b38, 6, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x594e3a, 4, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x625640, 3, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x6a5c43, 2, i1);
			DrawingArea.method339(l + 13 + l1 + k1, 0x000001, 1, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 16, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x443c2d, 15, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x4b4131, 14, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x544936, 12, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x564b38, 11, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x594e3a, 10, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x5d513c, 7, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x61553e, 4, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x6e6046, 3, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x7b6a4d, 2, i1);
			DrawingArea.method339(l + 12 + l1 + k1, 0x000001, 1, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 16, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x4b4131, 15, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x514635, 14, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x564b38, 13, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x594e3a, 11, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x5d513c, 9, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x61553e, 7, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x655841, 5, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x6a5c43, 4, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x73654a, 3, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x7b6a4d, 2, i1);
			DrawingArea.method339(l + 11 + l1 + k1, 0x000001, 1, i1);
		} else {
			scrollBar3.drawSprite(i1, l);
			scrollBar4.drawSprite(i1, (l + j) - 16);
			DrawingArea.method336(j - 32, l + 16, i1, anInt1002, 16);
			int k1 = ((j - 32) * j) / j1;
			if (k1 < 8)
				k1 = 8;
			int l1 = ((j - 32 - k1) * k) / (j1 - j);
			DrawingArea.method336(k1, l + 16 + l1, i1, barFillColor, 16);
			DrawingArea.method341(l + 16 + l1, anInt902, k1, i1);
			DrawingArea.method341(l + 16 + l1, anInt902, k1, i1 + 1);
			DrawingArea.method339(l + 16 + l1, anInt902, 16, i1);
			DrawingArea.method339(l + 17 + l1, anInt902, 16, i1);
			DrawingArea.method341(l + 16 + l1, anInt927, k1, i1 + 15);
			DrawingArea.method341(l + 17 + l1, anInt927, k1 - 1, i1 + 14);
			DrawingArea.method339(l + 15 + l1 + k1, anInt927, 16, i1);
			DrawingArea.method339(l + 14 + l1 + k1, anInt927, 15, i1 + 1);
		}
	}

	private void updateNPCs(Stream stream, int i) {
		anInt839 = 0;
		anInt893 = 0;
		method139(stream);
		method46(i, stream);
		method86(stream);
		for (int k = 0; k < anInt839; k++) {
			int l = anIntArray840[k];
			if (npcArray[l].anInt1537 != loopCycle) {
				npcArray[l].desc = null;
				npcArray[l] = null;
			}
		}
		if (stream.currentOffset != i) {
			signlink.reporterror(myUsername
					+ " size mismatch in getnpcpos - pos:"
					+ stream.currentOffset + " psize:" + i);
			throw new RuntimeException("eek");
		}
		for (int i1 = 0; i1 < npcCount; i1++)
			if (npcArray[npcIndices[i1]] == null) {
				signlink.reporterror(myUsername
						+ " null entry in npc list - pos:" + i1 + " size:"
						+ npcCount);
				throw new RuntimeException("eek");
			}
	}

	private int cButtonHPos;
	private int cButtonCPos;

	private void processChatModeClick() {
		if (is480 == true || is508 == true || is525 == true || is562 == true) {
			if (super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= 482
					&& super.mouseY <= 503) {
				cButtonHPos = 0;
				inputTaken = true;
			} else if (super.mouseX >= 62 && super.mouseX <= 117
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 1;
				inputTaken = true;
			} else if (super.mouseX >= 119 && super.mouseX <= 174
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 2;
				inputTaken = true;
			} else if (super.mouseX >= 176 && super.mouseX <= 231
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 3;
				inputTaken = true;
			} else if (super.mouseX >= 233 && super.mouseX <= 288
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 4;
				inputTaken = true;
			} else if (super.mouseX >= 290 && super.mouseX <= 345
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 5;
				inputTaken = true;
			} else if (super.mouseX >= 347 && super.mouseX <= 402
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 7;
				inputTaken = true;
			} else if (super.mouseX >= 404 && super.mouseX <= 514
					&& super.mouseY >= 480 && super.mouseY <= 501) {
				cButtonHPos = 6;
				inputTaken = true;
			} else {
				cButtonHPos = -1;
				inputTaken = true;
			}
			if (super.clickMode3 == 1) {
				if (super.saveClickX >= 5 && super.saveClickX <= 61
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 0;
					chatTypeView = 0;
					inputTaken = true;
				} else if (super.saveClickX >= 62 && super.saveClickX <= 117
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 1;
					chatTypeView = 5;
					inputTaken = true;
				} else if (super.saveClickX >= 119 && super.saveClickX <= 174
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 2;
					chatTypeView = 1;
					inputTaken = true;
				} else if (super.saveClickX >= 176 && super.saveClickX <= 231
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 3;
					chatTypeView = 2;
					inputTaken = true;
				} else if (super.saveClickX >= 233 && super.saveClickX <= 288
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 4;
					chatTypeView = 11;
					inputTaken = true;
				} else if (super.saveClickX >= 290 && super.saveClickX <= 345
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 5;
					chatTypeView = 3;
					inputTaken = true;
				} else if (super.saveClickX >= 347 && super.saveClickX <= 402
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 6;
					inputTaken = true;
				} else if (super.saveClickX >= 404 && super.saveClickX <= 515
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					if (openInterfaceID == -1) {
						clearTopInterfaces();
						reportAbuseInput = "";
						canMute = false;
						for (int i = 0; i < RSInterface.interfaceCache.length; i++) {
							if (RSInterface.interfaceCache[i] == null
									|| RSInterface.interfaceCache[i].contentType != 600)
								continue;
							reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i].parentID;
							break;
						}
					} else {
						pushMessage(
								"Please close the interface you have open before using 'report abuse'",
								0, "");
					}
				}
			}
		} else if (is474) {
			if (super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= 482
					&& super.mouseY <= 503) {
				cButtonHPos = 0;
				inputTaken = true;
			} else if (super.mouseX >= 71 && super.mouseX <= 127
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 1;
				inputTaken = true;
			} else if (super.mouseX >= 137 && super.mouseX <= 193
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 2;
				inputTaken = true;
			} else if (super.mouseX >= 203 && super.mouseX <= 259
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 3;
				inputTaken = true;
			} else if (super.mouseX >= 269 && super.mouseX <= 325
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 4;
				inputTaken = true;
			} else if (super.mouseX >= 335 && super.mouseX <= 391
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 5;
				inputTaken = true;
			} else if (super.mouseX >= 404 && super.mouseX <= 515
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				cButtonHPos = 6;
				inputTaken = true;
			} else {
				cButtonHPos = -1;
				inputTaken = true;
			}
			if (super.clickMode3 == 1) {
				if (super.saveClickX >= 5 && super.saveClickX <= 61
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 0;
					chatTypeView = 0;
					inputTaken = true;
				} else if (super.saveClickX >= 71 && super.saveClickX <= 127
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 1;
					chatTypeView = 5;
					inputTaken = true;
				} else if (super.saveClickX >= 137 && super.saveClickX <= 193
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 2;
					chatTypeView = 1;
					inputTaken = true;
				} else if (super.saveClickX >= 203 && super.saveClickX <= 259
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 3;
					chatTypeView = 2;
					inputTaken = true;
				} else if (super.saveClickX >= 269 && super.saveClickX <= 325
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 4;
					chatTypeView = 11;
					inputTaken = true;
				} else if (super.saveClickX >= 335 && super.saveClickX <= 391
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					cButtonCPos = 5;
					chatTypeView = 3;
					inputTaken = true;
				} else if (super.saveClickX >= 404 && super.saveClickX <= 515
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					if (openInterfaceID == -1) {
						clearTopInterfaces();
						reportAbuseInput = "";
						canMute = false;
						for (int i = 0; i < RSInterface.interfaceCache.length; i++) {
							if (RSInterface.interfaceCache[i] == null
									|| RSInterface.interfaceCache[i].contentType != 600)
								continue;
							reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i].parentID;
							break;
						}
					} else {
						pushMessage(
								"Please close the interface you have open before using 'report abuse'",
								0, "");
					}
				}
			}
		} else {
			if (super.clickMode3 == 1) {
				if (super.saveClickX >= 6 && super.saveClickX <= 106
						&& super.saveClickY >= 467 && super.saveClickY <= 499) {
					publicChatMode = (publicChatMode + 1) % 4;
					inputTaken = true;
					stream.createFrame(95);
					stream.writeWordBigEndian(publicChatMode);
					stream.writeWordBigEndian(privateChatMode);
					stream.writeWordBigEndian(tradeMode);
				}
				if (super.saveClickX >= 135 && super.saveClickX <= 235
						&& super.saveClickY >= 467 && super.saveClickY <= 499) {
					privateChatMode = (privateChatMode + 1) % 3;
					inputTaken = true;
					stream.createFrame(95);
					stream.writeWordBigEndian(publicChatMode);
					stream.writeWordBigEndian(privateChatMode);
					stream.writeWordBigEndian(tradeMode);
				}
				if (super.saveClickX >= 273 && super.saveClickX <= 373
						&& super.saveClickY >= 467 && super.saveClickY <= 499) {
					tradeMode = (tradeMode + 1) % 3;
					inputTaken = true;
					stream.createFrame(95);
					stream.writeWordBigEndian(publicChatMode);
					stream.writeWordBigEndian(privateChatMode);
					stream.writeWordBigEndian(tradeMode);
				}
				if (super.saveClickX >= 404 && super.saveClickX <= 515
						&& super.saveClickY >= 482 && super.saveClickY <= 505) {
					if (openInterfaceID == -1) {
						clearTopInterfaces();
						reportAbuseInput = "";
						canMute = false;
						for (int i = 0; i < RSInterface.interfaceCache.length; i++) {
							if (RSInterface.interfaceCache[i] == null
									|| RSInterface.interfaceCache[i].contentType != 600)
								continue;
							reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i].parentID;
							break;
						}
					} else {
						pushMessage(
								"Please close the interface you have open before using 'report abuse'",
								0, "");
					}
				}
			}
		}
	}

	private void method33(int i) {
		int j = Varp.cache[i].anInt709;
		if (j == 0)
			return;
		int k = variousSettings[i];
		if (j == 1) {
			if (k == 1)
				Texture.method372(0.90000000000000002D);
			if (k == 2)
				Texture.method372(0.80000000000000004D);
			if (k == 3)
				Texture.method372(0.69999999999999996D);
			if (k == 4)
				Texture.method372(0.59999999999999998D);
			ItemDef.mruNodes1.unlinkAll();
			welcomeScreenRaised = true;
		}
		if (j == 5)
			anInt1253 = k;
		if (j == 6)
			anInt1249 = k;
		if (j == 8) {
			splitPrivateChat = k;
			inputTaken = true;
		}
		if (j == 9)
			anInt913 = k;
	}

	/*
	 * void noSoakHit1(int i, int j, int k, int l, int i1, String s) { if(i >
	 * loopCycle) { k -= 30; int j1 = i - loopCycle; int k1 =
	 * (int)Math.round((double)j1 * 3.5D); int l1 = Math.round(j1 / 6);
	 * hitMark[5].drawTransparent(j - 8, (k - 12) + l1, k1);
	 * hitMark[5].drawTransparent(j - 8, (k - 12) + l1, k1);
	 * hitMark[5].drawTransparent(j - 8, (k - 12) + l1, k1);
	 * smallText.drawText(0, s, k + 4 + l1, j); smallText.drawText(0xffffff, s,
	 * k + 3 + l1, j - 1); } }
	 * 
	 * void noSoakHit10(int i, int j, int k, int l, int i1, String s) { if(i >
	 * loopCycle) { k -= 30; int j1 = i - loopCycle; int k1 =
	 * (int)Math.round((double)j1 * 3.5D); int l1 = Math.round(j1 / 6);
	 * hitMark[l].drawTransparent(j - 12, (k - 12) + l1, k1);
	 * hitMark[l].drawTransparent(j - 12, (k - 12) + l1, k1);
	 * hitMark[l].drawTransparent(j - 12, (k - 12) + l1, k1);
	 * smallText.drawText(0, s, k + 4 + l1, j); smallText.drawText(0xffffff, s,
	 * k + 3 + l1, j - 1); } }
	 * 
	 * void noSoakHit100(int i, int j, int k, int l, int i1, String s) { if(i >
	 * loopCycle) { k -= 30; int j1 = i - loopCycle; int k1 =
	 * (int)Math.round((double)j1 * 3.5D); int l1 = Math.round(j1 / 6);
	 * hitMark[l].drawTransparent(j - 20, (k - 13) + l1, k1);
	 * hitMark[l].drawTransparent(j - 20, (k - 13) + l1, k1);
	 * hitMark[l].drawTransparent(j - 20, (k - 13) + l1, k1);
	 * smallText.drawText(0, s, k + 4 + l1, j); smallText.drawText(0xffffff, s,
	 * k + 3 + l1, j - 1); } }
	 * 
	 * void noSoakHitMax(int i, int j, int k, int l, String s) { if(i >
	 * loopCycle) { k -= 30; int i1 = i - loopCycle; int j1 =
	 * (int)Math.round((double)i1 * 3.5D); int k1 = Math.round(i1 / 6);
	 * hitMark[4].drawTransparent(j - 20, (k - 13) + k1, j1);
	 * hitMark[4].drawTransparent(j - 20, (k - 13) + k1, j1);
	 * hitMark[4].drawTransparent(j - 20, (k - 13) + k1, j1);
	 * chatTextDrawingArea.drawText(0xffffff, s, k + 3 + k1, j - 1); } }
	 * 
	 * void soakHit1(int i, int j, int k, int l, int i1, String s, String s1) {
	 * if(i > loopCycle) { k -= 30; int j1 = i - loopCycle; int k1 =
	 * (int)Math.round((double)j1 * 3.5D); int l1 = Math.round(j1 / 6);
	 * hitMark[i1].drawTransparent(j - 29, (k - 13) + l1, k1);
	 * hitMark[i1].drawTransparent(j - 29, (k - 13) + l1, k1);
	 * hitMark[i1].drawTransparent(j - 29, (k - 13) + l1, k1);
	 * smallText.drawText(0, s, k + 4 + l1, j - 9); smallText.drawText(0xffffff,
	 * s, k + 3 + l1, j - 10); hitMark[6].drawTransparent(j + 24, (k - 11) + l1,
	 * k1); hitMark[6].drawTransparent(j + 24, (k - 11) + l1, k1);
	 * hitMark[6].drawTransparent(j + 24, (k - 11) + l1, k1);
	 * smallText.drawText(0, s1, k + 5 + l1, j + 32);
	 * smallText.drawText(0xffffff, s1, k + 4 + l1, j + 31); } }
	 * 
	 * void soakHit(int i, int j, int k, int l, int i1, String s, String s1) {
	 * if(i > loopCycle) { k -= 30; int j1 = i - loopCycle; int k1 =
	 * (int)Math.round((double)j1 * 3.5D); int l1 = Math.round(j1 / 6);
	 * hitMark[i1].drawTransparent(j - 29, (k - 13) + l1, k1);
	 * hitMark[i1].drawTransparent(j - 29, (k - 13) + l1, k1);
	 * hitMark[i1].drawTransparent(j - 29, (k - 13) + l1, k1);
	 * smallText.drawText(0, s, k + 4 + l1, j - 9); smallText.drawText(0xffffff,
	 * s, k + 3 + l1, j - 10); hitMark[0].drawTransparent(j + 24, (k - 11) + l1,
	 * k1); hitMark[0].drawTransparent(j + 24, (k - 11) + l1, k1);
	 * hitMark[0].drawTransparent(j + 24, (k - 11) + l1, k1);
	 * smallText.drawText(0, s1, k + 5 + l1, j + 38);
	 * smallText.drawText(0xffffff, s1, k + 4 + l1, j + 37); } }
	 * 
	 * void soakHitMax(int i, int j, int k, int l, String s, String s1) { if(i >
	 * loopCycle) { k -= 30; int i1 = i - loopCycle; int j1 =
	 * (int)Math.round((double)i1 * 3.5D); int k1 = Math.round(i1 / 6);
	 * hitMark[4].drawTransparent(j - 29, (k - 13) + k1, j1);
	 * hitMark[4].drawTransparent(j - 29, (k - 13) + k1, j1);
	 * hitMark[4].drawTransparent(j - 29, (k - 13) + k1, j1);
	 * chatTextDrawingArea.drawText(0xffffff, s, k + 4 + k1, j - 10);
	 * hitMark[0].drawTransparent(j + 24, (k - 11) + k1, j1);
	 * hitMark[0].drawTransparent(j + 24, (k - 11) + k1, j1);
	 * hitMark[0].drawTransparent(j + 24, (k - 11) + k1, j1);
	 * smallText.drawText(0, s1, k + 5 + k1, j + 38);
	 * smallText.drawText(0xffffff, s1, k + 4 + k1, j + 37); } }
	 */
	void block(int cycle, int x, int y) {
		if (cycle > loopCycle) {
			y -= 30;
			int difference = (cycle - loopCycle);
			int trans = (int) Math.round((double) difference * 3.5);
			int height = (int) Math.round(difference / 6);
			combatIcons[3].drawTransparent((x - 12), (y - 12 + height), trans);
		}
	}

	void hit10(int cycle, int x, int y, int type, int type2, String damage) {
		if (cycle > loopCycle) {
			y -= 30;
			int difference = (cycle - loopCycle);
			int trans = (int) Math.round((double) difference * 3.5);
			int height = (int) Math.round(difference / 6);
			combatIcons[type2].drawTransparent((x - 30), (y - 12 + height),
					trans);
			hitMark[type].drawTransparent((x - 12), (y - 12 + height), trans);
			smallText.drawText(0, damage, (y + 4 + height), x);
			smallText.drawText(0xffffff, damage, (y + 3 + height), (x - 1));
		}
	}

	void hit100(int cycle, int x, int y, int type, int type2, String damage) {
		if (cycle > loopCycle) {
			y -= 30;
			int difference = (cycle - loopCycle);
			int trans = (int) Math.round((double) difference * 3.5);
			int height = (int) Math.round(difference / 6);
			combatIcons[type2].drawTransparent((x - 35), (y - 11 + height),
					trans);
			hitMark[0].drawTransparent((x - 20), (y - 13 + height), trans);
			smallText.drawText(0, damage, (y + 4 + height), x);
			smallText.drawText(0xffffff, damage, (y + 3 + height), (x - 1));
		}
	}

	void hit400(int cycle, int x, int y, int type, int type2, String damage) {
		if (cycle > loopCycle) {
			y -= 30;
			int difference = (cycle - loopCycle);
			int trans = (int) Math.round((double) difference * 3.5);
			int height = (int) Math.round(difference / 6);
			combatIcons[type2].drawTransparent((x - 35), (y - 11 + height),
					trans);
			hitMark[2].drawTransparent((x - 20), (y - 13 + height), trans);
			smallText.drawText(0, damage, (y + 4 + height), x);
			smallText.drawText(0xffffff, damage, (y + 3 + height), (x - 1));
		}
	}

	private Sprite HPBarFull;
	private Sprite HPBarEmpty;

	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 (namesToggle == true) {
						String s = entityDef.name;
						s = s
								+ combatDiffColor(myPlayer.combatLevel,
										entityDef.combatLevel) + " (level-"
								+ entityDef.combatLevel + ")";
						if (entityDef.combatLevel != 0) {
							npcScreenPos(((Entity) (obj)),
									((Entity) (obj)).height + 15);
							smallText.method382(0xFFFF33, spriteDrawX, s,
									spriteDrawY - 8, true);
						} else if (entityDef.combatLevel == 0) {
							npcScreenPos(((Entity) (obj)),
									((Entity) (obj)).height + 15);
							smallText.method382(0xFFFF33, spriteDrawX,
									entityDef.name, spriteDrawY - 8, true);
						}
					} else if (namesToggle == false) {

					}

					if (entityDef.childrenIDs != null)
						entityDef = entityDef.method161();
					if (entityDef == null)
						continue;
				}
				if (namesToggle == true) {
					if (j < playerCount) {
						int l = 45;
						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;// 25
								}
								/*
								 * if (player.headIcon < 7) {
								 * headIcons[player.headIcon
								 * ].drawSprite(spriteDrawX - 12, spriteDrawY -
								 * l); l += 20;//20 }
								 */
								if (player.headIcon < 18) {
									headIcons[player.headIcon].drawSprite(
											spriteDrawX - 12, spriteDrawY - l);
									l += 26;
								}
							}
						}
						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);
							l += 30;
						}
						npcScreenPos(((Entity) (obj)),
								((Entity) (obj)).height + 15);
						int col = 0x3399ff;
						newSmallFont.drawCenteredString(player.name,
								spriteDrawX, spriteDrawY - 8, col, 100);

					} 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 - 50);
						}
						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 - 50);
						}
					}
				} else if (namesToggle == false) {
					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 (player.headIcon < 18) {
									headIcons[player.headIcon].drawSprite(
											spriteDrawX - 12, spriteDrawY - l);
									l += 26;
								}
							}
						}
						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);
						}
						npcScreenPos(((Entity) (obj)),
								((Entity) (obj)).height + 15);

					} 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 - 30);
						}
					}
				}
				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;
							}
							int HpPercent = (((Entity) (obj)).currentHealth * 56)
									/ ((Entity) (obj)).maxHealth;
							if (HpPercent > 56) {
								HpPercent = 56;
							}
							// if(namesToggle) {
							// newSmallFont.drawCenteredString((new
							// StringBuilder()).append(((Entity) (Entity)
							// obj).currentHealth).append("/").append(((Entity)
							// (Entity) obj).maxHealth).toString(), spriteDrawX,
							// spriteDrawY - 19, 0x3399ff, 100);
							// }//draws HP above head
							// HPBar crap
							if (!hitbarToggle) {
								DrawingArea.method336(5, spriteDrawY - 3,
										spriteDrawX - 15, 65280, i1);
								DrawingArea.method336(5, spriteDrawY - 3,
										(spriteDrawX - 15) + i1, 0xff0000,
										30 - i1);
							} else {
								HPBarEmpty.drawSprite(spriteDrawX - 28,
										spriteDrawY - 5);// 3
								HPBarFull = new Sprite(
										sign.signlink.findcachedir()
												+ "Sprites/Player/HP 0.PNG",
										HpPercent, 7);
								HPBarFull.drawSprite(spriteDrawX - 28,
										spriteDrawY - 5);
							}
						}
					} catch (Exception e) {
					}
				}
				applyTrans = 0;
				for (int j1 = 0; j1 < 4; j1++) {
					if (((Entity) (obj)).hitsLoopCycle[j1] > loopCycle) {
						npcScreenPos(((Entity) (obj)),
								((Entity) (obj)).height / 2);
						applyTrans = 200;
						if (spriteDrawX > -1) {

							if (j1 > 0) {
								spriteDrawY += (19 * j1);
							}
							if (((Entity) (obj)).hitArray[j1] == 0
									|| ((Entity) (obj)).hitType[j1] == 3) {
								block(((Entity) (obj)).hitsLoopCycle[j1],
										spriteDrawX, spriteDrawY);
							} else {
								if (newHits) {
									if (((Entity) (obj)).hitArray[j1] > 399) {
										hit400(((Entity) (obj)).hitsLoopCycle[j1],
												spriteDrawX,
												spriteDrawY,
												((Entity) (obj)).hitMarkTypes[j1],
												((Entity) (obj)).hitType[j1],
												String.valueOf(((Entity) (obj)).hitArray[j1]));
									} else if (((Entity) (obj)).hitArray[j1] < 100) {
										hit10(((Entity) (obj)).hitsLoopCycle[j1],
												spriteDrawX,
												spriteDrawY,
												((Entity) (obj)).hitMarkTypes[j1],
												((Entity) (obj)).hitType[j1],
												String.valueOf(((Entity) (obj)).hitArray[j1]));
									} else {
										hit100(((Entity) (obj)).hitsLoopCycle[j1],
												spriteDrawX,
												spriteDrawY,
												((Entity) (obj)).hitMarkTypes[j1],
												((Entity) (obj)).hitType[j1],
												String.valueOf(((Entity) (obj)).hitArray[j1]));
									}
								} else {
									hitMarks[((Entity) (obj)).hitMarkTypes[j1]]
											.drawTranSprite(spriteDrawX - 12,
													spriteDrawY - 12, 0);
									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) {
		}
	}

	private void delFriend(long l) {
		try {
			if (l == 0L)
				return;
			for (int i = 0; i < friendsCount; i++) {
				if (friendsListAsLongs[i] != l)
					continue;
				friendsCount--;
				for (int j = i; j < friendsCount; j++) {
					friendsList[j] = friendsList[j + 1];
					friendsNodeIDs[j] = friendsNodeIDs[j + 1];
					friendsListAsLongs[j] = friendsListAsLongs[j + 1];
				}

				stream.createFrame(215);
				stream.writeQWord(l);
				break;
			}
		} catch (RuntimeException runtimeexception) {
			signlink.reporterror("18622, " + false + ", " + l + ", "
					+ runtimeexception.toString());
			throw new RuntimeException();
		}
	}

	public void drawSideIcons() {
		if (is480 || is508 || is525) {
			/* Top sideIcons */
			if (tabInterfaceIDs[0] != -1)// attack
				sideIcons[0].drawSprite(10 + 3, 4);
			if (tabInterfaceIDs[1] != -1)// stat
				sideIcons[1].drawSprite(43 + 3, 4);
			if (tabInterfaceIDs[2] != -1)// quest
				sideIcons[2].drawSprite(76 + 3, 3);
			if (tabInterfaceIDs[3] != -1)// inventory
				sideIcons[3].drawSprite(111 + 3, 5);
			if (tabInterfaceIDs[4] != -1)// equipment
				sideIcons[4].drawSprite(140 + 3, 1);
			if (tabInterfaceIDs[5] != -1)// prayer
				sideIcons[5].drawSprite(174 + 3, 1);
			if (tabInterfaceIDs[6] != -1)// magic
				sideIcons[6].drawSprite(208 + 3, 4);
			/* Bottom sideIcons */
			if (tabInterfaceIDs[7] != -1)// summoning
				sIcons483[7].drawSprite(11 + 3, 303);
			if (tabInterfaceIDs[8] != -1)// friends
				sideIcons[8].drawSprite(46 + 3, 306);
			if (tabInterfaceIDs[9] != -1)// ignore
				sideIcons[9].drawSprite(79 + 3, 306);
			if (tabInterfaceIDs[10] != -1)// logout
				sideIcons[7].drawSprite(113 + 3, 302);
			if (tabInterfaceIDs[11] != -1)// options
				sideIcons[11].drawSprite(145 + 3, 304);
			if (tabInterfaceIDs[12] != -1)// emotes
				sideIcons[12].drawSprite(181 + 3, 302);
			if (tabInterfaceIDs[13] != -1)// music
				sideIcons[13].drawSprite(213 + 3, 303);
		} else if (is474) {
			/** Top sideIcons */
			if (tabInterfaceIDs[0] != -1)// /attack
				sideIcons[0].drawSprite(10 + 3, 4);
			if (tabInterfaceIDs[1] != -1)// /stat
				sideIcons[1].drawSprite(43 + 3, 4);
			if (tabInterfaceIDs[2] != -1)// /quest
				sideIcons[2].drawSprite(76 + 3, 3);
			if (tabInterfaceIDs[3] != -1)// /inventory
				sideIcons[3].drawSprite(111 + 3, 5);
			if (tabInterfaceIDs[4] != -1)// /equipment
				sideIcons[4].drawSprite(140 + 3, 1);
			if (tabInterfaceIDs[5] != -1)// /prayer
				sideIcons[5].drawSprite(174 + 3, 1);
			if (tabInterfaceIDs[6] != -1)// /magic
				sideIcons[6].drawSprite(208 + 3, 4);
			/** Bottom sideIcons */
			if (tabInterfaceIDs[7] != -1)// /clan
				sideIcons[7].drawSprite(11 + 3, 303);
			if (tabInterfaceIDs[8] != -1)// /friends
				sideIcons[8].drawSprite(46 + 3, 306);
			if (tabInterfaceIDs[9] != -1)// /ignore
				sideIcons[9].drawSprite(79 + 3, 306);
			if (tabInterfaceIDs[10] != -1)// /logout
				sideIcons[10].drawSprite(113 + 3, 302);
			if (tabInterfaceIDs[11] != -1)// /options
				sideIcons[11].drawSprite(145 + 3, 304);
			if (tabInterfaceIDs[12] != -1)// /emotes
				sideIcons[12].drawSprite(181 + 3, 302);
			if (tabInterfaceIDs[13] != -1)// /music
				sideIcons[13].drawSprite(213 + 3, 303);
		} else if (is562) {
			/* Top sideIcons */
			if (tabInterfaceIDs[0] != -1)
				newSideIcons[0].drawSprite(8 + 3, 8);
			if (tabInterfaceIDs[1] != -1)
				newSideIcons[1].drawSprite(37 + 3, 8);
			if (tabInterfaceIDs[2] != -1)
				newSideIcons[2].drawSprite(67 + 3, 8);
			if (tabInterfaceIDs[14] != -1)
				newSideIcons[3].drawSprite(97 + 3, 8);
			if (tabInterfaceIDs[3] != -1)
				newSideIcons[4].drawSprite(127 + 3, 8);
			if (tabInterfaceIDs[4] != -1)
				newSideIcons[5].drawSprite(159 + 3, 8);
			if (tabInterfaceIDs[5] != -1)
				newSideIcons[6].drawSprite(187 + 3, 8);
			if (tabInterfaceIDs[6] != -1)
				newSideIcons[7].drawSprite(217 + 3, 8);
			/* Bottom sideIcons */
			if (tabInterfaceIDs[10] != -1)
				newSideIcons[15].drawSprite(8 + 3, 306);
			if (tabInterfaceIDs[9] != -1)
				newSideIcons[8].drawSprite(38 + 3, 306);
			if (tabInterfaceIDs[8] != -1)
				newSideIcons[9].drawSprite(70 + 3, 306);
			if (tabInterfaceIDs[7] != -1)
				newSideIcons[13].drawSprite(97 + 3, 306);
			if (tabInterfaceIDs[11] != -1)
				newSideIcons[10].drawSprite(127 + 3, 306);
			if (tabInterfaceIDs[12] != -1)
				newSideIcons[11].drawSprite(157 + 3, 306);
			if (tabInterfaceIDs[13] != -1)
				newSideIcons[12].drawSprite(187 + 3, 306);
			if (tabInterfaceIDs[15] != -1)
				newSideIcons[14].drawSprite(216 + 3, 307);
		} else {
			/** Top sideIcons */
			if (tabInterfaceIDs[0] != -1)// /attack
				sIcons459[0].drawSprite(32, 11);
			if (tabInterfaceIDs[1] != -1)// /stat
				sIcons459[1].drawSprite(57, 9);
			if (tabInterfaceIDs[2] != -1)// /quest
				sIcons459[2].drawSprite(86, 9);
			if (tabInterfaceIDs[3] != -1)// /inventory
				sIcons459[3].drawSprite(116, 4);
			if (tabInterfaceIDs[4] != -1)// /equipment
				sIcons459[4].drawSprite(155, 5);
			if (tabInterfaceIDs[5] != -1)// /prayer
				sIcons459[5].drawSprite(183, 5);
			if (tabInterfaceIDs[6] != -1)// /magic
				sIcons459[6].drawSprite(212, 10);
			/** Bottom sideIcons */
			if (tabInterfaceIDs[7] != -1)// /clan
				sideIcons[7].drawSprite(31, 300);
			if (tabInterfaceIDs[8] != -1)// /friends
				sIcons459[7].drawSprite(57, 306);
			if (tabInterfaceIDs[9] != -1)// /ignore
				sIcons459[8].drawSprite(85, 308);
			if (tabInterfaceIDs[10] != -1)// /logout
				sIcons459[9].drawSprite(121, 302);
			if (tabInterfaceIDs[11] != -1)// /options
				sIcons459[10].drawSprite(157, 305);
			if (tabInterfaceIDs[12] != -1)// /emotes
				sIcons459[11].drawSprite(187, 302);
			if (tabInterfaceIDs[13] != -1)// /music
				sIcons459[12].drawSprite(211, 302);
		}
	}

	public String NORMAL = "<col=ce6500>", MINIGAME = "<col=AD45A5>",
			ATTACK = "<col=12582912>", STRENGTH = "<col=616004>",
			DEFENCE = "<col=5530515>", RANGED = "<col=5269017>",
			PRAYER = "<col=4670541>", MAGIC = "<col=198>",
			RUNECRAFTING = "<col=C0307C>", CONSTRUCTION = "<col=ce6500>",
			DUNGEON = "<col=492509>", CONSTITUTION = "<col=C32339>",
			AGILITY = "<col=252566>", HERBLORE = "<col=095D0E>",
			THIEVE = "<col=59324B>", CRAFT = "<col=4E3922>",
			FLETCH = "<col=004144>", SLAYER = "<col=6F160E>",
			HUNTER = "<col=3D3932>", MINING = "<col=1B79BF>",
			SMITH = "<col=00E0B9>", FISH = "<col=415DAF>",
			COOK = "<col=4E2159>", FIRE = "<col=C06719>",
			WOOD = "<col=04AE1F>", FARM = "<col=234E25>",
			SUMMON = "<col=AA44AA>", SKILL = "<col=00AA8B>",
			TRIAL = "<col=B4033D>", STAFF = "<col=AA44AA>",
			VETERAN = "<col=A37700>", END = "</col>";

	String[][] titles = { { "", NORMAL }, { "Lord ", NORMAL },
			{ "Lady ", NORMAL }, { "Sir ", NORMAL }, { "Dame ", NORMAL },
			{ "Duderino ", NORMAL }, { "Dudette ", NORMAL },
			{ "Lionheart ", NORMAL }, { "Crusador ", NORMAL },
			{ "Hellraiser ", NORMAL }, { "Desperado ", NORMAL },
			{ "Baron ", NORMAL }, { "Baroness ", NORMAL },
			{ "Count ", NORMAL }, { "Countess", NORMAL },
			{ "Overlord ", NORMAL }, { "Overlordess ", NORMAL },
			{ "Prince", NORMAL }, { "Princess ", NORMAL },
			{ "Bandito ", NORMAL }, { "Duke ", NORMAL },
			{ "Duchess ", NORMAL }, { "Justiciar ", NORMAL },
			{ "Big Cheese ", NORMAL }, { "Bigwig ", NORMAL },
			{ "Archon ", NORMAL }, { "Emperor ", NORMAL },
			{ "Emperess ", NORMAL }, { "King ", NORMAL },
			{ "Witch King ", NORMAL }, { "Which Queen ", NORMAL },
			{ "Wunderkid ", NORMAL }, { "The Awesome ", NORMAL },
			{ "The Warrior", NORMAL }, { "The Magnificent ", NORMAL },
			{ "Berserker ", ATTACK }, { "Warrior ", STRENGTH },
			{ "Guardian ", DEFENCE }, { "Archer ", RANGED },
			{ "Turmoil ", PRAYER }, { "Mystical ", MAGIC },
			{ "Spellbinder ", RUNECRAFTING }, { "Builder ", CONSTRUCTION },
			{ "Explorer ", DUNGEON }, { "Eater ", CONSTITUTION },
			{ "Agile ", AGILITY }, { "Herbalist ", HERBLORE },
			{ "Outlaw ", THIEVE }, { "Artisan ", CRAFT },
			{ "Bowcrafter ", FLETCH }, { "Taskmaster ", SLAYER },
			{ "Poacher ", HUNTER }, { "Rocky ", MINING },
			{ "Blacksmith ", SMITH }, { "Fisher ", FISH },
			{ "Master Chef ", COOK }, { "Pyro ", FIRE },
			{ "Lumberjack ", WOOD }, { "Stoner ", FARM },
			{ "Summoner ", SUMMON }, { "Skiller ", SKILL },
			{ "Junior Cadet ", MINIGAME }, { "Sergeant ", MINIGAME },
			{ "Commander ", MINIGAME }, { "War-chief ", MINIGAME },
			{ "Trial Mod ", TRIAL }, { "Moderator ", STAFF },
			{ "Administrator ", STAFF }, { "Developer ", STAFF },
			{ "Veteran ", VETERAN },

	};

	public String playerTitle1(int t) {
		for (int i = 0; i < titles.length; i++)
			if (t == i) {
				return (titles[i][1] + titles[i][0] + END).trim();
			}
		return "";
	}

	public final String playerTitle(final int i) {
		switch (i) {
		case 1:
			return "Sir ";
		case 2:
			return "Lord ";
		case 3:
			return "Monster ";
		case 4:
			return "Unreal ";
		case 5:
			return "HellRaiser ";
		case 6:
			return "Archon ";
		case 7:
			return "Stoner ";
		case 8:
			return "Chronic ";
		case 9:
			return "Overlord ";
		case 10:
			return "The Divine  ";
		case 11:
			return "The Fallen ";
		case 12:
			return "Commander ";
		case 13:
			return "War-chief ";
		case 14:
			return "Pimp ";
		case 15:
			return "Pornstar ";
		case 16:
			return "Pk Master ";
			/**
			 * Staff Titles
			 **/
		case 17:
			return "Main Owner ";
		case 18:
			return "Co Owner ";
		case 19:
			return "Head Admin ";
		case 20:
			return "Admin ";
		case 21:
			return "Head Mod ";
		case 22:
			return "Mod ";
		case 23:
			return "Extreme ";
		case 24:
			return "Super ";
		case 25:
			return "Donator ";
		case 26:
			return "Graphics ";
		case 27:
			return "Ultra ";
		case 28:
			return "Support ";
		case 29:
			return "Veteran ";
		case 30:
			return "Server Sponsor ";
		case 31:
			return "Completionist ";
		case 32:
			return "Developer ";
		case 33:
			return "Peasant ";
		case 34:
			return "Billionaire ";
		case 35:
			return "Noob ";
		default:
			return "";
		}
	}

	public void drawRedStones() {
		if (is474 || is480 || is508 || is525) {
			if (tabInterfaceIDs[tabID] != -1) {
				switch (tabID) {
				case 0:
					redStones[0].drawSprite(3 + 3, 0);
					break;
				case 1:
					redStones[4].drawSprite(41 + 3, 0);
					break;
				case 2:
					redStones[4].drawSprite(74 + 3, 0);
					break;
				case 3:
					redStones[4].drawSprite(107 + 3, 0);
					break;
				case 4:
					redStones[4].drawSprite(140 + 3, 0);
					break;
				case 5:
					redStones[4].drawSprite(173 + 3, 0);
					break;
				case 6:
					redStones[1].drawSprite(206 + 3, 0);
					break;
				case 7:
					redStones[2].drawSprite(3 + 3, 298);
					break;
				case 8:
					redStones[4].drawSprite(41 + 3, 298);
					break;
				case 9:
					redStones[4].drawSprite(74 + 3, 298);
					break;
				case 10:
					redStones[4].drawSprite(107 + 3, 298);
					break;
				case 11:
					redStones[4].drawSprite(140 + 3, 298);
					break;
				case 12:
					redStones[4].drawSprite(173 + 3, 298);
					break;
				case 13:
					redStones[3].drawSprite(206 + 3, 298);
					break;
				}
			}
		} else if (is562) {
			drawTabHover();
			if (tabInterfaceIDs[tabID] != -1) {
				if (tabID == 0)
					tabClicked.drawSprite(2 + 3, 0);
				if (tabID == 1)
					tabClicked.drawSprite(32 + 3, 0);
				if (tabID == 2)
					tabClicked.drawSprite(62 + 3, 0);
				if (tabID == 14)
					tabClicked.drawSprite(92 + 3, 0);
				if (tabID == 3)
					tabClicked.drawSprite(122 + 3, 0);
				if (tabID == 4)
					tabClicked.drawSprite(152 + 3, 0);
				if (tabID == 5)
					tabClicked.drawSprite(182 + 3, 0);
				if (tabID == 6)
					tabClicked.drawSprite(212 + 3, 0);
				if (tabID == 16)
					tabClicked.drawSprite(2 + 3, 298);
				if (tabID == 8)
					tabClicked.drawSprite(32 + 3, 298);
				if (tabID == 9)
					tabClicked.drawSprite(62 + 3, 298);
				if (tabID == 7)
					tabClicked.drawSprite(92 + 3, 298);
				if (tabID == 11)
					tabClicked.drawSprite(122 + 3, 298);
				if (tabID == 12)
					tabClicked.drawSprite(152 + 3, 298);
				if (tabID == 13)
					tabClicked.drawSprite(182 + 3, 298);
				if (tabID == 15)
					tabClicked.drawSprite(212 + 3, 298);
			}
		} else {
			if (tabInterfaceIDs[tabID] != -1) {
				switch (tabID) {
				case 0:
					redStones[5].drawSprite(16 + 7, 1);
					break;
				case 1:
					redStones[13].drawSprite(48 + 7, 1);
					break;
				case 2:
					redStones[13].drawSprite(75 + 7, 1);
					break;
				case 3:
					redStones[7].drawSprite(103 + 7, 0);
					break;
				case 4:
					redStones[14].drawSprite(146 + 7, 1);
					break;
				case 5:
					redStones[14].drawSprite(174 + 7, 1);
					break;
				case 6:
					redStones[6].drawSprite(202 + 7, 2);
					break;

				case 7:
					redStones[12].drawSprite(22, 296);
					break;
				case 8:
					redStones[9].drawSprite(54, 297);
					break;
				case 9:
					redStones[9].drawSprite(82, 297);
					break;
				case 10:
					redStones[10].drawSprite(110, 299);
					break;
				case 11:
					redStones[8].drawSprite(153, 297);
					break;
				case 12:
					redStones[8].drawSprite(181, 297);
					break;
				case 13:
					redStones[11].drawSprite(209, 297);
					break;
				}
			}
		}
	}

	private void drawTabArea() {
		inventoryBackImage.initDrawingArea();
		Texture.anIntArray1472 = anIntArray1181;
		tabArea[getSpriteID()].drawSprite(0, 0);
		if (spriteChanged) {
		}
		tabAreaAltered = true;
		if (invOverlayInterfaceID == -1) {
			drawRedStones();
			drawSideIcons();
		}
		if (is474 || is480 || is508 || is525 || is562) {
			if (invOverlayInterfaceID != -1)
				drawInterface(0, 32,
						RSInterface.interfaceCache[invOverlayInterfaceID], 37);
			else if (tabInterfaceIDs[tabID] != -1)
				drawInterface(0, 32,
						RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37);
		} else if (is562) {
			if (tabHPos == 0 && tabInterfaceIDs[0] != -1)
				tabHover.drawSprite(3, 0);
			else if (tabHPos == 1 && tabInterfaceIDs[1] != -1)
				tabHover.drawSprite(33, 0);
			else if (tabHPos == 2 && tabInterfaceIDs[2] != -1)
				tabHover.drawSprite(63, 0);
			else if (tabHPos == 3 && tabInterfaceIDs[14] != -1)
				tabHover.drawSprite(93, 0);
			else if (tabHPos == 4 && tabInterfaceIDs[3] != -1)
				tabHover.drawSprite(123, 0);
			else if (tabHPos == 5 && tabInterfaceIDs[4] != -1)
				tabHover.drawSprite(153, 0);
			else if (tabHPos == 6 && tabInterfaceIDs[5] != -1)
				tabHover.drawSprite(183, 0);
			else if (tabHPos == 7 && tabInterfaceIDs[6] != -1)
				tabHover.drawSprite(213, 0);
			else if (tabHPos == 15 && tabInterfaceIDs[16] != -1)
				tabHover.drawSprite(3, 298);
			else if (tabHPos == 8 && tabInterfaceIDs[9] != -1)
				tabHover.drawSprite(33, 298);
			else if (tabHPos == 9 && tabInterfaceIDs[8] != -1)
				tabHover.drawSprite(63, 298);
			else if (tabHPos == 10 && tabInterfaceIDs[7] != -1)
				tabHover.drawSprite(93, 298);
			else if (tabHPos == 11 && tabInterfaceIDs[11] != -1)
				tabHover.drawSprite(123, 298);
			else if (tabHPos == 12 && tabInterfaceIDs[12] != -1)
				tabHover.drawSprite(153, 298);
			else if (tabHPos == 13 && tabInterfaceIDs[13] != -1)
				tabHover.drawSprite(183, 298);
			else if (tabHPos == 14 && tabInterfaceIDs[15] != -1)
				tabHover.drawSprite(213, 298);
		} else {
			if (invOverlayInterfaceID != -1)
				drawInterface(0, 38,
						RSInterface.interfaceCache[invOverlayInterfaceID], 37);
			else if (tabInterfaceIDs[tabID] != -1)
				drawInterface(0, 38,
						RSInterface.interfaceCache[tabInterfaceIDs[tabID]], 37);
		}
		if (menuOpen)
			drawMenu(516, 168);
		inventoryBackImage.drawGraphics(168, super.graphics, 516);// 519
		inGameScreen.initDrawingArea();
		Texture.anIntArray1472 = anIntArray1182;
	}

	private void method37(int j) {
		if (!lowMem) {
			if (Texture.anIntArray1480[17] >= j) {

				Background background = Texture.aBackgroundArray1474s[17];
				int k = background.anInt1452 * background.anInt1453 - 1;
				// fire cape apparently?
				int j1 = background.anInt1452 * anInt945 * 2;
				byte abyte0[] = background.aByteArray1450;
				byte abyte3[] = aByteArray912;
				for (int i2 = 0; i2 <= k; i2++)
					abyte3[i2] = abyte0[i2 - j1 & k];

				background.aByteArray1450 = abyte3;
				aByteArray912 = abyte0;
				Texture.method370(17);
				anInt854++;
				if (anInt854 > 1235) {
					anInt854 = 0;
					stream.createFrame(226);
					stream.writeWordBigEndian(0);
					int l2 = stream.currentOffset;
					stream.writeWord(58722);
					stream.writeWordBigEndian(240);
					stream.writeWord((int) (Math.random() * 65536D));
					stream.writeWordBigEndian((int) (Math.random() * 256D));
					if ((int) (Math.random() * 2D) == 0)
						stream.writeWord(51825);
					stream.writeWordBigEndian((int) (Math.random() * 256D));
					stream.writeWord((int) (Math.random() * 65536D));
					stream.writeWord(7130);
					stream.writeWord((int) (Math.random() * 65536D));
					stream.writeWord(61657);
					stream.writeBytes(stream.currentOffset - l2);
				}
			}
			if (Texture.anIntArray1480[24] >= j) {
				Background background_1 = Texture.aBackgroundArray1474s[24];
				int l = background_1.anInt1452 * background_1.anInt1453 - 1;
				int k1 = background_1.anInt1452 * anInt945 * 2;
				byte abyte1[] = background_1.aByteArray1450;
				byte abyte4[] = aByteArray912;
				for (int j2 = 0; j2 <= l; j2++)
					abyte4[j2] = abyte1[j2 - k1 & l];

				background_1.aByteArray1450 = abyte4;
				aByteArray912 = abyte1;
				Texture.method370(24);
			}
			if (Texture.anIntArray1480[34] >= j) {
				Background background_2 = Texture.aBackgroundArray1474s[34];
				int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
				int l1 = background_2.anInt1452 * anInt945 * 2;
				byte abyte2[] = background_2.aByteArray1450;
				byte abyte5[] = aByteArray912;
				for (int k2 = 0; k2 <= i1; k2++)
					abyte5[k2] = abyte2[k2 - l1 & i1];

				background_2.aByteArray1450 = abyte5;
				aByteArray912 = abyte2;
				Texture.method370(34);
			}
			if (Texture.anIntArray1480[40] >= j) {
				Background background_2 = Texture.aBackgroundArray1474s[40];
				int i1 = background_2.anInt1452 * background_2.anInt1453 - 1;
				int l1 = background_2.anInt1452 * anInt945 * 2;
				byte abyte2[] = background_2.aByteArray1450;
				byte abyte5[] = aByteArray912;
				for (int k2 = 0; k2 <= i1; k2++)
					abyte5[k2] = abyte2[k2 - l1 & i1];

				background_2.aByteArray1450 = abyte5;
				aByteArray912 = abyte2;
				Texture.method370(40);

			}
		}
	}

	private void method38() {
		for (int i = -1; i < playerCount; i++) {
			int j;
			if (i == -1)
				j = myPlayerIndex;
			else
				j = playerIndices[i];
			Player player = playerArray[j];
			if (player != null && player.textCycle > 0) {
				player.textCycle--;
				if (player.textCycle == 0)
					player.textSpoken = null;
			}
		}
		for (int k = 0; k < npcCount; k++) {
			int l = npcIndices[k];
			NPC npc = npcArray[l];
			if (npc != null && npc.textCycle > 0) {
				npc.textCycle--;
				if (npc.textCycle == 0)
					npc.textSpoken = null;
			}
		}
	}

	private void calcCameraPos() {

		int i = anInt1098 * 128 + 64;
		int j = anInt1099 * 128 + 64;
		int k = method42(plane, j, i) - anInt1100;
		if (xCameraPos < i) {
			xCameraPos += anInt1101 + ((i - xCameraPos) * anInt1102) / 1000;
			if (xCameraPos > i)
				xCameraPos = i;
		}
		if (xCameraPos > i) {
			xCameraPos -= anInt1101 + ((xCameraPos - i) * anInt1102) / 1000;
			if (xCameraPos < i)
				xCameraPos = i;
		}
		if (zCameraPos < k) {
			zCameraPos += anInt1101 + ((k - zCameraPos) * anInt1102) / 1000;
			if (zCameraPos > k)
				zCameraPos = k;
		}
		if (zCameraPos > k) {
			zCameraPos -= anInt1101 + ((zCameraPos - k) * anInt1102) / 1000;
			if (zCameraPos < k)
				zCameraPos = k;
		}
		if (yCameraPos < j) {
			yCameraPos += anInt1101 + ((j - yCameraPos) * anInt1102) / 1000;
			if (yCameraPos > j)
				yCameraPos = j;
		}
		if (yCameraPos > j) {
			yCameraPos -= anInt1101 + ((yCameraPos - j) * anInt1102) / 1000;
			if (yCameraPos < j)
				yCameraPos = j;
		}
		i = anInt995 * 128 + 64;
		j = anInt996 * 128 + 64;
		k = method42(plane, j, i) - anInt997;
		int l = i - xCameraPos;
		int i1 = k - zCameraPos;
		int j1 = j - yCameraPos;
		int k1 = (int) Math.sqrt(l * l + j1 * j1);
		int l1 = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
		int i2 = (int) (Math.atan2(l, j1) * -325.94900000000001D) & 0x7ff;
		if (l1 < 128)
			l1 = 128;
		if (l1 > 383)
			l1 = 383;
		if (yCameraCurve < l1) {
			yCameraCurve += anInt998 + ((l1 - yCameraCurve) * anInt999) / 1000;
			if (yCameraCurve > l1)
				yCameraCurve = l1;
		}
		if (yCameraCurve > l1) {
			yCameraCurve -= anInt998 + ((yCameraCurve - l1) * anInt999) / 1000;
			if (yCameraCurve < l1)
				yCameraCurve = l1;
		}
		int j2 = i2 - xCameraCurve;
		if (j2 > 1024)
			j2 -= 2048;
		if (j2 < -1024)
			j2 += 2048;
		if (j2 > 0) {
			xCameraCurve += anInt998 + (j2 * anInt999) / 1000;
			xCameraCurve &= 0x7ff;
		}
		if (j2 < 0) {
			xCameraCurve -= anInt998 + (-j2 * anInt999) / 1000;
			xCameraCurve &= 0x7ff;
		}
		int k2 = i2 - xCameraCurve;
		if (k2 > 1024)
			k2 -= 2048;
		if (k2 < -1024)
			k2 += 2048;
		if (k2 < 0 && j2 > 0 || k2 > 0 && j2 < 0)
			xCameraCurve = i2;
	}

	private void drawMenu(int xOffSet, int yOffSet) {
		if (menuToggle == false) {
			int xPos = menuOffsetX - (xOffSet - 4);
			int yPos = (-yOffSet + 4) + menuOffsetY;
			int menuW = menuWidth;
			int menuH = menuHeight + 1;
			int color = 0x5d5447;
			inputTaken = true;
			tabAreaAltered = true;
			// DrawingArea.drawPixels(height, yPos, xPos, color, width);
			// DrawingArea.fillPixels(xPos, width, height, color, yPos);
			DrawingArea.drawPixels(menuH, yPos, xPos, color, menuW);
			DrawingArea.drawPixels(16, yPos + 1, xPos + 1, 0, menuW - 2);
			DrawingArea.fillPixels(xPos + 1, menuW - 2, menuH - 19, 0,
					yPos + 18);
			chatTextDrawingArea.method385(color, "Choose Option", yPos + 14,
					xPos + 3);
			int mouseX = super.mouseX - (xOffSet);
			int mouseY = (-yOffSet) + super.mouseY;
			for (int l1 = 0; l1 < menuActionRow; l1++) {
				int textY = yPos + 31 + (menuActionRow - 1 - l1) * 15;
				int disColor = 0xffffff;
				if (mouseX > xPos && mouseX < xPos + menuW
						&& mouseY > textY - 13 && mouseY < textY + 3)
					disColor = 0xffff00;
				chatTextDrawingArea.method389(true, xPos + 3, disColor,
						menuActionName[l1], textY);
			}
		} else if (menuToggle == true) {
			int xPos = menuOffsetX - (xOffSet - 4);
			int yPos = (-yOffSet + 4) + menuOffsetY;
			int menuW = menuWidth;
			int menuH = menuHeight + 1;
			inputTaken = true;
			tabAreaAltered = true;
			// DrawingArea.drawPixels(height, yPos, xPos, color, width);
			// DrawingArea.fillPixels(xPos, width, height, color, yPos);
			DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos, 0x706a5e, menuW);
			DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 1, 0x706a5e,
					menuW - 2);
			DrawingArea.drawPixels(menuH, yPos, xPos + 2, 0x706a5e, menuW - 4);
			DrawingArea.drawPixels(menuH - 2, yPos + 1, xPos + 3, 0x2d2822,
					menuW - 6);
			DrawingArea.drawPixels(menuH - 4, yPos + 2, xPos + 2, 0x2d2822,
					menuW - 4);
			DrawingArea.drawPixels(menuH - 6, yPos + 3, xPos + 1, 0x2d2822,
					menuW - 2);
			DrawingArea.drawPixels(menuH - 22, yPos + 19, xPos + 2, 0x524a3d,
					menuW - 4);
			DrawingArea.drawPixels(menuH - 22, yPos + 20, xPos + 3, 0x524a3d,
					menuW - 6);
			DrawingArea.drawPixels(menuH - 23, yPos + 20, xPos + 3, 0x2b271c,
					menuW - 6);
			DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x2a291b, yPos + 2);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a261b, yPos + 3);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x252116, yPos + 4);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x211e15, yPos + 5);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1e1b12, yPos + 6);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x1a170e, yPos + 7);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 2, 0x15120b, yPos + 8);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x100d08, yPos + 10);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 11);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x080703, yPos + 12);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 13);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 14);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 15);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x070802, yPos + 16);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x090a04, yPos + 17);
			DrawingArea.fillPixels(xPos + 2, menuW - 4, 1, 0x2a291b, yPos + 18);
			DrawingArea.fillPixels(xPos + 3, menuW - 6, 1, 0x564943, yPos + 19);
			chatTextDrawingArea.method385(0xc6b895, "Choose Option", yPos + 14,
					xPos + 3);
			int mouseX = super.mouseX - (xOffSet);
			int mouseY = (-yOffSet) + super.mouseY;
			for (int l1 = 0; l1 < menuActionRow; l1++) {
				int textY = yPos + 31 + (menuActionRow - 1 - l1) * 15;
				int disColor = 0xc6b895;
				if (mouseX > xPos && mouseX < xPos + menuW
						&& mouseY > textY - 13 && mouseY < textY + 3) {
					DrawingArea.drawPixels(15, textY - 11, xPos + 3, 0x6f695d,
							menuWidth - 6);
					disColor = 0xeee5c6;
				}
				chatTextDrawingArea.method389(true, xPos + 3, disColor,
						menuActionName[l1], textY);
			}
		}
	}

	private void addFriend(long l) {
		try {
			if (l == 0L)
				return;
			if (friendsCount >= 100 && anInt1046 != 1) {
				pushMessage(
						"Your friendlist is full. Max of 100 for free users, and 200 for members",
						0, "");
				return;
			}
			if (friendsCount >= 200) {
				pushMessage(
						"Your friendlist is full. Max of 100 for free users, and 200 for members",
						0, "");
				return;
			}
			String s = TextClass.fixName(TextClass.nameForLong(l));
			for (int i = 0; i < friendsCount; i++)
				if (friendsListAsLongs[i] == l) {
					pushMessage(s + " is already on your friend list", 0, "");
					return;
				}
			for (int j = 0; j < ignoreCount; j++)
				if (ignoreListAsLongs[j] == l) {
					pushMessage("Please remove " + s
							+ " from your ignore list first", 0, "");
					return;
				}

			if (s.equals(myPlayer.name)) {
				return;
			} else {
				friendsList[friendsCount] = s;
				friendsListAsLongs[friendsCount] = l;
				friendsNodeIDs[friendsCount] = 0;
				friendsCount++;
				stream.createFrame(188);
				stream.writeQWord(l);
				return;
			}
		} catch (RuntimeException runtimeexception) {
			signlink.reporterror("15283, " + (byte) 68 + ", " + l + ", "
					+ runtimeexception.toString());
		}
		throw new RuntimeException();
	}

	private int method42(int i, int j, int k) {
		int l = k >> 7;
		int i1 = j >> 7;
		if (l < 0 || i1 < 0 || l > 103 || i1 > 103)
			return 0;
		int j1 = i;
		if (j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2)
			j1++;
		int k1 = k & 0x7f;
		int l1 = j & 0x7f;
		int i2 = intGroundArray[j1][l][i1] * (128 - k1)
				+ intGroundArray[j1][l + 1][i1] * k1 >> 7;
		int j2 = intGroundArray[j1][l][i1 + 1] * (128 - k1)
				+ intGroundArray[j1][l + 1][i1 + 1] * k1 >> 7;
		return i2 * (128 - l1) + j2 * l1 >> 7;
	}

	private static String intToKOrMil(int j) {
		if (j < 0x186a0)
			return String.valueOf(j);
		if (j < 0x989680)
			return j / 1000 + "K";
		else
			return j / 0xf4240 + "M";
	}

	public int canWalkDelay = 0;

	public int getDis(int coordX1, int coordY1, int coordX2, int coordY2) {
		int deltaX = coordX2 - coordX1;
		int deltaY = coordY2 - coordY1;
		return ((int) Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)));
	}

	public int random(int range) {
		return (int) (Math.random() * range);
	}

	public boolean withinDistance(int x1, int y1, int x2, int y2, int dis) {
		for (int i = 0; i <= dis; i++) {
			try {
				if ((x1 + i) == x2
						&& ((y1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
					return true;
				else if ((x1 - i) == x2
						&& ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
					return true;
				else if (x1 == x2
						&& ((x1 + i) == y2 || (y1 - i) == y2 || y1 == y2))
					return true;
			} catch (Exception ex) {
				System.out
						.println("Exception in following, method : WithingDistance");
			}
		}
		return false;
	}

	private void resetLogout() {
		try {
			if (socketStream != null)
				socketStream.close();
		} catch (Exception _ex) {
		}
		welcomeScreen = true;
		shopOverview = false;
		socketStream = null;
		alertHandler.alert = null;
		loggedIn = false;
		runClicked = true;
		musicOrb = false;
		restOrb = false;
		followPlayer = 0;
		followNPC = 0;
		followDistance = 1;
		prayClicked = false;
		xpClicked = false;
		drawXpBar = false;
		loginScreenState = 0;
		// myUsername = "";
		// myPassword = "";
		unlinkMRUNodes();
		worldController.initToNull();
		for (int i = 0; i < 4; i++)
			aClass11Array1230[i].method210();
		System.gc();
	}

	private void method45() {

		aBoolean1031 = true;
		for (int j = 0; j < 7; j++) {
			anIntArray1065[j] = -1;
			for (int k = 0; k < IdentityKit.length; k++) {
				if (IdentityKit.cache[k].aBoolean662
						|| IdentityKit.cache[k].anInt657 != j
								+ (aBoolean1047 ? 0 : 7))
					continue;
				anIntArray1065[j] = k;
				break;
			}
		}
	}

	private void method46(int i, Stream stream) {
		while (stream.bitPosition + 21 < i * 8) {
			int k = stream.readBits(14);
			if (k == 16383)
				break;
			if (npcArray[k] == null)
				npcArray[k] = new NPC();
			NPC npc = npcArray[k];
			npcIndices[npcCount++] = k;
			npc.anInt1537 = loopCycle;
			int l = stream.readBits(5);
			if (l > 15)
				l -= 32;
			int i1 = stream.readBits(5);
			if (i1 > 15)
				i1 -= 32;
			int j1 = stream.readBits(1);
			npc.desc = EntityDef.forID(stream.readBits(14));// NPC FIX
			int k1 = stream.readBits(1);
			if (k1 == 1)
				anIntArray894[anInt893++] = k;
			npc.anInt1540 = npc.desc.aByte68;
			npc.anInt1504 = npc.desc.anInt79;
			npc.anInt1554 = npc.desc.walkAnim;
			npc.anInt1555 = npc.desc.anInt58;
			npc.anInt1556 = npc.desc.anInt83;
			npc.anInt1557 = npc.desc.anInt55;
			npc.anInt1511 = npc.desc.standAnim;
			npc.setPos(myPlayer.smallX[0] + i1, myPlayer.smallY[0] + l, j1 == 1);
		}
		stream.finishBitAccess();
	}

	public void processGameLoop() {

		if (rsAlreadyLoaded || loadingError || genericLoadingError)
			return;
		loopCycle++;
		if (!loggedIn)
			processLoginScreenInput();
		else
			mainGameProcessor();
		processOnDemandQueue();
	}

	private void method47(boolean flag) {
		if (myPlayer.x >> 7 == destX && myPlayer.y >> 7 == destY)
			destX = 0;
		int j = playerCount;
		if (flag)
			j = 1;
		for (int l = 0; l < j; l++) {
			Player player;
			int i1;
			if (flag) {
				player = myPlayer;
				i1 = myPlayerIndex << 14;
			} else {
				player = playerArray[playerIndices[l]];
				i1 = playerIndices[l] << 14;
			}
			if (player == null || !player.isVisible())
				continue;
			player.aBoolean1699 = (lowMem && playerCount > 50 || playerCount > 200)
					&& !flag && player.anInt1517 == player.anInt1511;
			int j1 = player.x >> 7;
			int k1 = player.y >> 7;
			if (j1 < 0 || j1 >= 104 || k1 < 0 || k1 >= 104)
				continue;
			if (player.aModel_1714 != null && loopCycle >= player.anInt1707
					&& loopCycle < player.anInt1708) {
				player.aBoolean1699 = false;
				player.anInt1709 = method42(plane, player.y, player.x);
				worldController.method286(plane, player.y, player,
						player.anInt1552, player.anInt1722, player.x,
						player.anInt1709, player.anInt1719, player.anInt1721,
						i1, player.anInt1720);
				continue;
			}
			if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
				if (anIntArrayArray929[j1][k1] == anInt1265)
					continue;
				anIntArrayArray929[j1][k1] = anInt1265;
			}
			player.anInt1709 = method42(plane, player.y, player.x);
			worldController.method285(plane, player.anInt1552,
					player.anInt1709, i1, player.y, 60, player.x, player,
					player.aBoolean1541);
		}
	}

	private boolean promptUserForInput(RSInterface class9) {
		int j = class9.contentType;
		if (anInt900 == 2) {
			if (j == 201) {
				inputTaken = true;
				inputDialogState = 0;
				messagePromptRaised = true;
				promptInput = "";
				friendsListAction = 1;
				aString1121 = "Enter name of friend to add to list";
			}
			if (j == 202) {
				inputTaken = true;
				inputDialogState = 0;
				messagePromptRaised = true;
				promptInput = "";
				friendsListAction = 2;
				aString1121 = "Enter name of friend to delete from list";
			}
		}
		if (j == 205) {
			anInt1011 = 250;
			return true;
		}
		if (j == 501) {
			inputTaken = true;
			inputDialogState = 0;
			messagePromptRaised = true;
			promptInput = "";
			friendsListAction = 4;
			aString1121 = "Enter name of player to add to list";
		}
		if (j == 502) {
			inputTaken = true;
			inputDialogState = 0;
			messagePromptRaised = true;
			promptInput = "";
			friendsListAction = 5;
			aString1121 = "Enter name of player to delete from list";
		}
		if (j == 550) {
			inputTaken = true;
			inputDialogState = 0;
			messagePromptRaised = true;
			promptInput = "";
			friendsListAction = 6;
			aString1121 = "Enter the name of the chat you wish to join";
		}
		if (j >= 300 && j <= 313) {
			int k = (j - 300) / 2;
			int j1 = j & 1;
			int i2 = anIntArray1065[k];
			if (i2 != -1) {
				do {
					if (j1 == 0 && --i2 < 0)
						i2 = IdentityKit.length - 1;
					if (j1 == 1 && ++i2 >= IdentityKit.length)
						i2 = 0;
				} while (IdentityKit.cache[i2].aBoolean662
						|| IdentityKit.cache[i2].anInt657 != k
								+ (aBoolean1047 ? 0 : 7));
				anIntArray1065[k] = i2;
				aBoolean1031 = true;
			}
		}
		if (j >= 314 && j <= 323) {
			int l = (j - 314) / 2;
			int k1 = j & 1;
			int j2 = anIntArray990[l];
			if (k1 == 0 && --j2 < 0)
				j2 = anIntArrayArray1003[l].length - 1;
			if (k1 == 1 && ++j2 >= anIntArrayArray1003[l].length)
				j2 = 0;
			anIntArray990[l] = j2;
			aBoolean1031 = true;
		}
		if (j == 324 && !aBoolean1047) {
			aBoolean1047 = true;
			method45();
		}
		if (j == 325 && aBoolean1047) {
			aBoolean1047 = false;
			method45();
		}
		if (j == 326) {
			stream.createFrame(101);
			stream.writeWordBigEndian(aBoolean1047 ? 0 : 1);
			for (int i1 = 0; i1 < 7; i1++)
				stream.writeWordBigEndian(anIntArray1065[i1]);

			for (int l1 = 0; l1 < 5; l1++)
				stream.writeWordBigEndian(anIntArray990[l1]);

			return true;
		}
		if (j == 613)
			canMute = !canMute;
		if (j >= 601 && j <= 612) {
			clearTopInterfaces();
			if (reportAbuseInput.length() > 0) {
				stream.createFrame(218);
				stream.writeQWord(TextClass.longForName(reportAbuseInput));
				stream.writeWordBigEndian(j - 601);
				stream.writeWordBigEndian(canMute ? 1 : 0);
			}
		}
		return false;
	}

	private void method49(Stream stream) {
		for (int j = 0; j < anInt893; j++) {
			int k = anIntArray894[j];
			Player player = playerArray[k];
			int l = stream.readUnsignedByte();
			if ((l & 0x40) != 0)
				l += stream.readUnsignedByte() << 8;
			method107(l, k, stream, player);
		}
	}

	private void method50(int i, int k, int l, int i1, int j1) {
		int k1 = worldController.method300(j1, l, i);
		if (k1 != 0) {
			int l1 = worldController.method304(j1, l, i, k1);
			int k2 = l1 >> 6 & 3;
			int i3 = l1 & 0x1f;
			int k3 = k;
			if (k1 > 0)
				k3 = i1;
			int ai[] = aSprite_1263.myPixels;
			int k4 = 24624 + l * 4 + (103 - i) * 512 * 4;
			int i5 = k1 >> 14 & 0x7fff;
			ObjectDef class46_2 = ObjectDef.forID(i5);
			if (class46_2.anInt758 != -1) {
				Background background_2 = mapScenes[class46_2.anInt758];
				if (background_2 != null) {
					int i6 = (class46_2.anInt744 * 4 - background_2.anInt1452) / 2;
					int j6 = (class46_2.anInt761 * 4 - background_2.anInt1453) / 2;
					background_2.drawBackground(48 + l * 4 + i6, 48
							+ (104 - i - class46_2.anInt761) * 4 + j6);
				}
			} else {
				if (i3 == 0 || i3 == 2)
					if (k2 == 0) {
						ai[k4] = k3;
						ai[k4 + 512] = k3;
						ai[k4 + 1024] = k3;
						ai[k4 + 1536] = k3;
					} else if (k2 == 1) {
						ai[k4] = k3;
						ai[k4 + 1] = k3;
						ai[k4 + 2] = k3;
						ai[k4 + 3] = k3;
					} else if (k2 == 2) {
						ai[k4 + 3] = k3;
						ai[k4 + 3 + 512] = k3;
						ai[k4 + 3 + 1024] = k3;
						ai[k4 + 3 + 1536] = k3;
					} else if (k2 == 3) {
						ai[k4 + 1536] = k3;
						ai[k4 + 1536 + 1] = k3;
						ai[k4 + 1536 + 2] = k3;
						ai[k4 + 1536 + 3] = k3;
					}
				if (i3 == 3)
					if (k2 == 0)
						ai[k4] = k3;
					else if (k2 == 1)
						ai[k4 + 3] = k3;
					else if (k2 == 2)
						ai[k4 + 3 + 1536] = k3;
					else if (k2 == 3)
						ai[k4 + 1536] = k3;
				if (i3 == 2)
					if (k2 == 3) {
						ai[k4] = k3;
						ai[k4 + 512] = k3;
						ai[k4 + 1024] = k3;
						ai[k4 + 1536] = k3;
					} else if (k2 == 0) {
						ai[k4] = k3;
						ai[k4 + 1] = k3;
						ai[k4 + 2] = k3;
						ai[k4 + 3] = k3;
					} else if (k2 == 1) {
						ai[k4 + 3] = k3;
						ai[k4 + 3 + 512] = k3;
						ai[k4 + 3 + 1024] = k3;
						ai[k4 + 3 + 1536] = k3;
					} else if (k2 == 2) {
						ai[k4 + 1536] = k3;
						ai[k4 + 1536 + 1] = k3;
						ai[k4 + 1536 + 2] = k3;
						ai[k4 + 1536 + 3] = k3;
					}
			}
		}
		k1 = worldController.method302(j1, l, i);
		if (k1 != 0) {
			int i2 = worldController.method304(j1, l, i, k1);
			int l2 = i2 >> 6 & 3;
			int j3 = i2 & 0x1f;
			int l3 = k1 >> 14 & 0x7fff;
			ObjectDef class46_1 = ObjectDef.forID(l3);
			if (class46_1.anInt758 != -1) {
				Background background_1 = mapScenes[class46_1.anInt758];
				if (background_1 != null) {
					int j5 = (class46_1.anInt744 * 4 - background_1.anInt1452) / 2;
					int k5 = (class46_1.anInt761 * 4 - background_1.anInt1453) / 2;
					background_1.drawBackground(48 + l * 4 + j5, 48
							+ (104 - i - class46_1.anInt761) * 4 + k5);
				}
			} else if (j3 == 9) {
				int l4 = 0xeeeeee;
				if (k1 > 0)
					l4 = 0xee0000;
				int ai1[] = aSprite_1263.myPixels;
				int l5 = 24624 + l * 4 + (103 - i) * 512 * 4;
				if (l2 == 0 || l2 == 2) {
					ai1[l5 + 1536] = l4;
					ai1[l5 + 1024 + 1] = l4;
					ai1[l5 + 512 + 2] = l4;
					ai1[l5 + 3] = l4;
				} else {
					ai1[l5] = l4;
					ai1[l5 + 512 + 1] = l4;
					ai1[l5 + 1024 + 2] = l4;
					ai1[l5 + 1536 + 3] = l4;
				}
			}
		}
		k1 = worldController.method303(j1, l, i);
		if (k1 != 0) {
			int j2 = k1 >> 14 & 0x7fff;
			ObjectDef class46 = ObjectDef.forID(j2);
			if (class46.anInt758 != -1) {
				Background background = mapScenes[class46.anInt758];
				if (background != null) {
					int i4 = (class46.anInt744 * 4 - background.anInt1452) / 2;
					int j4 = (class46.anInt761 * 4 - background.anInt1453) / 2;
					background.drawBackground(48 + l * 4 + i4, 48
							+ (104 - i - class46.anInt761) * 4 + j4);
				}
			}
		}
	}

	private void loadTitleScreen() {

		check = new Sprite("Login/check");
		loginHover = new Sprite("Login/loginHover");
		if (normalLogin == false)
			titleBox = new Sprite("Login/titleBox");
		else
			titleBox1 = new Sprite("Player/Login/titleButton");
		titleButton = new Background(titleStreamLoader, "titlebutton", 0);
		aBackgroundArray1152s = new Background[12];
		int j = 0;
		try {
			j = Integer.parseInt(getParameter("fl_icon"));
		} catch (Exception _ex) {
		}
		if (j == 0) {
			for (int k = 0; k < 12; k++)
				aBackgroundArray1152s[k] = new Background(titleStreamLoader,
						"runes", k);

		} else {
			for (int l = 0; l < 12; l++)
				aBackgroundArray1152s[l] = new Background(titleStreamLoader,
						"runes", 12 + (l & 3));

		}
		aSprite_1201 = new Sprite(128, 265);
		aSprite_1202 = new Sprite(128, 265);
		System.arraycopy(leftSideFlame.anIntArray315, 0, aSprite_1201.myPixels,
				0, 33920);

		System.arraycopy(rightSideFlame.anIntArray315, 0,
				aSprite_1202.myPixels, 0, 33920);

		anIntArray851 = new int[256];
		for (int k1 = 0; k1 < 64; k1++)
			anIntArray851[k1] = k1 * 0x40000;

		for (int l1 = 0; l1 < 64; l1++)
			anIntArray851[l1 + 64] = 0xff0000 + 1024 * l1;

		for (int i2 = 0; i2 < 64; i2++)
			anIntArray851[i2 + 128] = 0xffff00 + 4 * i2;

		for (int j2 = 0; j2 < 64; j2++)
			anIntArray851[j2 + 192] = 0xffffff;

		anIntArray852 = new int[256];
		for (int k2 = 0; k2 < 64; k2++)
			anIntArray852[k2] = k2 * 1024;

		for (int l2 = 0; l2 < 64; l2++)
			anIntArray852[l2 + 64] = 65280 + 4 * l2;

		for (int i3 = 0; i3 < 64; i3++)
			anIntArray852[i3 + 128] = 65535 + 0x40000 * i3;

		for (int j3 = 0; j3 < 64; j3++)
			anIntArray852[j3 + 192] = 0xffffff;

		anIntArray853 = new int[256];
		for (int k3 = 0; k3 < 64; k3++)
			anIntArray853[k3] = k3 * 4;

		for (int l3 = 0; l3 < 64; l3++)
			anIntArray853[l3 + 64] = 255 + 0x40000 * l3;

		for (int i4 = 0; i4 < 64; i4++)
			anIntArray853[i4 + 128] = 0xff00ff + 1024 * i4;

		for (int j4 = 0; j4 < 64; j4++)
			anIntArray853[j4 + 192] = 0xffffff;

		anIntArray850 = new int[256];
		anIntArray1190 = new int[32768];
		anIntArray1191 = new int[32768];
		randomizeBackground(null);
		anIntArray828 = new int[32768];
		if (!aBoolean831) {
			drawFlames = true;
			aBoolean831 = true;
			startRunnable(this, 2);
		}
	}

	private static void setHighMem() {
		WorldController.lowMem = true;
		Texture.lowMem = false;
		lowMem = false;
		ObjectManager.lowMem = false;
		ObjectDef.lowMem = false;
	}

	public static void main(String args[]) {
		try {
			nodeID = 10;
			portOff = 0;
			setHighMem(); // sets high or low detail
			isMembers = true;
			signlink.storeid = 32;
			signlink.startpriv(InetAddress.getLocalHost());
			instance = new client();
			instance.createClientFrame(503, 765);// client frame size
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static client instance;

	private void loadingStages() {
		if (lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) {
			inGameScreen.initDrawingArea();
			loadingPleaseWait.drawSprite(8, 9);
			;
			inGameScreen.drawGraphics(4, super.graphics, 4);
			loadingStage = 1;
			aLong824 = System.currentTimeMillis();
		}
		if (loadingStage == 1) {
			int j = method54();
			if (j != 0 && System.currentTimeMillis() - aLong824 > 0x57e40L) {
				signlink.reporterror(myUsername + " glcfb " + aLong1215 + ","
						+ j + "," + lowMem + "," + decompressors[0] + ","
						+ onDemandFetcher.getNodeCount() + "," + plane + ","
						+ anInt1069 + "," + anInt1070);
				aLong824 = System.currentTimeMillis();
			}
		}
		if (loadingStage == 2 && plane != anInt985) {
			anInt985 = plane;
			method24(plane);
		}
	}

	private int method54() {
		for (int i = 0; i < aByteArrayArray1183.length; i++) {
			if (aByteArrayArray1183[i] == null && anIntArray1235[i] != -1)
				return -1;
			if (aByteArrayArray1247[i] == null && anIntArray1236[i] != -1)
				return -2;
		}
		boolean flag = true;
		for (int j = 0; j < aByteArrayArray1183.length; j++) {
			byte abyte0[] = aByteArrayArray1247[j];
			if (abyte0 != null) {
				int k = (anIntArray1234[j] >> 8) * 64 - baseX;
				int l = (anIntArray1234[j] & 0xff) * 64 - baseY;
				if (aBoolean1159) {
					k = 10;
					l = 10;
				}
				flag &= ObjectManager.method189(k, abyte0, l);
			}
		}
		if (!flag)
			return -3;
		if (aBoolean1080) {
			return -4;
		} else {
			loadingStage = 2;
			ObjectManager.anInt131 = plane;
			method22();
			stream.createFrame(121);
			return 0;
		}
	}

	private void method55() {
		for (Animable_Sub4 class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
				.reverseGetFirst(); class30_sub2_sub4_sub4 != null; class30_sub2_sub4_sub4 = (Animable_Sub4) aClass19_1013
				.reverseGetNext())
			if (class30_sub2_sub4_sub4.anInt1597 != plane
					|| loopCycle > class30_sub2_sub4_sub4.anInt1572)
				class30_sub2_sub4_sub4.unlink();
			else if (loopCycle >= class30_sub2_sub4_sub4.anInt1571) {
				if (class30_sub2_sub4_sub4.anInt1590 > 0) {
					NPC npc = npcArray[class30_sub2_sub4_sub4.anInt1590 - 1];
					if (npc != null && npc.x >= 0 && npc.x < 13312
							&& npc.y >= 0 && npc.y < 13312)
						class30_sub2_sub4_sub4.method455(
								loopCycle,
								npc.y,
								method42(class30_sub2_sub4_sub4.anInt1597,
										npc.y, npc.x)
										- class30_sub2_sub4_sub4.anInt1583,
								npc.x);
				}
				if (class30_sub2_sub4_sub4.anInt1590 < 0) {
					int j = -class30_sub2_sub4_sub4.anInt1590 - 1;
					Player player;
					if (j == unknownInt10)
						player = myPlayer;
					else
						player = playerArray[j];
					if (player != null && player.x >= 0 && player.x < 13312
							&& player.y >= 0 && player.y < 13312)
						class30_sub2_sub4_sub4.method455(
								loopCycle,
								player.y,
								method42(class30_sub2_sub4_sub4.anInt1597,
										player.y, player.x)
										- class30_sub2_sub4_sub4.anInt1583,
								player.x);
				}
				class30_sub2_sub4_sub4.method456(anInt945);
				worldController.method285(plane,
						class30_sub2_sub4_sub4.anInt1595,
						(int) class30_sub2_sub4_sub4.aDouble1587, -1,
						(int) class30_sub2_sub4_sub4.aDouble1586, 60,
						(int) class30_sub2_sub4_sub4.aDouble1585,
						class30_sub2_sub4_sub4, false);
			}

	}

	public AppletContext getAppletContext() {
		if (signlink.mainapp != null)
			return signlink.mainapp.getAppletContext();
		else
			return super.getAppletContext();
	}

	private void drawLogo() {
		byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
		Sprite sprite = new Sprite(abyte0, this);
		if (normalLogin == false) {
			leftSideFlame.initDrawingArea();
			sprite.method346(0, 0);
			rightSideFlame.initDrawingArea();
			sprite.method346(-637, 0);
			aRSImageProducer_1107.initDrawingArea();
			sprite.method346(-128, 0);
			aRSImageProducer_1108.initDrawingArea();
			sprite.method346(-202, -371);
			loginScreenArea.initDrawingArea();
			sprite.method346(-0, -0);
			gameLogo.initDrawingArea();
			sprite.method346(0, -265);
			aRSImageProducer_1113.initDrawingArea();
			sprite.method346(-562, -265);
			aRSImageProducer_1114.initDrawingArea();
			sprite.method346(-128, -171);
			aRSImageProducer_1115.initDrawingArea();
			sprite.method346(-562, -171);
			int ai[] = new int[sprite.myWidth];
			for (int j = 0; j < sprite.myHeight; j++) {
				for (int k = 0; k < sprite.myWidth; k++)
					ai[k] = sprite.myPixels[(sprite.myWidth - k - 1)
							+ sprite.myWidth * j];
				System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j,
						sprite.myWidth);
			}
			if (normalLogin == true) {
				/*
				 * leftSideFlame.initDrawingArea(); sprite.method346(382, 0);
				 * rightSideFlame.initDrawingArea(); sprite.method346(-255, 0);
				 * aRSImageProducer_1107.initDrawingArea();
				 * sprite.method346(254, 0);
				 * aRSImageProducer_1108.initDrawingArea();
				 * sprite.method346(180, -371);
				 * loginScreenArea.initDrawingArea(); sprite.method346(180,
				 * -171); gameLogo.initDrawingArea(); sprite.method346(382,
				 * -265); aRSImageProducer_1113.initDrawingArea();
				 * sprite.method346(-180, -265);
				 * aRSImageProducer_1114.initDrawingArea();
				 * sprite.method346(254, -171);
				 * aRSImageProducer_1115.initDrawingArea();
				 * sprite.method346(-180, -171);
				 */
				sprite = new Sprite(titleStreamLoader, "logo", 0);
				aRSImageProducer_1107.initDrawingArea();
				// sprite.drawSprite(382 - sprite.myWidth / 2 - 128, 18);
			}
		} else {
			int ai[] = new int[sprite.myWidth];
			for (int j = 0; j < sprite.myHeight; j++) {
				for (int k = 0; k < sprite.myWidth; k++)
					ai[k] = sprite.myPixels[(sprite.myWidth - k - 1)
							+ sprite.myWidth * j];
				System.arraycopy(ai, 0, sprite.myPixels, sprite.myWidth * j,
						sprite.myWidth);
			}
			new Sprite("Login/Random/LFull.png");
			new Sprite("Login/Random/LEmpty.png");
			Sprite logo = new Sprite(sign.signlink.findcachedir()
					+ "/Sprites/Logo.PNG");
			logo.drawSprite(385 - 174 - 174, 14 + 25);
			loginScreenArea.initDrawingArea();
			sprite.method346(0, 0);
		}
		sprite = null;
		System.gc();
	}

	private void processOnDemandQueue() {
		do {
			OnDemandData onDemandData;
			do {
				onDemandData = onDemandFetcher.getNextNode();
				if (onDemandData == null)
					return;
				if (onDemandData.dataType == 0) {
					Model.method460(onDemandData.buffer, onDemandData.ID);
					if ((onDemandFetcher.getModelIndex(onDemandData.ID) & 0x62) != 0) {
						if (backDialogID != -1)
							inputTaken = true;
					}
				}
				if (onDemandData.dataType == 1) {
					Class36.load(onDemandData.ID, onDemandData.buffer);
				}
				if (onDemandData.dataType == 3 && loadingStage == 1) {
					for (int i = 0; i < aByteArrayArray1183.length; i++) {
						if (anIntArray1235[i] == onDemandData.ID) {
							aByteArrayArray1183[i] = onDemandData.buffer;
							if (onDemandData.buffer == null)
								anIntArray1235[i] = -1;
							break;
						}
						if (anIntArray1236[i] != onDemandData.ID)
							continue;
						aByteArrayArray1247[i] = onDemandData.buffer;
						if (onDemandData.buffer == null)
							anIntArray1236[i] = -1;
						break;
					}

				}
			} while (onDemandData.dataType != 93
					|| !onDemandFetcher.method564(onDemandData.ID));
			ObjectManager.method173(new Stream(onDemandData.buffer),
					onDemandFetcher);
		} while (true);
	}

	private void method60(int i) {
		RSInterface class9 = RSInterface.interfaceCache[i];
		for (int j = 0; j < class9.children.length; j++) {
			if (class9.children[j] == -1)
				break;
			RSInterface class9_1 = RSInterface.interfaceCache[class9.children[j]];
			if (class9_1.interfaceType == 1)
				method60(class9_1.id);
			class9_1.animationLength = 0;
			class9_1.animationDelay = 0;
		}
	}

	private void drawHeadIcon() {
		if (anInt855 != 2)
			return;
		calcEntityScreenPos((anInt934 - baseX << 7) + anInt937, anInt936 * 2,
				(anInt935 - baseY << 7) + anInt938);
		if (spriteDrawX > -1 && loopCycle % 20 < 10)
			headIconsHint[0].drawSprite(spriteDrawX - 12, spriteDrawY - 28);
	}

	private void mainGameProcessor() {
		if (anInt1104 > 1)
			anInt1104--;
		if (anInt1011 > 0)
			anInt1011--;
		if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
			if (anInt1501 < 100) {
				anInt1501++;
				if (anInt1501 == 100) {
					if (anInt1500 != 0) {
						inputTaken = true;
					}
					if (anInt1044 != 0) {
					}
				}
			}
		} else if (anInt1501 > 0) {
			anInt1501--;
		}
		for (int j = 0; j < 5; j++)
			if (!parsePacket())
				break;
		if (!loggedIn)
			return;
		try {
			canWalkDelay--;
			if (followNPC > 0) {
				NPC n = npcArray[followNPC];
				if (n != null) {
					if (!withinDistance(myPlayer.smallX[0], myPlayer.smallY[0],
							n.smallX[0], n.smallY[0], followDistance)) {
						doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
								n.smallY[0], myPlayer.smallX[0], false,
								n.smallX[0]);
					}
				}
			} else if (followPlayer > 0 && canWalkDelay <= 0) {
				Player p = playerArray[followPlayer];
				if (p != null) {
					int dis = getDis(myPlayer.smallX[0], myPlayer.smallY[0],
							p.smallX[0], p.smallY[0]);
					if (dis > followDistance) {
						doWalkTo(2, 0, 1, 0, myPlayer.smallY[0],
								followDistance, 0, p.smallY[0],
								myPlayer.smallX[0], false, p.smallX[0]);
						canWalkDelay = 30;
					} else if (dis == 0) {
						int rnd = random(4);
						if (rnd == 0) {
							doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
									p.smallY[0], myPlayer.smallX[0], false,
									p.smallX[0] - 2);
						} else if (rnd == 1) {
							doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
									p.smallY[0], myPlayer.smallX[0], false,
									p.smallX[0] + 2);
						} else if (rnd == 2) {
							doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
									p.smallY[0] - 2, myPlayer.smallX[0], false,
									p.smallX[0]);
						} else if (rnd == 3) {
							doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
									p.smallY[0] + 2, myPlayer.smallX[0], false,
									p.smallX[0]);
						}
						canWalkDelay = 60;
					}
				}
			}
		} catch (Exception ex) {
			System.out.println("Exception in following, method : in process.)");
		}
		synchronized (mouseDetection.syncObject) {
			if (flagged) {
				if (super.clickMode3 != 0 || mouseDetection.coordsIndex >= 40) {
					stream.createFrame(45);
					stream.writeWordBigEndian(0);
					int j2 = stream.currentOffset;
					int j3 = 0;
					for (int j4 = 0; j4 < mouseDetection.coordsIndex; j4++) {
						if (j2 - stream.currentOffset >= 240)
							break;
						j3++;
						int l4 = mouseDetection.coordsY[j4];
						if (l4 < 0)
							l4 = 0;
						else if (l4 > 502)
							l4 = 502;
						int k5 = mouseDetection.coordsX[j4];
						if (k5 < 0)
							k5 = 0;
						else if (k5 > 764)
							k5 = 764;
						int i6 = l4 * 765 + k5;
						if (mouseDetection.coordsY[j4] == -1
								&& mouseDetection.coordsX[j4] == -1) {
							k5 = -1;
							l4 = -1;
							i6 = 0x7ffff;
						}
						if (k5 == anInt1237 && l4 == anInt1238) {
							if (anInt1022 < 2047)
								anInt1022++;
						} else {
							int j6 = k5 - anInt1237;
							anInt1237 = k5;
							int k6 = l4 - anInt1238;
							anInt1238 = l4;
							if (anInt1022 < 8 && j6 >= -32 && j6 <= 31
									&& k6 >= -32 && k6 <= 31) {
								j6 += 32;
								k6 += 32;
								stream.writeWord((anInt1022 << 12) + (j6 << 6)
										+ k6);
								anInt1022 = 0;
							} else if (anInt1022 < 8) {
								stream.writeDWordBigEndian(0x800000
										+ (anInt1022 << 19) + i6);
								anInt1022 = 0;
							} else {
								stream.writeDWord(0xc0000000
										+ (anInt1022 << 19) + i6);
								anInt1022 = 0;
							}
						}
					}

					stream.writeBytes(stream.currentOffset - j2);
					if (j3 >= mouseDetection.coordsIndex) {
						mouseDetection.coordsIndex = 0;
					} else {
						mouseDetection.coordsIndex -= j3;
						for (int i5 = 0; i5 < mouseDetection.coordsIndex; i5++) {
							mouseDetection.coordsX[i5] = mouseDetection.coordsX[i5
									+ j3];
							mouseDetection.coordsY[i5] = mouseDetection.coordsY[i5
									+ j3];
						}

					}
				}
			} else {
				mouseDetection.coordsIndex = 0;
			}
		}
		if (super.clickMode3 != 0) {
			long l = (super.aLong29 - aLong1220) / 50L;
			if (l > 4095L)
				l = 4095L;
			aLong1220 = super.aLong29;
			int k2 = super.saveClickY;
			if (k2 < 0)
				k2 = 0;
			else if (k2 > 502)
				k2 = 502;
			int k3 = super.saveClickX;
			if (k3 < 0)
				k3 = 0;
			else if (k3 > 764)
				k3 = 764;
			int k4 = k2 * 765 + k3;
			int j5 = 0;
			if (super.clickMode3 == 2)
				j5 = 1;
			int l5 = (int) l;
			stream.createFrame(241);
			stream.writeDWord((l5 << 20) + (j5 << 19) + k4);
		}
		if (anInt1016 > 0)
			anInt1016--;
		if (super.keyArray[1] == 1 || super.keyArray[2] == 1
				|| super.keyArray[3] == 1 || super.keyArray[4] == 1)
			aBoolean1017 = true;
		if (aBoolean1017 && anInt1016 <= 0) {
			anInt1016 = 20;
			aBoolean1017 = false;
			stream.createFrame(86);
			stream.writeWord(anInt1184);
			stream.method432(minimapInt1);
		}
		if (super.awtFocus && !aBoolean954) {
			aBoolean954 = true;
			stream.createFrame(3);
			stream.writeWordBigEndian(1);
		}
		if (!super.awtFocus && aBoolean954) {
			aBoolean954 = false;
			stream.createFrame(3);
			stream.writeWordBigEndian(0);
		}
		loadingStages();
		method115();
		method90();
		anInt1009++;
		if (anInt1009 > 750)
			dropClient();
		method114();
		method95();
		method38();

		anInt945++;
		if (crossType != 0) {
			crossIndex += 20;
			if (crossIndex >= 400)
				crossType = 0;
		}
		if (atInventoryInterfaceType != 0) {
			atInventoryLoopCycle++;
			if (atInventoryLoopCycle >= 15) {
				if (atInventoryInterfaceType == 2) {
				}
				if (atInventoryInterfaceType == 3)
					inputTaken = true;
				atInventoryInterfaceType = 0;
			}
		}
		if (activeInterfaceType != 0) {
			anInt989++;
			if (super.mouseX > anInt1087 + 5 || super.mouseX < anInt1087 - 5
					|| super.mouseY > anInt1088 + 5
					|| super.mouseY < anInt1088 - 5)
				aBoolean1242 = true;
			if (super.clickMode2 == 0) {
				if (activeInterfaceType == 2) {
				}
				if (activeInterfaceType == 3)
					inputTaken = true;
				activeInterfaceType = 0;
				if (aBoolean1242 && anInt989 >= 5) {
					lastActiveInvInterface = -1;
					processRightClick();
					if (lastActiveInvInterface == anInt1084
							&& mouseInvInterfaceIndex != anInt1085) {
						RSInterface class9 = RSInterface.interfaceCache[anInt1084];
						int j1 = 0;
						if (anInt913 == 1 && class9.contentType == 206)
							j1 = 1;
						if (class9.inventory[mouseInvInterfaceIndex] <= 0)
							j1 = 0;
						if (class9.deletesTargetSlot) {
							int l2 = anInt1085;
							int l3 = mouseInvInterfaceIndex;
							class9.inventory[l3] = class9.inventory[l2];
							class9.inventoryValue[l3] = class9.inventoryValue[l2];
							class9.inventory[l2] = -1;
							class9.inventoryValue[l2] = 0;
						} else if (j1 == 1) {
							int i3 = anInt1085;
							for (int i4 = mouseInvInterfaceIndex; i3 != i4;)
								if (i3 > i4) {
									class9.swapInventoryItems(i3, i3 - 1);
									i3--;
								} else if (i3 < i4) {
									class9.swapInventoryItems(i3, i3 + 1);
									i3++;
								}

						} else {
							class9.swapInventoryItems(anInt1085,
									mouseInvInterfaceIndex);
						}
						stream.createFrame(214);
						stream.method433(anInt1084);
						stream.method424(j1);
						stream.method433(anInt1085);
						stream.method431(mouseInvInterfaceIndex);
					}
				} else if ((anInt1253 == 1 || menuHasAddFriend(menuActionRow - 1))
						&& menuActionRow > 2)
					determineMenuSize();
				else if (menuActionRow > 0)
					doAction(menuActionRow - 1);
				atInventoryLoopCycle = 10;
				super.clickMode3 = 0;
			}
		}
		if (WorldController.anInt470 != -1) {
			int k = WorldController.anInt470;
			int k1 = WorldController.anInt471;
			boolean flag = doWalkTo(0, 0, 0, 0, myPlayer.smallY[0], 0, 0, k1,
					myPlayer.smallX[0], true, k);
			WorldController.anInt470 = -1;
			if (flag) {
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 1;
				crossIndex = 0;
			}
		}
		if (super.clickMode3 == 1 && aString844 != null) {
			aString844 = null;
			inputTaken = true;
			super.clickMode3 = 0;
		}
		processMenuClick();
		processMainScreenClick();
		processTabClick();
		processChatModeClick();
		if (super.clickMode2 == 1 || super.clickMode3 == 1)
			anInt1213++;
		if (anInt1500 != 0 || anInt1044 != 0 || anInt1129 != 0) {
			if (anInt1501 < 100) {
				anInt1501++;
				if (anInt1501 == 100) {
					if (anInt1500 != 0) {
						inputTaken = true;
					}
					if (anInt1044 != 0) {
					}
				}
			}
		} else if (anInt1501 > 0) {
			anInt1501--;
		}
		if (loadingStage == 2)
			method108();
		if (loadingStage == 2 && aBoolean1160)
			calcCameraPos();
		for (int i1 = 0; i1 < 5; i1++)
			anIntArray1030[i1]++;

		method73();
		super.idleTime++;
		if (super.idleTime > 4500) {
			anInt1011 = 250;
			super.idleTime -= 500;
			stream.createFrame(202);
		}
		anInt988++;
		if (anInt988 > 500) {
			anInt988 = 0;
			int l1 = (int) (Math.random() * 8D);
			if ((l1 & 1) == 1)
				anInt1278 += anInt1279;
			if ((l1 & 2) == 2)
				anInt1131 += anInt1132;
			if ((l1 & 4) == 4)
				anInt896 += anInt897;
		}
		if (anInt1278 < -50)
			anInt1279 = 2;
		if (anInt1278 > 50)
			anInt1279 = -2;
		if (anInt1131 < -55)
			anInt1132 = 2;
		if (anInt1131 > 55)
			anInt1132 = -2;
		if (anInt896 < -40)
			anInt897 = 1;
		if (anInt896 > 40)
			anInt897 = -1;
		anInt1254++;
		if (anInt1254 > 500) {
			anInt1254 = 0;
			int i2 = (int) (Math.random() * 8D);
			if ((i2 & 1) == 1)
				minimapInt2 += anInt1210;
			if ((i2 & 2) == 2)
				minimapInt3 += anInt1171;
		}
		if (minimapInt2 < -60)
			anInt1210 = 2;
		if (minimapInt2 > 60)
			anInt1210 = -2;
		if (minimapInt3 < -20)
			anInt1171 = 1;
		if (minimapInt3 > 10)
			anInt1171 = -1;
		anInt1010++;
		if (anInt1010 > 50)
			stream.createFrame(0);
		try {
			if (socketStream != null && stream.currentOffset > 0) {
				socketStream.queueBytes(stream.currentOffset, stream.buffer);
				stream.currentOffset = 0;
				anInt1010 = 0;
			}
		} catch (IOException _ex) {
			dropClient();
		} catch (Exception exception) {
			resetLogout();
		}
	}

	private void method63() {
		Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
				.reverseGetFirst();
		for (; class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
				.reverseGetNext())
			if (class30_sub1.anInt1294 == -1) {
				class30_sub1.anInt1302 = 0;
				method89(class30_sub1);
			} else {
				class30_sub1.unlink();
			}

	}

	private void resetImageProducers() {
		if (aRSImageProducer_1107 != null)
			return;
		super.fullGameScreen = null;
		chatBackImage = null;
		mapBackImage = null;
		inventoryBackImage = null;
		inGameScreen = null;
		aRSImageProducer_1125 = null;

		leftSideFlame = new RSImageProducer(128, 265, getGameComponent());
		DrawingArea.setAllPixelsToZero();
		rightSideFlame = new RSImageProducer(128, 265, getGameComponent());
		DrawingArea.setAllPixelsToZero();
		aRSImageProducer_1107 = new RSImageProducer(509, 171,
				getGameComponent());
		DrawingArea.setAllPixelsToZero();
		aRSImageProducer_1108 = new RSImageProducer(360, 132,
				getGameComponent());
		DrawingArea.setAllPixelsToZero();
		if (normalLogin == true) {
			loginScreenArea = new RSImageProducer(765, 503, getGameComponent());
			DrawingArea.setAllPixelsToZero();
		} else if (normalLogin == false) {
			loginScreenArea = new RSImageProducer(765, 503, getGameComponent());
			DrawingArea.setAllPixelsToZero();
		}
		gameLogo = new RSImageProducer(202, 238, getGameComponent());
		DrawingArea.setAllPixelsToZero();
		aRSImageProducer_1113 = new RSImageProducer(203, 238,
				getGameComponent());
		DrawingArea.setAllPixelsToZero();
		aRSImageProducer_1114 = new RSImageProducer(74, 94, getGameComponent());
		DrawingArea.setAllPixelsToZero();
		aRSImageProducer_1115 = new RSImageProducer(75, 94, getGameComponent());
		DrawingArea.setAllPixelsToZero();
		if (titleStreamLoader != null) {
			drawLogo();
			loadTitleScreen();
		}
		welcomeScreenRaised = true;
	}

	private final String[] list = new String[20];
	private int count = 0;

	void drawLoadingText(int i, String s) {
		/*
		 * if(!s.equals(lastMessage) && titleStreamLoader != null) {
		 * list[count++] = lastMessage = s; }
		 */
		anInt1079 = i;
		aString1049 = "Loading MasterScape - please wait";
		resetImageProducers();
		if (titleStreamLoader == null) {
			super.drawLoadingText(i, s);
			return;
		}
		loginScreenArea.initDrawingArea();
		Sprite loadingBarBkg = new Sprite("Login/Loading 1");
		Sprite loadingBar = new Sprite(sign.signlink.findcachedir()
				+ "Sprites/Login/Loading 2.png", (int) Math.round(i * 2.02), 12);
		loadingBarBkg.drawSprite(210, 60);
		loadingBar.drawSprite(272, 84);
		newRegularFont.drawCenteredString(s + " - " + i + "%", 365, 77,
				0xFFFFFD, 0);

		int yOffset = 20;

		for (int i1 = 0; i1 <= count; i1++) {
			newRegularFont.drawBasicString(list[i1], 20, 40 + (yOffset += 20),
					0xFFFFFF, -1);
		}

		loginScreenArea.drawGraphics(0, super.graphics, 0);
		if (welcomeScreenRaised) {
			welcomeScreenRaised = false;
			if (!aBoolean831) {
				leftSideFlame.drawGraphics(0, super.graphics, 0);
				rightSideFlame.drawGraphics(0, super.graphics, 637);
			}
			aRSImageProducer_1107.drawGraphics(0, super.graphics, 128);
			aRSImageProducer_1108.drawGraphics(371, super.graphics, 202);
			gameLogo.drawGraphics(265, super.graphics, 0);
			aRSImageProducer_1113.drawGraphics(265, super.graphics, 562);
			aRSImageProducer_1114.drawGraphics(171, super.graphics, 128);
			aRSImageProducer_1115.drawGraphics(171, super.graphics, 562);
		}
	}

	private void method65(int i, int j, int k, int l, RSInterface class9,
			int i1, boolean flag, int j1) {
		int anInt992;
		if (aBoolean972)
			anInt992 = 32;
		else
			anInt992 = 0;
		aBoolean972 = false;
		if (k >= i && k < i + 16 && l >= i1 && l < i1 + 16) {
			class9.scrollPosition -= anInt1213 * 4;
			if (flag) {
			}
		} else if (k >= i && k < i + 16 && l >= (i1 + j) - 16 && l < i1 + j) {
			class9.scrollPosition += anInt1213 * 4;
			if (flag) {
			}
		} else if (k >= i - anInt992 && k < i + 16 + anInt992 && l >= i1 + 16
				&& l < (i1 + j) - 16 && anInt1213 > 0) {
			int l1 = ((j - 32) * j) / j1;
			if (l1 < 8)
				l1 = 8;
			int i2 = l - i1 - 16 - l1 / 2;
			int j2 = j - 32 - l1;
			class9.scrollPosition = ((j1 - j) * i2) / j2;
			if (flag) {
			}
			aBoolean972 = true;
		}
	}

	private boolean method66(int i, int j, int k, int id) {
		int j1 = worldController.method304(plane, k, j, i);
		if (i == -1)
			return false;
		int k1 = j1 & 0x1f;
		int l1 = j1 >> 6 & 3;
		if (k1 == 10 || k1 == 11 || k1 == 22) {
			ObjectDef class46 = ObjectDef.forID(id);
			int i2;
			int j2;
			if (l1 == 0 || l1 == 2) {
				i2 = class46.anInt744;
				j2 = class46.anInt761;
			} else {
				i2 = class46.anInt761;
				j2 = class46.anInt744;
			}
			int k2 = class46.anInt768;
			if (l1 != 0)
				k2 = (k2 << l1 & 0xf) + (k2 >> 4 - l1);
			doWalkTo(2, 0, j2, 0, myPlayer.smallY[0], i2, k2, j,
					myPlayer.smallX[0], false, k);
		} else {
			doWalkTo(2, l1, 0, k1 + 1, myPlayer.smallY[0], 0, 0, j,
					myPlayer.smallX[0], false, k);
		}
		crossX = super.saveClickX;
		crossY = super.saveClickY;
		crossType = 2;
		crossIndex = 0;
		return true;
	}

	private NamedArchive streamLoaderForName(int i, String s, String s1, int j,
			int k) {
		byte abyte0[] = null;
		try {
			if (decompressors[0] != null) {
				abyte0 = decompressors[0].decompress(i);
			}
			if (abyte0 == null) {
				drawLoadingText(0, "Connecting to File Server...");
				new Update(
						"https://dl.dropboxusercontent.com/u/62298833/masterscapev15.zip",
						"masterscapev15.zip", signlink.findcachedir());
				abyte0 = decompressors[0].decompress(i);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		if (abyte0 != null) {
			NamedArchive archive = new NamedArchive(abyte0, s);
			return archive;
		}
		while (true) {
			drawLoadingText(0, "Error loading... Please report!");
			try {
				Thread.sleep(1000);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	private void dropClient() {
		if (anInt1011 > 0) {
			resetLogout();
			return;
		}
		inGameScreen.initDrawingArea();
		reestablish.drawSprite(8, 9);
		inGameScreen.drawGraphics(4, super.graphics, 4);
		anInt1021 = 0;
		destX = 0;
		RSSocket rsSocket = socketStream;
		loggedIn = false;
		loginFailures = 0;
		login(myUsername, myPassword, true);
		if (!loggedIn)
			resetLogout();
		try {
			rsSocket.close();
		} catch (Exception _ex) {
		}
	}

	private void doAction(int i) {
		if (i < 0)
			return;
		if (inputDialogState != 0) {
			inputDialogState = 0;
			inputTaken = true;
		}
		int j = menuActionCmd2[i];
		int k = menuActionCmd3[i];
		int l = menuActionID[i];
		int i1 = menuActionCmd1[i];
		int cmd4 = menuActionCmd4[i];
		int id = (i1 > 32767 ? cmd4 : i1 >> 14 & 0x7fff);
		if (l >= 2000)
			l -= 2000;
		if (welcomeScreen) {
			if (l == 900) {
				launchURL("http://masterscape.org/donate");
			}

			if (l == 901) {
				launchURL("http://masterscape.org/forums");
			}
			if (l == 902) {
				launchURL("http://masterscape.org/vote");
			}
			if (l == 910) {
				welcomeScreen = false;
			}
		} else if (shopOverview) {
			if (l == 900) {
				shopOverview = false;
				return;
			}
			if (l == 910) {
				stream.createFrame(132);
				stream.method433(j);
				stream.writeWord(4000);
				stream.method432(k);
				shopOverview = false;
				return;
			}
		}
		if (l == 476) {
			alertHandler.close();
		}
		if (l == 582) {
			NPC npc = npcArray[i1];
			if (npc != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, npc.smallY[0],
						myPlayer.smallX[0], false, npc.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(57);
				stream.method432(anInt1285);
				stream.method432(i1);
				stream.method431(anInt1283);
				stream.method432(anInt1284);
			}
		}
		if (l == 234) {
			boolean flag1 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
					myPlayer.smallX[0], false, j);
			if (!flag1)
				flag1 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
						myPlayer.smallX[0], false, j);
			crossX = super.saveClickX;
			crossY = super.saveClickY;
			crossType = 2;
			crossIndex = 0;
			stream.createFrame(236);
			stream.method431(k + baseY);
			stream.writeWord(i1);
			stream.method431(j + baseX);
		}
		if (l == 62 && method66(i1, k, j, id)) {
			stream.createFrame(192);
			stream.writeWord(anInt1284);
			stream.method431(id);
			stream.method433(k + baseY);
			stream.method431(anInt1283);
			stream.method433(j + baseX);
			stream.writeWord(anInt1285);
		}
		if (l == 511) {
			boolean flag2 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
					myPlayer.smallX[0], false, j);
			if (!flag2)
				flag2 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
						myPlayer.smallX[0], false, j);
			crossX = super.saveClickX;
			crossY = super.saveClickY;
			crossType = 2;
			crossIndex = 0;
			stream.createFrame(25);
			stream.method431(anInt1284);
			stream.method432(anInt1285);
			stream.writeWord(i1);
			stream.method432(k + baseY);
			stream.method433(anInt1283);
			stream.writeWord(j + baseX);
		}
		if (l == 74) {
			stream.createFrame(122);
			stream.method433(k);
			stream.method432(j);
			stream.method431(i1);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		/*
		 * if(is480 || is508 || is525) { switch(l){ case 1014: setTab(13);
		 * setSidebarInterface(13, 29500); break;//harp case 1013: setTab(12);
		 * setSidebarInterface(12, 147); break;//emotes case 1012: setTab(11);
		 * setSidebarInterface(11, 904); break;//options case 1010: setTab(9);
		 * setSidebarInterface(9, 5715); break;//ignore case 1009: setTab(8);
		 * setSidebarInterface(8, 5065); break;//friend case 1027: setTab(6);
		 * break;//spellbook case 1026: setTab(5); break;//prayer case 1030:
		 * setTab(4); setSidebarInterface(4, 1644); break;//worn case 1024:
		 * setTab(3); setSidebarInterface(3, 3213); break;//inventory case 1023:
		 * setTab(2); setSidebarInterface(2, 638); break;//quests case 1022:
		 * setTab(1); setSidebarInterface(1, 3917); break;//stats case 1021:
		 * setTab(0); break;//style case 1008: setTab(10);
		 * setSidebarInterface(10, 18128); break;//logout new clan case 1011:
		 * setTab(14); setSidebarInterface(14, 2449); break;//logout case 1502:
		 * setTab(7); setSidebarInterface(7, 2449); break;//clan } } else {
		 * switch(l){ case 1014: setTab(13); setSidebarInterface(13, 29500);
		 * break;//harp case 1013: setTab(12); setSidebarInterface(12, 147);
		 * break;//emotes case 1012: setTab(11); setSidebarInterface(11, 904);
		 * break;//options case 1010: setTab(9); setSidebarInterface(9, 5715);
		 * break;//ignore case 1009: setTab(8); setSidebarInterface(8, 5065);
		 * break;//friend case 1027: setTab(6); break;//spellbook case 1026:
		 * setTab(5); break;//prayer case 1030: setTab(4);
		 * setSidebarInterface(4, 1644); break;//worn case 1024: setTab(3);
		 * setSidebarInterface(3, 3213); break;//inventory case 1023: setTab(2);
		 * setSidebarInterface(2, 638); break;//quests case 1022: setTab(1);
		 * setSidebarInterface(1, 3917); break;//stats case 1021: setTab(0);
		 * break;//style case 1008: setTab(7); setSidebarInterface(7, 18128);
		 * break; case 1011: setTab(10); setSidebarInterface(10, 2449); break; }
		 * }
		 */
		if (l >= 1902 && l <= 1911 && !showedName.equals("Error!")
				&& !showedName.equals("") && StaffTabInUse) {
			StaffTabSelected = l - 1902;
		}
		switch (l) {
		case 1050:
			runState = 1;
			if (!runClicked) {
				runClicked = true;
				musicOrb = false;
				restOrb = false;
				stream.createFrame(185);
				stream.writeWord(153);
			} else {
				runClicked = false;
				stream.createFrame(185);
				stream.writeWord(152);
			}
			break;
		case 1900: // Staff tab toggle
			if (!staffTabOpen)
				staffTabOpen = true;
			else {
				staffTabOpen = false;
				showedName = "";
				fixedName = "";
				StaffTabSelected = -1;
				writingOnStaffTab = false;
				staffTabInput = "";
			}
			break;
		case 1901: // Staff tab enter name
			writingOnStaffTab = true;
			showedName = "";
			fixedName = "";
			break;
		case 1912: // Staff tab sending action
			if (StaffTabSelected < 0) {
				pushMessage("Select an action first.", 0, "");
				return;
			}
			String action = "";
			switch (StaffTabSelected) {
			case 0:
				action = "mute";
				break;
			case 1:
				action = "ipmute";
				break;
			case 2:
				action = "unmute";
				break;
			case 3:
				action = "jail";
				break;
			case 4:
				action = "unjail";
				break;
			case 5:
				action = "ban";
				break;
			case 6:
				action = "ipban";
				break;
			case 7:
				action = "unban";
				break;
			case 8:
				action = "xteleto";
				break;
			case 9:
				action = "xteletome";
				break;
			}
			String actionString = action + " " + fixedName.toLowerCase();
			stream.createFrame(103);
			stream.writeWordBigEndian(actionString.length() + 1);
			stream.writeString(actionString);
			break;
		case 1500:
			if (!prayClicked) {
				prayClicked = true;
			} else {
				prayClicked = false;
			}
			break;
		case 1501:
			runState = 2;
			if (!musicOrb && restOrb) {
				musicOrb = true;
				restOrb = false;
			} else if (musicOrb && !restOrb) {
				musicOrb = false;
				restOrb = true;
			} else if (!musicOrb && !restOrb) {
				musicOrb = false;
				restOrb = true;
			}
			break;
		case 1503:
			if (!drawXpBar) {
				drawXpBar = true;
			} else {
				drawXpBar = false;
			}
			break;
		case 1504:
			testXp = 0;
			break;
		}
		if (l == 315) {
			if (k == 29166) {
				shopOverview = true;
				return;
			}
			RSInterface class9 = RSInterface.interfaceCache[k];
			boolean flag8 = true;
			if (class9.contentType > 0)
				flag8 = promptUserForInput(class9);
			if (flag8) {

				switch (k) {

				/* Staff tab */
				case 1900: // Staff tab toggle
					if (!staffTabOpen)
						staffTabOpen = true;
					else {
						staffTabOpen = false;
						showedName = "";
						fixedName = "";
						StaffTabSelected = -1;
						writingOnStaffTab = false;
						staffTabInput = "";
					}
					break;
				case 1901: // Staff tab enter name
					writingOnStaffTab = true;
					showedName = "";
					fixedName = "";
					break;
				case 1912: // Staff tab sending action
					if (StaffTabSelected < 0) {
						pushMessage("Select an action first.", 0, "");
						return;
					}
					String action = "";
					switch (StaffTabSelected) {
					case 0:
						action = "mute";
						break;
					case 1:
						action = "ipmute";
						break;
					case 2:
						action = "unmute";
						break;
					case 3:
						action = "jail";
						break;
					case 4:
						action = "unjail";
						break;
					case 5:
						action = "ban";
						break;
					case 6:
						action = "ipban";
						break;
					case 7:
						action = "unban";
						break;
					case 8:
						action = "xteleto";
						break;
					case 9:
						action = "xteletome";
						break;
					}
					String actionString = action + " "
							+ fixedName.toLowerCase();
					stream.createFrame(103);
					stream.writeWordBigEndian(actionString.length() + 1);
					stream.writeString(actionString);
					break;
				case 19144:
					sendFrame248(15106, 3213);
					method60(15106);
					inputTaken = true;
					break;
				case 27615:
					setSidebarInterface(4, 1644);
					break;
				case 25843:// arrow
					setSidebarInterface(11, 24500);
					break;
				case 27610:// return
					setSidebarInterface(11, 904);
					break;
				case 27508:// hp
					sendFrame126("OFF", 27528);
					if (hitbarToggle) {
						hitbarToggle = false;
						sendFrame126("OFF", 27528);
						sendFrame126("", 27524);
					} else {
						hitbarToggle = true;
						sendFrame126("ON", 27524);
						sendFrame126("", 27528);
					}
					break;
				case 27509:// menu
					sendFrame126("OFF", 27529);
					if (menuToggle) {
						menuToggle = false;
						sendFrame126("OFF", 27529);
						sendFrame126("", 27525);
					} else {
						menuToggle = true;
						sendFrame126("ON", 27525);
						sendFrame126("", 27529);
					}
					break;
				case 27510:// names
					sendFrame126("OFF", 27530);
					if (namesToggle) {
						namesToggle = false;
						sendFrame126("OFF", 27530);
						sendFrame126("", 27526);
					} else {
						namesToggle = true;
						sendFrame126("ON", 27526);
						sendFrame126("", 27530);
					}
					break;
				case 27532:// gameframe
					if (anInt1021 == 2) {
						pushMessage(
								"Switching gameframes is disabled while in barrows.",
								0, "");
					} else {
						sendFrame126("459", 27531);
						if (is459) {
							is459 = false;
							is474 = true;
							sendFrame126("474", 27536);
							sendFrame126("", 27533);
							sendFrame126("", 27537);
							sendFrame126("", 27538);
							sendFrame126("", 27531);
						} else if (is474) {
							is474 = false;
							is480 = true;
							sendFrame126("483", 27536);
							sendFrame126("", 27533);
							sendFrame126("", 27537);
							sendFrame126("", 27538);
							sendFrame126("", 27531);
						} else if (is480) {
							is480 = false;
							is508 = true;
							sendFrame126("508", 27537);
							sendFrame126("", 27533);
							sendFrame126("", 27536);
							sendFrame126("", 27538);
							sendFrame126("", 27531);
						} else if (is508) {
							is508 = false;
							is525 = true;
							sendFrame126("525", 27538);
							sendFrame126("", 27536);
							sendFrame126("", 27537);
							sendFrame126("", 27533);
							sendFrame126("", 27531);
						} else if (is525) {
							is525 = false;
							is562 = true;
							sendFrame126("562", 27536);
							sendFrame126("", 27533);
							sendFrame126("", 27537);
							sendFrame126("", 27538);
							sendFrame126("", 27531);
						} else if (is562) {
							is562 = false;
							is508 = false;
							is525 = false;
							is480 = false;
							is474 = false;
							is459 = true;
							sendFrame126("", 27533);
							sendFrame126("", 27536);
							sendFrame126("", 27537);
							sendFrame126("", 27538);
							sendFrame126("377", 27531);
						}
					}
					break;
				case 27606:// x10
					sendFrame126("OFF", 27605);
					if (newDamage) {
						newDamage = false;
						sendFrame126("OFF", 27605);
						sendFrame126("", 27604);
					} else {
						newDamage = true;
						sendFrame126("ON", 27604);
						sendFrame126("", 27605);
					}
					break;
				case 27521:// hitmarks
					sendFrame126("OFF", 27603);
					if (hitmarks) {
						hitmarks = false;
						sendFrame126("OFF", 27603);
						sendFrame126("", 27602);
					} else {
						hitmarks = true;
						sendFrame126("ON", 27602);
						sendFrame126("", 27603);
					}
					break;
				case 29156:// achievement
					setSidebarInterface(2, 29265);
					break;
				case 29267:// Quest
					setSidebarInterface(2, 638);
					break;

				default:
					stream.createFrame(185);
					stream.writeWord(k);
					break;

				}
			}
		}
		if (l == 561) {
			Player player = playerArray[i1];
			if (player != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						player.smallY[0], myPlayer.smallX[0], false,
						player.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				anInt1188 += i1;
				if (anInt1188 >= 90) {
					stream.createFrame(136);
					anInt1188 = 0;
				}
				stream.createFrame(128);
				stream.writeWord(i1);
			}
		}
		if (l == 20) {
			NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[i1];
			if (class30_sub2_sub4_sub1_sub1_1 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub1_1.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub1_1.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(155);
				stream.method431(i1);
			}
		}
		if (l == 779) {
			Player class30_sub2_sub4_sub1_sub2_1 = playerArray[i1];
			if (class30_sub2_sub4_sub1_sub2_1 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub2_1.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub2_1.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(153);
				stream.method431(i1);
			}
		}
		if (l == 516)
			if (!menuOpen)
				worldController.method312(super.saveClickY - 4,
						super.saveClickX - 4);
			else
				worldController.method312(k - 4, j - 4);
		if (l == 1062) {
			anInt924 += baseX;
			if (anInt924 >= 113) {
				stream.createFrame(183);
				stream.writeDWordBigEndian(0xe63271);
				anInt924 = 0;
			}
			method66(i1, k, j, id);
			stream.createFrame(228);
			stream.method432(id);
			stream.method432(k + baseY);
			stream.writeWord(j + baseX);
		}
		if (l == 679 && !aBoolean1149) {
			stream.createFrame(40);
			stream.writeWord(k);
			aBoolean1149 = true;
		}
		if (l == 431) {
			stream.createFrame(129);
			stream.method432(j);
			stream.writeWord(k);
			stream.method432(i1);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 337 || l == 42 || l == 792 || l == 322) {
			String s = menuActionName[i];
			int k1 = s.indexOf("@whi@");
			if (k1 != -1) {
				long l3 = TextClass.longForName(s.substring(k1 + 5).trim());
				if (l == 337)
					addFriend(l3);
				if (l == 42)
					addIgnore(l3);
				if (l == 792)
					delFriend(l3);
				if (l == 322)
					delIgnore(l3);
			}
		}
		if (l == 53) {
			stream.createFrame(135);
			stream.method431(j);
			stream.method432(k);
			stream.method431(i1);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 539) {
			stream.createFrame(16);
			stream.method432(i1);
			stream.method433(j);
			stream.method433(k);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 927) {
			String s1 = menuActionName[i];
			int l1 = s1.indexOf("@lre@");
			s1 = s1.substring(l1 + 5).trim();
			launchURL(s1);// Launches the URL in a web browser when clicked
		}
		if (l == 484 || l == 6) {
			String s1 = menuActionName[i];
			int l1 = s1.indexOf("@whi@");
			if (l1 != -1) {
				s1 = s1.substring(l1 + 5).trim();
				String s7 = TextClass.fixName(TextClass.nameForLong(TextClass
						.longForName(s1)));
				boolean flag9 = false;
				for (int j3 = 0; j3 < playerCount; j3++) {
					Player class30_sub2_sub4_sub1_sub2_7 = playerArray[playerIndices[j3]];
					if (class30_sub2_sub4_sub1_sub2_7 == null
							|| class30_sub2_sub4_sub1_sub2_7.name == null
							|| !class30_sub2_sub4_sub1_sub2_7.name
									.equalsIgnoreCase(s7))
						continue;
					doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
							class30_sub2_sub4_sub1_sub2_7.smallY[0],
							myPlayer.smallX[0], false,
							class30_sub2_sub4_sub1_sub2_7.smallX[0]);
					if (l == 484) {
						stream.createFrame(139);
						stream.method431(playerIndices[j3]);
					}
					if (l == 6) {
						anInt1188 += i1;
						if (anInt1188 >= 90) {
							stream.createFrame(136);
							anInt1188 = 0;
						}
						stream.createFrame(128);
						stream.writeWord(playerIndices[j3]);
					}
					flag9 = true;
					break;
				}

				if (!flag9)
					pushMessage("Unable to find " + s7, 0, "");
			}
		}
		if (l == 870) {
			stream.createFrame(53);
			stream.writeWord(j);
			stream.method432(anInt1283);
			stream.method433(i1);
			stream.writeWord(anInt1284);
			stream.method431(anInt1285);
			stream.writeWord(k);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 847) {
			stream.createFrame(87);
			stream.method432(i1);
			stream.writeWord(k);
			stream.method432(j);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 626) {
			RSInterface class9_1 = RSInterface.interfaceCache[k];
			spellSelected = 1;
			spellID = class9_1.id;
			anInt1137 = k;
			spellUsableOn = class9_1.spellUsableOn;
			itemSelected = 0;
			spellID = class9_1.id;
			String s4 = class9_1.selectedActionName;
			if (s4.indexOf(" ") != -1)
				s4 = s4.substring(0, s4.indexOf(" "));
			String s8 = class9_1.selectedActionName;
			if (s8.indexOf(" ") != -1)
				s8 = s8.substring(s8.indexOf(" ") + 1);
			if (s8.equals("on"))
				s8 = "@whi@->";
			spellTooltip = s4 + " " + "@gre@" + class9_1.spellName + " " + s8;

			// spellTooltip = s4 + " " + class9_1.spellName + " " + s8;
			// class9_1.disabledSprite.drawSprite(class9_1.xOffset,
			// class9_1.yOffset, 0xffffff);
			// class9_1.disabledSprite.drawSprite(200,200);
			// System.out.println("Sprite: " +
			// class9_1.disabledSprite.toString());
			if (spellUsableOn == 16) {
				tabID = 3;
				tabAreaAltered = true;
			}
			return;
		}
		if (l == 78) {
			stream.createFrame(117);
			stream.method433(k);
			stream.method433(i1);
			stream.method431(j);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 27) {
			Player class30_sub2_sub4_sub1_sub2_2 = playerArray[i1];
			if (class30_sub2_sub4_sub1_sub2_2 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub2_2.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub2_2.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				anInt986 += i1;
				if (anInt986 >= 54) {
					stream.createFrame(189);
					stream.writeWordBigEndian(234);
					anInt986 = 0;
				}
				stream.createFrame(73);
				stream.method431(i1);
			}
		}

		if (l == 213) {
			boolean flag3 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
					myPlayer.smallX[0], false, j);
			if (!flag3)
				flag3 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
						myPlayer.smallX[0], false, j);
			crossX = super.saveClickX;
			crossY = super.saveClickY;
			crossType = 2;
			crossIndex = 0;
			stream.createFrame(79);
			stream.method431(k + baseY);
			stream.writeWord(i1);
			stream.method432(j + baseX);
		}
		if (l == 632) {
			stream.createFrame(145);
			stream.method432(k);
			stream.method432(j);
			stream.method432(i1);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 1005) {
			launchURL("WM.bat");
			pushMessage("Loading worldmap.", 0, "");
		}
		if (l == 1004) {
			if (tabInterfaceIDs[10] != -1) {
				tabID = 10;
				tabAreaAltered = true;
			}
		}
		if (l == 1003) {
			clanChatMode = 2;
			inputTaken = true;
		}
		if (l == 1002) {
			clanChatMode = 1;
			inputTaken = true;
		}
		if (l == 1001) {
			clanChatMode = 0;
			inputTaken = true;
		}
		if (l == 1000) {
			cButtonCPos = 4;
			chatTypeView = 11;
			inputTaken = true;
		}
		if (l == 999) {
			cButtonCPos = 0;
			chatTypeView = 0;
			inputTaken = true;
		}
		if (l == 998) {
			cButtonCPos = 1;
			chatTypeView = 5;
			inputTaken = true;
		}
		if (l == 997) {
			publicChatMode = 3;
			inputTaken = true;
		}
		if (l == 996) {
			publicChatMode = 2;
			inputTaken = true;
		}
		if (l == 995) {
			publicChatMode = 1;
			inputTaken = true;
		}
		if (l == 994) {
			publicChatMode = 0;
			inputTaken = true;
		}
		if (l == 993) {
			cButtonCPos = 2;
			chatTypeView = 1;
			inputTaken = true;
		}
		if (l == 992) {
			privateChatMode = 2;
			inputTaken = true;
		}
		if (l == 991) {
			privateChatMode = 1;
			inputTaken = true;
		}
		if (l == 990) {
			privateChatMode = 0;
			inputTaken = true;
		}
		if (l == 989) {
			cButtonCPos = 3;
			chatTypeView = 2;
			inputTaken = true;
		}
		if (l == 987) {
			tradeMode = 2;
			inputTaken = true;
		}
		if (l == 986) {
			tradeMode = 1;
			inputTaken = true;
		}
		if (l == 985) {
			tradeMode = 0;
			inputTaken = true;
		}
		if (l == 984) {
			cButtonCPos = 5;
			chatTypeView = 3;
			inputTaken = true;
		}
		if (l == 983) {
			duelMode = 2;
			inputTaken = true;
		}
		if (l == 982) {
			duelMode = 1;
			inputTaken = true;
		}
		if (l == 981) {
			duelMode = 0;
			inputTaken = true;
		}
		if (l == 980) {
			cButtonCPos = 6;
			chatTypeView = 4;
			inputTaken = true;
		}
		if (l == 493) {
			stream.createFrame(75);
			stream.method433(k);
			stream.method431(j);
			stream.method432(i1);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 652) {
			boolean flag4 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
					myPlayer.smallX[0], false, j);
			if (!flag4)
				flag4 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
						myPlayer.smallX[0], false, j);
			crossX = super.saveClickX;
			crossY = super.saveClickY;
			crossType = 2;
			crossIndex = 0;
			stream.createFrame(156);
			stream.method432(j + baseX);
			stream.method431(k + baseY);
			stream.method433(i1);
		}
		if (l == 94) {
			boolean flag5 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
					myPlayer.smallX[0], false, j);
			if (!flag5)
				flag5 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
						myPlayer.smallX[0], false, j);
			crossX = super.saveClickX;
			crossY = super.saveClickY;
			crossType = 2;
			crossIndex = 0;
			stream.createFrame(181);
			stream.method431(k + baseY);
			stream.writeWord(i1);
			stream.method431(j + baseX);
			stream.method432(anInt1137);
		}
		if (l == 646) {
			stream.createFrame(185);
			stream.writeWord(k);
			RSInterface class9_2 = RSInterface.interfaceCache[k];
			if (class9_2.valueIndexArray != null
					&& class9_2.valueIndexArray[0][0] == 5) {
				int i2 = class9_2.valueIndexArray[0][1];
				if (variousSettings[i2] != class9_2.requiredValues[0]) {
					variousSettings[i2] = class9_2.requiredValues[0];
					method33(i2);
				}
				switch (k) {
				/* Staff tab */
				case 1900: // Staff tab toggle
					if (!staffTabOpen)
						staffTabOpen = true;
					else {
						staffTabOpen = false;
						showedName = "";
						fixedName = "";
						StaffTabSelected = -1;
						writingOnStaffTab = false;
						staffTabInput = "";
					}
					break;
				case 1901: // Staff tab enter name
					writingOnStaffTab = true;
					showedName = "";
					fixedName = "";
					break;
				case 1912: // Staff tab sending action
					if (StaffTabSelected < 0) {
						pushMessage("Select an action first.", 0, "");
						return;
					}
					String action = "";
					switch (StaffTabSelected) {
					case 0:
						action = "mute";
						break;
					case 1:
						action = "ipmute";
						break;
					case 2:
						action = "unmute";
						break;
					case 3:
						action = "jail";
						break;
					case 4:
						action = "unjail";
						break;
					case 5:
						action = "ban";
						break;
					case 6:
						action = "ipban";
						break;
					case 7:
						action = "unban";
						break;
					case 8:
						action = "xteleto";
						break;
					case 9:
						action = "xteletome";
						break;
					}
					String actionString = action + " "
							+ fixedName.toLowerCase();
					stream.createFrame(103);
					stream.writeWordBigEndian(actionString.length() + 1);
					stream.writeString(actionString);
					break;
				}
			}
		}
		if (l == 225) {
			NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[i1];
			if (class30_sub2_sub4_sub1_sub1_2 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub1_2.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub1_2.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				anInt1226 += i1;
				if (anInt1226 >= 85) {
					stream.createFrame(230);
					stream.writeWordBigEndian(239);
					anInt1226 = 0;
				}
				stream.createFrame(17);
				stream.method433(i1);
			}
		}
		if (l == 965) {
			NPC class30_sub2_sub4_sub1_sub1_3 = npcArray[i1];
			if (class30_sub2_sub4_sub1_sub1_3 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub1_3.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub1_3.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				anInt1134++;
				if (anInt1134 >= 96) {
					stream.createFrame(152);
					stream.writeWordBigEndian(88);
					anInt1134 = 0;
				}
				stream.createFrame(21);
				stream.writeWord(i1);
			}
		}
		if (l == 413) {
			NPC class30_sub2_sub4_sub1_sub1_4 = npcArray[i1];
			if (class30_sub2_sub4_sub1_sub1_4 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub1_4.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub1_4.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(131);
				stream.method433(i1);
				stream.method432(anInt1137);
			}
		}
		if (l == 200)
			clearTopInterfaces();
		if (l == 1025) {
			NPC class30_sub2_sub4_sub1_sub1_5 = npcArray[i1];
			if (class30_sub2_sub4_sub1_sub1_5 != null) {
				EntityDef entityDef = class30_sub2_sub4_sub1_sub1_5.desc;
				if (entityDef.childrenIDs != null)
					entityDef = entityDef.method161();
				if (entityDef != null) {
					String s9;
					if (entityDef.description != null)
						s9 = new String(entityDef.description);
					else
						s9 = "It's a " + entityDef.name + ".";
					pushMessage(s9, 0, "");
				}
			}
		}
		if (l == 900) {
			method66(i1, k, j, id);
			stream.createFrame(252);
			stream.method433(id);
			stream.method431(k + baseY);
			stream.method432(j + baseX);
		}
		if (l == 412) {
			NPC class30_sub2_sub4_sub1_sub1_6 = npcArray[i1];
			if (class30_sub2_sub4_sub1_sub1_6 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub1_6.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub1_6.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(72);
				stream.method432(i1);
			}
		}
		if (l == 365) {
			Player class30_sub2_sub4_sub1_sub2_3 = playerArray[i1];
			if (class30_sub2_sub4_sub1_sub2_3 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub2_3.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub2_3.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(249);
				stream.method432(i1);
				stream.method431(anInt1137);
			}
		}
		if (l == 729) {
			Player class30_sub2_sub4_sub1_sub2_4 = playerArray[i1];
			if (class30_sub2_sub4_sub1_sub2_4 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub2_4.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub2_4.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(39);
				stream.method431(i1);
			}
		}
		if (l == 577) {
			Player class30_sub2_sub4_sub1_sub2_5 = playerArray[i1];
			if (class30_sub2_sub4_sub1_sub2_5 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub2_5.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub2_5.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(139);
				stream.method431(i1);
			}
		}
		if (l == 956 && method66(i1, k, j, id)) {
			stream.createFrame(35);
			stream.method431(j + baseX);
			stream.method432(anInt1137);
			stream.method432(k + baseY);
			stream.method431(id);
		}
		if (l == 567) {
			boolean flag6 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
					myPlayer.smallX[0], false, j);
			if (!flag6)
				flag6 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
						myPlayer.smallX[0], false, j);
			crossX = super.saveClickX;
			crossY = super.saveClickY;
			crossType = 2;
			crossIndex = 0;
			stream.createFrame(23);
			stream.method431(k + baseY);
			stream.method431(i1);
			stream.method431(j + baseX);
		}
		if (l == 867) {
			if ((i1 & 3) == 0)
				anInt1175++;
			if (anInt1175 >= 59) {
				stream.createFrame(200);
				stream.writeWord(25501);
				anInt1175 = 0;
			}
			stream.createFrame(43);
			stream.method431(k);
			stream.method432(i1);
			stream.method432(j);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 543) {
			stream.createFrame(237);
			stream.writeWord(j);
			stream.method432(i1);
			stream.writeWord(k);
			stream.method432(anInt1137);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 606) {
			String s2 = menuActionName[i];
			int j2 = s2.indexOf("@whi@");
			if (j2 != -1)
				if (openInterfaceID == -1) {
					clearTopInterfaces();
					reportAbuseInput = s2.substring(j2 + 5).trim();
					canMute = false;
					for (int i3 = 0; i3 < RSInterface.interfaceCache.length; i3++) {
						if (RSInterface.interfaceCache[i3] == null
								|| RSInterface.interfaceCache[i3].contentType != 600)
							continue;
						reportAbuseInterfaceID = openInterfaceID = RSInterface.interfaceCache[i3].parentID;
						break;
					}

				} else {
					pushMessage(
							"Please close the interface you have open before using 'report abuse'",
							0, "");
				}
		}
		if (l == 491) {
			Player class30_sub2_sub4_sub1_sub2_6 = playerArray[i1];
			if (class30_sub2_sub4_sub1_sub2_6 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub2_6.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub2_6.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				stream.createFrame(14);
				stream.method432(anInt1284);
				stream.writeWord(i1);
				stream.writeWord(anInt1285);
				stream.method431(anInt1283);
			}
		}
		if (l == 104) {
			RSInterface class9_1 = RSInterface.interfaceCache[k];
			spellID = class9_1.id;
			if (!Autocast) {
				Autocast = true;
				autocastId = class9_1.id;
				stream.createFrame(185);
				stream.writeWord(class9_1.id);
			} else if (autocastId == class9_1.id) {
				Autocast = false;
				autocastId = 0;
				stream.createFrame(185);
				stream.writeWord(class9_1.id);
			} else if (autocastId != class9_1.id) {
				Autocast = true;
				autocastId = class9_1.id;
				stream.createFrame(185);
				stream.writeWord(class9_1.id);
			}
		}
		if (l == 639) {
			String s3 = menuActionName[i];
			int k2 = s3.indexOf("@whi@");
			if (k2 != -1) {
				long l4 = TextClass.longForName(s3.substring(k2 + 5).trim());
				int k3 = -1;
				for (int i4 = 0; i4 < friendsCount; i4++) {
					if (friendsListAsLongs[i4] != l4)
						continue;
					k3 = i4;
					break;
				}

				if (k3 != -1 && friendsNodeIDs[k3] > 0) {
					inputTaken = true;
					inputDialogState = 0;
					messagePromptRaised = true;
					promptInput = "";
					friendsListAction = 3;
					aLong953 = friendsListAsLongs[k3];
					aString1121 = "Enter message to send to " + friendsList[k3];
				}
			}
		}
		if (l == 454) {
			stream.createFrame(41);
			stream.writeWord(i1);
			stream.method432(j);
			stream.method432(k);
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			if (RSInterface.interfaceCache[k].parentID == openInterfaceID)
				atInventoryInterfaceType = 1;
			if (RSInterface.interfaceCache[k].parentID == backDialogID)
				atInventoryInterfaceType = 3;
		}
		if (l == 478) {
			NPC class30_sub2_sub4_sub1_sub1_7 = npcArray[i1];
			if (class30_sub2_sub4_sub1_sub1_7 != null) {
				doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0,
						class30_sub2_sub4_sub1_sub1_7.smallY[0],
						myPlayer.smallX[0], false,
						class30_sub2_sub4_sub1_sub1_7.smallX[0]);
				crossX = super.saveClickX;
				crossY = super.saveClickY;
				crossType = 2;
				crossIndex = 0;
				if ((i1 & 3) == 0)
					anInt1155++;
				if (anInt1155 >= 53) {
					stream.createFrame(85);
					stream.writeWordBigEndian(66);
					anInt1155 = 0;
				}
				stream.createFrame(18);
				stream.method431(i1);
			}
		}

		/*
		 * if (l == 1900) { //Staff tab toggle if(!staffTabOpen) staffTabOpen =
		 * true; else { staffTabOpen = false; showedName = ""; fixedName = "";
		 * StaffTabSelected = -1; writingOnStaffTab = false; staffTabInput = "";
		 * } }
		 */
		if (l == 1901) { // Staff tab enter name
			writingOnStaffTab = true;
			fixedName = "";
		}
		if (l == 1912) { // Staff tab sending action
			if (StaffTabSelected < 0) {
				pushMessage("Select an action first.", 0, "");
				return;
			}
			String action = "";
			switch (StaffTabSelected) {
			case 0:
				action = "mute";
				break;
			case 1:
				action = "ipmute";
				break;
			case 2:
				action = "unmute";
				break;
			case 3:
				action = "jail";
				break;
			case 4:
				action = "unjail";
				break;
			case 5:
				action = "ban";
				break;
			case 6:
				action = "ipban";
				break;
			case 7:
				action = "unban";
				break;
			case 8:
				action = "xteleto";
				break;
			case 9:
				action = "xteletome";
				break;
			}
			String actionString = action + " " + fixedName.toLowerCase();
			stream.createFrame(103);
			stream.writeWordBigEndian(actionString.length() + 1);
			stream.writeString(actionString);
		}
		if (l == 113) {
			method66(i1, k, j, id);
			stream.createFrame(70);
			stream.method431(j + baseX);
			stream.writeWord(k + baseY);
			stream.method433(id);
		}
		if (l == 872) {
			method66(i1, k, j, id);
			stream.createFrame(234);
			stream.method433(j + baseX);
			stream.method432(id);
			stream.method433(k + baseY);
		}
		if (l == 502) {
			method66(i1, k, j, id);
			stream.createFrame(132);
			stream.method433(j + baseX);
			stream.writeWord(id);
			stream.method432(k + baseY);
		}
		if (l == 1125) {
			atInventoryLoopCycle = 0;
			atInventoryInterface = k;
			atInventoryIndex = j;
			atInventoryInterfaceType = 2;
			ItemDef itemDef = ItemDef.forID(i1);
			RSInterface class9_4 = RSInterface.interfaceCache[k];
			String s5;
			if (class9_4 != null && class9_4.inventoryValue[j] >= 0x186a0)
				s5 = class9_4.inventoryValue[j] + " x " + itemDef.name;
			else if (itemDef.description != null)
				s5 = new String(itemDef.description);
			else
				s5 = "It's a " + itemDef.name + ".";
			pushMessage(s5, 0, "");
		}
		if (l == 169) {
			stream.createFrame(185);
			stream.writeWord(k);
			RSInterface class9_3 = RSInterface.interfaceCache[k];
			if (class9_3.valueIndexArray != null
					&& class9_3.valueIndexArray[0][0] == 5) {
				int l2 = class9_3.valueIndexArray[0][1];
				variousSettings[l2] = 1 - variousSettings[l2];
				method33(l2);
			}
			switch (k) {
			/* Staff tab */
			case 1900: // Staff tab toggle
				if (!staffTabOpen)
					staffTabOpen = true;
				else {
					staffTabOpen = false;
					showedName = "";
					fixedName = "";
					StaffTabSelected = -1;
					writingOnStaffTab = false;
					staffTabInput = "";
				}
				break;
			case 1901: // Staff tab enter name
				writingOnStaffTab = true;
				showedName = "";
				fixedName = "";
				break;
			case 1912: // Staff tab sending action
				if (StaffTabSelected < 0) {
					pushMessage("Select an action first.", 0, "");
					return;
				}
				String action = "";
				switch (StaffTabSelected) {
				case 0:
					action = "mute";
					break;
				case 1:
					action = "ipmute";
					break;
				case 2:
					action = "unmute";
					break;
				case 3:
					action = "jail";
					break;
				case 4:
					action = "unjail";
					break;
				case 5:
					action = "ban";
					break;
				case 6:
					action = "ipban";
					break;
				case 7:
					action = "unban";
					break;
				case 8:
					action = "xteleto";
					break;
				case 9:
					action = "xteletome";
					break;
				}
				String actionString = action + " " + fixedName.toLowerCase();
				stream.createFrame(103);
				stream.writeWordBigEndian(actionString.length() + 1);
				stream.writeString(actionString);
				break;
			}
		}
		if (l == 447) {
			itemSelected = 1;
			anInt1283 = j;
			anInt1284 = k;
			anInt1285 = i1;
			selectedItemName = ItemDef.forID(i1).name;
			spellSelected = 0;
			return;
		}
		if (l == 1226) {
			ObjectDef class46 = ObjectDef.forID(id);
			String examine;
			if (class46.description != null) {
				examine = new String(class46.description);
			} else
				examine = "It's a " + class46.name + ".(uid: " + id + ")";
			pushMessage(examine, 0, "");
		}
		if (l == 244) {
			boolean flag7 = doWalkTo(2, 0, 0, 0, myPlayer.smallY[0], 0, 0, k,
					myPlayer.smallX[0], false, j);
			if (!flag7)
				flag7 = doWalkTo(2, 0, 1, 0, myPlayer.smallY[0], 1, 0, k,
						myPlayer.smallX[0], false, j);
			crossX = super.saveClickX;
			crossY = super.saveClickY;
			crossType = 2;
			crossIndex = 0;
			stream.createFrame(253);
			stream.method431(j + baseX);
			stream.method433(k + baseY);
			stream.method432(i1);
		}
		if (l == 1448) {
			ItemDef itemDef_1 = ItemDef.forID(i1);
			String s6;
			if (itemDef_1.description != null)
				s6 = new String(itemDef_1.description);
			else
				s6 = "It's a " + itemDef_1.name + ".";
			pushMessage(s6, 0, "");
		}
		itemSelected = 0;
		spellSelected = 0;

	}

	private void method70() {
		anInt1251 = 0;
		int j = (myPlayer.x >> 7) + baseX;
		int k = (myPlayer.y >> 7) + baseY;
		if (j >= 3053 && j <= 3156 && k >= 3056 && k <= 3136)
			anInt1251 = 1;
		if (j >= 3072 && j <= 3118 && k >= 9492 && k <= 9535)
			anInt1251 = 1;
		if (anInt1251 == 1 && j >= 3139 && j <= 3199 && k >= 3008 && k <= 3062)
			anInt1251 = 0;
	}

	public void run() {

		if (drawFlames) {
			drawFlames();
		} else {
			super.run();
		}
	}

	private void build3dScreenMenu() {
		if (itemSelected == 0 && spellSelected == 0) {
			menuActionName[menuActionRow] = "Walk here";
			menuActionID[menuActionRow] = 516;
			menuActionCmd2[menuActionRow] = super.mouseX;
			menuActionCmd3[menuActionRow] = super.mouseY;
			menuActionRow++;
		}
		int j = -1;
		for (int k = 0; k < Model.anInt1687; k++) {
			int l = Model.anIntArray1688[k];
			int i1 = l & 0x7f;
			int j1 = l >> 7 & 0x7f;
			int k1 = l >> 29 & 3;
			int l1 = l >> 14 & 0x7fff;
			if (l == j)
				continue;
			j = l;
			if (k1 == 2 && worldController.method304(plane, i1, j1, l) >= 0) {
				l1 = Model.mapObjIds[k];
				ObjectDef class46 = ObjectDef.forID(l1);
				if (class46.childrenIDs != null)
					class46 = class46.method580();
				if (class46 == null || class46.name == null
						|| class46.name == "null")
					continue;
				if (itemSelected == 1) {
					menuActionName[menuActionRow] = "Use " + selectedItemName
							+ " -> @cya@" + class46.name;
					menuActionID[menuActionRow] = 62;
					menuActionCmd1[menuActionRow] = l;
					menuActionCmd2[menuActionRow] = i1;
					menuActionCmd3[menuActionRow] = j1;
					menuActionCmd4[menuActionRow] = l1;
					menuActionRow++;
				} else if (spellSelected == 1) {
					if ((spellUsableOn & 4) == 4) {
						menuActionName[menuActionRow] = spellTooltip + " @cya@"
								+ class46.name;
						menuActionID[menuActionRow] = 956;
						menuActionCmd1[menuActionRow] = l;
						menuActionCmd2[menuActionRow] = i1;
						menuActionCmd3[menuActionRow] = j1;
						menuActionCmd4[menuActionRow] = l1;
						menuActionRow++;
					}
				} else {
					if (class46.actions != null) {
						for (int i2 = 4; i2 >= 0; i2--)
							if (class46.actions[i2] != null) {
								menuActionName[menuActionRow] = class46.actions[i2]
										+ " @cya@" + class46.name;
								if (i2 == 0)
									menuActionID[menuActionRow] = 502;
								if (i2 == 1)
									menuActionID[menuActionRow] = 900;
								if (i2 == 2)
									menuActionID[menuActionRow] = 113;
								if (i2 == 3)
									menuActionID[menuActionRow] = 872;
								if (i2 == 4)
									menuActionID[menuActionRow] = 1062;
								menuActionCmd1[menuActionRow] = l;
								menuActionCmd2[menuActionRow] = i1;
								menuActionCmd3[menuActionRow] = j1;
								menuActionCmd4[menuActionRow] = l1;
								menuActionRow++;
							}

					}
					if (idToggle == true) {
						menuActionName[menuActionRow] = "Examine @cya@"
								+ class46.name + " @gre@(@whi@" + l1
								+ "@gre@) (@whi@" + (i1 + baseX) + ","
								+ (j1 + baseY) + "@gre@)";
					} else {
						menuActionName[menuActionRow] = "Examine @cya@"
								+ class46.name;
					}
					menuActionID[menuActionRow] = 1226;
					menuActionCmd1[menuActionRow] = class46.type << 14;
					menuActionCmd2[menuActionRow] = i1;
					menuActionCmd3[menuActionRow] = j1;
					menuActionCmd4[menuActionRow] = l1;
					menuActionRow++;
				}
			}
			if (k1 == 1) {
				NPC npc = npcArray[l1];
				if (npc.desc.aByte68 == 1 && (npc.x & 0x7f) == 64
						&& (npc.y & 0x7f) == 64) {
					for (int j2 = 0; j2 < npcCount; j2++) {
						NPC npc2 = npcArray[npcIndices[j2]];
						if (npc2 != null && npc2 != npc
								&& npc2.desc.aByte68 == 1 && npc2.x == npc.x
								&& npc2.y == npc.y)
							buildAtNPCMenu(npc2.desc, npcIndices[j2], j1, i1);
					}

					for (int l2 = 0; l2 < playerCount; l2++) {
						Player player = playerArray[playerIndices[l2]];
						if (player != null && player.x == npc.x
								&& player.y == npc.y)
							buildAtPlayerMenu(i1, playerIndices[l2], player, j1);
					}

				}
				buildAtNPCMenu(npc.desc, l1, j1, i1);
			}
			if (k1 == 0) {
				Player player = playerArray[l1];
				if ((player.x & 0x7f) == 64 && (player.y & 0x7f) == 64) {
					for (int k2 = 0; k2 < npcCount; k2++) {
						NPC class30_sub2_sub4_sub1_sub1_2 = npcArray[npcIndices[k2]];
						if (class30_sub2_sub4_sub1_sub1_2 != null
								&& class30_sub2_sub4_sub1_sub1_2.desc.aByte68 == 1
								&& class30_sub2_sub4_sub1_sub1_2.x == player.x
								&& class30_sub2_sub4_sub1_sub1_2.y == player.y)
							buildAtNPCMenu(class30_sub2_sub4_sub1_sub1_2.desc,
									npcIndices[k2], j1, i1);
					}

					for (int i3 = 0; i3 < playerCount; i3++) {
						Player class30_sub2_sub4_sub1_sub2_2 = playerArray[playerIndices[i3]];
						if (class30_sub2_sub4_sub1_sub2_2 != null
								&& class30_sub2_sub4_sub1_sub2_2 != player
								&& class30_sub2_sub4_sub1_sub2_2.x == player.x
								&& class30_sub2_sub4_sub1_sub2_2.y == player.y)
							buildAtPlayerMenu(i1, playerIndices[i3],
									class30_sub2_sub4_sub1_sub2_2, j1);
					}

				}
				buildAtPlayerMenu(i1, l1, player, j1);
			}
			if (k1 == 3) {
				NodeList class19 = groundArray[plane][i1][j1];
				if (class19 != null) {
					for (Item item = (Item) class19.getFirst(); item != null; item = (Item) class19
							.getNext()) {
						ItemDef itemDef = ItemDef.forID(item.ID);
						if (itemSelected == 1) {
							menuActionName[menuActionRow] = "Use "
									+ selectedItemName + " -> @lre@"
									+ itemDef.name;
							menuActionID[menuActionRow] = 511;
							menuActionCmd1[menuActionRow] = item.ID;
							menuActionCmd2[menuActionRow] = i1;
							menuActionCmd3[menuActionRow] = j1;
							menuActionRow++;
						} else if (spellSelected == 1) {
							if ((spellUsableOn & 1) == 1) {
								menuActionName[menuActionRow] = spellTooltip
										+ " @lre@" + itemDef.name;
								menuActionID[menuActionRow] = 94;
								menuActionCmd1[menuActionRow] = item.ID;
								menuActionCmd2[menuActionRow] = i1;
								menuActionCmd3[menuActionRow] = j1;
								menuActionRow++;
							}
						} else {
							for (int j3 = 4; j3 >= 0; j3--)
								if (itemDef.groundActions != null
										&& itemDef.groundActions[j3] != null) {
									menuActionName[menuActionRow] = itemDef.groundActions[j3]
											+ " @lre@" + itemDef.name;
									if (j3 == 0)
										menuActionID[menuActionRow] = 652;
									if (j3 == 1)
										menuActionID[menuActionRow] = 567;
									if (j3 == 2)
										menuActionID[menuActionRow] = 234;
									if (j3 == 3)
										menuActionID[menuActionRow] = 244;
									if (j3 == 4)
										menuActionID[menuActionRow] = 213;
									menuActionCmd1[menuActionRow] = item.ID;
									menuActionCmd2[menuActionRow] = i1;
									menuActionCmd3[menuActionRow] = j1;
									menuActionRow++;
								} else if (j3 == 2) {
									menuActionName[menuActionRow] = "Take @lre@"
											+ itemDef.name;
									menuActionID[menuActionRow] = 234;
									menuActionCmd1[menuActionRow] = item.ID;
									menuActionCmd2[menuActionRow] = i1;
									menuActionCmd3[menuActionRow] = j1;
									menuActionRow++;
								}
							if (idToggle == true) {
								menuActionName[menuActionRow] = "Examine @lre@"
										+ itemDef.name + " @gre@(@whi@"
										+ item.ID + "@gre@)";
							} else {
								menuActionName[menuActionRow] = "Examine @lre@"
										+ itemDef.name;
							}
							menuActionID[menuActionRow] = 1448;
							menuActionCmd1[menuActionRow] = item.ID;
							menuActionCmd2[menuActionRow] = i1;
							menuActionCmd3[menuActionRow] = j1;
							menuActionRow++;
						}
					}

				}
			}
		}
	}

	public void cleanUpForQuit() {
		signlink.reporterror = false;
		try {
			if (socketStream != null)
				socketStream.close();
			// System.out.println("Here6");
		} catch (Exception _ex) {
		}
		socketStream = null;
		if (mouseDetection != null)
			mouseDetection.running = false;
		mouseDetection = null;
		onDemandFetcher.disable();
		onDemandFetcher = null;
		aStream_834 = null;
		stream = null;
		aStream_847 = null;
		inStream = null;
		anIntArray1234 = null;
		aByteArrayArray1183 = null;
		aByteArrayArray1247 = null;
		anIntArray1235 = null;
		anIntArray1236 = null;
		intGroundArray = null;
		byteGroundArray = null;
		worldController = null;
		aClass11Array1230 = null;
		anIntArrayArray901 = null;
		anIntArrayArray825 = null;
		bigX = null;
		bigY = null;
		aByteArray912 = null;
		inventoryBackImage = null;
		leftFrame = null;
		topFrame = null;
		mapBackImage = null;
		inGameScreen = null;
		chatBackImage = null;
		aRSImageProducer_1125 = null;
		/* Null pointers for custom sprites */

		alertBack = null;
		alertBorder = null;
		alertBorderH = null;
		chatArea = null;
		loadingPleaseWait = null;
		reestablish = null;
		chatButtons = null;
		tabArea = null;
		HPBarFull = null;
		HPBarEmpty = null;
		magicAuto = null;
		tabHover = null;
		tabClicked = null;
		newSideIcons = null;
		/**/
		mapBack = null;
		CustomMapback = null;

		sideIcons = null;
		sIcons483 = null;
		sIcons459 = null;

		redStones = null;
		compass = null;
		hitMarks = null;
		hitMark = null;
		headIcons = null;
		skullIcons = null;
		headIconsHint = null;
		crosses = null;
		mapDotItem = null;
		mapDotNPC = null;
		mapDotPlayer = null;
		mapDotFriend = null;
		mapDotTeam = null;
		mapScenes = null;
		mapFunctions = null;
		anIntArrayArray929 = null;
		playerArray = null;
		playerIndices = null;
		anIntArray894 = null;
		aStreamArray895s = null;
		anIntArray840 = null;
		npcArray = null;
		npcIndices = null;
		groundArray = null;
		aClass19_1179 = null;
		aClass19_1013 = null;
		aClass19_1056 = null;
		menuActionCmd2 = null;
		menuActionCmd3 = null;
		menuActionCmd4 = null;
		menuActionID = null;
		menuActionCmd1 = null;
		menuActionName = null;
		variousSettings = null;
		anIntArray1072 = null;
		anIntArray1073 = null;
		aSpriteArray1140 = null;
		aSprite_1263 = null;
		friendsList = null;
		friendsListAsLongs = null;
		friendsNodeIDs = null;
		leftSideFlame = null;
		rightSideFlame = null;
		aRSImageProducer_1107 = null;
		aRSImageProducer_1108 = null;
		loginScreenArea = null;
		gameLogo = null;
		aRSImageProducer_1113 = null;
		aRSImageProducer_1114 = null;
		aRSImageProducer_1115 = null;
		multiOverlay = null;
		nullLoader();
		ObjectDef.nullLoader();
		EntityDef.nullLoader();
		ItemDef.nullLoader();
		Flo.cache = null;
		IdentityKit.cache = null;
		RSInterface.interfaceCache = null;
		Animation.anims = null;
		SpotAnim.cache = null;
		SpotAnim.aMRUNodes_415 = null;
		Varp.cache = null;
		super.fullGameScreen = null;
		Player.mruNodes = null;
		Texture.nullLoader();
		WorldController.nullLoader();
		Model.nullLoader();
		Class36.nullLoader();
		System.gc();
	}

	private void printDebug() {
		System.out.println("============");
		System.out.println("flame-cycle:" + anInt1208);
		if (onDemandFetcher != null)
			System.out.println("Od-cycle:" + onDemandFetcher.onDemandCycle);
		System.out.println("loop-cycle:" + loopCycle);
		System.out.println("draw-cycle:" + anInt1061);
		System.out.println("ptype:" + pktType);
		System.out.println("psize:" + pktSize);
		if (socketStream != null)
			socketStream.printDebug();
		super.shouldDebug = true;
	}

	Component getGameComponent() {

		if (signlink.mainapp != null)
			return signlink.mainapp;
		if (super.gameFrame != null)
			return super.gameFrame;
		else
			return this;
	}

	private void method73() {
		do {
			int j = readChar(-796);
			if (j == -1)
				break;
			if (openInterfaceID != -1
					&& openInterfaceID == reportAbuseInterfaceID) {
				if (j == 8 && reportAbuseInput.length() > 0)
					reportAbuseInput = reportAbuseInput.substring(0,
							reportAbuseInput.length() - 1);
				if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48
						&& j <= 57 || j == 32)
						&& reportAbuseInput.length() < 12)
					reportAbuseInput += (char) j;
			} else if (messagePromptRaised) {
				if (j >= 32 && j <= 122 && promptInput.length() < 80) {
					promptInput += (char) j;
					inputTaken = true;
				}
				if (j == 8 && promptInput.length() > 0) {
					promptInput = promptInput.substring(0,
							promptInput.length() - 1);
					inputTaken = true;
				}
				if (j == 13 || j == 10) {
					messagePromptRaised = false;
					inputTaken = true;
					if (friendsListAction == 1) {
						long l = TextClass.longForName(promptInput);
						addFriend(l);
					}
					if (friendsListAction == 2 && friendsCount > 0) {
						long l1 = TextClass.longForName(promptInput);
						delFriend(l1);
					}
					if (friendsListAction == 3 && promptInput.length() > 0) {
						stream.createFrame(126);
						stream.writeWordBigEndian(0);
						int k = stream.currentOffset;
						stream.writeQWord(aLong953);
						TextInput.method526(promptInput, stream);
						stream.writeBytes(stream.currentOffset - k);
						promptInput = TextInput.processText(promptInput);
						// promptInput = Censor.doCensor(promptInput);
						pushMessage(promptInput, 6, TextClass.fixName(TextClass
								.nameForLong(aLong953)));
						if (privateChatMode == 2) {
							privateChatMode = 1;
							stream.createFrame(95);
							stream.writeWordBigEndian(publicChatMode);
							stream.writeWordBigEndian(privateChatMode);
							stream.writeWordBigEndian(tradeMode);
						}
					}
					if (friendsListAction == 4 && ignoreCount < 100) {
						long l2 = TextClass.longForName(promptInput);
						addIgnore(l2);
					}
					if (friendsListAction == 5 && ignoreCount > 0) {
						long l3 = TextClass.longForName(promptInput);
						delIgnore(l3);
					}
					if (friendsListAction == 6) {
						long l3 = TextClass.longForName(promptInput);
						chatJoin(l3);
					}
				}
			} else if (inputDialogState == 1) {
				if (j >= 48 && j <= 57 && amountOrNameInput.length() < 10) {
					amountOrNameInput += (char) j;
					inputTaken = true;
				}

				if (j == 8 && amountOrNameInput.length() > 0) {
					amountOrNameInput = amountOrNameInput.substring(0,
							amountOrNameInput.length() - 1);
					inputTaken = true;
				}
				if (j == 13 || j == 10) {
					if (amountOrNameInput.length() > 0) {
						int i1 = 0;
						try {
							i1 = Integer.parseInt(amountOrNameInput);
						} catch (Exception _ex) {
						}
						stream.createFrame(208);
						stream.writeDWord(i1);
					}
					inputDialogState = 0;
					inputTaken = true;
				}
			} else if (inputDialogState == 2) {
				if (j >= 32 && j <= 122 && amountOrNameInput.length() < 12) {
					amountOrNameInput += (char) j;
					inputTaken = true;
				}
				if (j == 8 && amountOrNameInput.length() > 0) {
					amountOrNameInput = amountOrNameInput.substring(0,
							amountOrNameInput.length() - 1);
					inputTaken = true;
				}
				if (j == 13 || j == 10) {
					if (amountOrNameInput.length() > 0) {
						stream.createFrame(60);
						stream.writeQWord(TextClass
								.longForName(amountOrNameInput));
					}
					inputDialogState = 0;
					inputTaken = true;
				}
			} else if (writingOnStaffTab) {
				if ((j >= 97 && j <= 122 || j >= 65 && j <= 90 || j >= 48
						&& j <= 57 || j == 32)
						&& staffTabInput.length() < 12) {
					staffTabInput += (char) j;
					staffTabInput = TextClass.fixName(staffTabInput);
				}
				if ((j == 13 || j == 10) && staffTabInput.length() > 0) {
					long l3 = TextClass.longForName(staffTabInput);
					String s = TextClass.nameForLong(l3);
					fixedName = TextClass.fixName(s);
					showedName = fixedName;
					writingOnStaffTab = false;
				}
				if (j == 8 && staffTabInput.length() > 0)
					staffTabInput = staffTabInput.substring(0,
							staffTabInput.length() - 1);
			} else if (backDialogID == -1 && !writingOnStaffTab) {
				if (j >= 32 && j <= 122 && inputString.length() < 80) {
					inputString += (char) j;
					inputTaken = true;
				}
				if (j == 8 && inputString.length() > 0) {
					inputString = inputString.substring(0,
							inputString.length() - 1);
					inputTaken = true;
				}
				if ((j == 13 || j == 10) && inputString.length() > 0) {
					if (myPrivilege == 2 || server.equals("127.0.0.1")) {
						if (inputString.equals("::donate")) {
							launchURL("http://masterscape.org/donate");
						}
						if (inputString.equals("::vote")) {
							launchURL("http://masterscape.org/vote");
						}
					}
					if(inputString.contains("chatglow")) {
						inputTaken = true;
					}
					if (inputString.startsWith("::")) {
						if (inputString.equals("::newhits")
								&& newDamage == false) {
							newDamage = true;
						} else if (inputString.equals("::newhits")
								&& newDamage == true) {
							newDamage = false;
						}
						/*
						 * if(inputString.equals("dumpnpcs"))
						 * EntityDef.rewriteNpcs();
						 */
						if (inputString.startsWith("full")) {
							try {
								String[] args = inputString.split(" ");
								int id1 = Integer.parseInt(args[1]);
								int id2 = Integer.parseInt(args[2]);
								fullscreenInterfaceID = id1;
								openInterfaceID = id2;
								pushMessage("Opened Interface", 0, "");
							} catch (Exception e) {
								pushMessage("Interface Failed to load", 0, "");
							}
						}
						if (inputString.equals("::lag"))
							printDebug();
						if (inputString.equals("::fpson"))
							fpsOn = true;
						if (inputString.equals("::fpsoff"))
							fpsOn = false;
						if (inputString.equals("::dataon"))
							clientData = true;
						if (inputString.equals("::dataoff"))
							clientData = false;
						if (inputString.equals("::noclip")) {
							for (int k1 = 0; k1 < 4; k1++) {
								for (int i2 = 1; i2 < 103; i2++) {
									for (int k2 = 1; k2 < 103; k2++)
										aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;

								}
							}
						}
					}
					if (inputString.startsWith("/")){
						inputString = "::" + inputString;
					}
					if (inputString.equals("add model")) {
						try {
							int ModelIndex = Integer.parseInt(JOptionPane
									.showInputDialog(this, "Enter model ID",
											"Model", 3));
							byte[] abyte0 = getModel(ModelIndex);
							if (abyte0 != null && abyte0.length > 0) {
								decompressors[1].method234(abyte0.length,
										abyte0, ModelIndex);
								pushMessage("Model: [" + ModelIndex
										+ "] added successfully!", 0, "");
							} else {
								pushMessage("Unable to find the model. "
										+ ModelIndex, 0, "");
							}
						} catch (Exception e) {
							pushMessage("Syntax - ::add model <path>", 0, "");
						}
					}
					if (inputString.startsWith("/"))
						inputString = "::" + inputString;
					if (inputString.startsWith("::")) {
						stream.createFrame(103);
						stream.writeWordBigEndian(inputString.length() - 1);
						stream.writeString(inputString.substring(2));
					} else {
						String s = inputString.toLowerCase();
						int j2 = 0;
						if (s.startsWith("yellow:")) {
							j2 = 0;
							inputString = inputString.substring(7);
						} else if (s.startsWith("red:")) {
							j2 = 1;
							inputString = inputString.substring(4);
						} else if (s.startsWith("green:")) {
							j2 = 2;
							inputString = inputString.substring(6);
						} else if (s.startsWith("cyan:")) {
							j2 = 3;
							inputString = inputString.substring(5);
						} else if (s.startsWith("purple:")) {
							j2 = 4;
							inputString = inputString.substring(7);
						} else if (s.startsWith("white:")) {
							j2 = 5;
							inputString = inputString.substring(6);
						} else if (s.startsWith("flash1:")) {
							j2 = 6;
							inputString = inputString.substring(7);
						} else if (s.startsWith("flash2:")) {
							j2 = 7;
							inputString = inputString.substring(7);
						} else if (s.startsWith("flash3:")) {
							j2 = 8;
							inputString = inputString.substring(7);
						} else if (s.startsWith("glow1:")) {
							j2 = 9;
							inputString = inputString.substring(6);
						} else if (s.startsWith("glow2:")) {
							j2 = 10;
							inputString = inputString.substring(6);
						} else if (s.startsWith("glow3:")) {
							j2 = 11;
							inputString = inputString.substring(6);
						}
						s = inputString.toLowerCase();
						int i3 = 0;
						if (s.startsWith("wave:")) {
							i3 = 1;
							inputString = inputString.substring(5);
						} else if (s.startsWith("wave2:")) {
							i3 = 2;
							inputString = inputString.substring(6);
						} else if (s.startsWith("shake:")) {
							i3 = 3;
							inputString = inputString.substring(6);
						} else if (s.startsWith("scroll:")) {
							i3 = 4;
							inputString = inputString.substring(7);
						} else if (s.startsWith("slide:")) {
							i3 = 5;
							inputString = inputString.substring(6);
						}
						stream.createFrame(4);
						stream.writeWordBigEndian(0);
						int j3 = stream.currentOffset;
						stream.method425(i3);
						stream.method425(j2);
						aStream_834.currentOffset = 0;
						TextInput.method526(inputString, aStream_834);
						stream.method441(0, aStream_834.buffer,
								aStream_834.currentOffset);
						stream.writeBytes(stream.currentOffset - j3);
						inputString = TextInput.processText(inputString);
						// inputString = Censor.doCensor(inputString);
						myPlayer.textSpoken = inputString;
						myPlayer.anInt1513 = j2;
						myPlayer.anInt1531 = i3;
						myPlayer.textCycle = 150;
						// My players icons showing up when I speak
						String glow = "<shad=" + titleColor(myPlayer.chatGlow)
								+ ">";
						if (titleColor(myPlayer.chatGlow) == 0) {
							glow = "";
						}
						switch (myPrivilege) {
						case 1:
							pushMessage(myPlayer.textSpoken, 2, "@cr0@"
									+ "<col=13132800>"
									+ playerTitle(myPlayer.skill) + "</col>"
									+ glow + myPlayer.name);
							break;
						case 2:
							pushMessage(myPlayer.textSpoken, 2, "@cr1@"
									+ "<col=13132800>"
									+ playerTitle(myPlayer.skill) + "</col>"
									+ glow + myPlayer.name);
							break;
						case 3:
							pushMessage(myPlayer.textSpoken, 2, "@cr2@"
									+ "<col=13132800>"
									+ playerTitle(myPlayer.skill) + "</col>"
									+ glow + myPlayer.name);
							break;
						case 4:
							pushMessage(myPlayer.textSpoken, 2, "@cr3@"
									+ "<col=13132800>"
									+ playerTitle(myPlayer.skill) + "</col>"
									+ glow + myPlayer.name);
							break;
						case 5:
							pushMessage(myPlayer.textSpoken, 2, "@cr4@"
									+ "<col=13132800>"
									+ playerTitle(myPlayer.skill) + "</col>"
									+ glow + myPlayer.name);
							break;
						case 6:
							pushMessage(myPlayer.textSpoken, 2, "@cr5@"
									+ "<col=13132800>"
									+ playerTitle(myPlayer.skill) + "</col>"
									+ glow + myPlayer.name);
							break;
						case 7:
							pushMessage(myPlayer.textSpoken, 2, "@cr6@"
									+ "<col=13132800>"
									+ playerTitle(myPlayer.skill) + "</col>"
									+ glow + myPlayer.name);
							break;
						case 8:
							pushMessage(myPlayer.textSpoken, 2, "@cr7@"
									+ "<col=13132800>"
									+ playerTitle(myPlayer.skill) + "</col>"
									+ glow + myPlayer.name);
							break;
						default:
							pushMessage(myPlayer.textSpoken, 2,
									"<col=13132800>"
											+ playerTitle(myPlayer.skill)
											+ "</col>" + glow + myPlayer.name);
							break;
						}
						/**
						 * if(myPrivilege == 4) {
						 * pushMessage(myPlayer.textSpoken, 2, "@cr0@" +
						 * myPlayer.name); } else if(myPrivilege == 3) {
						 * pushMessage(myPlayer.textSpoken, 2, "@cr3@" +
						 * myPlayer.name); } else if(myPrivilege == 2) {
						 * pushMessage(myPlayer.textSpoken, 2, "@cr2@" +
						 * myPlayer.name); } else if(myPrivilege == 1) {
						 * pushMessage(myPlayer.textSpoken, 2, "@cr1@" +
						 * myPlayer.name); } else {
						 * pushMessage(myPlayer.textSpoken, 2, myPlayer.name); }
						 **/
						if (publicChatMode == 2) {
							publicChatMode = 3;
							stream.createFrame(95);
							stream.writeWordBigEndian(publicChatMode);
							stream.writeWordBigEndian(privateChatMode);
							stream.writeWordBigEndian(tradeMode);
						}
					}
					inputString = "";
					inputTaken = true;
				}
			}
		} while (true);
	}

	private void buildPublicChat(int j) {
		int l = 0;
		for (int i1 = 0; i1 < 500; i1++) {
			if (chatMessages[i1] == null)
				continue;
			if (chatTypeView != 1)
				continue;
			int j1 = chatTypes[i1];
			String s = chatNames[i1];
			int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
			if (k1 < -23)
				break;
			/*
			 * This is where the client handles where to start player text for
			 * the public chat area. We switch from substring 5 to substring 6
			 * when the crown numbers become double digits. This is because we
			 * have to start the text after the @cr#@ text because we don't want
			 * that showing.
			 */
			if (s != null && s.startsWith("@cr0@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr1@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr2@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr3@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr4@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr5@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr6@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr7@"))
				s = s.substring(5);
			if (s != null && s.startsWith("<col=")) {
				s = s.substring(s.indexOf("</col>") + 6);
			}
			if ((j1 == 1 || j1 == 2)
					&& (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
							&& isFriendOrSelf(s))) {
				if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
					if (myPrivilege >= 1) {
						menuActionName[menuActionRow] = "Report abuse @blu@"
								+ s;
						menuActionID[menuActionRow] = 606;
						menuActionRow++;
					}
					menuActionName[menuActionRow] = "Add ignore @whi@" + s;
					menuActionID[menuActionRow] = 42;
					menuActionRow++;
					menuActionName[menuActionRow] = "Add friend @whi@" + s;
					menuActionID[menuActionRow] = 337;
					menuActionRow++;
				}
				l++;
			}
		}
	}

	private void buildFriendChat(int j) {
		int l = 0;
		for (int i1 = 0; i1 < 500; i1++) {
			if (chatMessages[i1] == null)
				continue;
			if (chatTypeView != 2)
				continue;
			int j1 = chatTypes[i1];
			String s = chatNames[i1];
			int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
			if (k1 < -23)
				break;
			if (s != null && s.startsWith("@cr0@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr1@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr2@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr3@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr4@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr5@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr6@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr7@"))
				s = s.substring(5);
			if (s != null && s.startsWith("<col=")) {
				s = s.substring(s.indexOf("</col>") + 6);
			}
			if ((j1 == 5 || j1 == 6)
					&& (splitPrivateChat == 0 || chatTypeView == 2)
					&& (j1 == 6 || privateChatMode == 0 || privateChatMode == 1
							&& isFriendOrSelf(s)))
				l++;
			if ((j1 == 3 || j1 == 7)
					&& (splitPrivateChat == 0 || chatTypeView == 2)
					&& (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
							&& isFriendOrSelf(s))) {
				if (j > k1 - 14 && j <= k1) {
					if (myPrivilege >= 1) {
						menuActionName[menuActionRow] = "Report abuse @whi@"
								+ s;
						menuActionID[menuActionRow] = 606;
						menuActionRow++;
					}
					menuActionName[menuActionRow] = "Add ignore @whi@" + s;
					menuActionID[menuActionRow] = 42;
					menuActionRow++;
					menuActionName[menuActionRow] = "Add friend @whi@" + s;
					menuActionID[menuActionRow] = 337;
					menuActionRow++;
				}
				l++;
			}
		}
	}

	private void buildDuelorTrade(int j) {
		int l = 0;
		for (int i1 = 0; i1 < 500; i1++) {
			if (chatMessages[i1] == null)
				continue;
			if (chatTypeView != 3 && chatTypeView != 4)
				continue;
			int j1 = chatTypes[i1];
			String s = chatNames[i1];
			int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
			if (k1 < -23)
				break;
			/*
			 * This is where the client handles where to start player text for
			 * the duel and trade chat area. We switch from substring 5 to
			 * substring 6 when the crown numbers become double digits. This is
			 * because we have to start the text after the @cr#@ text because we
			 * don't want that showing.
			 */
			if (s != null && s.startsWith("@cr0@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr1@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr2@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr3@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr4@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr5@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr6@"))
				s = s.substring(5);
			if (s != null && s.startsWith("@cr7@"))
				s = s.substring(5);
			if (s != null && s.startsWith("<col=")) {
				s = s.substring(s.indexOf("</col>") + 6);
			}
			if (chatTypeView == 3 && j1 == 4
					&& (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
				if (j > k1 - 14 && j <= k1) {
					menuActionName[menuActionRow] = "Accept trade @whi@" + s;
					menuActionID[menuActionRow] = 484;
					menuActionRow++;
				}
				l++;
			}
			if (chatTypeView == 4 && j1 == 8
					&& (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
				if (j > k1 - 14 && j <= k1) {
					menuActionName[menuActionRow] = "Accept challenge @whi@"
							+ s;
					menuActionID[menuActionRow] = 6;
					menuActionRow++;
				}
				l++;
			}
			if (j1 == 12) {
				if (j > k1 - 14 && j <= k1) {
					menuActionName[menuActionRow] = "Go-to @cya@" + s;
					menuActionID[menuActionRow] = 915;
					menuActionRow++;
				}
				l++;
			}
		}
	}

	private void buildChatAreaMenu(int j) {
		int l = 0;
		for (int i1 = 0; i1 < 500; i1++) {
			if (chatMessages[i1] == null)
				continue;
			int j1 = chatTypes[i1];
			int k1 = (70 - l * 14 + 42) + anInt1089 + 4 + 5;
			if (k1 < -23)
				break;
			String s = chatNames[i1];
			if (chatTypeView == 1) {
				buildPublicChat(j);
				break;
			}
			if (chatTypeView == 2) {
				buildFriendChat(j);
				break;
			}
			if (chatTypeView == 3 || chatTypeView == 4) {
				buildDuelorTrade(j);
				break;
			}
			if (chatTypeView == 5) {
				break;
			}
			if (s != null && s.startsWith("@cr0@")) {
				s = s.substring(5);
			}
			if (s != null && s.startsWith("@cr1@")) {
				s = s.substring(5);
			}
			if (s != null && s.startsWith("@cr2@")) {
				s = s.substring(5);
			}
			if (s != null && s.startsWith("@cr3@")) {
				s = s.substring(5);
			}
			if (s != null && s.startsWith("@cr4@")) {
				s = s.substring(5);
			}
			if (s != null && s.startsWith("@cr5@")) {
				s = s.substring(5);
			}
			if (s != null && s.startsWith("@cr6@")) {
				s = s.substring(5);
			}
			if (s != null && s.startsWith("@cr7@")) {
				s = s.substring(5);
			}
			if (s != null && s.startsWith("<col=")) {
				s = s.substring(s.indexOf("</col>") + 6);
			}
			if (j1 == 0)
				l++;
			if ((j1 == 1 || j1 == 2)
					&& (j1 == 1 || publicChatMode == 0 || publicChatMode == 1
							&& isFriendOrSelf(s))) {
				if (j > k1 - 14 && j <= k1 && !s.equals(myPlayer.name)) {
					if (myPrivilege >= 1) {
						menuActionName[menuActionRow] = "Report abuse @whi@"
								+ s;
						menuActionID[menuActionRow] = 606;
						menuActionRow++;
					}
					menuActionName[menuActionRow] = "Add ignore @whi@" + s;
					menuActionID[menuActionRow] = 42;
					menuActionRow++;
					menuActionName[menuActionRow] = "Add friend @whi@" + s;
					menuActionID[menuActionRow] = 337;
					menuActionRow++;
				}
				l++;
			}
			if ((j1 == 3 || j1 == 7)
					&& splitPrivateChat == 0
					&& (j1 == 7 || privateChatMode == 0 || privateChatMode == 1
							&& isFriendOrSelf(s))) {
				if (j > k1 - 14 && j <= k1) {
					if (myPrivilege >= 1) {
						menuActionName[menuActionRow] = "Report abuse @whi@"
								+ s;
						menuActionID[menuActionRow] = 606;
						menuActionRow++;
					}
					menuActionName[menuActionRow] = "Add ignore @whi@" + s;
					menuActionID[menuActionRow] = 42;
					menuActionRow++;
					menuActionName[menuActionRow] = "Add friend @whi@" + s;
					menuActionID[menuActionRow] = 337;
					menuActionRow++;
				}
				l++;
			}
			if (j1 == 4
					&& (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
				if (j > k1 - 14 && j <= k1) {
					menuActionName[menuActionRow] = "Accept trade @whi@" + s;
					menuActionID[menuActionRow] = 484;
					menuActionRow++;
				}
				l++;
			}
			if ((j1 == 5 || j1 == 6) && splitPrivateChat == 0
					&& privateChatMode < 2)
				l++;
			if (j1 == 8
					&& (tradeMode == 0 || tradeMode == 1 && isFriendOrSelf(s))) {
				if (j > k1 - 14 && j <= k1) {
					menuActionName[menuActionRow] = "Accept challenge @whi@"
							+ s;
					menuActionID[menuActionRow] = 6;
					menuActionRow++;
				}
				l++;
			}
			if (j1 == 9) {
				if (j > k1 - 14 && j <= k1) {
					menuActionName[menuActionRow] = "Go-to @cya@" + s;
					menuActionID[menuActionRow] = 927;
					menuActionRow++;
				}
				l++;
			}
			if (j1 == 10) {
				if (j > k1 - 14 && j <= k1) {
					menuActionName[menuActionRow] = s;
					menuActionID[menuActionRow] = 1090;
					menuActionRow++;
				}
				l++;
			}
		}

	}

	private void drawFriendsListOrWelcomeScreen(RSInterface class9) {
		int j = class9.contentType;
		if (j == 204) {
			if (maxStats[0] < 99) {
				class9.disabledMessage = "Attack: " + currentStats[0] + "/"
						+ maxStats[0] + "\\nCurrent XP: " + currentExp[0]
						+ "\\nNext level: " + getXPForLevel(maxStats[0] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[0] + 1) - currentExp[0]);
				return;
			} else {
				class9.disabledMessage = "Attack: " + currentStats[0] + "/"
						+ maxStats[0] + "\\nExperience: " + currentExp[0];
				return;
			}
		}
		if (j == 229) {
			if (maxStats[3] < 99) {
				class9.disabledMessage = "Hitpoints: " + currentStats[3] + "/"
						+ maxStats[3] + "\\nCurrent XP: " + currentExp[3]
						+ "\\nNext level: " + getXPForLevel(maxStats[3] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[3] + 1) - currentExp[3]);
				return;
			} else {
				class9.disabledMessage = "Hitpoints: " + currentStats[3] + "/"
						+ maxStats[3] + "\\nExperience: " + currentExp[3];
				return;
			}
		}
		if (j == 206) {
			if (maxStats[14] < 99) {
				class9.disabledMessage = "Mining: " + currentStats[14] + "/"
						+ maxStats[14] + "\\nCurrent XP: " + currentExp[14]
						+ "\\nNext level: " + getXPForLevel(maxStats[14] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[14] + 1) - currentExp[14]);
				return;
			} else {
				class9.disabledMessage = "Mining: " + currentStats[14] + "/"
						+ maxStats[14] + "\\nExperience: " + currentExp[14];
				return;
			}
		}
		if (j == 207) {
			if (maxStats[2] < 99) {
				class9.disabledMessage = "Strength: " + currentStats[2] + "/"
						+ maxStats[2] + "\\nCurrent XP: " + currentExp[2]
						+ "\\nNext level: " + getXPForLevel(maxStats[2] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[2] + 1) - currentExp[2]);
				return;
			} else {
				class9.disabledMessage = "Strength: " + currentStats[2] + "/"
						+ maxStats[2] + "\\nExperience: " + currentExp[2];
				return;
			}
		}
		if (j == 208) {
			if (maxStats[16] < 99) {
				class9.disabledMessage = "Agility: " + currentStats[16] + "/"
						+ maxStats[16] + "\\nCurrent XP: " + currentExp[16]
						+ "\\nNext level: " + getXPForLevel(maxStats[16] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[16] + 1) - currentExp[16]);
				return;
			} else {
				class9.disabledMessage = "Agility: " + currentStats[16] + "/"
						+ maxStats[16] + "\\nExperience: " + currentExp[16];
				return;
			}
		}
		if (j == 209) {
			if (maxStats[13] < 99) {
				class9.disabledMessage = "Smithing: " + currentStats[13] + "/"
						+ maxStats[13] + "\\nCurrent XP: " + currentExp[13]
						+ "\\nNext level: " + getXPForLevel(maxStats[13] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[13] + 1) - currentExp[13]);
				return;
			} else {
				class9.disabledMessage = "Smithing: " + currentStats[13] + "/"
						+ maxStats[13] + "\\nExperience: " + currentExp[13];
				return;
			}
		}
		if (j == 210) {
			if (maxStats[1] < 99) {
				class9.disabledMessage = "Defence: " + currentStats[1] + "/"
						+ maxStats[1] + "\\nCurrent XP: " + currentExp[1]
						+ "\\nNext level: " + getXPForLevel(maxStats[1] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[1] + 1) - currentExp[1]);
				return;
			} else {
				class9.disabledMessage = "Defence: " + currentStats[1] + "/"
						+ maxStats[1] + "\\nExperience: " + currentExp[1];
				return;
			}
		}
		if (j == 211) {
			if (maxStats[15] < 99) {
				class9.disabledMessage = "Herblore: " + currentStats[15] + "/"
						+ maxStats[15] + "\\nCurrent XP: " + currentExp[15]
						+ "\\nNext level: " + getXPForLevel(maxStats[15] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[15] + 1) - currentExp[15]);
				return;
			} else {
				class9.disabledMessage = "Herblore: " + currentStats[15] + "/"
						+ maxStats[15] + "\\nExperience: " + currentExp[15];
				return;
			}
		}
		if (j == 212) {
			if (maxStats[10] < 99) {
				class9.disabledMessage = "Fishing: " + currentStats[10] + "/"
						+ maxStats[10] + "\\nCurrent XP: " + currentExp[10]
						+ "\\nNext level: " + getXPForLevel(maxStats[10] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[10] + 1) - currentExp[10]);
				return;
			} else {
				class9.disabledMessage = "Fishing: " + currentStats[10] + "/"
						+ maxStats[10] + "\\nExperience: " + currentExp[10];
				return;
			}
		}
		if (j == 213) {
			if (maxStats[4] < 99) {
				class9.disabledMessage = "Ranged: " + currentStats[4] + "/"
						+ maxStats[4] + "\\nCurrent XP: " + currentExp[4]
						+ "\\nNext level: " + getXPForLevel(maxStats[4] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[4] + 1) - currentExp[4]);
				return;
			} else {
				class9.disabledMessage = "Ranged: " + currentStats[4] + "/"
						+ maxStats[4] + "\\nExperience: " + currentExp[4];
				return;
			}
		}
		if (j == 214) {
			if (maxStats[17] < 99) {
				class9.disabledMessage = "Thieving: " + currentStats[17] + "/"
						+ maxStats[17] + "\\nCurrent XP: " + currentExp[17]
						+ "\\nNext level: " + getXPForLevel(maxStats[17] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[17] + 1) - currentExp[17]);
				return;
			} else {
				class9.disabledMessage = "Thieving: " + currentStats[17] + "/"
						+ maxStats[17] + "\\nExperience: " + currentExp[17];
				return;
			}
		}
		if (j == 215) {
			if (maxStats[7] < 99) {
				class9.disabledMessage = "Cooking: " + currentStats[7] + "/"
						+ maxStats[7] + "\\nCurrent XP: " + currentExp[7]
						+ "\\nNext level: " + getXPForLevel(maxStats[7] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[7] + 1) - currentExp[7]);
				return;
			} else {
				class9.disabledMessage = "Cooking: " + currentStats[7] + "/"
						+ maxStats[7] + "\\nExperience: " + currentExp[7];
				return;
			}
		}
		if (j == 216) {
			if (maxStats[5] < 99) {
				class9.disabledMessage = "Prayer: " + currentStats[5] + "/"
						+ maxStats[5] + "\\nCurrent XP: " + currentExp[5]
						+ "\\nNext level: " + getXPForLevel(maxStats[5] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[5] + 1) - currentExp[5]);
				return;
			} else {
				class9.disabledMessage = "Prayer: " + currentStats[5] + "/"
						+ maxStats[5] + "\\nExperience: " + currentExp[5];
				return;
			}
		}
		if (j == 217) {
			if (maxStats[12] < 99) {
				class9.disabledMessage = "Crafting: " + currentStats[12] + "/"
						+ maxStats[12] + "\\nCurrent XP: " + currentExp[12]
						+ "\\nNext level: " + getXPForLevel(maxStats[12] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[12] + 1) - currentExp[12]);
				return;
			} else {
				class9.disabledMessage = "Crafting: " + currentStats[12] + "/"
						+ maxStats[12] + "\\nExperience: " + currentExp[12];
				return;
			}
		}
		if (j == 218) {
			if (maxStats[11] < 99) {
				class9.disabledMessage = "Firemaking: " + currentStats[11]
						+ "/" + maxStats[11] + "\\nCurrent XP: "
						+ currentExp[11] + "\\nNext level: "
						+ getXPForLevel(maxStats[11] + 1) + "\\nRemainder: "
						+ (getXPForLevel(maxStats[11] + 1) - currentExp[11]);
				return;
			} else {
				class9.disabledMessage = "Firemaking: " + currentStats[11]
						+ "/" + maxStats[11] + "\\nExperience: "
						+ currentExp[11];
				return;
			}
		}
		if (j == 219) {
			if (maxStats[6] < 99) {
				class9.disabledMessage = "Magic: " + currentStats[6] + "/"
						+ maxStats[6] + "\\nCurrent XP: " + currentExp[6]
						+ "\\nNext level: " + getXPForLevel(maxStats[6] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[6] + 1) - currentExp[6]);
				return;
			} else {
				class9.disabledMessage = "Magic: " + currentStats[6] + "/"
						+ maxStats[6] + "\\nExperience: " + currentExp[6];
				return;
			}
		}
		if (j == 220) {
			if (maxStats[9] < 99) {
				class9.disabledMessage = "Fletching: " + currentStats[9] + "/"
						+ maxStats[9] + "\\nCurrent XP: " + currentExp[9]
						+ "\\nNext level: " + getXPForLevel(maxStats[9] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[9] + 1) - currentExp[9]);
				return;
			} else {
				class9.disabledMessage = "Fletching: " + currentStats[6] + "/"
						+ maxStats[6] + "\\nExperience: " + currentExp[9];
				return;
			}
		}
		if (j == 221) {
			if (maxStats[8] < 99) {
				class9.disabledMessage = "Woodcutting: " + currentStats[8]
						+ "/" + maxStats[8] + "\\nCurrent XP: " + currentExp[8]
						+ "\\nNext level: " + getXPForLevel(maxStats[8] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[8] + 1) - currentExp[8]);
				return;
			} else {
				class9.disabledMessage = "Woodcutting: " + currentStats[8]
						+ "/" + maxStats[8] + "\\nExperience: " + currentExp[8];
				return;
			}
		}
		if (j == 222) {
			if (maxStats[20] < 99) {
				class9.disabledMessage = "Runecrafting: " + currentStats[20]
						+ "/" + maxStats[20] + "\\nCurrent XP: "
						+ currentExp[20] + "\\nNext level: "
						+ getXPForLevel(maxStats[20] + 1) + "\\nRemainder: "
						+ (getXPForLevel(maxStats[20] + 1) - currentExp[20]);
				return;
			} else {
				class9.disabledMessage = "Runecrafting: " + currentStats[20]
						+ "/" + maxStats[20] + "\\nExperience: "
						+ currentExp[20];
				return;
			}
		}
		if (j == 223) {
			if (maxStats[18] < 99) {
				class9.disabledMessage = "Slayer: " + currentStats[18] + "/"
						+ maxStats[18] + "\\nCurrent XP: " + currentExp[18]
						+ "\\nNext level: " + getXPForLevel(maxStats[18] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[18] + 1) - currentExp[18]);
				return;
			} else {
				class9.disabledMessage = "Slayer: " + currentStats[18] + "/"
						+ maxStats[18] + "\\nExperience: " + currentExp[18];
				return;
			}
		}
		if (j == 224) {
			if (maxStats[19] < 99) {
				class9.disabledMessage = "Farming: " + currentStats[19] + "/"
						+ maxStats[19] + "\\nCurrent XP: " + currentExp[19]
						+ "\\nNext level: " + getXPForLevel(maxStats[19] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[19] + 1) - currentExp[19]);
				return;
			} else {
				class9.disabledMessage = "Farming: " + currentStats[19] + "/"
						+ maxStats[19] + "\\nExperience: " + currentExp[19];
				return;
			}
		}
		if (j == 225) {
			if (maxStats[21] < 99) {
				class9.disabledMessage = "Construction: " + currentStats[21]
						+ "/" + maxStats[21] + "\\nCurrent XP: "
						+ currentExp[21] + "\\nNext level: "
						+ getXPForLevel(maxStats[21] + 1) + "\\nRemainder: "
						+ (getXPForLevel(maxStats[21] + 1) - currentExp[21]);
				return;
			} else {
				class9.disabledMessage = "Construction: " + currentStats[21]
						+ "/" + maxStats[21] + "\\nExperience: "
						+ currentExp[21];
				return;
			}
		}
		if (j == 226) {
			if (maxStats[22] < 99) {
				class9.disabledMessage = "Hunter: " + currentStats[22] + "/"
						+ maxStats[22] + "\\nCurrent XP: " + currentExp[22]
						+ "\\nNext level: " + getXPForLevel(maxStats[22] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[22] + 1) - currentExp[22]);
				return;
			} else {
				class9.disabledMessage = "Hunter: " + currentStats[22] + "/"
						+ maxStats[22] + "\\nExperience: " + currentExp[22];
				return;
			}
		}
		if (j == 227) {
			if (maxStats[23] < 99) {
				class9.disabledMessage = "Summoning: " + currentStats[23] + "/"
						+ maxStats[23] + "\\nCurrent XP: " + currentExp[23]
						+ "\\nNext level: " + getXPForLevel(maxStats[23] + 1)
						+ "\\nRemainder: "
						+ (getXPForLevel(maxStats[23] + 1) - currentExp[23]);
				return;
			} else {
				class9.disabledMessage = "Summoning: " + currentStats[23] + "/"
						+ maxStats[23] + "\\nExperience: " + currentExp[23];
				return;
			}
		}
		if (j == 228) {
			if (maxStats[24] < 120) {
				class9.disabledMessage = "Dungeoneering: " + currentStats[24]
						+ "/" + maxStats[24] + "\\nCurrent XP: "
						+ currentExp[24] + "\\nNext level: "
						+ getXPForLevel(maxStats[24] + 1) + "\\nRemainder: "
						+ (getXPForLevel(maxStats[24] + 1) - currentExp[24]);
				return;
			} else {
				class9.disabledMessage = "Dungeoneering: " + currentStats[24]
						+ "/" + maxStats[24] + "\\nExperience: "
						+ currentExp[24];
				return;
			}
		}
		if (j >= 1 && j <= 100 || j >= 701 && j <= 800) {
			if (j == 1 && anInt900 == 0) {
				class9.disabledMessage = "Loading friend list";
				class9.atActionType = 0;
				return;
			}
			if (j == 1 && anInt900 == 1) {
				class9.disabledMessage = "Connecting to friendserver";
				class9.atActionType = 0;
				return;
			}
			if (j == 2 && anInt900 != 2) {
				class9.disabledMessage = "Please wait...";
				class9.atActionType = 0;
				return;
			}
			int k = friendsCount;
			if (anInt900 != 2)
				k = 0;
			if (j > 700)
				j -= 601;
			else
				j--;
			if (j >= k) {
				class9.disabledMessage = "";
				class9.atActionType = 0;
				return;
			} else {
				class9.disabledMessage = friendsList[j];
				class9.atActionType = 1;
				return;
			}
		}
		if (j >= 101 && j <= 200 || j >= 801 && j <= 900) {
			int l = friendsCount;
			if (anInt900 != 2)
				l = 0;
			if (j > 800)
				j -= 701;
			else
				j -= 101;
			if (j >= l) {
				class9.disabledMessage = "";
				class9.atActionType = 0;
				return;
			}
			if (friendsNodeIDs[j] == 10)
				class9.disabledMessage = "@gre@Online";
			else if (friendsNodeIDs[j] == nodeID)
				class9.disabledMessage = "@red@Offline";
			else
				class9.disabledMessage = "@red@Offline";
			class9.atActionType = 1;
			return;
		}
		if (j == 203) {
			int i1 = friendsCount;
			if (anInt900 != 2)
				i1 = 0;
			class9.scrollMax = i1 * 15 + 20;
			if (class9.scrollMax <= class9.height)
				class9.scrollMax = class9.height + 1;
			return;
		}
		if (j >= 401 && j <= 500) {
			if ((j -= 401) == 0 && anInt900 == 0) {
				class9.disabledMessage = "Loading ignore list";
				class9.atActionType = 0;
				return;
			}
			if (j == 1 && anInt900 == 0) {
				class9.disabledMessage = "Please wait...";
				class9.atActionType = 0;
				return;
			}
			int j1 = ignoreCount;
			if (anInt900 == 0)
				j1 = 0;
			if (j >= j1) {
				class9.disabledMessage = "";
				class9.atActionType = 0;
				return;
			} else {
				class9.disabledMessage = TextClass.fixName(TextClass
						.nameForLong(ignoreListAsLongs[j]));
				class9.atActionType = 1;
				return;
			}
		}
		if (j == 503) {
			class9.scrollMax = ignoreCount * 15 + 20;
			if (class9.scrollMax <= class9.height)
				class9.scrollMax = class9.height + 1;
			return;
		}
		if (j == 327) {
			class9.modelRotationY = 150;
			class9.modelRotationX = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
			if (aBoolean1031) {
				for (int k1 = 0; k1 < 7; k1++) {
					int l1 = anIntArray1065[k1];
					if (l1 >= 0 && !IdentityKit.cache[l1].method537())
						return;
				}

				aBoolean1031 = false;
				Model aclass30_sub2_sub4_sub6s[] = new Model[7];
				int i2 = 0;
				for (int j2 = 0; j2 < 7; j2++) {
					int k2 = anIntArray1065[j2];
					if (k2 >= 0)
						aclass30_sub2_sub4_sub6s[i2++] = IdentityKit.cache[k2]
								.method538();
				}

				Model model = new Model(i2, aclass30_sub2_sub4_sub6s);
				for (int l2 = 0; l2 < 5; l2++)
					if (anIntArray990[l2] != 0) {
						model.method476(anIntArrayArray1003[l2][0],
								anIntArrayArray1003[l2][anIntArray990[l2]]);
						if (l2 == 1)
							model.method476(anIntArray1204[0],
									anIntArray1204[anIntArray990[l2]]);
					}

				model.method469();
				model.method470(Animation.anims[myPlayer.anInt1511].anIntArray353[0]);
				model.method479(64, 850, -30, -50, -30, true);
				class9.disabledMediaType = 5;
				class9.disabledMediaID = 0;
				RSInterface.method208(aBoolean994, model);
			}
			return;
		}
		if (j == 328) {
			RSInterface rsInterface = class9;
			int verticleTilt = 150;
			int animationSpeed = (int) (Math.sin((double) loopCycle / 40D) * 256D) & 0x7ff;
			rsInterface.modelRotationY = verticleTilt;
			rsInterface.modelRotationX = animationSpeed;
			if (aBoolean1031) {
				Model characterDisplay = myPlayer.method452();
				for (int l2 = 0; l2 < 5; l2++)
					if (anIntArray990[l2] != 0) {
						characterDisplay.method476(anIntArrayArray1003[l2][0],
								anIntArrayArray1003[l2][anIntArray990[l2]]);
						if (l2 == 1)
							characterDisplay.method476(anIntArray1204[0],
									anIntArray1204[anIntArray990[l2]]);
					}
				int staticFrame = myPlayer.anInt1511;
				characterDisplay.method469();
				characterDisplay
						.method470(Animation.anims[staticFrame].anIntArray353[0]);
				// characterDisplay.method479(64, 850, -30, -50, -30, true);
				rsInterface.disabledMediaType = 5;
				rsInterface.disabledMediaID = 0;
				RSInterface.method208(aBoolean994, characterDisplay);
			}
			return;
		}
		if (j == 324) {
			if (aSprite_931 == null) {
				aSprite_931 = class9.disabledSprite;
				aSprite_932 = class9.enabledSprite;
			}
			if (aBoolean1047) {
				class9.disabledSprite = aSprite_932;
				return;
			} else {
				class9.disabledSprite = aSprite_931;
				return;
			}
		}
		if (j == 325) {
			if (aSprite_931 == null) {
				aSprite_931 = class9.disabledSprite;
				aSprite_932 = class9.enabledSprite;
			}
			if (aBoolean1047) {
				class9.disabledSprite = aSprite_931;
				return;
			} else {
				class9.disabledSprite = aSprite_932;
				return;
			}
		}
		if (j == 600) {
			class9.disabledMessage = reportAbuseInput;
			if (loopCycle % 20 < 10) {
				class9.disabledMessage += "|";
				return;
			} else {
				class9.disabledMessage += " ";
				return;
			}
		}
		if (j == 613)
			if (myPrivilege >= 1) {
				if (canMute) {
					class9.disabledColor = 0xff0000;
					class9.disabledMessage = "Moderator option: Mute player for 48 hours: <ON>";
				} else {
					class9.disabledColor = 0xffffff;
					class9.disabledMessage = "Moderator option: Mute player for 48 hours: <OFF>";
				}
			} else {
				class9.disabledMessage = "";
			}
		if (j == 650 || j == 655)
			if (anInt1193 != 0) {
				String s;
				if (daysSinceLastLogin == 0)
					s = "earlier today";
				else if (daysSinceLastLogin == 1)
					s = "yesterday";
				else
					s = daysSinceLastLogin + " days ago";
				class9.disabledMessage = "You last logged in " + s + " from: "
						+ signlink.dns;
			} else {
				class9.disabledMessage = "";
			}
		if (j == 651) {
			if (unreadMessages == 0) {
				class9.disabledMessage = "0 unread messages";
				class9.disabledColor = 0xffff00;
			}
			if (unreadMessages == 1) {
				class9.disabledMessage = "1 unread disabledMessage";
				class9.disabledColor = 65280;
			}
			if (unreadMessages > 1) {
				class9.disabledMessage = unreadMessages + " unread messages";
				class9.disabledColor = 65280;
			}
		}
		if (j == 652)
			if (daysSinceRecovChange == 201) {
				if (membersInt == 1)
					class9.disabledMessage = "@yel@This is a non-members world: @whi@Since you are a member we";
				else
					class9.disabledMessage = "";
			} else if (daysSinceRecovChange == 200) {
				class9.disabledMessage = "You have not yet set any password recovery questions.";
			} else {
				String s1;
				if (daysSinceRecovChange == 0)
					s1 = "Earlier today";
				else if (daysSinceRecovChange == 1)
					s1 = "Yesterday";
				else
					s1 = daysSinceRecovChange + " days ago";
				class9.disabledMessage = s1
						+ " you changed your recovery questions";
			}
		if (j == 653)
			if (daysSinceRecovChange == 201) {
				if (membersInt == 1)
					class9.disabledMessage = "@whi@recommend you use a members world instead. You may use";
				else
					class9.disabledMessage = "";
			} else if (daysSinceRecovChange == 200)
				class9.disabledMessage = "We strongly recommend you do so now to secure your account.";
			else
				class9.disabledMessage = "If you do not remember making this change then cancel it immediately";
		if (j == 654) {
			if (daysSinceRecovChange == 201)
				if (membersInt == 1) {
					class9.disabledMessage = "@whi@this world but member benefits are unavailable whilst here.";
					return;
				} else {
					class9.disabledMessage = "";
					return;
				}
			if (daysSinceRecovChange == 200) {
				class9.disabledMessage = "Do this from the 'account management' area on our front webpage";
				return;
			}
			class9.disabledMessage = "Do this from the 'account management' area on our front webpage";
		}
	}

	private void drawSplitPrivateChat() {
		if (splitPrivateChat == 0)
			return;
		RSFont textDrawingArea = aTextDrawingArea_1271;
		int i = 0;
		if (anInt1104 != 0)
			i = 1;
		for (int j = 0; j < 100; j++)
			if (chatMessages[j] != null) {
				int k = chatTypes[j];
				String s = chatNames[j];
				byte byte1 = 0;
				/*
				 * This is where the Client assigns a crown to a specific
				 * modIcon. If you remember from previous code we were assigning
				 * a modIcon to a byte called byte1. This is where we relate the
				 * two together making @cr#@ call a crown sprite rather then
				 * just be text.
				 * 
				 * @Variable s, This is the player's name, It's telling the
				 * client to start the name after the 5th character which would
				 * be the last @ sign.
				 */
				if (s != null && s.startsWith("@cr0@")) {
					s = s.substring(5);
					byte1 = 1;
				}
				if (s != null && s.startsWith("@cr1@")) {
					s = s.substring(5);
					byte1 = 2;
				}
				if (s != null && s.startsWith("@cr2@")) {
					s = s.substring(5);
					byte1 = 3;
				}
				if (s != null && s.startsWith("@cr3@")) {
					s = s.substring(5);
					byte1 = 4;
				}
				if (s != null && s.startsWith("@cr4@")) {
					s = s.substring(5);
					byte1 = 5;
				}
				if (s != null && s.startsWith("@cr5@")) {
					s = s.substring(5);
					byte1 = 6;
				}
				if (s != null && s.startsWith("@cr6@")) {
					s = s.substring(5);
					byte1 = 7;
				}
				if ((k == 3 || k == 7)
						&& (k == 7 || privateChatMode == 0 || privateChatMode == 1
								&& isFriendOrSelf(s))) {
					int l = 329 - i * 13;
					int k1 = 4;
					textDrawingArea.method385(0, "From", l, k1);
					textDrawingArea.method385(65535, "From", l - 1, k1);
					k1 += textDrawingArea.getTextWidth("From ");
					/*
					 * This is where the Client assigns a crown to a variable,
					 * byte1. Byte1 is used to call the crown sprite when
					 * needed.
					 * 
					 * @Variable k1, This signifies the "From: " text width.
					 */
					if (byte1 == 1) {
						modIcons[0].drawSprite(k1, l - 12);
						k1 += 12;
					}
					if (byte1 == 2) {
						modIcons[1].drawSprite(k1, l - 12);
						k1 += 12;
					}
					if (byte1 == 3) {
						modIcons[2].drawSprite(k1, l - 12);
						k1 += 12;
					}
					if (byte1 == 4) {
						modIcons[3].drawSprite(k1, l - 12);
						k1 += 12;
					}
					if (byte1 == 5) {
						modIcons[4].drawSprite(k1, l - 12);
						k1 += 12;
					}
					if (byte1 == 6) {
						modIcons[5].drawSprite(k1, l - 12);
						k1 += 12;
					}
					if (byte1 == 7) {
						modIcons[6].drawSprite(k1, l - 12);
						k1 += 12;
					}
					if (byte1 == 8) {
						modIcons[7].drawSprite(k1, l - 12);
						k1 += 12;
					}
					textDrawingArea.method385(0, s + ": " + chatMessages[j], l,
							k1);
					textDrawingArea.method385(65535,
							s + ": " + chatMessages[j], l - 1, k1);
					if (++i >= 5)
						return;
				}
				if (k == 5 && privateChatMode < 2) {
					int i1 = 329 - i * 13;
					textDrawingArea.method385(0, chatMessages[j], i1, 4);
					textDrawingArea
							.method385(65535, chatMessages[j], i1 - 1, 4);
					if (++i >= 5)
						return;
				}
				if (k == 6 && privateChatMode < 2) {
					int j1 = 329 - i * 13;
					textDrawingArea.method385(0, "To " + s + ": "
							+ chatMessages[j], j1, 4);
					textDrawingArea.method385(65535, "To " + s + ": "
							+ chatMessages[j], j1 - 1, 4);
					if (++i >= 5)
						return;
				}
			}

	}

	private String clanUsername;
	private String clanMessage;
	private String clanTitle;
	private int channelRights;
	private int hoverId;

	public void pushMessage(String s, int i, String s1) {
		if (i == 0 && dialogID != -1) {
			aString844 = s;
			super.clickMode3 = 0;
		}
		if (backDialogID == -1) {
			inputTaken = true;
		}
		for (int j = 499; j > 0; j--) {
			chatTypes[j] = chatTypes[j - 1];
			chatNames[j] = chatNames[j - 1];
			chatMessages[j] = chatMessages[j - 1];
			chatRights[j] = chatRights[j - 1];
			clanTitles[j] = clanTitles[j - 1];
		}
		chatTypes[0] = i;
		chatNames[0] = s1;
		chatMessages[0] = s;
		chatRights[0] = rights;
		clanTitles[0] = clanTitle;
	}

	public static void setTab(int id) {
		tabID = id;
		tabAreaAltered = true;
	}

	public int tabHPos;

	private void processTabClick() {
		if (is480 == true || is508 == true || is525 == true || is562 == true) {
			if (super.mouseX >= 706 && super.mouseX <= 762
					&& super.mouseY >= 95 && super.mouseY < 128) {
				runHover = true;
			} else {
				runHover = false;
			}
			if (super.mouseX >= 706 && super.mouseX <= 762
					&& super.mouseY >= 52 && super.mouseY < 87) {
				prayHover = true;
			} else {
				prayHover = false;
			}
			if (super.mouseX >= 765 - 24 && super.mouseX <= 765
					&& super.mouseY >= 3 && super.mouseY <= 25) {
				logHover = true;
			} else {
				logHover = false;
			}
		}
		if (is562 == false) {
			if (super.clickMode3 == 1) {
				if (super.saveClickX >= 524 && super.saveClickX <= 561
						&& super.saveClickY >= 169 && super.saveClickY < 205
						&& tabInterfaceIDs[0] != -1) {
					tabID = 0;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 562 && super.saveClickX <= 594
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[1] != -1) {
					tabID = 1;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 595 && super.saveClickX <= 626
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[2] != -1) {
					tabID = 2;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 627 && super.saveClickX <= 660
						&& super.saveClickY >= 168 && super.saveClickY < 203
						&& tabInterfaceIDs[3] != -1) {
					tabID = 3;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 661 && super.saveClickX <= 693
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[4] != -1) {
					tabID = 4;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 694 && super.saveClickX <= 725
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[5] != -1) {
					tabID = 5;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 726 && super.saveClickX <= 765
						&& super.saveClickY >= 169 && super.saveClickY < 205
						&& tabInterfaceIDs[6] != -1) {
					tabID = 6;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 524 && super.saveClickX <= 561
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[7] != -1) {
					tabID = 7;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 562 && super.saveClickX <= 594
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[8] != -1) {
					tabID = 8;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 595 && super.saveClickX <= 627
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[9] != -1) {
					tabID = 9;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 627 && super.saveClickX <= 664
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[10] != -1) {
					tabID = 10;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 661 && super.saveClickX <= 694
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[11] != -1) {
					tabID = 11;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 695 && super.saveClickX <= 725
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[12] != -1) {
					tabID = 12;
					tabAreaAltered = true;
				}
				if (super.saveClickX >= 726 && super.saveClickX <= 765
						&& super.saveClickY >= 466 && super.saveClickY < 502
						&& tabInterfaceIDs[13] != -1) {
					tabID = 13;
					tabAreaAltered = true;
				}
			}
		} else {
			if (super.mouseX >= 521 && super.mouseX <= 550
					&& super.mouseY >= 169 && super.mouseY < 205) {
				tabHPos = 0;
				tabAreaAltered = true;
			} else if (super.mouseX >= 552 && super.mouseX <= 581
					&& super.mouseY >= 168 && super.mouseY < 205) {
				tabHPos = 1;
				tabAreaAltered = true;
			} else if (super.mouseX >= 582 && super.mouseX <= 611
					&& super.mouseY >= 168 && super.mouseY < 205) {
				tabHPos = 2;
				tabAreaAltered = true;
			} else if (super.mouseX >= 612 && super.mouseX <= 641
					&& super.mouseY >= 168 && super.mouseY < 203) {
				tabHPos = 3;
				tabAreaAltered = true;
			} else if (super.mouseX >= 642 && super.mouseX <= 671
					&& super.mouseY >= 168 && super.mouseY < 205) {
				tabHPos = 4;
				tabAreaAltered = true;
			} else if (super.mouseX >= 672 && super.mouseX <= 701
					&& super.mouseY >= 168 && super.mouseY < 205) {
				tabHPos = 5;
				tabAreaAltered = true;
			} else if (super.mouseX >= 702 && super.mouseX <= 731
					&& super.mouseY >= 169 && super.mouseY < 205) {
				tabHPos = 6;
				tabAreaAltered = true;
			} else if (super.mouseX >= 732 && super.mouseX <= 761
					&& super.mouseY >= 169 && super.mouseY < 205) {
				tabHPos = 7;
				tabAreaAltered = true;
			} else if (super.mouseX >= 522 && super.mouseX <= 551
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 15;
				tabAreaAltered = true;
			} else if (super.mouseX >= 552 && super.mouseX <= 581
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 8;
				tabAreaAltered = true;
			} else if (super.mouseX >= 582 && super.mouseX <= 611
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 9;
				tabAreaAltered = true;
			} else if (super.mouseX >= 612 && super.mouseX <= 641
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 10;
				tabAreaAltered = true;
			} else if (super.mouseX >= 642 && super.mouseX <= 671
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 11;
				tabAreaAltered = true;
			} else if (super.mouseX >= 672 && super.mouseX <= 701
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 12;
				tabAreaAltered = true;
			} else if (super.mouseX >= 702 && super.mouseX <= 731
					&& super.mouseY >= 466 && super.mouseY < 502) {
				tabHPos = 13;
				tabAreaAltered = true;
			} else if (super.mouseX >= 732 && super.mouseX <= 761
					&& super.mouseY >= 466 && super.mouseY < 502) {
				tabHPos = 14;
				tabAreaAltered = true;
			} else {
				tabHPos = -1;
				tabAreaAltered = true;
			}
			if (super.clickMode3 == 1) {
				if (super.saveClickX >= 522 && super.saveClickX <= 551
						&& super.saveClickY >= 169 && super.saveClickY < 205
						&& tabInterfaceIDs[0] != -1) {
					tabID = 0;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 552 && super.saveClickX <= 581
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[1] != -1) {
					tabID = 1;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 582 && super.saveClickX <= 611
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[2] != -1) {
					tabID = 2;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 612 && super.saveClickX <= 641
						&& super.saveClickY >= 168 && super.saveClickY < 203
						&& tabInterfaceIDs[14] != -1) {
					tabID = 14;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 642 && super.saveClickX <= 671
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[3] != -1) {
					tabID = 3;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 672 && super.saveClickX <= 701
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[4] != -1) {
					tabID = 4;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 702 && super.saveClickX <= 731
						&& super.saveClickY >= 169 && super.saveClickY < 205
						&& tabInterfaceIDs[5] != -1) {
					tabID = 5;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 732 && super.saveClickX <= 761
						&& super.saveClickY >= 169 && super.saveClickY < 205
						&& tabInterfaceIDs[6] != -1) {
					tabID = 6;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 522 && super.saveClickX <= 551
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[16] != -1) {
					tabID = 16;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 552 && super.saveClickX <= 581
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[8] != -1) {
					tabID = 8;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 582 && super.saveClickX <= 611
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[9] != -1) {
					tabID = 9;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 612 && super.saveClickX <= 641
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[7] != -1) {
					tabID = 7;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 642 && super.saveClickX <= 671
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[11] != -1) {
					tabID = 11;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 672 && super.saveClickX <= 701
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[12] != -1) {
					tabID = 12;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 702 && super.saveClickX <= 731
						&& super.saveClickY >= 466 && super.saveClickY < 502
						&& tabInterfaceIDs[13] != -1) {
					tabID = 13;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 732 && super.saveClickX <= 761
						&& super.saveClickY >= 466 && super.saveClickY < 502
						&& tabInterfaceIDs[15] != -1) {
					tabID = 15;
					tabAreaAltered = true;
				}
				/* Logout X */
				else if (super.saveClickX >= 742 && super.saveClickX <= 764
						&& super.saveClickY >= 1 && super.saveClickY < 24
						&& tabInterfaceIDs[10] != -1) {
					tabID = 10;
					tabAreaAltered = true;
				}

			}
		}

	}

	private void resetImageProducers2() {
		if (chatBackImage != null)
			return;
		nullLoader();
		super.fullGameScreen = null;
		aRSImageProducer_1107 = null;
		aRSImageProducer_1108 = null;
		loginScreenArea = null;
		leftSideFlame = null;
		rightSideFlame = null;
		gameLogo = null;
		aRSImageProducer_1113 = null;
		aRSImageProducer_1114 = null;
		aRSImageProducer_1115 = null;
		chatBackImage = new RSImageProducer(516, 165, getGameComponent());// 519
		mapBackImage = new RSImageProducer(249, 168, getGameComponent());//
		DrawingArea.setAllPixelsToZero();
		// mapBack.drawBackground(0, 0);
		CustomMapback[getSpriteID()].drawSprite(0, 0);
		inventoryBackImage = new RSImageProducer(250, 335, getGameComponent());
		inGameScreen = new RSImageProducer(512, 334, getGameComponent());
		DrawingArea.setAllPixelsToZero();
		new RSImageProducer(269, 37, getGameComponent());
		aRSImageProducer_1125 = new RSImageProducer(249, 45, getGameComponent());
		welcomeScreenRaised = true;
	}

	public String getDocumentBaseHost() {
		if (signlink.mainapp != null) {
			return signlink.mainapp.getDocumentBase().getHost().toLowerCase();
		}
		return null;
	}

	private void method81(Sprite sprite, int j, int k) {
		int l = k * k + j * j;
		if (l > 4225 && l < 0x15f90) {
			int i1 = minimapInt1 + minimapInt2 & 0x7ff;
			int j1 = Model.modelIntArray1[i1];
			int k1 = Model.modelIntArray2[i1];
			j1 = (j1 * 256) / (minimapInt3 + 256);
			k1 = (k1 * 256) / (minimapInt3 + 256);
			int l1 = j * j1 + k * k1 >> 16;
			int i2 = j * k1 - k * j1 >> 16;
			double d = Math.atan2(l1, i2);
			int j2 = (int) (Math.sin(d) * 63D);
			int k2 = (int) (Math.cos(d) * 57D);
			mapEdge.method353(83 - k2 - 20, d, (94 + j2 + 4) - 10);
			CustomMapback[getSpriteID()].drawSprite(0, 0);
			return;
		} else {
			markMinimap(sprite, k, j, false);
			CustomMapback[getSpriteID()].drawSprite(0, 0);
		}
	}

	public void processRightClick() {
		if (activeInterfaceType != 0) {
			return;
		}
		menuActionName[0] = "Cancel";
		menuActionID[0] = 1107;
		menuActionRow = 1;
		if (fullscreenInterfaceID != -1) {
			anInt886 = 0;
			anInt1315 = 0;
			buildInterfaceMenu(8,
					RSInterface.interfaceCache[fullscreenInterfaceID],
					super.mouseX, 8, super.mouseY, 0);
			if (anInt886 != anInt1026) {
				anInt1026 = anInt886;
			}
			if (anInt1315 != anInt1129) {
				anInt1129 = anInt1315;
			}
			return;
		}
		buildSplitPrivateChatMenu();
		anInt886 = 0;
		anInt1315 = 0;
		if (super.mouseX > 0 && super.mouseY > 0 && super.mouseX < 516
				&& super.mouseY < 338) {
			if (welcomeScreen) {
				if (super.mouseX > 250
						&& super.mouseX < 250 + welcomePlay.myWidth
						&& super.mouseY > 262
						&& super.mouseY < 262 + welcomePlay.myHeight) {
					menuActionName[menuActionRow] = "Play " + welcomeName;
					menuActionID[menuActionRow] = 910;
					menuActionRow++;
				}
				if (super.mouseX > 316 && super.mouseX < 408
						&& super.mouseY > 196 && super.mouseY < 218) {
					menuActionName[menuActionRow] = "Donate";
					menuActionID[menuActionRow] = 900;
					menuActionRow++;
				}
				if (super.mouseX > 256 && super.mouseX < 350
						&& super.mouseY > 220 && super.mouseY < 240) {
					menuActionName[menuActionRow] = "Forums";
					menuActionID[menuActionRow] = 901;
					menuActionRow++;
				}
				if (super.mouseX > 375 && super.mouseX < 474
						&& super.mouseY > 220 && super.mouseY < 240) {
					menuActionName[menuActionRow] = "Vote";
					menuActionID[menuActionRow] = 902;
					menuActionRow++;
				}
			} else if (shopOverview) {
				if (super.mouseX > 4 && super.mouseX < 510 && super.mouseY > 4
						&& mouseY < 332) {
					if (super.mouseX > 496 && super.mouseX < 508
							&& super.mouseY > 14 && super.mouseY < 26) {
						menuActionName[menuActionRow] = "Close";
						menuActionID[menuActionRow] = 900;
						menuActionRow++;
					} else {
						final int yOffset = super.mouseY - 86;
						if (super.mouseX > 14 && super.mouseX < 498
								&& yOffset > 0 && yOffset < 246) {
							final int xSlot = (super.mouseX - 14) / 160;
							final int ySlot = yOffset / 28;
							try {
								if (shops[xSlot][ySlot] == null) {
									return;
								}
							} catch (ArrayIndexOutOfBoundsException e) {
								return;
							}
							menuActionName[menuActionRow] = "Open "
									+ shops[xSlot][ySlot].toLowerCase();
							menuActionID[menuActionRow] = 910;
							menuActionCmd2[menuActionRow] = xSlot;
							menuActionCmd3[menuActionRow] = ySlot;
							menuActionRow++;
						}
					}
				}
			} else if (openInterfaceID != -1) {
				buildInterfaceMenu(4,
						RSInterface.interfaceCache[openInterfaceID],
						super.mouseX, 4, super.mouseY, 0);
			} else {
				build3dScreenMenu();
			}
		}
		if (anInt886 != anInt1026) {
			anInt1026 = anInt886;
		}
		if (anInt1315 != anInt1129) {
			anInt1129 = anInt1315;
		}
		anInt886 = 0;
		anInt1315 = 0;
		if (super.mouseX > 548 && super.mouseY > 207 && super.mouseX < 740
				&& super.mouseY < 468) {
			if (invOverlayInterfaceID != -1) {
				buildInterfaceMenu(548,
						RSInterface.interfaceCache[invOverlayInterfaceID],
						super.mouseX, 207, super.mouseY, 0);
			} else if (tabInterfaceIDs[tabID] != -1) {
				buildInterfaceMenu(548,
						RSInterface.interfaceCache[tabInterfaceIDs[tabID]],
						super.mouseX, 207, super.mouseY, 0);
			}
		}
		if (anInt886 != anInt1048) {
			tabAreaAltered = true;
			anInt1048 = anInt886;
		}
		if (anInt1315 != anInt1044) {
			tabAreaAltered = true;
			anInt1044 = anInt1315;
		}
		anInt886 = 0;
		anInt1315 = 0;
		if (super.mouseX > 0 && super.mouseY > 338 && super.mouseX < 490
				&& super.mouseY < 463) {
			if (backDialogID != -1) {
				buildInterfaceMenu(20,
						RSInterface.interfaceCache[backDialogID], super.mouseX,
						358, super.mouseY, 0);
			} else if (super.mouseY < 463 && super.mouseX < 490) {
				buildChatAreaMenu(super.mouseY - 338);
			}
		}
		if (mouseLeftClickInArea(6, 512, 459, 475))
			writingOnStaffTab = false;
		if (backDialogID != -1 && anInt886 != anInt1039) {
			inputTaken = true;
			anInt1039 = anInt886;
		}
		if (backDialogID != -1 && anInt1315 != anInt1500) {
			inputTaken = true;
			anInt1500 = anInt1315;
		}
		/** Custom menu drawing */
		rightClickChatButtons();
		alertHandler.processMouse(super.mouseX, super.mouseY);
		determineTopTabs();
		determineBottomTabs();

		if (is480 == true || is508 == true || is525 == true || is562 == true) {
			processMinimapActions();
		}

		boolean flag = false;
		while (!flag) {
			flag = true;
			for (int j = 0; j < menuActionRow - 1; j++) {
				if (menuActionID[j] < 1000 && menuActionID[j + 1] > 1000) {
					String s = menuActionName[j];
					menuActionName[j] = menuActionName[j + 1];
					menuActionName[j + 1] = s;
					int k = menuActionID[j];
					menuActionID[j] = menuActionID[j + 1];
					menuActionID[j + 1] = k;
					k = menuActionCmd2[j];
					menuActionCmd2[j] = menuActionCmd2[j + 1];
					menuActionCmd2[j + 1] = k;
					k = menuActionCmd3[j];
					menuActionCmd3[j] = menuActionCmd3[j + 1];
					menuActionCmd3[j + 1] = k;
					k = menuActionCmd1[j];
					menuActionCmd1[j] = menuActionCmd1[j + 1];
					menuActionCmd1[j + 1] = k;
					k = menuActionCmd4[j];
					menuActionCmd4[j] = menuActionCmd4[j + 1];
					menuActionCmd4[j + 1] = k;
					flag = false;
				}
			}
		}
	}

	private int method83(int i, int j, int k) {
		int l = 256 - k;
		return ((i & 0xff00ff) * l + (j & 0xff00ff) * k & 0xff00ff00)
				+ ((i & 0xff00) * l + (j & 0xff00) * k & 0xff0000) >> 8;
	}

	private String getMac() {
		InetAddress ip;
		String macA = null;
		try {

			ip = InetAddress.getLocalHost();
			NetworkInterface network = NetworkInterface.getByInetAddress(ip);

			byte[] mac = network.getHardwareAddress();

			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < mac.length; i++) {
				sb.append(String.format("%02X%s", mac[i],
						(i < mac.length - 1) ? "-" : ""));
			}
			macA = sb.toString();

		} catch (UnknownHostException e) {

			e.printStackTrace();

		} catch (SocketException e) {

			e.printStackTrace();

		}
		return macA;
	}

	private void login(String s, String s1, boolean flag) {
		signlink.errorname = s;
		try {
			if (RememberMe == true) {
				writeSettings();
			}
			if (!flag) {
				loginMessage1 = "";
				loginMessage2 = "Connecting to server...";
				drawLoginScreen(true);
			}
			socketStream = new RSSocket(this, openSocket(43594));
			long l = TextClass.longForName(s);
			int i = (int) (l >> 16 & 31L);
			stream.currentOffset = 0;
			stream.writeWordBigEndian(14);
			stream.writeWordBigEndian(i);
			socketStream.queueBytes(2, stream.buffer);
			for (int j = 0; j < 8; j++)
				socketStream.read();

			int k = socketStream.read();
			int i1 = k;
			if (k == 0) {
				socketStream.flushInputStream(inStream.buffer, 8);
				inStream.currentOffset = 0;
				aLong1215 = inStream.readQWord();
				int ai[] = new int[4];
				ai[0] = (int) (Math.random() * 99999999D);
				ai[1] = (int) (Math.random() * 99999999D);
				ai[2] = (int) (aLong1215 >> 32);
				ai[3] = (int) aLong1215;
				stream.currentOffset = 0;
				stream.writeWordBigEndian(10);
				stream.writeDWord(ai[0]);
				stream.writeDWord(ai[1]);
				stream.writeDWord(ai[2]);
				stream.writeDWord(ai[3]);
				stream.writeWord(-1);
				stream.writeDWord(882352382);
				stream.writeString("");
				stream.writeString(getMac());
				stream.writeString(s);
				stream.writeString(s1);
				stream.doKeys();
				aStream_847.currentOffset = 0;
				if (flag)
					aStream_847.writeWordBigEndian(18);
				else
					aStream_847.writeWordBigEndian(16);
				aStream_847.writeWordBigEndian(stream.currentOffset + 36 + 1
						+ 1 + 2);
				aStream_847.writeWordBigEndian(255);
				aStream_847.writeWord(317);
				aStream_847.writeWordBigEndian(lowMem ? 1 : 0);
				for (int l1 = 0; l1 < 9; l1++)
					aStream_847.writeDWord(expectedCRCs[l1]);

				aStream_847.writeBytes(stream.buffer, stream.currentOffset, 0);
				stream.encryption = new ISAACRandomGen(ai);
				for (int j2 = 0; j2 < 4; j2++)
					ai[j2] += 50;

				encryption = new ISAACRandomGen(ai);
				socketStream.queueBytes(aStream_847.currentOffset,
						aStream_847.buffer);
				k = socketStream.read();
			}
			if (k == 1) {
				try {
					Thread.sleep(2000L);
				} catch (Exception _ex) {
				}
				login(s, s1, flag);
				return;
			}
			if (k == 2) {
				myPrivilege = socketStream.read();
				flagged = socketStream.read() == 1;
				aLong1220 = 0L;
				anInt1022 = 0;
				mouseDetection.coordsIndex = 0;
				super.awtFocus = true;
				aBoolean954 = true;
				loggedIn = true;
				stream.currentOffset = 0;
				inStream.currentOffset = 0;
				pktType = -1;
				anInt841 = -1;
				anInt842 = -1;
				anInt843 = -1;
				pktSize = 0;
				anInt1009 = 0;
				anInt1104 = 0;
				anInt1011 = 0;
				anInt855 = 0;
				menuActionRow = 0;
				menuOpen = false;
				super.idleTime = 0;
				for (int j1 = 0; j1 < 100; j1++)
					chatMessages[j1] = null;

				itemSelected = 0;
				spellSelected = 0;
				loadingStage = 0;
				anInt1062 = 0;
				anInt1278 = (int) (Math.random() * 100D) - 50;
				anInt1131 = (int) (Math.random() * 110D) - 55;
				anInt896 = (int) (Math.random() * 80D) - 40;
				minimapInt2 = (int) (Math.random() * 120D) - 60;
				minimapInt3 = (int) (Math.random() * 30D) - 20;
				minimapInt1 = (int) (Math.random() * 20D) - 10 & 0x7ff;
				anInt1021 = 0;
				anInt985 = -1;
				destX = 0;
				destY = 0;
				playerCount = 0;
				npcCount = 0;
				for (int i2 = 0; i2 < maxPlayers; i2++) {
					playerArray[i2] = null;
					aStreamArray895s[i2] = null;
				}

				for (int k2 = 0; k2 < 16384; k2++)
					npcArray[k2] = null;

				myPlayer = playerArray[myPlayerIndex] = new Player();
				aClass19_1013.removeAll();
				aClass19_1056.removeAll();
				for (int l2 = 0; l2 < 4; l2++) {
					for (int i3 = 0; i3 < 104; i3++) {
						for (int k3 = 0; k3 < 104; k3++)
							groundArray[l2][i3][k3] = null;

					}

				}
				aClass19_1179 = new NodeList();
				fullscreenInterfaceID = -1;
				anInt900 = 0;
				friendsCount = 0;
				dialogID = -1;
				backDialogID = -1;
				openInterfaceID = -1;
				invOverlayInterfaceID = -1;
				anInt1018 = -1;
				aBoolean1149 = false;
				tabID = 3;
				inputDialogState = 0;
				menuOpen = false;
				messagePromptRaised = false;
				aString844 = null;
				anInt1055 = 0;
				anInt1054 = -1;
				aBoolean1047 = true;
				method45();
				welcome();
				for (int j3 = 0; j3 < 5; j3++)
					anIntArray990[j3] = 0;

				for (int l3 = 0; l3 < 5; l3++) {
					atPlayerActions[l3] = null;
					atPlayerArray[l3] = false;
				}

				anInt1175 = 0;
				anInt1134 = 0;
				anInt986 = 0;
				anInt1288 = 0;
				anInt924 = 0;
				anInt1188 = 0;
				anInt1155 = 0;
				anInt1226 = 0;
				resetImageProducers2();
				return;
			}
			if (k == 3) {
				loginMessage1 = "";
				loginMessage2 = "Invalid username or password.";
				return;
			}
			if (k == 4) {
				loginMessage1 = "Your account has been Banned.";
				loginMessage2 = "Goodfight.";
				return;
			}
			if (k == 5) {
				loginMessage1 = "Your account is already logged in.";
				loginMessage2 = "Sucks huh?";
				return;
			}
			if (k == 6) {
				loginMessage1 = "Masterscape has been updated!";
				loginMessage2 = "Please reload this page.";
				return;
			}
			if (k == 7) {
				loginMessage1 = "This world is full.";
				loginMessage2 = "Please use a different world.";
				return;
			}
			if (k == 8) {
				loginMessage1 = "Unable to connect.";
				loginMessage2 = "Login server offline.";
				return;
			}
			if (k == 9) {
				loginMessage1 = "Login limit exceeded.";
				loginMessage2 = "Too many connections from your address.";
				return;
			}
			if (k == 10) {
				loginMessage1 = "Unable to connect.";
				loginMessage2 = "Bad session id.";
				return;
			}
			if (k == 11) {
				loginMessage2 = "Login server rejected session.";
				loginMessage2 = "Please try again.";
				return;
			}
			if (k == 12) {
				loginMessage1 = "You need a members account to login to this world.";
				loginMessage2 = "Please subscribe, or use a different world.";
				return;
			}
			if (k == 13) {
				loginMessage1 = "Could not complete login.";
				loginMessage2 = "Please try using a different world.";
				return;
			}
			if (k == 14) {
				loginMessage1 = "The server is being updated.";
				loginMessage2 = "Please wait 1 minute and try again.";
				return;
			}
			if (k == 15) {
				loggedIn = true;
				stream.currentOffset = 0;
				inStream.currentOffset = 0;
				pktType = -1;
				anInt841 = -1;
				anInt842 = -1;
				anInt843 = -1;
				pktSize = 0;
				anInt1009 = 0;
				anInt1104 = 0;
				menuActionRow = 0;
				menuOpen = false;
				aLong824 = System.currentTimeMillis();
				return;
			}
			if (k == 16) {
				loginMessage1 = "Login attempts exceeded.";
				loginMessage2 = "Please wait 1 minute and try again.";
				return;
			}
			if (k == 17) {
				loginMessage1 = "You are standing in a members-only area.";
				loginMessage2 = "To play on this world move to a free area first";
				return;
			}
			if (k == 20) {
				loginMessage1 = "Invalid loginserver requested";
				loginMessage2 = "Please try using a different world.";
				return;
			}
			if (k == 21) {
				for (int k1 = socketStream.read(); k1 >= 0; k1--) {
					loginMessage1 = "You have only just left another world";
					loginMessage2 = "Your profile will be transferred in: "
							+ k1 + " seconds";
					drawLoginScreen(true);
					try {
						Thread.sleep(1000L);
					} catch (Exception _ex) {
					}
				}

				login(s, s1, flag);
				return;
			}
			if (k == 22) {
				loginMessage1 = "Your computer has been MAC banned from";
				loginMessage2 = "Masterscape. Please appeal on forums!";
				return;
			}
			if (k == -1) {
				if (i1 == 0) {
					if (loginFailures < 2) {
						try {
							Thread.sleep(2000L);
						} catch (Exception _ex) {
						}
						loginFailures++;
						login(s, s1, flag);
						return;
					} else {
						loginMessage1 = "You must download The latest";
						loginMessage2 = "client at masterscape.info";
						return;
					}
				} else {
					loginMessage1 = "No response from server";
					loginMessage2 = "Please try using a different world.";
					return;
				}
			} else {
				System.out.println("response:" + k);
				loginMessage1 = "Unexpected server response";
				loginMessage2 = "Please try using a different world.";
				return;
			}
		} catch (IOException _ex) {
			loginMessage1 = "";
		}
		loginMessage2 = "Error connecting to server.";
	}

	private boolean doWalkTo(int i, int j, int k, int i1, int j1, int k1,
			int l1, int i2, int j2, boolean flag, int k2) {
		byte byte0 = 104;
		byte byte1 = 104;
		for (int l2 = 0; l2 < byte0; l2++) {
			for (int i3 = 0; i3 < byte1; i3++) {
				anIntArrayArray901[l2][i3] = 0;
				anIntArrayArray825[l2][i3] = 0x5f5e0ff;
			}
		}
		int j3 = j2;
		int k3 = j1;
		anIntArrayArray901[j2][j1] = 99;
		anIntArrayArray825[j2][j1] = 0;
		int l3 = 0;
		int i4 = 0;
		bigX[l3] = j2;
		bigY[l3++] = j1;
		boolean flag1 = false;
		int j4 = bigX.length;
		int ai[][] = aClass11Array1230[plane].anIntArrayArray294;
		while (i4 != l3) {
			j3 = bigX[i4];
			k3 = bigY[i4];
			i4 = (i4 + 1) % j4;
			if (j3 == k2 && k3 == i2) {
				flag1 = true;
				break;
			}
			if (i1 != 0) {
				if ((i1 < 5 || i1 == 10)
						&& aClass11Array1230[plane].method219(k2, j3, k3, j,
								i1 - 1, i2)) {
					flag1 = true;
					break;
				}
				if (i1 < 10
						&& aClass11Array1230[plane].method220(k2, i2, k3,
								i1 - 1, j, j3)) {
					flag1 = true;
					break;
				}
			}
			if (k1 != 0
					&& k != 0
					&& aClass11Array1230[plane].method221(i2, k2, j3, k, l1,
							k1, k3)) {
				flag1 = true;
				break;
			}
			int l4 = anIntArrayArray825[j3][k3] + 1;
			if (j3 > 0 && anIntArrayArray901[j3 - 1][k3] == 0
					&& (ai[j3 - 1][k3] & 0x1280108) == 0) {
				bigX[l3] = j3 - 1;
				bigY[l3] = k3;
				l3 = (l3 + 1) % j4;
				anIntArrayArray901[j3 - 1][k3] = 2;
				anIntArrayArray825[j3 - 1][k3] = l4;
			}
			if (j3 < byte0 - 1 && anIntArrayArray901[j3 + 1][k3] == 0
					&& (ai[j3 + 1][k3] & 0x1280180) == 0) {
				bigX[l3] = j3 + 1;
				bigY[l3] = k3;
				l3 = (l3 + 1) % j4;
				anIntArrayArray901[j3 + 1][k3] = 8;
				anIntArrayArray825[j3 + 1][k3] = l4;
			}
			if (k3 > 0 && anIntArrayArray901[j3][k3 - 1] == 0
					&& (ai[j3][k3 - 1] & 0x1280102) == 0) {
				bigX[l3] = j3;
				bigY[l3] = k3 - 1;
				l3 = (l3 + 1) % j4;
				anIntArrayArray901[j3][k3 - 1] = 1;
				anIntArrayArray825[j3][k3 - 1] = l4;
			}
			if (k3 < byte1 - 1 && anIntArrayArray901[j3][k3 + 1] == 0
					&& (ai[j3][k3 + 1] & 0x1280120) == 0) {
				bigX[l3] = j3;
				bigY[l3] = k3 + 1;
				l3 = (l3 + 1) % j4;
				anIntArrayArray901[j3][k3 + 1] = 4;
				anIntArrayArray825[j3][k3 + 1] = l4;
			}
			if (j3 > 0 && k3 > 0 && anIntArrayArray901[j3 - 1][k3 - 1] == 0
					&& (ai[j3 - 1][k3 - 1] & 0x128010e) == 0
					&& (ai[j3 - 1][k3] & 0x1280108) == 0
					&& (ai[j3][k3 - 1] & 0x1280102) == 0) {
				bigX[l3] = j3 - 1;
				bigY[l3] = k3 - 1;
				l3 = (l3 + 1) % j4;
				anIntArrayArray901[j3 - 1][k3 - 1] = 3;
				anIntArrayArray825[j3 - 1][k3 - 1] = l4;
			}
			if (j3 < byte0 - 1 && k3 > 0
					&& anIntArrayArray901[j3 + 1][k3 - 1] == 0
					&& (ai[j3 + 1][k3 - 1] & 0x1280183) == 0
					&& (ai[j3 + 1][k3] & 0x1280180) == 0
					&& (ai[j3][k3 - 1] & 0x1280102) == 0) {
				bigX[l3] = j3 + 1;
				bigY[l3] = k3 - 1;
				l3 = (l3 + 1) % j4;
				anIntArrayArray901[j3 + 1][k3 - 1] = 9;
				anIntArrayArray825[j3 + 1][k3 - 1] = l4;
			}
			if (j3 > 0 && k3 < byte1 - 1
					&& anIntArrayArray901[j3 - 1][k3 + 1] == 0
					&& (ai[j3 - 1][k3 + 1] & 0x1280138) == 0
					&& (ai[j3 - 1][k3] & 0x1280108) == 0
					&& (ai[j3][k3 + 1] & 0x1280120) == 0) {
				bigX[l3] = j3 - 1;
				bigY[l3] = k3 + 1;
				l3 = (l3 + 1) % j4;
				anIntArrayArray901[j3 - 1][k3 + 1] = 6;
				anIntArrayArray825[j3 - 1][k3 + 1] = l4;
			}
			if (j3 < byte0 - 1 && k3 < byte1 - 1
					&& anIntArrayArray901[j3 + 1][k3 + 1] == 0
					&& (ai[j3 + 1][k3 + 1] & 0x12801e0) == 0
					&& (ai[j3 + 1][k3] & 0x1280180) == 0
					&& (ai[j3][k3 + 1] & 0x1280120) == 0) {
				bigX[l3] = j3 + 1;
				bigY[l3] = k3 + 1;
				l3 = (l3 + 1) % j4;
				anIntArrayArray901[j3 + 1][k3 + 1] = 12;
				anIntArrayArray825[j3 + 1][k3 + 1] = l4;
			}
		}
		anInt1264 = 0;
		if (!flag1) {
			if (flag) {
				int i5 = 100;
				for (int k5 = 1; k5 < 2; k5++) {
					for (int i6 = k2 - k5; i6 <= k2 + k5; i6++) {
						for (int l6 = i2 - k5; l6 <= i2 + k5; l6++)
							if (i6 >= 0 && l6 >= 0 && i6 < 104 && l6 < 104
									&& anIntArrayArray825[i6][l6] < i5) {
								i5 = anIntArrayArray825[i6][l6];
								j3 = i6;
								k3 = l6;
								anInt1264 = 1;
								flag1 = true;
							}

					}

					if (flag1)
						break;
				}

			}
			if (!flag1)
				return false;
		}
		i4 = 0;
		bigX[i4] = j3;
		bigY[i4++] = k3;
		int l5;
		for (int j5 = l5 = anIntArrayArray901[j3][k3]; j3 != j2 || k3 != j1; j5 = anIntArrayArray901[j3][k3]) {
			if (j5 != l5) {
				l5 = j5;
				bigX[i4] = j3;
				bigY[i4++] = k3;
			}
			if ((j5 & 2) != 0)
				j3++;
			else if ((j5 & 8) != 0)
				j3--;
			if ((j5 & 1) != 0)
				k3++;
			else if ((j5 & 4) != 0)
				k3--;
		}
		// if(cancelWalk) { return i4 > 0; }

		if (i4 > 0) {
			int k4 = i4;
			if (k4 > 25)
				k4 = 25;
			i4--;
			int k6 = bigX[i4];
			int i7 = bigY[i4];
			anInt1288 += k4;
			if (anInt1288 >= 92) {
				stream.createFrame(36);
				stream.writeDWord(0);
				anInt1288 = 0;
			}
			if (i == 0) {
				stream.createFrame(164);
				stream.writeWordBigEndian(k4 + k4 + 3);
			}
			if (i == 1) {
				stream.createFrame(248);
				stream.writeWordBigEndian(k4 + k4 + 3 + 14);
			}
			if (i == 2) {
				stream.createFrame(98);
				stream.writeWordBigEndian(k4 + k4 + 3);
			}
			stream.method433(k6 + baseX);
			destX = bigX[0];
			destY = bigY[0];
			for (int j7 = 1; j7 < k4; j7++) {
				i4--;
				stream.writeWordBigEndian(bigX[i4] - k6);
				stream.writeWordBigEndian(bigY[i4] - i7);
			}

			stream.method431(i7 + baseY);
			stream.method424(super.keyArray[5] != 1 ? 0 : 1);
			return true;
		}
		return i != 1;
	}

	private void method86(Stream stream) {
		for (int j = 0; j < anInt893; j++) {
			int k = anIntArray894[j];
			NPC npc = npcArray[k];
			int l = stream.readUnsignedByte();
			if ((l & 0x10) != 0) {
				int i1 = stream.method434();
				if (i1 == 65535)
					i1 = -1;
				int i2 = stream.readUnsignedByte();
				if (i1 == npc.anim && i1 != -1) {
					int l2 = Animation.anims[i1].anInt365;
					if (l2 == 1) {
						npc.anInt1527 = 0;
						npc.anInt1528 = 0;
						npc.anInt1529 = i2;
						npc.anInt1530 = 0;
					}
					if (l2 == 2)
						npc.anInt1530 = 0;
				} else if (i1 == -1
						|| npc.anim == -1
						|| Animation.anims[i1].anInt359 >= Animation.anims[npc.anim].anInt359) {
					npc.anim = i1;
					npc.anInt1527 = 0;
					npc.anInt1528 = 0;
					npc.anInt1529 = i2;
					npc.anInt1530 = 0;
					npc.anInt1542 = npc.smallXYIndex;
				}
			}
			if ((l & 8) != 0) {
				int j1 = stream.method426();
				int j2 = stream.method427();
				int type1 = stream.readUnsignedByte();
				npc.updateHitData(j2, j1, type1, loopCycle);
				npc.loopCycleStatus = loopCycle + 300;
				npc.currentHealth = stream.method426();
				npc.maxHealth = stream.readUnsignedByte();
			}
			if ((l & 0x80) != 0) {
				npc.anInt1520 = stream.readUnsignedWord();
				int k1 = stream.readDWord();
				npc.anInt1524 = k1 >> 16;
				npc.anInt1523 = loopCycle + (k1 & 0xffff);
				npc.anInt1521 = 0;
				npc.anInt1522 = 0;
				if (npc.anInt1523 > loopCycle)
					npc.anInt1521 = -1;
				if (npc.anInt1520 == 65535)
					npc.anInt1520 = -1;
			}
			if ((l & 0x20) != 0) {
				npc.interactingEntity = stream.readUnsignedWord();
				if (npc.interactingEntity == 65535)
					npc.interactingEntity = -1;
			}
			if ((l & 1) != 0) {
				npc.textSpoken = stream.readString();
				npc.textCycle = 100;
				// entityMessage(npc);

			}
			if ((l & 0x40) != 0) {
				int l1 = stream.method427();
				int k2 = stream.method428();
				int type2 = stream.readUnsignedByte();
				npc.updateHitData(k2, l1, type2, loopCycle);
				npc.loopCycleStatus = loopCycle + 300;
				npc.currentHealth = stream.method428();
				npc.maxHealth = stream.method427();
			}
			if ((l & 2) != 0) {
				npc.desc = EntityDef.forID(stream.method436());
				npc.anInt1540 = npc.desc.aByte68;
				npc.anInt1504 = npc.desc.anInt79;
				npc.anInt1554 = npc.desc.walkAnim;
				npc.anInt1555 = npc.desc.anInt58;
				npc.anInt1556 = npc.desc.anInt83;
				npc.anInt1557 = npc.desc.anInt55;
				npc.anInt1511 = npc.desc.standAnim;
			}
			if ((l & 4) != 0) {
				npc.anInt1538 = stream.method434();
				npc.anInt1539 = stream.method434();
			}
		}
	}

	private void buildAtNPCMenu(EntityDef entityDef, int i, int j, int k) {
		if (menuActionRow >= 400)
			return;
		if (entityDef.childrenIDs != null)
			entityDef = entityDef.method161();
		if (entityDef == null)
			return;
		if (!entityDef.aBoolean84)
			return;
		String s = entityDef.name;
		if (entityDef.combatLevel != 0)
			s = s
					+ combatDiffColor(myPlayer.combatLevel,
							entityDef.combatLevel) + " (level-"
					+ entityDef.combatLevel + ")";
		if (itemSelected == 1) {
			menuActionName[menuActionRow] = "Use " + selectedItemName
					+ " with @yel@" + s;
			menuActionID[menuActionRow] = 582;
			menuActionCmd1[menuActionRow] = i;
			menuActionCmd2[menuActionRow] = k;
			menuActionCmd3[menuActionRow] = j;
			menuActionRow++;
			return;
		}
		if (spellSelected == 1) {
			if ((spellUsableOn & 2) == 2) {
				menuActionName[menuActionRow] = spellTooltip + " @yel@" + s;
				menuActionID[menuActionRow] = 413;
				menuActionCmd1[menuActionRow] = i;
				menuActionCmd2[menuActionRow] = k;
				menuActionCmd3[menuActionRow] = j;
				menuActionRow++;
			}
		} else {
			if (entityDef.actions != null) {
				for (int l = 4; l >= 0; l--)
					if (entityDef.actions[l] != null
							&& !entityDef.actions[l].equalsIgnoreCase("attack")) {
						menuActionName[menuActionRow] = entityDef.actions[l]
								+ " @yel@" + s;
						if (l == 0)
							menuActionID[menuActionRow] = 20;
						if (l == 1)
							menuActionID[menuActionRow] = 412;
						if (l == 2)
							menuActionID[menuActionRow] = 225;
						if (l == 3)
							menuActionID[menuActionRow] = 965;
						if (l == 4)
							menuActionID[menuActionRow] = 478;
						menuActionCmd1[menuActionRow] = i;
						menuActionCmd2[menuActionRow] = k;
						menuActionCmd3[menuActionRow] = j;
						menuActionRow++;
					}

			}
			if (entityDef.actions != null) {
				for (int i1 = 4; i1 >= 0; i1--)
					if (entityDef.actions[i1] != null
							&& entityDef.actions[i1].equalsIgnoreCase("attack")) {
						char c = '\0';
						if (entityDef.combatLevel > myPlayer.combatLevel)
							c = '\u07D0';
						menuActionName[menuActionRow] = entityDef.actions[i1]
								+ " @yel@" + s;
						if (i1 == 0)
							menuActionID[menuActionRow] = 20 + c;
						if (i1 == 1)
							menuActionID[menuActionRow] = 412 + c;
						if (i1 == 2)
							menuActionID[menuActionRow] = 225 + c;
						if (i1 == 3)
							menuActionID[menuActionRow] = 965 + c;
						if (i1 == 4)
							menuActionID[menuActionRow] = 478 + c;
						menuActionCmd1[menuActionRow] = i;
						menuActionCmd2[menuActionRow] = k;
						menuActionCmd3[menuActionRow] = j;
						menuActionRow++;
					}

			}
			if (idToggle == true) {
				menuActionName[menuActionRow] = "Examine @yel@" + s
						+ " @gre@(@whi@" + entityDef.type + "@gre@)";
			} else {
				menuActionName[menuActionRow] = "Examine @yel@" + s;
			}
			menuActionID[menuActionRow] = 1025;
			menuActionCmd1[menuActionRow] = i;
			menuActionCmd2[menuActionRow] = k;
			menuActionCmd3[menuActionRow] = j;
			menuActionRow++;
		}
	}

	private void buildAtPlayerMenu(int i, int j, Player player, int k) {
		if (player == myPlayer)
			return;
		if (menuActionRow >= 400)
			return;
		String s;

		if (player.skill == 0)
			s = player.name
					+ combatDiffColor(myPlayer.combatLevel, player.combatLevel)
					+ " (level-" + player.combatLevel + ")";
		else
			s = "@or2@" + playerTitle(player.skill) + "@whi@ " + player.name
					+ combatDiffColor(myPlayer.combatLevel, player.combatLevel)
					+ " (level-" + player.combatLevel + ")";
		if (itemSelected == 1) {
			menuActionName[menuActionRow] = "Use " + selectedItemName
					+ " -> @whi@" + s;
			menuActionID[menuActionRow] = 491;
			menuActionCmd1[menuActionRow] = j;
			menuActionCmd2[menuActionRow] = i;
			menuActionCmd3[menuActionRow] = k;
			menuActionRow++;
		} else if (spellSelected == 1) {
			if ((spellUsableOn & 8) == 8) {
				menuActionName[menuActionRow] = spellTooltip + " @whi@" + s;
				menuActionID[menuActionRow] = 365;
				menuActionCmd1[menuActionRow] = j;
				menuActionCmd2[menuActionRow] = i;
				menuActionCmd3[menuActionRow] = k;
				menuActionRow++;
			}
		} else {
			for (int l = 4; l >= 0; l--)
				if (atPlayerActions[l] != null) {
					menuActionName[menuActionRow] = atPlayerActions[l]
							+ " @whi@" + s;
					char c = '\0';
					if (atPlayerActions[l].equalsIgnoreCase("attack")) {
						if (player.combatLevel > myPlayer.combatLevel)
							c = '\u07D0';
						if (myPlayer.team != 0 && player.team != 0)
							if (myPlayer.team == player.team)
								c = '\u07D0';
							else
								c = '\0';
					} else if (atPlayerArray[l])
						c = '\u07D0';
					if (l == 0)
						menuActionID[menuActionRow] = 561 + c;
					if (l == 1)
						menuActionID[menuActionRow] = 779 + c;
					if (l == 2)
						menuActionID[menuActionRow] = 27 + c;
					if (l == 3)
						menuActionID[menuActionRow] = 577 + c;
					if (l == 4)
						menuActionID[menuActionRow] = 729 + c;
					menuActionCmd1[menuActionRow] = j;
					menuActionCmd2[menuActionRow] = i;
					menuActionCmd3[menuActionRow] = k;
					menuActionRow++;
				}

		}
		for (int i1 = 0; i1 < menuActionRow; i1++)
			if (menuActionID[i1] == 516) {
				menuActionName[i1] = "Walk here @whi@" + s;
				return;
			}

	}

	private void method89(Class30_Sub1 class30_sub1) {
		int i = 0;
		int j = -1;
		int k = 0;
		int l = 0;
		if (class30_sub1.anInt1296 == 0)
			i = worldController.method300(class30_sub1.anInt1295,
					class30_sub1.anInt1297, class30_sub1.anInt1298);
		if (class30_sub1.anInt1296 == 1)
			i = worldController.method301(class30_sub1.anInt1295,
					class30_sub1.anInt1297, class30_sub1.anInt1298);
		if (class30_sub1.anInt1296 == 2)
			i = worldController.method302(class30_sub1.anInt1295,
					class30_sub1.anInt1297, class30_sub1.anInt1298);
		if (class30_sub1.anInt1296 == 3)
			i = worldController.method303(class30_sub1.anInt1295,
					class30_sub1.anInt1297, class30_sub1.anInt1298);
		if (i != 0) {
			int i1 = worldController.method304(class30_sub1.anInt1295,
					class30_sub1.anInt1297, class30_sub1.anInt1298, i);
			j = i >> 14 & 0x7fff;
			k = i1 & 0x1f;
			l = i1 >> 6;
		}
		class30_sub1.anInt1299 = j;
		class30_sub1.anInt1301 = k;
		class30_sub1.anInt1300 = l;
	}

	private void method90() {
		for (int i = 0; i < anInt1062; i++)
			if (anIntArray1250[i] <= 0) {
				boolean flag1 = false;
				if (!flag1 || anIntArray1250[i] == -5) {
					anInt1062--;
					for (int j = i; j < anInt1062; j++) {
						anIntArray1207[j] = anIntArray1207[j + 1];
						anIntArray1241[j] = anIntArray1241[j + 1];
						anIntArray1250[j] = anIntArray1250[j + 1];
					}

					i--;
				} else {
					anIntArray1250[i] = -5;
				}
			} else {
				anIntArray1250[i]--;
			}

	}

	/*
	 * public static void compress(int ID) { try { String inF = "C:/DSPK/gzip/"+
	 * ID +".dat"; String outF = "C:/DSPK/gzip/"+ ID; File inF2 = new File(inF);
	 * File outF2 = new File(outF); System.out.println("GZipping: " + inF2 +
	 * " file"); FileOutputStream FOS = new FileOutputStream(outF2 + ".gz");
	 * GZIPOutputStream GZOS = new GZIPOutputStream(FOS); FileInputStream FIN =
	 * new FileInputStream(inF2); BufferedInputStream IN = new
	 * BufferedInputStream(FIN); byte[] buffer = new byte[1024]; int i; while
	 * ((i = IN.read(buffer)) >= 0) { GZOS.write(buffer, 0, i); }
	 * System.out.println("File has been GZipped succesfully"); IN.close();
	 * GZOS.close(); } catch(IOException e) { System.out.println("Error: " + e);
	 * } compress(ID + 1); } void main() { compress(29); }
	 */

	void startUp() {
		// main();
		// models();
		drawLoadingText(20, "Starting up");
		// new CacheDownloader(this).downloadCache();
		// setNewMaps();
		if (signlink.sunjava)
			super.minDelay = 5;
		getDocumentBaseHost();
		if (signlink.cache_dat != null) {
			for (int i = 0; i < 5; i++)
				decompressors[i] = new Decompressor(signlink.cache_dat,
						signlink.cache_idx[i], i + 1);
		}
		try {
			titleStreamLoader = streamLoaderForName(1, "title screen", "title",
					expectedCRCs[1], 25);
			smallText = new RSFont(false, "p11_full", titleStreamLoader);
			aTextDrawingArea_1271 = new RSFont(false, "p12_full",
					titleStreamLoader);
			chatTextDrawingArea = new RSFont(false, "b12_full",
					titleStreamLoader);
			RSFont aTextDrawingArea_1273 = new RSFont(true, "q8_full",
					titleStreamLoader);

			newSmallFont = new TextDrawingArea(false, "p11_full",
					titleStreamLoader);
			newRegularFont = new TextDrawingArea(false, "p12_full",
					titleStreamLoader);
			newBoldFont = new TextDrawingArea(false, "b12_full",
					titleStreamLoader);
			newFancyFont = new TextDrawingArea(true, "q8_full",
					titleStreamLoader);
			// UserInterface.fonts = newFonts;
			newSmallFont.unpackChatImages(chatImages);
			newRegularFont.unpackChatImages(chatImages);
			newBoldFont.unpackChatImages(chatImages);
			newFancyFont.unpackChatImages(chatImages);

			drawLogo();
			loadTitleScreen();
			NamedArchive archive = streamLoaderForName(2, "config", "config",
					expectedCRCs[2], 30);
			NamedArchive streamLoader_1 = streamLoaderForName(3, "interface",
					"interface", expectedCRCs[3], 35);
			NamedArchive mediaArchive = streamLoaderForName(4, "2d graphics",
					"media", expectedCRCs[4], 40);
			NamedArchive streamLoader_3 = streamLoaderForName(6, "textures",
					"textures", expectedCRCs[6], 45);
			NamedArchive streamLoader_4 = streamLoaderForName(7, "chat system",
					"wordenc", expectedCRCs[7], 50);
			streamLoaderForName(8, "sound effects", "sounds", expectedCRCs[8],
					55);
			byteGroundArray = new byte[4][104][104];
			intGroundArray = new int[4][105][105];
			worldController = new WorldController(intGroundArray);
			for (int j = 0; j < 4; j++)
				aClass11Array1230[j] = new Class11();
			aSprite_1263 = new Sprite(512, 512);
			NamedArchive streamLoader_6 = streamLoaderForName(5, "update list",
					"versionlist", expectedCRCs[5], 60);
			drawLoadingText(60, "Unpacking Media");
			onDemandFetcher = new OnDemandFetcher();
			onDemandFetcher.start(streamLoader_6, this);
			Class36.method528(onDemandFetcher.getAnimCount());
			Model.method459(onDemandFetcher.getModelCount(), onDemandFetcher);
			drawLoadingText(70, "Loading Models..");
			drawLoadingText(80, "Unpacking Models..");
			preloadModels();
			// repackCacheIndex(1);
			// repackCacheIndex(2);
			// repackCacheIndex(4);
			/* Custom sprite unpacking */
			loadExtraSprites();
			loadingPleaseWait = new Sprite("loadingPleaseWait");
			reestablish = new Sprite("reestablish");
			hitMarks[20] = new Sprite("hitMark");
			hitMarks[21] = new Sprite("hitMark2");
			hitMarks[22] = new Sprite("hitMark3");
			hitMarks[23] = new Sprite("hitMark4");

			/* Staff tab */
			StaffToggle = new Sprite("stafftab/SPRITE 0");
			StaffType = new Sprite("stafftab/SPRITE 1");
			StaffSelectBg = new Sprite("stafftab/SPRITE 2");
			StaffSelect = new Sprite("stafftab/SPRITE 3");
			StaffSelectH = new Sprite("stafftab/SPRITE 4");
			StaffSelected = new Sprite("stafftab/SPRITE 5");
			StaffSend = new Sprite("stafftab/SPRITE 6");
			StaffError = new Sprite("stafftab/SPRITE 7");

			compass = new Sprite(mediaArchive, "compass", 0);
			new Sprite("maparea");
			multiOverlay = new Sprite(mediaArchive, "overlay_multiway", 0);
			HPBarFull = new Sprite(sign.signlink.findcachedir()
					+ "Sprites/Player/HP 0.PNG", 1);
			HPBarEmpty = new Sprite(sign.signlink.findcachedir()
					+ "Sprites/Player/HP 1.PNG", 1);
			/**/

			mapBack = new Background(mediaArchive, "mapback", 0);
			for (int i = 0; i <= 3; i++) {
				combatIcons[i] = new Sprite("Player/combatIcon " + i + "");
			}

			for (int c1 = 0; c1 <= 3; c1++)
				chatButtons[c1] = new Sprite(mediaArchive, "chatbuttons", c1);

			for (int j3 = 0; j3 <= 13; j3++)
				sideIcons[j3] = new Sprite(mediaArchive, "sideicons", j3);

			for (int j3 = 0; j3 <= 13; j3++)
				sIcons483[j3] = new Sprite("Gameframe/SIcons/483/" + j3 + "");

			for (int j3 = 0; j3 <= 12; j3++)
				sIcons459[j3] = new Sprite("Gameframe/SIcons/459/SIDEICONS "
						+ j3 + "");

			for (int nSI = 0; nSI <= 15; nSI++)
				newSideIcons[nSI] = new Sprite("Gameframe/SIcons/562/icon "
						+ nSI);

			tabHover = new Sprite("Gameframe/SIcons/562/tabhover");
			tabClicked = new Sprite("Gameframe/SIcons/562/tabclicked1");

			shopOverviewBackground = new Sprite("SHOP");
			welcomeBackground = new Sprite("Welcome");
			welcomePlay = new Sprite("Play");

			for (int i = 0; i <= 3; i++) {
				combatIcons[i] = new Sprite("Player/combatIcon " + i + "");
			}

			for (int r1 = 0; r1 < 15; r1++)
				redStones[r1] = new Sprite("redstones " + r1);
			mapEdge = new Sprite(mediaArchive, "mapedge", 0);
			mapEdge.method345();
			try {
				for (int k3 = 0; k3 < 100; k3++)
					mapScenes[k3] = new Background(mediaArchive, "mapscene", k3);
			} catch (Exception _ex) {
			}
			try {
				for (int l3 = 0; l3 < 100; l3++)
					mapFunctions[l3] = new Sprite(mediaArchive, "mapfunction",
							l3);
			} catch (Exception _ex) {
			}
			try {
				for (int i4 = 0; i4 < 20; i4++)
					hitMarks[i4] = new Sprite(mediaArchive, "hitmarks", i4);
			} catch (Exception _ex) {
			}
			try {
				for (int h1 = 0; h1 < 6; h1++)
					headIconsHint[h1] = new Sprite(mediaArchive,
							"headicons_hint", h1);
			} catch (Exception _ex) {
			}
			try {
				for (int j4 = 0; j4 < 8; j4++)
					headIcons[j4] = new Sprite(mediaArchive,
							"headicons_prayer", j4);
				for (int idx = 0; idx < 18; idx++)
					headIcons[idx] = new Sprite("Player/Prayer/Prayer " + idx);
				for (int j45 = 0; j45 < 3; j45++)
					skullIcons[j45] = new Sprite(mediaArchive, "headicons_pk",
							j45);
			} catch (Exception _ex) {
			}
			mapFlag = new Sprite(mediaArchive, "mapmarker", 0);
			mapMarker = new Sprite(mediaArchive, "mapmarker", 1);
			for (int k4 = 0; k4 < 8; k4++)
				crosses[k4] = new Sprite(mediaArchive, "cross", k4);

			mapDotItem = new Sprite(mediaArchive, "mapdots", 0);
			mapDotNPC = new Sprite(mediaArchive, "mapdots", 1);
			mapDotPlayer = new Sprite(mediaArchive, "mapdots", 2);
			mapDotFriend = new Sprite(mediaArchive, "mapdots", 3);
			mapDotTeam = new Sprite(mediaArchive, "mapdots", 4);
			mapDotClan = new Sprite(mediaArchive, "mapdots", 5);

			scrollBar1 = new Sprite(mediaArchive, "scrollbar", 0);
			scrollBar2 = new Sprite(mediaArchive, "scrollbar", 1);
			alertBack = new Sprite("alertback");
			alertBorder = new Sprite("alertborder");
			alertBorderH = new Sprite("alertborderh");
			scrollBar3 = new Sprite("Gameframe/SCROLLBAR 0");
			scrollBar4 = new Sprite("Gameframe/SCROLLBAR 1");

			Sprite sprite = new Sprite(mediaArchive, "screenframe", 0);
			leftFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
					getGameComponent());
			sprite.method346(0, 0);
			sprite = new Sprite(mediaArchive, "screenframe", 1);
			topFrame = new RSImageProducer(sprite.myWidth, sprite.myHeight,
					getGameComponent());
			sprite.method346(0, 0);
			sprite = new Sprite(mediaArchive, "screenframe", 2);
			new RSImageProducer(sprite.myWidth, sprite.myHeight,
					getGameComponent());
			sprite.method346(0, 0);
			sprite = new Sprite(mediaArchive, "mapedge", 0);
			new RSImageProducer(sprite.myWidth, sprite.myHeight,
					getGameComponent());
			sprite.method346(0, 0);

			int i5 = (int) (Math.random() * 21D) - 10;
			int j5 = (int) (Math.random() * 21D) - 10;
			int k5 = (int) (Math.random() * 21D) - 10;
			int l5 = (int) (Math.random() * 41D) - 20;
			for (int i6 = 0; i6 < 100; i6++) {
				if (mapFunctions[i6] != null)
					mapFunctions[i6].method344(i5 + l5, j5 + l5, k5 + l5);
				if (mapScenes[i6] != null)
					mapScenes[i6].method360(i5 + l5, j5 + l5, k5 + l5);
			}
			drawLoadingText(83, "Unpacking textures");
			Texture.method368(streamLoader_3);
			Texture.method372(0.80000000000000004D);
			Texture.method367();
			drawLoadingText(86, "Unpacking config");
			try {
				ObjectDef.unpackConfig(archive);
				Flo.unpackConfig(archive);
				OverLayFlo317.load();
				Animation.unpackConfig(archive);
				SpotAnim.unpackConfig(archive);
				ItemDef.unpackConfig(archive);
				EntityDef.unpackConfig(archive);
				IdentityKit.unpackConfig(archive);
				Varp.unpackConfig(archive);
				VarBit.unpackConfig(archive);
				ItemDef.isMembers = isMembers;
			} catch (Exception e) {
				e.printStackTrace();
			}
			drawLoadingText(95, "Unpacking interfaces");
			RSFont aclass30_sub2_sub1_sub4s[] = { smallText,
					aTextDrawingArea_1271, chatTextDrawingArea,
					aTextDrawingArea_1273 };
			RSInterface.fonts = aclass30_sub2_sub1_sub4s;
			RSInterface.unpack(streamLoader_1, aclass30_sub2_sub1_sub4s,
					mediaArchive);
			drawLoadingText(100, "Preparing game engine");
			for (int j6 = 0; j6 < 33; j6++) {
				int k6 = 999;
				int i7 = 0;
				for (int k7 = 0; k7 < 34; k7++) {
					if (mapBack.aByteArray1450[k7 + j6 * mapBack.anInt1452] == 0) {
						if (k6 == 999)
							k6 = k7;
						continue;
					}
					if (k6 == 999)
						continue;
					i7 = k7;
					break;
				}

				anIntArray968[j6] = k6;
				anIntArray1057[j6] = i7 - k6;
			}
			for (int l6 = 1; l6 < 153; l6++) {
				int j7 = 999;
				int l7 = 0;
				for (int j8 = 24; j8 < 177; j8++) {
					if (mapBack.aByteArray1450[j8 + l6 * mapBack.anInt1452] == 0
							&& (j8 > 34 || l6 > 34)) {
						if (j7 == 999) {
							j7 = j8;
						}
						continue;
					}
					if (j7 == 999) {
						continue;
					}
					l7 = j8;
					break;
				}

				anIntArray1052[l6 - 1] = j7 - 24;
				anIntArray1229[l6 - 1] = l7 - j7;
			}
			Texture.method365(765, 503);
			fullScreenTextureArray = Texture.anIntArray1472;
			Texture.method365(516, 165);// 519
			anIntArray1180 = Texture.anIntArray1472;
			Texture.method365(250, 335);
			anIntArray1181 = Texture.anIntArray1472;
			Texture.method365(512, 334);// 512 334
			anIntArray1182 = Texture.anIntArray1472;

			int ai[] = new int[9];
			for (int i8 = 0; i8 < 9; i8++) {
				int k8 = 128 + i8 * 32 + 15;
				int l8 = 600 + k8 * 3;
				int i9 = Texture.anIntArray1470[k8];
				ai[i8] = l8 * i9 >> 16;
			}

			WorldController.method310(500, 800, 512, 334, ai);

			Censor.loadConfig(streamLoader_4);
			mouseDetection = new MouseDetection(this);
			startRunnable(mouseDetection, 10);
			Animable_Sub5.clientInstance = this;
			ObjectDef.clientInstance = this;
			EntityDef.clientInstance = this;
			return;
		} catch (Exception exception) {
			exception.printStackTrace();
			signlink.reporterror("loaderror " + aString1049 + " " + anInt1079);
		}
		loadingError = true;
	}

	private void method91(Stream stream, int i) {
		while (stream.bitPosition + 10 < i * 8) {
			int j = stream.readBits(11);
			if (j == 2047)
				break;
			if (playerArray[j] == null) {
				playerArray[j] = new Player();
				if (aStreamArray895s[j] != null)
					playerArray[j].updatePlayer(aStreamArray895s[j]);
			}
			playerIndices[playerCount++] = j;
			Player player = playerArray[j];
			player.anInt1537 = loopCycle;
			int k = stream.readBits(1);
			if (k == 1)
				anIntArray894[anInt893++] = j;
			int l = stream.readBits(1);
			int i1 = stream.readBits(5);
			if (i1 > 15)
				i1 -= 32;
			int j1 = stream.readBits(5);
			if (j1 > 15)
				j1 -= 32;
			player.setPos(myPlayer.smallX[0] + j1, myPlayer.smallY[0] + i1,
					l == 1);
		}
		stream.finishBitAccess();
	}

	private void processMainScreenClick() {
		if (anInt1021 != 0)
			return;
		if (super.clickMode3 == 1) {
			if (is480 == true || is508 == true || is525 == true
					|| is562 == true) {
				int i = super.saveClickX - 25 - 530;//
				int j = super.saveClickY - 8;
				if (i >= 0 && j >= 0 && i < 146 && j < 151) {
					i -= 73;
					j -= 75;
					int k = minimapInt1 + minimapInt2 & 0x7ff;
					int i1 = Texture.anIntArray1470[k];
					int j1 = Texture.anIntArray1471[k];
					i1 = i1 * (minimapInt3 + 256) >> 8;
					j1 = j1 * (minimapInt3 + 256) >> 8;
					int k1 = j * i1 + i * j1 >> 11;
					int l1 = j * j1 - i * i1 >> 11;
					int i2 = myPlayer.x + k1 >> 7;
					int j2 = myPlayer.y - l1 >> 7;
					boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0,
							0, j2, myPlayer.smallX[0], true, i2);
					if (flag1) {
						stream.writeWordBigEndian(i);
						stream.writeWordBigEndian(j);
						stream.writeWord(minimapInt1);
						stream.writeWordBigEndian(57);
						stream.writeWordBigEndian(minimapInt2);
						stream.writeWordBigEndian(minimapInt3);
						stream.writeWordBigEndian(89);
						stream.writeWord(myPlayer.x);
						stream.writeWord(myPlayer.y);
						stream.writeWordBigEndian(anInt1264);
						stream.writeWordBigEndian(63);
					}
				}
			} else {
				int i = super.saveClickX - 25 - 545;// 545
				int j = super.saveClickY - 5 - 4;
				if (i >= 0 && j >= 0 && i < 146 && j < 151) {
					i -= 73;
					j -= 75;
					int k = minimapInt1 + minimapInt2 & 0x7ff;
					int i1 = Texture.anIntArray1470[k];
					int j1 = Texture.anIntArray1471[k];
					i1 = i1 * (minimapInt3 + 256) >> 8;
					j1 = j1 * (minimapInt3 + 256) >> 8;
					int k1 = j * i1 + i * j1 >> 11;
					int l1 = j * j1 - i * i1 >> 11;
					int i2 = myPlayer.x + k1 >> 7;
					int j2 = myPlayer.y - l1 >> 7;
					boolean flag1 = doWalkTo(1, 0, 0, 0, myPlayer.smallY[0], 0,
							0, j2, myPlayer.smallX[0], true, i2);
					if (flag1) {
						stream.writeWordBigEndian(i);
						stream.writeWordBigEndian(j);
						stream.writeWord(minimapInt1);
						stream.writeWordBigEndian(57);
						stream.writeWordBigEndian(minimapInt2);
						stream.writeWordBigEndian(minimapInt3);
						stream.writeWordBigEndian(89);
						stream.writeWord(myPlayer.x);
						stream.writeWord(myPlayer.y);
						stream.writeWordBigEndian(anInt1264);
						stream.writeWordBigEndian(63);
					}
				}
			}
			anInt1117++;
			if (anInt1117 > 1151) {
				anInt1117 = 0;
				stream.createFrame(246);
				stream.writeWordBigEndian(0);
				int l = stream.currentOffset;
				if ((int) (Math.random() * 2D) == 0)
					stream.writeWordBigEndian(101);
				stream.writeWordBigEndian(197);
				stream.writeWord((int) (Math.random() * 65536D));
				stream.writeWordBigEndian((int) (Math.random() * 256D));
				stream.writeWordBigEndian(67);
				stream.writeWord(14214);
				if ((int) (Math.random() * 2D) == 0)
					stream.writeWord(29487);
				stream.writeWord((int) (Math.random() * 65536D));
				if ((int) (Math.random() * 2D) == 0)
					stream.writeWordBigEndian(220);
				stream.writeWordBigEndian(180);
				stream.writeBytes(stream.currentOffset - l);
			}
		}
	}

	private String interfaceIntToString(int j) {
		if (j < 0x3b9ac9ff)
			return String.valueOf(j);
		else
			return "*";
	}

	private void showErrorScreen() {
		Graphics g = getGameComponent().getGraphics();
		g.setColor(Color.black);
		g.fillRect(0, 0, 765, 503);
		method4(1);
		if (loadingError) {
			aBoolean831 = false;
			g.setFont(new Font("Helvetica", 1, 16));
			g.setColor(Color.yellow);
			int k = 35;
			g.drawString(
					"Sorry, an error has occured whilst loading Masterscape.",
					30, k);
			k += 50;
			g.setColor(Color.white);
			g.drawString("To fix this try the following (in order):", 30, k);
			k += 50;
			g.setColor(Color.white);
			g.setFont(new Font("Helvetica", 1, 12));
			g.drawString(
					"1: Try closing and reopening the client and/or web browser",
					30, k);
			k += 30;
			g.drawString(
					"2: Try clearing your web-browsers cache from tools->internet options",
					30, k);
			k += 30;
			g.drawString("3: Try rebooting your computer", 30, k);
			k += 30;
			g.drawString(" ", 30, k);
			k += 30;
			g.drawString(
					"If problems still occur, visit the forums at http://Masterscape.org and ask help",
					30, k);
		}
		if (genericLoadingError) {
			aBoolean831 = false;
			g.setFont(new Font("Helvetica", 1, 20));
			g.setColor(Color.white);
			g.drawString("Error - unable to load game!", 50, 50);
			g.drawString(
					"To play Masterscape make sure you play on Download Client",
					50, 100);
			g.drawString("http://Masterscape.org", 50, 150);
		}
		if (rsAlreadyLoaded) {
			aBoolean831 = false;
			g.setColor(Color.yellow);
			int l = 35;
			g.drawString(
					"Error a copy of Masterscape already appears to be loaded",
					30, l);
			l += 50;
			g.setColor(Color.white);
			g.drawString("To fix this try the following (in order):", 30, l);
			l += 50;
			g.setColor(Color.white);
			g.setFont(new Font("Helvetica", 1, 12));
			g.drawString(
					"1: Try closing ALL open web-browser windows, and reloading",
					30, l);
			l += 30;
			g.drawString("2: Try rebooting your computer, and reloading", 30, l);
			l += 30;
		}
	}

	public URL getCodeBase() {

		try {
			return new URL(server + ":" + (80 + portOff));
		} catch (Exception _ex) {
		}
		return null;
	}

	private void method95() {
		for (int j = 0; j < npcCount; j++) {
			int k = npcIndices[j];
			NPC npc = npcArray[k];
			if (npc != null)
				method96(npc);
		}
	}

	private void method96(Entity entity) {
		if (entity.x < 128 || entity.y < 128 || entity.x >= 13184
				|| entity.y >= 13184) {
			entity.anim = -1;
			entity.anInt1520 = -1;
			entity.anInt1547 = 0;
			entity.anInt1548 = 0;
			entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
			entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
			entity.method446();
		}
		if (entity == myPlayer
				&& (entity.x < 1536 || entity.y < 1536 || entity.x >= 11776 || entity.y >= 11776)) {
			entity.anim = -1;
			entity.anInt1520 = -1;
			entity.anInt1547 = 0;
			entity.anInt1548 = 0;
			entity.x = entity.smallX[0] * 128 + entity.anInt1540 * 64;
			entity.y = entity.smallY[0] * 128 + entity.anInt1540 * 64;
			entity.method446();
		}
		if (entity.anInt1547 > loopCycle)
			method97(entity);
		else if (entity.anInt1548 >= loopCycle)
			method98(entity);
		else
			method99(entity);
		method100(entity);
		method101(entity);
	}

	private void method97(Entity entity) {
		int i = entity.anInt1547 - loopCycle;
		int j = entity.anInt1543 * 128 + entity.anInt1540 * 64;
		int k = entity.anInt1545 * 128 + entity.anInt1540 * 64;
		entity.x += (j - entity.x) / i;
		entity.y += (k - entity.y) / i;
		entity.anInt1503 = 0;
		if (entity.anInt1549 == 0)
			entity.turnDirection = 1024;
		if (entity.anInt1549 == 1)
			entity.turnDirection = 1536;
		if (entity.anInt1549 == 2)
			entity.turnDirection = 0;
		if (entity.anInt1549 == 3)
			entity.turnDirection = 512;
	}

	private void method98(Entity entity) {
		if (entity.anInt1548 == loopCycle
				|| entity.anim == -1
				|| entity.anInt1529 != 0
				|| entity.anInt1528 + 1 > Animation.anims[entity.anim]
						.method258(entity.anInt1527)) {
			int i = entity.anInt1548 - entity.anInt1547;
			int j = loopCycle - entity.anInt1547;
			int k = entity.anInt1543 * 128 + entity.anInt1540 * 64;
			int l = entity.anInt1545 * 128 + entity.anInt1540 * 64;
			int i1 = entity.anInt1544 * 128 + entity.anInt1540 * 64;
			int j1 = entity.anInt1546 * 128 + entity.anInt1540 * 64;
			entity.x = (k * (i - j) + i1 * j) / i;
			entity.y = (l * (i - j) + j1 * j) / i;
		}
		entity.anInt1503 = 0;
		if (entity.anInt1549 == 0)
			entity.turnDirection = 1024;
		if (entity.anInt1549 == 1)
			entity.turnDirection = 1536;
		if (entity.anInt1549 == 2)
			entity.turnDirection = 0;
		if (entity.anInt1549 == 3)
			entity.turnDirection = 512;
		entity.anInt1552 = entity.turnDirection;
	}

	private void method99(Entity entity) {
		entity.anInt1517 = entity.anInt1511;
		if (entity.smallXYIndex == 0) {
			entity.anInt1503 = 0;
			return;
		}
		if (entity.anim != -1 && entity.anInt1529 == 0) {
			Animation animation = Animation.anims[entity.anim];
			if (entity.anInt1542 > 0 && animation.anInt363 == 0) {
				entity.anInt1503++;
				return;
			}
			if (entity.anInt1542 <= 0 && animation.anInt364 == 0) {
				entity.anInt1503++;
				return;
			}
		}
		int i = entity.x;
		int j = entity.y;
		int k = entity.smallX[entity.smallXYIndex - 1] * 128 + entity.anInt1540
				* 64;
		int l = entity.smallY[entity.smallXYIndex - 1] * 128 + entity.anInt1540
				* 64;
		if (k - i > 256 || k - i < -256 || l - j > 256 || l - j < -256) {
			entity.x = k;
			entity.y = l;
			return;
		}
		if (i < k) {
			if (j < l)
				entity.turnDirection = 1280;
			else if (j > l)
				entity.turnDirection = 1792;
			else
				entity.turnDirection = 1536;
		} else if (i > k) {
			if (j < l)
				entity.turnDirection = 768;
			else if (j > l)
				entity.turnDirection = 256;
			else
				entity.turnDirection = 512;
		} else if (j < l)
			entity.turnDirection = 1024;
		else
			entity.turnDirection = 0;
		int i1 = entity.turnDirection - entity.anInt1552 & 0x7ff;
		if (i1 > 1024)
			i1 -= 2048;
		int j1 = entity.anInt1555;
		if (i1 >= -256 && i1 <= 256)
			j1 = entity.anInt1554;
		else if (i1 >= 256 && i1 < 768)
			j1 = entity.anInt1557;
		else if (i1 >= -768 && i1 <= -256)
			j1 = entity.anInt1556;
		if (j1 == -1)
			j1 = entity.anInt1554;
		entity.anInt1517 = j1;
		int k1 = 4;
		if (entity.anInt1552 != entity.turnDirection
				&& entity.interactingEntity == -1 && entity.anInt1504 != 0)
			k1 = 2;
		if (entity.smallXYIndex > 2)
			k1 = 6;
		if (entity.smallXYIndex > 3)
			k1 = 8;
		if (entity.anInt1503 > 0 && entity.smallXYIndex > 1) {
			k1 = 8;
			entity.anInt1503--;
		}
		if (entity.aBooleanArray1553[entity.smallXYIndex - 1])
			k1 <<= 1;
		if (k1 >= 8 && entity.anInt1517 == entity.anInt1554
				&& entity.anInt1505 != -1)
			entity.anInt1517 = entity.anInt1505;
		if (i < k) {
			entity.x += k1;
			if (entity.x > k)
				entity.x = k;
		} else if (i > k) {
			entity.x -= k1;
			if (entity.x < k)
				entity.x = k;
		}
		if (j < l) {
			entity.y += k1;
			if (entity.y > l)
				entity.y = l;
		} else if (j > l) {
			entity.y -= k1;
			if (entity.y < l)
				entity.y = l;
		}
		if (entity.x == k && entity.y == l) {
			entity.smallXYIndex--;
			if (entity.anInt1542 > 0)
				entity.anInt1542--;
		}
	}

	private void method100(Entity entity) {
		if (entity.anInt1504 == 0)
			return;
		if (entity.interactingEntity != -1 && entity.interactingEntity < 32768) {
			NPC npc = npcArray[entity.interactingEntity];
			if (npc != null) {
				int i1 = entity.x - npc.x;
				int k1 = entity.y - npc.y;
				if (i1 != 0 || k1 != 0)
					entity.turnDirection = (int) (Math.atan2(i1, k1) * 325.94900000000001D) & 0x7ff;
			}
		}
		if (entity.interactingEntity >= 32768) {
			int j = entity.interactingEntity - 32768;
			if (j == unknownInt10)
				j = myPlayerIndex;
			Player player = playerArray[j];
			if (player != null) {
				int l1 = entity.x - player.x;
				int i2 = entity.y - player.y;
				if (l1 != 0 || i2 != 0)
					entity.turnDirection = (int) (Math.atan2(l1, i2) * 325.94900000000001D) & 0x7ff;
			}
		}
		if ((entity.anInt1538 != 0 || entity.anInt1539 != 0)
				&& (entity.smallXYIndex == 0 || entity.anInt1503 > 0)) {
			int k = entity.x - (entity.anInt1538 - baseX - baseX) * 64;
			int j1 = entity.y - (entity.anInt1539 - baseY - baseY) * 64;
			if (k != 0 || j1 != 0)
				entity.turnDirection = (int) (Math.atan2(k, j1) * 325.94900000000001D) & 0x7ff;
			entity.anInt1538 = 0;
			entity.anInt1539 = 0;
		}
		int l = entity.turnDirection - entity.anInt1552 & 0x7ff;
		if (l != 0) {
			if (l < entity.anInt1504 || l > 2048 - entity.anInt1504)
				entity.anInt1552 = entity.turnDirection;
			else if (l > 1024)
				entity.anInt1552 -= entity.anInt1504;
			else
				entity.anInt1552 += entity.anInt1504;
			entity.anInt1552 &= 0x7ff;
			if (entity.anInt1517 == entity.anInt1511
					&& entity.anInt1552 != entity.turnDirection) {
				if (entity.anInt1512 != -1) {
					entity.anInt1517 = entity.anInt1512;
					return;
				}
				entity.anInt1517 = entity.anInt1554;
			}
		}
	}

	private void method101(Entity entity) {
		if (entity.anInt1517 > 13798) {
			entity.anInt1517 = -1;
		}
		entity.aBoolean1541 = false;
		if (entity.anInt1517 != -1) {
			Animation animation = Animation.anims[entity.anInt1517];
			entity.anInt1519++;
			if (entity.anInt1518 < animation.anInt352
					&& entity.anInt1519 > animation.method258(entity.anInt1518)) {
				entity.anInt1519 = 0;
				entity.anInt1518++;
			}
			if (entity.anInt1518 >= animation.anInt352) {
				entity.anInt1519 = 0;
				entity.anInt1518 = 0;
			}
		}
		if (entity.anInt1520 != -1 && loopCycle >= entity.anInt1523) {
			if (entity.anInt1521 < 0)
				entity.anInt1521 = 0;
			Animation animation_1 = SpotAnim.cache[entity.anInt1520].aAnimation_407;
			for (entity.anInt1522++; entity.anInt1521 < animation_1.anInt352
					&& entity.anInt1522 > animation_1
							.method258(entity.anInt1521); entity.anInt1521++)
				// huhhhhh
				entity.anInt1522 -= animation_1.method258(entity.anInt1521);

			if (entity.anInt1521 >= animation_1.anInt352
					&& (entity.anInt1521 < 0 || entity.anInt1521 >= animation_1.anInt352))
				entity.anInt1520 = -1;
		}
		if (entity.anim != -1 && entity.anInt1529 <= 1) {
			Animation animation_2 = Animation.anims[entity.anim];
			if (animation_2.anInt363 == 1 && entity.anInt1542 > 0
					&& entity.anInt1547 <= loopCycle
					&& entity.anInt1548 < loopCycle) {
				entity.anInt1529 = 1;
				return;
			}
		}
		if (entity.anim != -1 && entity.anInt1529 == 0) {
			Animation animation_3 = Animation.anims[entity.anim];
			for (entity.anInt1528++; entity.anInt1527 < animation_3.anInt352
					&& entity.anInt1528 > animation_3
							.method258(entity.anInt1527); entity.anInt1527++)
				entity.anInt1528 -= animation_3.method258(entity.anInt1527);

			if (entity.anInt1527 >= animation_3.anInt352) {
				entity.anInt1527 -= animation_3.anInt356;
				entity.anInt1530++;
				if (entity.anInt1530 >= animation_3.anInt362)
					entity.anim = -1;
				if (entity.anInt1527 < 0
						|| entity.anInt1527 >= animation_3.anInt352)
					entity.anim = -1;
			}
			entity.aBoolean1541 = animation_3.aBoolean358;
		}
		if (entity.anInt1529 > 0)
			entity.anInt1529--;
	}

	private boolean shopOverview;
	private Sprite shopOverviewBackground;

	private boolean welcomeScreen = true;
	private Sprite welcomeBackground;
	private Sprite welcomePlay;
	private String welcomeName;
	private String welcomeText;

	private void drawGameScreen() {
		if (fullscreenInterfaceID != -1
				&& (loadingStage == 2 || super.fullGameScreen != null)) {
			if (loadingStage == 2) {
				method119(anInt945, fullscreenInterfaceID);
				if (openInterfaceID != -1) {
					method119(anInt945, openInterfaceID);
				}
				anInt945 = 0;
				resetAllImageProducers();
				super.fullGameScreen.initDrawingArea();
				Texture.anIntArray1472 = fullScreenTextureArray;
				DrawingArea.setAllPixelsToZero();
				welcomeScreenRaised = true;
				if (openInterfaceID != -1) {
					RSInterface class9_1 = RSInterface.interfaceCache[openInterfaceID];
					if (class9_1.width == 512 && class9_1.height == 334
							&& class9_1.interfaceType == 0) {
						class9_1.width = 765;
						class9_1.height = 503;
					}
					drawInterface(0, 0, class9_1, 8);
				}
				RSInterface rsInterface = RSInterface.interfaceCache[fullscreenInterfaceID];
				if (rsInterface.width == 512 && rsInterface.height == 334
						&& rsInterface.interfaceType == 0) {
					rsInterface.width = 765;
					rsInterface.height = 503;
				}
				drawInterface(0, 0, rsInterface, 8);

				if (!menuOpen) {
					processRightClick();
					drawTooltip();
				} else {
					drawMenu(0, 0);
				}
			}
			drawCount++;
			super.fullGameScreen.drawGraphics(0, super.graphics, 0);
			return;
		} else {
			if (drawCount != 0) {
				resetImageProducers2();
			}
		}
		if (welcomeScreenRaised) {
			welcomeScreenRaised = false;
			topFrame.drawGraphics(0, super.graphics, 0);
			leftFrame.drawGraphics(4, super.graphics, 0);
			inputTaken = true;
			tabAreaAltered = true;
			if (loadingStage != 2) {
				inGameScreen.drawGraphics(4, super.graphics, 4);
				mapBackImage.drawGraphics(0, super.graphics, 516);// 545

			}
		}
		if (menuOpen) {
		}
		if (menuOpen)
			drawMenu(4, 4);

		if (invOverlayInterfaceID != -1) {
			boolean flag1 = method119(anInt945, invOverlayInterfaceID);
			if (flag1) {
			}
		}
		if (atInventoryInterfaceType == 2) {
		}
		if (activeInterfaceType == 2) {
		}
		drawTabArea();
		if (loadingStage == 2) {
			method146();
		}
		if (backDialogID == -1) {
			if (is474 || is480 || is508 || is525 || is562) {
				aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 110;
				if (super.mouseX > 478 && super.mouseX < 580
						&& super.mouseY > 342)
					method65(494, 110, super.mouseX - 0, super.mouseY - 348,
							aClass9_1059, 0, false, anInt1211);
				int i = anInt1211 - 110 - aClass9_1059.scrollPosition;
				if (i < 0)
					i = 0;
				if (i > anInt1211 - 110)
					i = anInt1211 - 110;
				if (anInt1089 != i) {
					anInt1089 = i;
					inputTaken = true;
				}
			} else {
				aClass9_1059.scrollPosition = anInt1211 - anInt1089 - 77;
				if (super.mouseX > 448 && super.mouseX < 560
						&& super.mouseY > 332)
					method65(463, 77, super.mouseX - 17, super.mouseY - 357,
							aClass9_1059, 0, false, anInt1211);
				int i = anInt1211 - 77 - aClass9_1059.scrollPosition;
				if (i < 0)
					i = 0;
				if (i > anInt1211 - 77)
					i = anInt1211 - 77;
				if (anInt1089 != i) {
					anInt1089 = i;
					inputTaken = true;
				}
			}
		}
		if (backDialogID != -1) {
			boolean flag2 = method119(anInt945, backDialogID);
			if (flag2)
				inputTaken = true;
		}
		if (atInventoryInterfaceType == 3)
			inputTaken = true;
		if (activeInterfaceType == 3)
			inputTaken = true;
		if (aString844 != null)
			inputTaken = true;
		if (menuOpen && menuScreenArea == 2)
			inputTaken = true;
		
		if (inputTaken) {
			drawChatArea();
			inputTaken = false;
		}
		if (loadingStage == 2) {
			drawMinimap();
			mapBackImage.drawGraphics(0, super.graphics, 516);// 545
		}
		if (anInt1054 != -1)
			tabAreaAltered = true;
		if (tabAreaAltered) {
			if (anInt1054 != -1 && anInt1054 == tabID) {
				anInt1054 = -1;
				stream.createFrame(120);
				stream.writeWordBigEndian(tabID);
			}
			tabAreaAltered = false;
			aRSImageProducer_1125.initDrawingArea();
			inGameScreen.initDrawingArea();
		}
		if (menuOpen) {
			drawMenu(516, 466);
		}
		anInt945 = 0;
	}

	private boolean buildFriendsListMenu(RSInterface class9) {
		int i = class9.contentType;
		if (i >= 1 && i <= 200 || i >= 701 && i <= 900) {
			if (i >= 801)
				i -= 701;
			else if (i >= 701)
				i -= 601;
			else if (i >= 101)
				i -= 101;
			else
				i--;
			menuActionName[menuActionRow] = "Remove @whi@" + friendsList[i];
			menuActionID[menuActionRow] = 792;
			menuActionRow++;
			menuActionName[menuActionRow] = "Message @whi@" + friendsList[i];
			menuActionID[menuActionRow] = 639;
			menuActionRow++;
			return true;
		}
		if (i >= 401 && i <= 500) {
			menuActionName[menuActionRow] = "Remove @whi@"
					+ class9.disabledMessage;
			menuActionID[menuActionRow] = 322;
			menuActionRow++;
			return true;
		} else {
			return false;
		}
	}

	private void method104() {
		Animable_Sub3 class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
				.reverseGetFirst();
		for (; class30_sub2_sub4_sub3 != null; class30_sub2_sub4_sub3 = (Animable_Sub3) aClass19_1056
				.reverseGetNext())
			if (class30_sub2_sub4_sub3.anInt1560 != plane
					|| class30_sub2_sub4_sub3.aBoolean1567)
				class30_sub2_sub4_sub3.unlink();
			else if (loopCycle >= class30_sub2_sub4_sub3.anInt1564) {
				class30_sub2_sub4_sub3.method454(anInt945);
				if (class30_sub2_sub4_sub3.aBoolean1567)
					class30_sub2_sub4_sub3.unlink();
				else
					worldController.method285(class30_sub2_sub4_sub3.anInt1560,
							0, class30_sub2_sub4_sub3.anInt1563, -1,
							class30_sub2_sub4_sub3.anInt1562, 60,
							class30_sub2_sub4_sub3.anInt1561,
							class30_sub2_sub4_sub3, false);
			}

	}

	private void drawInterface(int j, int k, RSInterface class9, int l) {
		if (class9.interfaceType != 0 || class9.children == null)
			return;
		if (class9.interfaceShown && anInt1026 != class9.id
				&& anInt1048 != class9.id && anInt1039 != class9.id)
			return;
		int i1 = DrawingArea.topX;
		int j1 = DrawingArea.topY;
		int k1 = DrawingArea.bottomX;
		int l1 = DrawingArea.bottomY;
		DrawingArea.setDrawingArea(l + class9.height, k, k + class9.width, l);
		int i2 = class9.children.length;
		for (int j2 = 0; j2 < i2; j2++) {
			int k2 = class9.childX[j2] + k;
			int l2 = (class9.childY[j2] + l) - j;
			RSInterface rsi = RSInterface.interfaceCache[class9.children[j2]];
			k2 += rsi.xOffset;
			l2 += rsi.yOffset;
			if (rsi.contentType > 0)
				drawFriendsListOrWelcomeScreen(rsi);
			// here
			int[] IDs = { 1196, 1199, 1206, 1215, 1224, 1231, 1240, 1249, 1258,
					1267, 1274, 1283, 1573, 1290, 1299, 1308, 1315, 1324, 1333,
					1340, 1349, 1358, 1367, 1374, 1381, 1388, 1397, 1404, 1583,
					12038, 1414, 1421, 1430, 1437, 1446, 1453, 1460, 1469,
					15878, 1602, 1613, 1624, 7456, 1478, 1485, 1494, 1503,
					1512, 1521, 1530, 1544, 1553, 1563, 1593, 1635, 12426,
					12436, 12446, 12456, 6004, 18471,
					/* Ancients */
					12940, 12988, 13036, 12902, 12862, 13046, 12964, 13012,
					13054, 12920, 12882, 13062, 12952, 13000, 13070, 12912,
					12872, 13080, 12976, 13024, 13088, 12930, 12892, 13096 };
			for (int m5 = 0; m5 < IDs.length; m5++) {
				if (rsi.id == IDs[m5] + 1) {
					if (m5 > 61)
						drawBlackBox(k2 + 1, l2);
					else
						drawBlackBox(k2, l2 + 1);
				}
			}
			int[] runeChildren = { 1202, 1203, 1209, 1210, 1211, 1218, 1219,
					1220, 1227, 1228, 1234, 1235, 1236, 1243, 1244, 1245, 1252,
					1253, 1254, 1261, 1262, 1263, 1270, 1271, 1277, 1278, 1279,
					1286, 1287, 1293, 1294, 1295, 1302, 1303, 1304, 1311, 1312,
					1318, 1319, 1320, 1327, 1328, 1329, 1336, 1337, 1343, 1344,
					1345, 1352, 1353, 1354, 1361, 1362, 1363, 1370, 1371, 1377,
					1378, 1384, 1385, 1391, 1392, 1393, 1400, 1401, 1407, 1408,
					1410, 1417, 1418, 1424, 1425, 1426, 1433, 1434, 1440, 1441,
					1442, 1449, 1450, 1456, 1457, 1463, 1464, 1465, 1472, 1473,
					1474, 1481, 1482, 1488, 1489, 1490, 1497, 1498, 1499, 1506,
					1507, 1508, 1515, 1516, 1517, 1524, 1525, 1526, 1533, 1534,
					1535, 1547, 1548, 1549, 1556, 1557, 1558, 1566, 1567, 1568,
					1576, 1577, 1578, 1586, 1587, 1588, 1596, 1597, 1598, 1605,
					1606, 1607, 1616, 1617, 1618, 1627, 1628, 1629, 1638, 1639,
					1640, 6007, 6008, 6011, 8673, 8674, 12041, 12042, 12429,
					12430, 12431, 12439, 12440, 12441, 12449, 12450, 12451,
					12459, 12460, 15881, 15882, 15885, 18474, 18475, 18478 };
			for (int r = 0; r < runeChildren.length; r++)
				if (rsi.id == runeChildren[r])
					rsi.modelZoom = 775;

			if (rsi.interfaceType == 0) {
				if (rsi.scrollPosition > rsi.scrollMax - rsi.height)
					rsi.scrollPosition = rsi.scrollMax - rsi.height;
				if (rsi.scrollPosition < 0)
					rsi.scrollPosition = 0;
				drawInterface(rsi.scrollPosition, k2, rsi, l2);
				if (rsi.scrollMax > rsi.height)
					drawScrollbar(rsi.height, rsi.scrollPosition, l2, k2
							+ rsi.width, rsi.scrollMax);
				if (rsi.scrollMax > rsi.height) {
					// clan chat
					if (rsi.id == 50013) {
						int clanMates = 0;
						for (int i = 50025; i < 50117; i++) {
							RSInterface line = RSInterface.interfaceCache[i];
							if (line.disabledMessage.length() > 0) {
								clanMates++;
							}
						}
						rsi.scrollMax = (clanMates * 14) + rsi.height + 1;
					}
					if (rsi.id == 18322 || rsi.id == 18423) {
						int members = 0;
						for (int i = rsi.id + 1; i < rsi.id + 1 + 100; i++) {
							RSInterface line = RSInterface.interfaceCache[i];
							if (line != null && line.disabledMessage != null) {
								if (line.disabledMessage.length() > 0) {
									members++;
								}
							}
						}
						rsi.scrollMax = (members * 14) + 1;
					}
					drawScrollbar(rsi.height, rsi.scrollPosition, l2, k2
							+ rsi.width, rsi.scrollMax);
				}
			} else if (rsi.interfaceType != 1)
				if (rsi.interfaceType == 2) {
					int i3 = 0;
					for (int l3 = 0; l3 < rsi.height; l3++) {
						for (int l4 = 0; l4 < rsi.width; l4++) {
							int k5 = k2 + l4 * (32 + rsi.invSpritePadX);
							int j6 = l2 + l3 * (32 + rsi.invSpritePadY);
							if (i3 < 20) {
								k5 += rsi.spritesX[i3];
								j6 += rsi.spritesY[i3];
							}
							if (rsi.inventory[i3] > 0) {
								int k6 = 0;
								int j7 = 0;
								int j9 = rsi.inventory[i3] - 1;
								if (k5 > DrawingArea.topX - 32
										&& k5 < DrawingArea.bottomX
										&& j6 > DrawingArea.topY - 32
										&& j6 < DrawingArea.bottomY
										|| activeInterfaceType != 0
										&& anInt1085 == i3) {
									int l9 = 0;
									if (itemSelected == 1 && anInt1283 == i3
											&& anInt1284 == rsi.id)
										l9 = 0xffffff;
									Sprite Sprite_2 = ItemDef.getSprite(j9,
											rsi.inventoryValue[i3], l9);
									if (Sprite_2 != null) {
										if (activeInterfaceType != 0
												&& anInt1085 == i3
												&& anInt1084 == rsi.id) {
											k6 = super.mouseX - anInt1087;
											j7 = super.mouseY - anInt1088;
											if (k6 < 5 && k6 > -5)
												k6 = 0;
											if (j7 < 5 && j7 > -5)
												j7 = 0;
											if (anInt989 < 5) {
												k6 = 0;
												j7 = 0;
											}
											Sprite_2.drawSprite1(k5 + k6, j6
													+ j7);
											if (j6 + j7 < DrawingArea.topY
													&& class9.scrollPosition > 0) {
												int i10 = (anInt945 * (DrawingArea.topY
														- j6 - j7)) / 3;
												if (i10 > anInt945 * 10)
													i10 = anInt945 * 10;
												if (i10 > class9.scrollPosition)
													i10 = class9.scrollPosition;
												class9.scrollPosition -= i10;
												anInt1088 += i10;
											}
											if (j6 + j7 + 32 > DrawingArea.bottomY
													&& class9.scrollPosition < class9.scrollMax
															- class9.height) {
												int j10 = (anInt945 * ((j6 + j7 + 32) - DrawingArea.bottomY)) / 3;
												if (j10 > anInt945 * 10)
													j10 = anInt945 * 10;
												if (j10 > class9.scrollMax
														- class9.height
														- class9.scrollPosition)
													j10 = class9.scrollMax
															- class9.height
															- class9.scrollPosition;
												class9.scrollPosition += j10;
												anInt1088 -= j10;
											}
										} else if (atInventoryInterfaceType != 0
												&& atInventoryIndex == i3
												&& atInventoryInterface == rsi.id)
											Sprite_2.drawSprite1(k5, j6);
										else
											Sprite_2.drawSprite(k5, j6);
										if (Sprite_2.maxWidth == 33
												|| rsi.inventoryValue[i3] != 1) {
											int k10 = rsi.inventoryValue[i3];
											smallText.method385(0,
													intToKOrMil(k10), j6 + 10
															+ j7, k5 + 1 + k6);
											if (k10 >= 1)
												smallText.method385(0xFFFF00,
														intToKOrMil(k10), j6
																+ 9 + j7, k5
																+ k6);
											if (k10 >= 100000)
												smallText.method385(0xFFFFFF,
														intToKOrMil(k10), j6
																+ 9 + j7, k5
																+ k6);
											if (k10 >= 10000000)
												smallText.method385(0x00FF80,
														intToKOrMil(k10), j6
																+ 9 + j7, k5
																+ k6);
										}
									}
								}
							} else if (rsi.sprites != null && i3 < 20) {
								Sprite Sprite_1 = rsi.sprites[i3];
								if (Sprite_1 != null)
									Sprite_1.drawSprite(k5, j6);
							}
							i3++;
						}
					}
				} else if (rsi.interfaceType == 3) {
					boolean flag = false;
					if (anInt1039 == rsi.id || anInt1048 == rsi.id
							|| anInt1026 == rsi.id)
						flag = true;
					int j3;
					if (interfaceIsSelected(rsi)) {
						j3 = rsi.enabledColor;
						if (flag && rsi.enabledHoverColor != 0)
							j3 = rsi.enabledHoverColor;
					} else {
						j3 = rsi.disabledColor;
						if (flag && rsi.disabledHoverColor != 0)
							j3 = rsi.disabledHoverColor;
					}
					if (rsi.opacity == 0) {
						if (rsi.boxFilled)
							DrawingArea.drawPixels(rsi.height, l2, k2, j3,
									rsi.width);
						else
							DrawingArea.fillPixels(k2, rsi.width, rsi.height,
									j3, l2);
					} else if (rsi.boxFilled)
						DrawingArea.method335(j3, l2, rsi.width, rsi.height,
								256 - (rsi.opacity & 0xff), k2);
					else
						DrawingArea.method338(l2, rsi.height,
								256 - (rsi.opacity & 0xff), j3, rsi.width, k2);
				} else if (rsi.interfaceType == 4) {
					RSFont textDrawingArea = rsi.rsFonts;
					String s = rsi.disabledMessage;
					boolean flag1 = false;
					if (anInt1039 == rsi.id || anInt1048 == rsi.id
							|| anInt1026 == rsi.id)
						flag1 = true;
					int i4;
					if (interfaceIsSelected(rsi)) {
						i4 = rsi.enabledColor;
						if (flag1 && rsi.enabledHoverColor != 0)
							i4 = rsi.enabledHoverColor;
						if (rsi.enabledMessage.length() > 0)
							s = rsi.enabledMessage;
					} else {
						i4 = rsi.disabledColor;
						if (flag1 && rsi.disabledHoverColor != 0)
							i4 = rsi.disabledHoverColor;
					}
					if (rsi.atActionType == 6 && aBoolean1149) {
						s = "Please wait...";
						i4 = rsi.disabledColor;
					}
					if (DrawingArea.width == 516) {// 519
						if (i4 == 0xffff00)
							i4 = 255;
						if (i4 == 49152)
							i4 = 0xffffff;
					}
					// Magic interface
					if ((rsi.parentID == 1151) || (rsi.parentID == 12855)) {
						switch (i4) {
						case 16773120:
							i4 = 0xFE981F;
							break;
						case 7040819:
							i4 = 0xAF6A1A;
							break;
						}
					}
					// Skill interface
					int id = 4004;
					int id2 = 4005;
					if (rsi.parentID == 3917 && rsi.id != id
							&& rsi.id != id + 2 && rsi.id != id + 4
							&& rsi.id != id + 6 && rsi.id != id + 8
							&& rsi.id != id + 10 && rsi.id != id + 12
							&& rsi.id != id + 14 && rsi.id != id + 16
							&& rsi.id != id + 18 && rsi.id != id + 20
							&& rsi.id != id + 23 && rsi.id != id + 24
							&& rsi.id != id + 26 && rsi.id != id + 28
							&& rsi.id != id + 30 && rsi.id != id + 32
							&& rsi.id != id + 34 && rsi.id != 13926
							&& rsi.id != 4152 && rsi.id != 12166
							&& rsi.id != id2 && rsi.id != id2 + 2
							&& rsi.id != id2 + 4 && rsi.id != id2 + 6
							&& rsi.id != id2 + 8 && rsi.id != id2 + 10
							&& rsi.id != id2 + 12 && rsi.id != id2 + 14
							&& rsi.id != id2 + 16 && rsi.id != id2 + 18
							&& rsi.id != id2 + 20 && rsi.id != id2 + 23
							&& rsi.id != id2 + 24 && rsi.id != id2 + 26
							&& rsi.id != id2 + 28 && rsi.id != id2 + 30
							&& rsi.id != id2 + 32 && rsi.id != id2 + 34
							&& rsi.id != 13927 && rsi.id != 4153
							&& rsi.id != 12167 && rsi.id != 4026) {
						if (i4 == 16776960)
							i4 = 0x0000;
						rsi.textShadowed = false;
					}
					/*
					 * if(class9_1.parentID == 3917) { for(int i = 4004; i <
					 * 4040; i++) { int[] moreData = { 13926, 4152, 12166,
					 * 13927, 4153, 12167, 4026 }; if(class9_1.id == i ||
					 * class9_1.id == moreData[i]) { return; } if(i4 ==
					 * 16776960) { i4 = 0x0000; class9_1.textShadowed = false; }
					 * } }
					 */
					for (int l6 = l2 + textDrawingArea.anInt1497; s.length() > 0; l6 += textDrawingArea.anInt1497) {
						if (s.indexOf("%") != -1) {
							do {
								int k7 = s.indexOf("%1");
								if (k7 == -1)
									break;
								if (rsi.id < 4000 || rsi.id > 5000
										&& rsi.id != 13921 && rsi.id != 13922
										&& rsi.id != 12171 && rsi.id != 12172)
									s = s.substring(0, k7)
											+ methodR(extractInterfaceValues(
													rsi, 0))
											+ s.substring(k7 + 2);
								else
									s = s.substring(0, k7)
											+ interfaceIntToString(extractInterfaceValues(
													rsi, 0))
											+ s.substring(k7 + 2);
							} while (true);
							do {
								int l7 = s.indexOf("%2");
								if (l7 == -1)
									break;
								s = s.substring(0, l7)
										+ interfaceIntToString(extractInterfaceValues(
												rsi, 1)) + s.substring(l7 + 2);
							} while (true);
							do {
								int i8 = s.indexOf("%3");
								if (i8 == -1)
									break;
								s = s.substring(0, i8)
										+ interfaceIntToString(extractInterfaceValues(
												rsi, 2)) + s.substring(i8 + 2);
							} while (true);
							do {
								int j8 = s.indexOf("%4");
								if (j8 == -1)
									break;
								s = s.substring(0, j8)
										+ interfaceIntToString(extractInterfaceValues(
												rsi, 3)) + s.substring(j8 + 2);
							} while (true);
							do {
								int k8 = s.indexOf("%5");
								if (k8 == -1)
									break;
								s = s.substring(0, k8)
										+ interfaceIntToString(extractInterfaceValues(
												rsi, 4)) + s.substring(k8 + 2);
							} while (true);
						}
						int l8 = s.indexOf("\\n");
						String s1;
						if (l8 != -1) {
							s1 = s.substring(0, l8);
							s = s.substring(l8 + 2);
						} else {
							s1 = s;
							s = "";
						}
						if (rsi.textCentered)
							textDrawingArea.method382(i4, k2 + rsi.width / 2,
									s1, l6, rsi.textShadowed);
						else
							textDrawingArea.method389(rsi.textShadowed, k2, i4,
									s1, l6);
					}
				} else if (rsi.interfaceType == 5) {
					// whats this?

					Sprite sprite;
					if (interfaceIsSelected(rsi))
						sprite = rsi.enabledSprite;
					else
						sprite = rsi.disabledSprite;
					if (spellSelected == 1 && rsi.id == spellID && spellID != 0
							&& sprite != null) {
						sprite.drawSprite2(k2, l2, 0xffffff);
					} else {
						if (Autocast && rsi.id == autocastId)
							magicAuto.drawSprite(k2 - 3, l2 - 3);
						if (sprite != null)
							sprite.drawSprite(k2, l2);
					}
					if (sprite != null)
						sprite.drawSprite(k2, l2);
				} else if (rsi.interfaceType == 6) {
					int k3 = Texture.textureInt1;
					int j4 = Texture.textureInt2;
					Texture.textureInt1 = k2 + rsi.width / 2;
					Texture.textureInt2 = l2 + rsi.height / 2;
					int i5 = Texture.anIntArray1470[rsi.modelRotationY]
							* rsi.modelZoom >> 16;
					int l5 = Texture.anIntArray1471[rsi.modelRotationY]
							* rsi.modelZoom >> 16;
					boolean flag2 = interfaceIsSelected(rsi);
					int i7;
					if (flag2)
						i7 = rsi.enabledAnimation;
					else
						i7 = rsi.disabledAnimation;
					Model model;
					if (i7 == -1) {
						model = rsi.method209(-1, -1, flag2);
					} else {
						Animation animation = Animation.anims[i7];
						model = rsi.method209(
								animation.anIntArray354[rsi.animationLength],
								animation.anIntArray353[rsi.animationLength],
								flag2);
					}
					if (model != null)
						model.method482(rsi.modelRotationX, 0,
								rsi.modelRotationY, 0, i5, l5);
					Texture.textureInt1 = k3;
					Texture.textureInt2 = j4;
				} else if (rsi.interfaceType == 7) {
					RSFont textDrawingArea_1 = rsi.rsFonts;
					int k4 = 0;
					for (int j5 = 0; j5 < rsi.height; j5++) {
						for (int i6 = 0; i6 < rsi.width; i6++) {
							if (rsi.inventory[k4] > 0) {
								ItemDef itemDef = ItemDef
										.forID(rsi.inventory[k4] - 1);
								String s2 = itemDef.name;
								if (itemDef.stackable
										|| rsi.inventoryValue[k4] != 1)
									s2 = s2
											+ " x"
											+ intToKOrMilLongName(rsi.inventoryValue[k4]);
								int i9 = k2 + i6 * (115 + rsi.invSpritePadX);
								int k9 = l2 + j5 * (12 + rsi.invSpritePadY);
								if (rsi.textCentered)
									textDrawingArea_1.method382(
											rsi.disabledColor, i9 + rsi.width
													/ 2, s2, k9,
											rsi.textShadowed);
								else
									textDrawingArea_1.method389(
											rsi.textShadowed, i9,
											rsi.disabledColor, s2, k9);
							}
							k4++;
						}
					}
				} else if (rsi.interfaceType == 8
						&& (anInt1500 == rsi.id || anInt1044 == rsi.id || anInt1129 == rsi.id)
						&& anInt1501 == 100) {
					int boxWidth = 0;
					int boxHeight = 0;
					RSFont textDrawingArea_2 = aTextDrawingArea_1271;
					for (String s1 = rsi.disabledMessage; s1.length() > 0;) {
						int l7 = s1.indexOf("\\n");
						String s4;
						if (l7 != -1) {
							s4 = s1.substring(0, l7);
							s1 = s1.substring(l7 + 2);
						} else {
							s4 = s1;
							s1 = "";
						}
						int j10 = textDrawingArea_2.getTextWidth(s4);
						if (j10 > boxWidth) {
							boxWidth = j10;
						}
						boxHeight += textDrawingArea_2.anInt1497 + 1;
					}
					boxWidth += 6;
					boxHeight += 7;
					int xPos = (l2 + rsi.width) - 5 - boxWidth;
					int yPos = k2 + rsi.height + 5;
					if (xPos < l2 + 5) {
						xPos = l2 + 5;
					}
					if (xPos + boxWidth > j + class9.width) {
						xPos = (j + class9.width) - boxWidth;
					}
					if (yPos + boxHeight > k + class9.height) {
						yPos = (k + class9.height) - boxHeight;
					}
					DrawingArea.method336(boxHeight, yPos, xPos, 0xFFFFA0,
							boxWidth);
					DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
					String s2 = rsi.disabledMessage;
					for (int j11 = yPos + textDrawingArea_2.anInt1497 + 2; s2
							.length() > 0; j11 += textDrawingArea_2.anInt1497 + 1) {// anInt1497
						int l11 = s2.indexOf("\\n");
						String s5;
						if (l11 != -1) {
							s5 = s2.substring(0, l11);
							s2 = s2.substring(l11 + 2);
						} else {
							s5 = s2;
							s2 = "";
						}
						textDrawingArea_2
								.method389(false, xPos + 3, 0, s5, j11);
					}
				} else if (rsi.interfaceType == 9) {
					drawHoverBox(k2, l2, rsi.disabledMessage);
				} else if (rsi.interfaceType == 10
						&& (anInt1500 == rsi.id || anInt1044 == rsi.id || anInt1129 == rsi.id)
						&& !menuOpen) {
					int boxWidth = 0;
					int boxHeight = 0;

					TextDrawingArea textDrawingArea_2 = newRegularFont;
					for (String s1 = rsi.disabledMessage; s1.length() > 0;) {
						int l7 = s1.indexOf("\\n");
						String s4;
						if (l7 != -1) {
							s4 = s1.substring(0, l7);
							s1 = s1.substring(l7 + 2);
						} else {
							s4 = s1;
							s1 = "";
						}
						int j10 = textDrawingArea_2.getTextWidth(s4);
						if (j10 > boxWidth) {
							boxWidth = j10;
						}
						boxHeight += textDrawingArea_2.baseCharacterHeight + 1;
					}
					boxWidth += 6;
					boxHeight += 7;
					int xPos = (k2 + rsi.width) - 5 - boxWidth;
					int yPos = l2 + rsi.height + 5;
					if (xPos < k2 + 5) {
						xPos = k2 + 5;
					}
					if (xPos + boxWidth > j + class9.width) {
						xPos = (j + class9.width) - boxWidth;
					}
					if (yPos + boxHeight > k + class9.height) {
						yPos = (k + class9.height) - boxHeight;
					}
					if (class9.isInventoryInterface) {
						if (xPos + boxWidth + j > 249)
							xPos = 251 - boxWidth - j;
						if (yPos + boxHeight + k > 261)
							yPos = 245 - boxHeight - k;
					}
					DrawingArea.method336(boxHeight, yPos, xPos, 0xFFFFA0,
							boxWidth);
					DrawingArea.fillPixels(xPos, boxWidth, boxHeight, 0, yPos);
					String s2 = rsi.disabledMessage;
					for (int j11 = yPos + textDrawingArea_2.baseCharacterHeight
							+ 2; s2.length() > 0; j11 += textDrawingArea_2.baseCharacterHeight + 1) {// anInt1497
						int l11 = s2.indexOf("\\n");
						String s5;
						if (l11 != -1) {
							s5 = s2.substring(0, l11);
							s2 = s2.substring(l11 + 2);
						} else {
							s5 = s2;
							s2 = "";
						}
						// textDrawingArea_2.method389(false, xPos + 3, 0, s5,
						// j11);
						textDrawingArea_2.drawBasicString(s5, xPos + 3, j11, 0,
								-1);
					}
				}
		}
		DrawingArea.setDrawingArea(l1, i1, k1, j1);
	}

	private void randomizeBackground(Background background) {
		int j = 256;
		for (int k = 0; k < anIntArray1190.length; k++)
			anIntArray1190[k] = 0;

		for (int l = 0; l < 5000; l++) {
			int i1 = (int) (Math.random() * 128D * (double) j);
			anIntArray1190[i1] = (int) (Math.random() * 256D);
		}
		for (int j1 = 0; j1 < 20; j1++) {
			for (int k1 = 1; k1 < j - 1; k1++) {
				for (int i2 = 1; i2 < 127; i2++) {
					int k2 = i2 + (k1 << 7);
					anIntArray1191[k2] = (anIntArray1190[k2 - 1]
							+ anIntArray1190[k2 + 1] + anIntArray1190[k2 - 128] + anIntArray1190[k2 + 128]) / 4;
				}

			}
			int ai[] = anIntArray1190;
			anIntArray1190 = anIntArray1191;
			anIntArray1191 = ai;
		}
		if (background != null) {
			int l1 = 0;
			for (int j2 = 0; j2 < background.anInt1453; j2++) {
				for (int l2 = 0; l2 < background.anInt1452; l2++)
					if (background.aByteArray1450[l1++] != 0) {
						int i3 = l2 + 16 + background.anInt1454;
						int j3 = j2 + 16 + background.anInt1455;
						int k3 = i3 + (j3 << 7);
						anIntArray1190[k3] = 0;
					}
			}
		}
	}

	private void method107(int i, int j, Stream stream, Player player) {
		if ((i & 0x400) != 0) {
			player.anInt1543 = stream.method428();
			player.anInt1545 = stream.method428();
			player.anInt1544 = stream.method428();
			player.anInt1546 = stream.method428();
			player.anInt1547 = stream.method436() + loopCycle;
			player.anInt1548 = stream.method435() + loopCycle;
			player.anInt1549 = stream.method428();
			player.method446();
		}
		if ((i & 0x100) != 0) {
			player.anInt1520 = stream.method434();
			int k = stream.readDWord();
			player.anInt1524 = k >> 16;
			player.anInt1523 = loopCycle + (k & 0xffff);
			player.anInt1521 = 0;
			player.anInt1522 = 0;
			if (player.anInt1523 > loopCycle)
				player.anInt1521 = -1;
			if (player.anInt1520 == 65535)
				player.anInt1520 = -1;
			try {
				if (Class36.animationlist[Integer
						.parseInt(
								Integer.toHexString(
										SpotAnim.cache[player.anInt1520].aAnimation_407.anIntArray353[0])
										.substring(
												0,
												Integer.toHexString(
														SpotAnim.cache[player.anInt1520].aAnimation_407.anIntArray353[0])
														.length() - 4), 16)].length == 0)
					onDemandFetcher
							.method558(
									1,
									Integer.parseInt(
											Integer.toHexString(
													SpotAnim.cache[player.anInt1520].aAnimation_407.anIntArray353[0])
													.substring(
															0,
															Integer.toHexString(
																	SpotAnim.cache[player.anInt1520].aAnimation_407.anIntArray353[0])
																	.length() - 4),
											16));
			} catch (Exception e) {
			}
		}
		if ((i & 8) != 0) {
			int l = stream.method434();
			if (l == 65535)
				l = -1;
			int i2 = stream.method427();
			if (l == player.anim && l != -1) {
				int i3 = Animation.anims[l].anInt365;
				if (i3 == 1) {
					player.anInt1527 = 0;
					player.anInt1528 = 0;
					player.anInt1529 = i2;
					player.anInt1530 = 0;
				}
				if (i3 == 2)
					player.anInt1530 = 0;
			} else if (l == -1
					|| player.anim == -1
					|| Animation.anims[l].anInt359 >= Animation.anims[player.anim].anInt359) {
				player.anim = l;
				player.anInt1527 = 0;
				player.anInt1528 = 0;
				player.anInt1529 = i2;
				player.anInt1530 = 0;
				player.anInt1542 = player.smallXYIndex;
			}
		}
		if ((i & 4) != 0) {
			player.textSpoken = stream.readString();
			if (player.textSpoken.charAt(0) == '~') {
				player.textSpoken = player.textSpoken.substring(1);
				pushMessage(player.textSpoken, 2, player.name);
			} else if (player == myPlayer)
				pushMessage(player.textSpoken, 2, player.name);
			player.anInt1513 = 0;
			player.anInt1531 = 0;
			player.textCycle = 150;
		}
		if ((i & 0x80) != 0) {
			// right fucking here
			int i1 = stream.method434();
			int j2 = stream.readUnsignedByte();
			int j3 = stream.method427();
			int k3 = stream.currentOffset;
			if (player.name != null && player.visible) {
				long l3 = TextClass.longForName(player.name);
				boolean flag = false;
				if (j2 <= 1) {
					for (int i4 = 0; i4 < ignoreCount; i4++) {
						if (ignoreListAsLongs[i4] != l3)
							continue;
						flag = true;
						break;
					}

				}
				if (!flag && anInt1251 == 0)
					try {
						aStream_834.currentOffset = 0;
						stream.method442(j3, 0, aStream_834.buffer);
						aStream_834.currentOffset = 0;
						String s = TextInput.method525(j3, aStream_834);
						// s = Censor.doCensor(s);
						player.textSpoken = s;
						player.anInt1513 = i1 >> 8;
						player.privelage = j2;
						player.anInt1531 = i1 & 0xff;
						player.textCycle = 150;
						// Other players see your icon
						switch (j2) {
						case 1:
							pushMessage(s, 1, "@cr0@" + "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						case 2:
							pushMessage(s, 1, "@cr1@" + "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						case 3:
							pushMessage(s, 1, "@cr2@" + "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						case 4:
							pushMessage(s, 1, "@cr3@" + "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						case 5:
							pushMessage(s, 1, "@cr4@" + "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						case 6:
							pushMessage(s, 1, "@cr5@" + "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						case 7:
							pushMessage(s, 1, "@cr6@" + "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						case 8:
							pushMessage(s, 1, "@cr7@" + "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						default:
							pushMessage(s, 2, "<col=13132800>"
									+ playerTitle(player.skill) + "</col>"
									+ player.name);
							break;
						}
						/**
						 * if(j2 == 4) pushMessage(s, 2, "@cr0@" + player.name);
						 * else if(j2 == 3) pushMessage(s, 2, "@cr3@" +
						 * player.name); else if(j2 == 2) pushMessage(s, 2,
						 * "@cr2@" + player.name); else if (j2 == 1)
						 * pushMessage(s, 2, "@cr1@" + player.name); else
						 * pushMessage(s, 2, player.name);
						 **/
					} catch (Exception exception) {
						signlink.reporterror("cde2");
					}
			}
			stream.currentOffset = k3 + j3;
		}
		if ((i & 1) != 0) {
			player.interactingEntity = stream.method434();
			if (player.interactingEntity == 65535)
				player.interactingEntity = -1;
		}
		if ((i & 0x10) != 0) {
			int j1 = stream.method427();
			byte abyte0[] = new byte[j1];
			Stream stream_1 = new Stream(abyte0);
			stream.readBytes(j1, 0, abyte0);
			aStreamArray895s[j] = stream_1;
			player.updatePlayer(stream_1);
		}
		if ((i & 2) != 0) {
			player.anInt1538 = stream.method436();
			player.anInt1539 = stream.method434();
		}
		if ((i & 0x20) != 0) {
			int k1 = stream.readUnsignedByte();
			int k2 = stream.method426();
			int type1 = stream.readUnsignedByte();
			player.updateHitData(k2, k1, type1, loopCycle);
			player.loopCycleStatus = loopCycle + 300;
			player.currentHealth = stream.method427();
			player.maxHealth = stream.readUnsignedByte();
		}
		if ((i & 0x200) != 0) {
			int l1 = stream.readUnsignedByte();
			int l2 = stream.method428();
			int type2 = stream.readUnsignedByte();
			player.updateHitData(l2, l1, type2, loopCycle);
			player.loopCycleStatus = loopCycle + 300;
			player.currentHealth = stream.readUnsignedByte();
			player.maxHealth = stream.method427();
		}
	}

	private void method108() {
		try {
			int j = myPlayer.x + anInt1278;
			int k = myPlayer.y + anInt1131;
			if (anInt1014 - j < -500 || anInt1014 - j > 500
					|| anInt1015 - k < -500 || anInt1015 - k > 500) {
				anInt1014 = j;
				anInt1015 = k;
			}
			if (anInt1014 != j)
				anInt1014 += (j - anInt1014) / 16;
			if (anInt1015 != k)
				anInt1015 += (k - anInt1015) / 16;
			if (super.keyArray[1] == 1)
				anInt1186 += (-24 - anInt1186) / 2;
			else if (super.keyArray[2] == 1)
				anInt1186 += (24 - anInt1186) / 2;
			else
				anInt1186 /= 2;
			if (super.keyArray[3] == 1)
				anInt1187 += (12 - anInt1187) / 2;
			else if (super.keyArray[4] == 1)
				anInt1187 += (-12 - anInt1187) / 2;
			else
				anInt1187 /= 2;
			minimapInt1 = minimapInt1 + anInt1186 / 2 & 0x7ff;
			anInt1184 += anInt1187 / 2;
			if (anInt1184 < 128)
				anInt1184 = 128;
			if (anInt1184 > 383)
				anInt1184 = 383;
			int l = anInt1014 >> 7;
			int i1 = anInt1015 >> 7;
			int j1 = method42(plane, anInt1015, anInt1014);
			int k1 = 0;
			if (l > 3 && i1 > 3 && l < 100 && i1 < 100) {
				for (int l1 = l - 4; l1 <= l + 4; l1++) {
					for (int k2 = i1 - 4; k2 <= i1 + 4; k2++) {
						int l2 = plane;
						if (l2 < 3 && (byteGroundArray[1][l1][k2] & 2) == 2)
							l2++;
						int i3 = j1 - intGroundArray[l2][l1][k2];
						if (i3 > k1)
							k1 = i3;
					}

				}

			}
			anInt1005++;
			if (anInt1005 > 1512) {
				anInt1005 = 0;
				stream.createFrame(77);
				stream.writeWordBigEndian(0);
				int i2 = stream.currentOffset;
				stream.writeWordBigEndian((int) (Math.random() * 256D));
				stream.writeWordBigEndian(101);
				stream.writeWordBigEndian(233);
				stream.writeWord(45092);
				if ((int) (Math.random() * 2D) == 0)
					stream.writeWord(35784);
				stream.writeWordBigEndian((int) (Math.random() * 256D));
				stream.writeWordBigEndian(64);
				stream.writeWordBigEndian(38);
				stream.writeWord((int) (Math.random() * 65536D));
				stream.writeWord((int) (Math.random() * 65536D));
				stream.writeBytes(stream.currentOffset - i2);
			}
			int j2 = k1 * 192;
			if (j2 > 0x17f00)
				j2 = 0x17f00;
			if (j2 < 32768)
				j2 = 32768;
			if (j2 > anInt984) {
				anInt984 += (j2 - anInt984) / 24;
				return;
			}
			if (j2 < anInt984) {
				anInt984 += (j2 - anInt984) / 80;
			}
		} catch (Exception _ex) {
			signlink.reporterror("glfc_ex " + myPlayer.x + "," + myPlayer.y
					+ "," + anInt1014 + "," + anInt1015 + "," + anInt1069 + ","
					+ anInt1070 + "," + baseX + "," + baseY);
			throw new RuntimeException("eek");
		}
	}

	public void processDrawing() {
		if (rsAlreadyLoaded || loadingError || genericLoadingError) {
			showErrorScreen();
			return;
		}
		anInt1061++;
		if (!loggedIn) {
			drawLoginScreen(false);
		} else {
			drawGameScreen();
		}
		anInt1213 = 0;
	}

	private boolean isFriendOrSelf(String s) {
		if (s == null)
			return false;
		for (int i = 0; i < friendsCount; i++)
			if (s.equalsIgnoreCase(friendsList[i]))
				return true;
		return s.equalsIgnoreCase(myPlayer.name);
	}

	private static String combatDiffColor(int i, int j) {
		int k = i - j;
		if (k < -9)
			return "@red@";
		if (k < -6)
			return "@or3@";
		if (k < -3)
			return "@or2@";
		if (k < 0)
			return "@or1@";
		if (k > 9)
			return "@gre@";
		if (k > 6)
			return "@gr3@";
		if (k > 3)
			return "@gr2@";
		if (k > 0)
			return "@gr1@";
		else
			return "@yel@";
	}

	private static final String[][] shops = new String[3][9];

	private int[] staffTabAnimations = { 0, 0, 0 };

	private void draw3dScreen() {
		alertHandler.processAlerts();
		drawSplitPrivateChat();
		if (crossType == 1) {
			crosses[crossIndex / 100]
					.drawSprite(crossX - 8 - 4, crossY - 8 - 4);
			anInt1142++;
			if (anInt1142 > 67) {
				anInt1142 = 0;
				stream.createFrame(78);
			}
		}
		if (crossType == 2)
			crosses[4 + crossIndex / 100].drawSprite(crossX - 8 - 4,
					crossY - 8 - 4);
		if (anInt1018 != -1) {
			method119(anInt945, anInt1018);
			drawInterface(0, 0, RSInterface.interfaceCache[anInt1018], 0);
		}
		drawStaffTab();
		if (openInterfaceID != -1) {
			method119(anInt945, openInterfaceID);
			drawInterface(0, 0, RSInterface.interfaceCache[openInterfaceID], 0);
		}
		if (welcomeScreen) {
			welcomeBackground.drawSprite(0, 0);
			final String welcome = "Welcome to " + welcomeName;
			newRegularFont.drawBasicString(welcome,
					(welcomeBackground.myWidth - newRegularFont
							.getTextWidth(welcome)) / 2, 19, 0xff9e08, -1);
			welcomePlay.drawSprite(250, 262);
			newBoldFont.drawCenteredString("This is a", 100, 250, 0xff9e08, -1);
			newBoldFont.drawCenteredString(welcomeName, 100, 270, 0xff9e08, -1);
			newBoldFont.drawCenteredString("creation", 100, 290, 0xff9e08, -1);
			newBoldFont.drawBasicString(welcomeText, 43, 68, 0x880026, -1);
		}
		if (shopOverview) {
			shopOverviewBackground.drawSprite(0, 0);
			int xOffset = 24;
			for (int i = 0; i < shops.length; i++) {
				final String[] list = shops[i];
				int yOffset = 70;
				for (String shop : list) {
					newRegularFont.drawBasicString(shop, xOffset,
							yOffset += 27, 0xFFFFFF, -1);
				}
				xOffset += 162;
			}
		}
		method70();
		if (!menuOpen) {
			processRightClick();
			drawTooltip();
		} else
			drawMenu(4, 4);
		if (anInt1055 == 1)
			multiOverlay.drawSprite(472, 296);
		if (fpsOn) {
			char c = '\u01FB';
			int k = 20;
			int i1 = 0xffff00;
			if (super.fps < 15)
				i1 = 0xff0000;
			aTextDrawingArea_1271.method380("Fps:" + super.fps, c, i1, k);
			k += 15;
			Runtime runtime = Runtime.getRuntime();
			int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
			i1 = 0xffff00;
			if (j1 > 0x2000000 && lowMem)
				i1 = 0xff0000;
			aTextDrawingArea_1271.method380("Mem:" + j1 + "k", c, 0xffff00, k);
			k += 15;
		}
		int x = baseX + (myPlayer.x - 6 >> 7);
		int y = baseY + (myPlayer.y - 6 >> 7);
		if (clientData) {
			if (super.fps < 15) {
			}
			aTextDrawingArea_1271.method385(0xffff00, "Fps: " + super.fps, 285,
					5);
			Runtime runtime = Runtime.getRuntime();
			int j1 = (int) ((runtime.totalMemory() - runtime.freeMemory()) / 1024L);
			if (j1 > 0x2000000 && lowMem) {
			}
			aTextDrawingArea_1271.method385(0xffff00, "Mem: " + j1 + "k", 299,
					5);
			aTextDrawingArea_1271.method385(0xffff00, "Mouse X: "
					+ super.mouseX + " , Mouse Y: " + super.mouseY, 314, 5);
			aTextDrawingArea_1271.method385(0xffff00,
					"Coords: " + x + ", " + y, 329, 5);
		}
		if (anInt1104 != 0) {
			int j = anInt1104 / 50;
			int l = j / 60;
			j %= 60;
			if (j < 10)
				aTextDrawingArea_1271.method385(0xffff00,
						"MasterScape update in: " + l + ":0" + j, 329, 4);
			else
				aTextDrawingArea_1271.method385(0xffff00,
						"MasterScape update in: " + l + ":" + j, 329, 4);
			anInt849++;
			if (anInt849 > 75) {
				anInt849 = 0;
				stream.createFrame(148);
			}
		}
	}

	private void drawStaffTab() {
		if (myPrivilege >= 6 && myPrivilege <= 8 && StaffTabInUse
				&& openInterfaceID == -1) {
			if (!staffTabOpen) {
				if (mouseInArea(496 - staffTabAnimations[0], 515, 7, 38)) {
					StaffToggle.drawSprite(496 - staffTabAnimations[0], 3,
							230 + staffTabAnimations[0]);
					if (staffTabAnimations[0] < 24)
						staffTabAnimations[0] += 2;
				} else {
					StaffToggle.drawSprite(496 - staffTabAnimations[0], 3,
							150 + staffTabAnimations[0]);
					if (staffTabAnimations[0] > 0)
						staffTabAnimations[0] -= 2;
				}
			} else {
				StaffToggle.drawSprite2(472, 3);
				staffTabAnimations[0] = 24;
				StaffType.drawSprite2(343, 3);
				// if(mouseInArea(363, 477, 9, 30))
				if (showedName.length() == 0) {
					DrawingArea.fillRect(9, 349, 120, 21, 0xFFFFA0);
					if (staffTabInput.length() == 0 && !writingOnStaffTab)
						newRegularFont.drawLeftAlignedString("Enter name...",
								351, 22, 0xFFFFFD, 0, true);
					else if (staffTabInput.length() > 0 && !writingOnStaffTab)
						newRegularFont.drawLeftAlignedString(staffTabInput,
								351, 22, 0xFFFFFD, 0, true);
					else if (writingOnStaffTab)
						newRegularFont.drawLeftAlignedString(staffTabInput
								+ ((loopCycle % 40 < 20) ? "|" : ""), 351, 22,
								0xFFFFFD, 0, true);
				} else if (showedName.equals("Error!")) {
					StaffError.drawSprite2(350, 9);
					newRegularFont.drawLeftAlignedString("Error!", 370, 22,
							0xF3DE42, 0, true);
				} else {
					newRegularFont.drawLeftAlignedString(showedName, 351, 22,
							0xFFFFFD, 0, true);
					StaffSelectBg.drawSprite(343, 33, 200);
					smallText.drawString(false, 376, 0xffffff, "Mute", 67);
					smallText.drawString(false, 376, 0xffffff, "IP Mute", 90);
					smallText.drawString(false, 376, 0xffffff, "Unmute", 113);
					smallText.drawString(false, 376, 0xffffff, "Jail", 136);
					smallText.drawString(false, 376, 0xffffff, "Unjail", 159);
					smallText.drawString(false, 442, 0xffffff, "Ban", 67);
					smallText.drawString(false, 442, 0xffffff, "IP Ban", 90);
					smallText.drawString(false, 442, 0xffffff, "Unban", 113);
					smallText.drawString(false, 442, 0xffffff, "Tele to", 136);
					smallText.drawString(false, 442, 0xffffff, "Tele to me",
							159);
					if (mouseInArea(355, 355 + 63, 54, 54 + 17))
						StaffSelectH.drawSprite2(355, 54);
					else
						StaffSelect.drawSprite2(355, 54);
					if (mouseInArea(355, 355 + 63, 77, 77 + 17))
						StaffSelectH.drawSprite2(355, 77);
					else
						StaffSelect.drawSprite2(355, 77);
					if (mouseInArea(355, 355 + 63, 100, 100 + 17))
						StaffSelectH.drawSprite2(355, 100);
					else
						StaffSelect.drawSprite2(355, 100);
					if (mouseInArea(355, 355 + 63, 123, 123 + 17))
						StaffSelectH.drawSprite2(355, 123);
					else
						StaffSelect.drawSprite2(355, 123);
					if (mouseInArea(355, 355 + 63, 146, 146 + 17))
						StaffSelectH.drawSprite2(355, 146);
					else
						StaffSelect.drawSprite2(355, 146);
					if (mouseInArea(421, 421 + 75, 54, 54 + 17))
						StaffSelectH.drawSprite2(421, 54);
					else
						StaffSelect.drawSprite2(421, 54);
					if (mouseInArea(421, 421 + 75, 77, 77 + 17))
						StaffSelectH.drawSprite2(421, 77);
					else
						StaffSelect.drawSprite2(421, 77);
					if (mouseInArea(421, 421 + 75, 100, 100 + 17))
						StaffSelectH.drawSprite2(421, 100);
					else
						StaffSelect.drawSprite2(421, 100);
					if (mouseInArea(421, 421 + 75, 123, 123 + 17))
						StaffSelectH.drawSprite2(421, 123);
					else
						StaffSelect.drawSprite2(421, 123);
					if (mouseInArea(421, 431 + 75, 146, 146 + 17))
						StaffSelectH.drawSprite2(421, 146);
					else
						StaffSelect.drawSprite2(421, 146);
					if (StaffTabSelected != -1) {
						int x = 0, y = 0;
						switch (StaffTabSelected) {
						case 0:
							x = 355;
							y = 54;
							break;
						case 1:
							x = 355;
							y = 77;
							break;
						case 2:
							x = 355;
							y = 100;
							break;
						case 3:
							x = 355;
							y = 123;
							break;
						case 4:
							x = 355;
							y = 146;
							break;
						case 5:
							x = 421;
							y = 54;
							break;
						case 6:
							x = 421;
							y = 77;
							break;
						case 7:
							x = 421;
							y = 100;
							break;
						case 8:
							x = 421;
							y = 123;
							break;
						case 9:
							x = 421;
							y = 146;
							break;
						}
						StaffSelected.drawSprite2(x, y);
						StaffSend.drawSprite(430 + staffTabAnimations[2], 182,
								staffTabAnimations[1]);
						if (staffTabAnimations[1] + 5 < 256)
							staffTabAnimations[1] += 5;
						if (mouseInArea(430, 490, 182, 213)
								&& staffTabAnimations[2] <= 8)
							staffTabAnimations[2] += 2;
						if (!mouseInArea(430, 490, 182, 213)
								&& staffTabAnimations[2] >= 2)
							staffTabAnimations[2] -= 2;
					} else {
						staffTabAnimations[1] = 0;
						staffTabAnimations[2] = 0;
					}
				}
			}
		}
	}

	private void addIgnore(long l) {
		try {
			if (l == 0L)
				return;
			if (ignoreCount >= 100) {
				pushMessage(
						"You have reached your max: 100 players in your ignore list.",
						0, "");
				return;
			}
			String s = TextClass.fixName(TextClass.nameForLong(l));
			for (int j = 0; j < ignoreCount; j++)
				if (ignoreListAsLongs[j] == l) {
					pushMessage(s + " is already on your ignore list", 0, "");
					return;
				}
			for (int k = 0; k < friendsCount; k++)
				if (friendsListAsLongs[k] == l) {
					pushMessage("Please remove " + s
							+ " from your friend list first", 0, "");
					return;
				}

			ignoreListAsLongs[ignoreCount++] = l;
			stream.createFrame(133);
			stream.writeQWord(l);
			return;
		} catch (RuntimeException runtimeexception) {
			signlink.reporterror("45688, " + l + ", " + 4 + ", "
					+ runtimeexception.toString());
		}
		throw new RuntimeException();
	}

	private void method114() {
		for (int i = -1; i < playerCount; i++) {
			int j;
			if (i == -1)
				j = myPlayerIndex;
			else
				j = playerIndices[i];
			Player player = playerArray[j];
			if (player != null)
				method96(player);
		}

	}

	private void method115() {
		if (loadingStage == 2) {
			for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
					.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
					.reverseGetNext()) {
				if (class30_sub1.anInt1294 > 0)
					class30_sub1.anInt1294--;
				if (class30_sub1.anInt1294 == 0) {
					if (class30_sub1.anInt1299 < 0
							|| ObjectManager.method178(class30_sub1.anInt1299,
									class30_sub1.anInt1301)) {
						method142(class30_sub1.anInt1298,
								class30_sub1.anInt1295, class30_sub1.anInt1300,
								class30_sub1.anInt1301, class30_sub1.anInt1297,
								class30_sub1.anInt1296, class30_sub1.anInt1299);
						class30_sub1.unlink();
					}
				} else {
					if (class30_sub1.anInt1302 > 0)
						class30_sub1.anInt1302--;
					if (class30_sub1.anInt1302 == 0
							&& class30_sub1.anInt1297 >= 1
							&& class30_sub1.anInt1298 >= 1
							&& class30_sub1.anInt1297 <= 102
							&& class30_sub1.anInt1298 <= 102
							&& (class30_sub1.anInt1291 < 0 || ObjectManager
									.method178(class30_sub1.anInt1291,
											class30_sub1.anInt1293))) {
						method142(class30_sub1.anInt1298,
								class30_sub1.anInt1295, class30_sub1.anInt1292,
								class30_sub1.anInt1293, class30_sub1.anInt1297,
								class30_sub1.anInt1296, class30_sub1.anInt1291);
						class30_sub1.anInt1302 = -1;
						if (class30_sub1.anInt1291 == class30_sub1.anInt1299
								&& class30_sub1.anInt1299 == -1)
							class30_sub1.unlink();
						else if (class30_sub1.anInt1291 == class30_sub1.anInt1299
								&& class30_sub1.anInt1292 == class30_sub1.anInt1300
								&& class30_sub1.anInt1293 == class30_sub1.anInt1301)
							class30_sub1.unlink();
					}
				}
			}

		}
	}

	private void determineMenuSize() {
		int i = chatTextDrawingArea.getTextWidth("Choose Option");
		for (int j = 0; j < menuActionRow; j++) {
			int k = chatTextDrawingArea.getTextWidth(menuActionName[j]);
			if (k > i)
				i = k;
		}
		i += 8;
		int l = 15 * menuActionRow + 21;
		if (super.saveClickX > 0 && super.saveClickY > 0
				&& super.saveClickX < 765 && super.saveClickY < 503) {
			int i1 = super.saveClickX - i / 2;
			if (i1 + i > 765) {
				i1 = 765 - i;
			}
			if (i1 < 0) {
				i1 = 0;
			}
			int l1 = super.saveClickY - 0;
			if (l1 + l > 503) {
				l1 = 503 - l;
			}
			if (l1 < 0) {
				l1 = 0;
			}
			menuOpen = true;
			menuOffsetX = i1;
			menuOffsetY = l1;
			menuWidth = i;
			menuHeight = 15 * menuActionRow + 22;
		}
	}

	private void method117(Stream stream) {
		stream.initBitAccess();
		int j = stream.readBits(1);
		if (j == 0)
			return;
		int k = stream.readBits(2);
		if (k == 0) {
			anIntArray894[anInt893++] = myPlayerIndex;
			return;
		}
		if (k == 1) {
			int l = stream.readBits(3);
			myPlayer.moveInDir(false, l);
			int k1 = stream.readBits(1);
			if (k1 == 1)
				anIntArray894[anInt893++] = myPlayerIndex;
			return;
		}
		if (k == 2) {
			int i1 = stream.readBits(3);
			myPlayer.moveInDir(true, i1);
			int l1 = stream.readBits(3);
			myPlayer.moveInDir(true, l1);
			int j2 = stream.readBits(1);
			if (j2 == 1)
				anIntArray894[anInt893++] = myPlayerIndex;
			return;
		}
		if (k == 3) {
			plane = stream.readBits(2);
			int j1 = stream.readBits(1);
			int i2 = stream.readBits(1);
			if (i2 == 1)
				anIntArray894[anInt893++] = myPlayerIndex;
			int k2 = stream.readBits(7);
			int l2 = stream.readBits(7);
			myPlayer.setPos(l2, k2, j1 == 1);
		}
	}

	private void nullLoader() {
		aBoolean831 = false;
		while (drawingFlames) {
			aBoolean831 = false;
			try {
				Thread.sleep(50L);
			} catch (Exception _ex) {
			}
		}
		titleBox = null;
		titleButton = null;
		aBackgroundArray1152s = null;
		anIntArray850 = null;
		anIntArray851 = null;
		anIntArray852 = null;
		anIntArray853 = null;
		anIntArray1190 = null;
		anIntArray1191 = null;
		anIntArray828 = null;
		aSprite_1201 = null;
		aSprite_1202 = null;
	}

	private boolean method119(int i, int j) {
		boolean flag1 = false;
		RSInterface class9 = RSInterface.interfaceCache[j];
		for (int k = 0; k < class9.children.length; k++) {
			if (class9.children[k] == -1)
				break;
			RSInterface class9_1 = RSInterface.interfaceCache[class9.children[k]];
			if (class9_1.interfaceType == 1)
				flag1 |= method119(i, class9_1.id);
			if (class9_1.interfaceType == 6
					&& (class9_1.disabledAnimation != -1 || class9_1.enabledAnimation != -1)) {
				boolean flag2 = interfaceIsSelected(class9_1);
				int l;
				if (flag2)
					l = class9_1.enabledAnimation;
				else
					l = class9_1.disabledAnimation;
				if (l != -1) {
					Animation animation = Animation.anims[l];
					for (class9_1.animationDelay += i; class9_1.animationDelay > animation
							.method258(class9_1.animationLength);) {
						class9_1.animationDelay -= animation
								.method258(class9_1.animationLength) + 1;
						class9_1.animationLength++;
						if (class9_1.animationLength >= animation.anInt352) {
							class9_1.animationLength -= animation.anInt356;
							if (class9_1.animationLength < 0
									|| class9_1.animationLength >= animation.anInt352)
								class9_1.animationLength = 0;
						}
						flag1 = true;
					}

				}
			}
		}

		return flag1;
	}

	private int method120() {
		int j = 3;
		if (yCameraCurve < 310) {
			int k = xCameraPos >> 7;
			int l = yCameraPos >> 7;
			int i1 = myPlayer.x >> 7;
			int j1 = myPlayer.y >> 7;
			if ((byteGroundArray[plane][k][l] & 4) != 0)
				j = plane;
			int k1;
			if (i1 > k)
				k1 = i1 - k;
			else
				k1 = k - i1;
			int l1;
			if (j1 > l)
				l1 = j1 - l;
			else
				l1 = l - j1;
			if (k1 > l1) {
				int i2 = (l1 * 0x10000) / k1;
				int k2 = 32768;
				while (k != i1) {
					if (k < i1)
						k++;
					else if (k > i1)
						k--;
					if ((byteGroundArray[plane][k][l] & 4) != 0)
						j = plane;
					k2 += i2;
					if (k2 >= 0x10000) {
						k2 -= 0x10000;
						if (l < j1)
							l++;
						else if (l > j1)
							l--;
						if ((byteGroundArray[plane][k][l] & 4) != 0)
							j = plane;
					}
				}
			} else {
				int j2 = (k1 * 0x10000) / l1;
				int l2 = 32768;
				while (l != j1) {
					if (l < j1)
						l++;
					else if (l > j1)
						l--;
					if ((byteGroundArray[plane][k][l] & 4) != 0)
						j = plane;
					l2 += j2;
					if (l2 >= 0x10000) {
						l2 -= 0x10000;
						if (k < i1)
							k++;
						else if (k > i1)
							k--;
						if ((byteGroundArray[plane][k][l] & 4) != 0)
							j = plane;
					}
				}
			}
		}
		if ((byteGroundArray[plane][myPlayer.x >> 7][myPlayer.y >> 7] & 4) != 0)
			j = plane;
		return j;
	}

	private int method121() {
		int j = method42(plane, yCameraPos, xCameraPos);
		if (j - zCameraPos < 800
				&& (byteGroundArray[plane][xCameraPos >> 7][yCameraPos >> 7] & 4) != 0)
			return plane;
		else
			return 3;
	}

	private void delIgnore(long l) {
		try {
			if (l == 0L)
				return;
			for (int j = 0; j < ignoreCount; j++)
				if (ignoreListAsLongs[j] == l) {
					ignoreCount--;
					System.arraycopy(ignoreListAsLongs, j + 1,
							ignoreListAsLongs, j, ignoreCount - j);

					stream.createFrame(74);
					stream.writeQWord(l);
					return;
				}

			return;
		} catch (RuntimeException runtimeexception) {
			signlink.reporterror("47229, " + 3 + ", " + l + ", "
					+ runtimeexception.toString());
		}
		throw new RuntimeException();
	}

	private void chatJoin(long l) {
		try {
			if (l == 0L)
				return;
			stream.createFrame(60);
			stream.writeQWord(l);
			return;
		} catch (RuntimeException runtimeexception) {
			signlink.reporterror("47229, " + 3 + ", " + l + ", "
					+ runtimeexception.toString());
		}
		throw new RuntimeException();

	}

	public String getParameter(String s) {
		if (signlink.mainapp != null)
			return signlink.mainapp.getParameter(s);
		else
			return super.getParameter(s);
	}

	private int extractInterfaceValues(RSInterface class9, int j) {
		if (class9.valueIndexArray == null
				|| j >= class9.valueIndexArray.length)
			return -2;
		try {
			int ai[] = class9.valueIndexArray[j];
			int k = 0;
			int l = 0;
			int i1 = 0;
			do {
				int j1 = ai[l++];
				int k1 = 0;
				byte byte0 = 0;
				if (j1 == 0)
					return k;
				if (j1 == 1)
					k1 = currentStats[ai[l++]];
				if (j1 == 2)
					k1 = maxStats[ai[l++]];
				if (j1 == 3)
					k1 = currentExp[ai[l++]];
				if (j1 == 4) {
					RSInterface class9_1 = RSInterface.interfaceCache[ai[l++]];
					int k2 = ai[l++];
					if (k2 >= 0 && k2 < ItemDef.totalItems
							&& (!ItemDef.forID(k2).membersObject || isMembers)) {
						for (int j3 = 0; j3 < class9_1.inventory.length; j3++)
							if (class9_1.inventory[j3] == k2 + 1)
								k1 += class9_1.inventoryValue[j3];

					}
				}
				if (j1 == 5)
					k1 = variousSettings[ai[l++]];
				if (j1 == 6)
					k1 = anIntArray1019[maxStats[ai[l++]] - 1];
				if (j1 == 7)
					k1 = (variousSettings[ai[l++]] * 100) / 46875;
				if (j1 == 8)
					k1 = myPlayer.combatLevel;
				if (j1 == 9) {
					for (int l1 = 0; l1 < Skills.skillsCount; l1++)
						if (Skills.skillEnabled[l1])
							k1 += maxStats[l1];

				}
				if (j1 == 10) {
					RSInterface class9_2 = RSInterface.interfaceCache[ai[l++]];
					int l2 = ai[l++] + 1;
					if (l2 >= 0 && l2 < ItemDef.totalItems
							&& (!ItemDef.forID(l2).membersObject || isMembers)) {
						for (int k3 = 0; k3 < class9_2.inventory.length; k3++) {
							if (class9_2.inventory[k3] != l2)
								continue;
							k1 = 0x3b9ac9ff;
							break;
						}

					}
				}
				if (j1 == 11)
					k1 = energy;
				if (j1 == 12)
					k1 = weight;
				if (j1 == 13) {
					int i2 = variousSettings[ai[l++]];
					int i3 = ai[l++];
					k1 = (i2 & 1 << i3) == 0 ? 0 : 1;
				}
				if (j1 == 14) {
					int j2 = ai[l++];
					VarBit varBit = VarBit.cache[j2];
					int l3 = varBit.anInt648;
					int i4 = varBit.anInt649;
					int j4 = varBit.anInt650;
					int k4 = anIntArray1232[j4 - i4];
					k1 = variousSettings[l3] >> i4 & k4;
				}
				if (j1 == 15)
					byte0 = 1;
				if (j1 == 16)
					byte0 = 2;
				if (j1 == 17)
					byte0 = 3;
				if (j1 == 18)
					k1 = (myPlayer.x >> 7) + baseX;
				if (j1 == 19)
					k1 = (myPlayer.y >> 7) + baseY;
				if (j1 == 20)
					k1 = ai[l++];
				if (byte0 == 0) {
					if (i1 == 0)
						k += k1;
					if (i1 == 1)
						k -= k1;
					if (i1 == 2 && k1 != 0)
						k /= k1;
					if (i1 == 3)
						k *= k1;
					i1 = 0;
				} else {
					i1 = byte0;
				}
			} while (true);
		} catch (Exception _ex) {
			return -1;
		}
	}

	private void drawTooltip() {
		if (menuActionRow < 2 && itemSelected == 0 && spellSelected == 0)
			return;
		String s;
		if (itemSelected == 1 && menuActionRow < 2)
			s = "Use " + selectedItemName + " with...";
		else if (spellSelected == 1 && menuActionRow < 2)
			s = spellTooltip + "...";
		else
			s = menuActionName[menuActionRow - 1];
		if (menuActionRow > 2)
			s = s + "@whi@ / " + (menuActionRow - 2) + " more options";
		chatTextDrawingArea.method390(4, 0xffffff, s, loopCycle / 1000, 15);
	}

	private void drawMinimap() {
		int compassX, compassY, MapY, MapX;
		if (is480 == true || is508 == true || is525 == true || is562 == true) {
			compassX = 11;
			compassY = 8;
			MapY = 9;
			MapX = 38;
		} else if (is474) {
			compassX = 30;
			compassY = 4;
			MapY = 9;
			MapX = 50;
		} else {
			compassX = 30 + 5;
			compassY = 4;
			MapY = 9;
			MapX = 50 + 6;
		}
		mapBackImage.initDrawingArea();
		if (anInt1021 == 2) {
			Black[getSpriteID()].drawSprite(0, 0);
			if (is480 == true || is508 == true || is525 == true
					|| is562 == true) {
				loadOrbs();
			}
			compass.method352(33, minimapInt1, anIntArray1057, 256,
					anIntArray968, 25, compassY, compassX - 1, 33, 25);
			if (menuOpen) {
				drawMenu(516, 0);
			}
			inGameScreen.initDrawingArea();
			return;
		}
		int i = minimapInt1 + minimapInt2 & 0x7ff;
		int j = 48 + myPlayer.x / 32;
		int l2 = 464 - myPlayer.y / 32;

		for (int j1 = 0; j1 < anIntArray1229.length; j1++) {
			anIntArray1229[j1] = 172;
			anIntArray1052[j1] = -22;
		}
		aSprite_1263.method352(152, i, anIntArray1229, 256 + minimapInt3,
				anIntArray1052, l2, MapY, MapX, 146, j);
		compass.method352(33, minimapInt1, anIntArray1057, 256, anIntArray968,
				25, compassY, compassX - 1, 33, 25);

		for (int j5 = 0; j5 < anInt1071; j5++) {
			try {
				int k = (anIntArray1072[j5] * 4 + 2) - myPlayer.x / 32;
				int i3 = (anIntArray1073[j5] * 4 + 2) - myPlayer.y / 32;
				markMinimap(aSpriteArray1140[j5], k, i3, false);
			} catch (Exception exception) {
			}
		}

		for (int k5 = 0; k5 < 104; k5++) {
			for (int l5 = 0; l5 < 104; l5++) {
				NodeList class19 = groundArray[plane][k5][l5];
				if (class19 != null) {
					int l = (k5 * 4 + 2) - myPlayer.x / 32;
					int j3 = (l5 * 4 + 2) - myPlayer.y / 32;
					markMinimap(mapDotItem, l, j3, false);
				}
			}
		}

		for (int i6 = 0; i6 < npcCount; i6++) {
			NPC npc = npcArray[npcIndices[i6]];
			if (npc != null && npc.isVisible()) {
				EntityDef entityDef = npc.desc;
				if (entityDef.childrenIDs != null)
					entityDef = entityDef.method161();
				if (entityDef != null && entityDef.aBoolean87
						&& entityDef.aBoolean84) {
					int i1 = npc.x / 32 - myPlayer.x / 32;
					int k3 = npc.y / 32 - myPlayer.y / 32;
					markMinimap(mapDotNPC, i1, k3, false);
				}
			}
		}
		for (int j6 = 0; j6 < playerCount; j6++) {
			Player player = playerArray[playerIndices[j6]];
			if (player != null && player.isVisible()) {
				int j1 = player.x / 32 - myPlayer.x / 32;
				int l3 = player.y / 32 - myPlayer.y / 32;
				boolean flag1 = false;
				boolean flag3 = false;
				for (int j3 = 0; j3 < clanList.length; j3++) {
					if (clanList[j3] == null)
						continue;
					if (!clanList[j3].equalsIgnoreCase(player.name))
						continue;
					flag3 = true;
					break;
				}
				long l6 = TextClass.longForName(player.name);
				for (int k6 = 0; k6 < friendsCount; k6++) {
					if (l6 != friendsListAsLongs[k6] || friendsNodeIDs[k6] == 0)
						continue;
					flag1 = true;
					break;
				}
				boolean flag2 = false;
				if (myPlayer.team != 0 && player.team != 0
						&& myPlayer.team == player.team)
					flag2 = true;
				if (flag1)
					markMinimap(mapDotFriend, j1, l3, false);
				else if (flag3)
					markMinimap(mapDotClan, j1, l3, false);
				else if (flag2)
					markMinimap(mapDotTeam, j1, l3, false);
				else
					markMinimap(mapDotPlayer, j1, l3, false);
			}
		}
		if (anInt855 != 0 && loopCycle % 20 < 10) {
			if (anInt855 == 1 && anInt1222 >= 0 && anInt1222 < npcArray.length) {
				NPC class30_sub2_sub4_sub1_sub1_1 = npcArray[anInt1222];
				if (class30_sub2_sub4_sub1_sub1_1 != null) {
					int k1 = class30_sub2_sub4_sub1_sub1_1.x / 32 - myPlayer.x
							/ 32;
					int i4 = class30_sub2_sub4_sub1_sub1_1.y / 32 - myPlayer.y
							/ 32;
					method81(mapMarker, i4, k1);
				}
			}
			if (anInt855 == 2) {
				int l1 = ((anInt934 - baseX) * 4 + 2) - myPlayer.x / 32;
				int j4 = ((anInt935 - baseY) * 4 + 2) - myPlayer.y / 32;
				method81(mapMarker, j4, l1);
			}
			if (anInt855 == 10 && anInt933 >= 0
					&& anInt933 < playerArray.length) {
				Player class30_sub2_sub4_sub1_sub2_1 = playerArray[anInt933];
				if (class30_sub2_sub4_sub1_sub2_1 != null) {
					int i2 = class30_sub2_sub4_sub1_sub2_1.x / 32 - myPlayer.x
							/ 32;
					int k4 = class30_sub2_sub4_sub1_sub2_1.y / 32 - myPlayer.y
							/ 32;
					method81(mapMarker, k4, i2);
				}
			}
		}
		if (destX != 0) {
			int j2 = (destX * 4 + 2) - myPlayer.x / 32;
			int l4 = (destY * 4 + 2) - myPlayer.y / 32;
			markMinimap(mapFlag, j2, l4, false);
		}
		CustomMapback[getSpriteID()].drawSprite(0, 0);
		if (is480 == true || is508 == true || is525 == true || is562 == true) {
			loadOrbs();
			DrawingArea.drawPixels(3, 84, 108, 0xffffff, 3);
		} else {
			DrawingArea.drawPixels(3, 84, 124, 0xffffff, 3);
		}
		if (menuOpen)
			drawMenu(516, 0);
		inGameScreen.initDrawingArea();
	}

	private void npcScreenPos(Entity entity, int i) {
		calcEntityScreenPos(entity.x, i, entity.y);
	}

	private void calcEntityScreenPos(int i, int j, int l) {
		if (i < 128 || l < 128 || i > 13056 || l > 13056) {
			spriteDrawX = -1;
			spriteDrawY = -1;
			return;
		}
		int i1 = method42(plane, l, i) - j;
		i -= xCameraPos;
		i1 -= zCameraPos;
		l -= yCameraPos;
		int j1 = Model.modelIntArray1[yCameraCurve];
		int k1 = Model.modelIntArray2[yCameraCurve];
		int l1 = Model.modelIntArray1[xCameraCurve];
		int i2 = Model.modelIntArray2[xCameraCurve];
		int j2 = l * l1 + i * i2 >> 16;
		l = l * i2 - i * l1 >> 16;
		i = j2;
		j2 = i1 * k1 - l * j1 >> 16;
		l = i1 * j1 + l * k1 >> 16;
		i1 = j2;
		if (l >= 50) {
			spriteDrawX = Texture.textureInt1 + (i << 9) / l;
			spriteDrawY = Texture.textureInt2 + (i1 << 9) / l;
		} else {
			spriteDrawX = -1;
			spriteDrawY = -1;
		}
	}

	private void buildSplitPrivateChatMenu() {
		if (splitPrivateChat == 0)
			return;
		int i = 0;
		if (anInt1104 != 0)
			i = 1;
		for (int j = 0; j < 100; j++)
			if (chatMessages[j] != null) {
				int k = chatTypes[j];
				String s = chatNames[j];
				/*
				 * This is where the assigns a @cr#@ "value" to each modIcon
				 * sprite in the split private chat. This is done by assigning a
				 * value to the byte0 variable.
				 * 
				 * @Variable s, This is the variable that signifies the player's
				 * name. It's used to tell the client where to start the name,
				 * wich would be after the @cr#@ value.
				 */
				if (s != null && s.startsWith("@cr0@")) {
					s = s.substring(5);
				}
				if (s != null && s.startsWith("@cr1@")) {
					s = s.substring(5);
				}
				if (s != null && s.startsWith("@cr2@")) {
					s = s.substring(5);
				}
				if (s != null && s.startsWith("@cr3@")) {
					s = s.substring(5);
				}
				if (s != null && s.startsWith("@cr4@")) {
					s = s.substring(5);
				}
				if (s != null && s.startsWith("@cr5@")) {
					s = s.substring(5);
				}
				if (s != null && s.startsWith("@cr6@")) {
					s = s.substring(5);
				}
				if (s != null && s.startsWith("@cr7@")) {
					s = s.substring(5);
				}
				if ((k == 3 || k == 7)
						&& (k == 7 || privateChatMode == 0 || privateChatMode == 1
								&& isFriendOrSelf(s))) {
					int l = 329 - i * 13;
					if (super.mouseX > 4 && super.mouseY - 4 > l - 10
							&& super.mouseY - 4 <= l + 3) {
						int i1 = aTextDrawingArea_1271.getTextWidth("From:  "
								+ s + chatMessages[j]) + 25;
						if (i1 > 450)
							i1 = 450;
						if (super.mouseX < 4 + i1) {
							if (myPrivilege >= 1) {
								menuActionName[menuActionRow] = "Report abuse";
								menuActionID[menuActionRow] = 2606;
								menuActionRow++;
							}
							menuActionName[menuActionRow] = "Add ignore" + s;
							;
							menuActionID[menuActionRow] = 42;
							menuActionRow++;
							menuActionName[menuActionRow] = "Add friend" + s;
							;
							menuActionID[menuActionRow] = 337;
							menuActionRow++;
						}
					}
					if (++i >= 5)
						return;
				}
				if ((k == 5 || k == 6) && privateChatMode < 2 && ++i >= 5)
					return;
			}

	}

	private void method130(int j, int k, int l, int i1, int j1, int k1, int l1,
			int i2, int j2) {
		Class30_Sub1 class30_sub1 = null;
		for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
				.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
				.reverseGetNext()) {
			if (class30_sub1_1.anInt1295 != l1
					|| class30_sub1_1.anInt1297 != i2
					|| class30_sub1_1.anInt1298 != j1
					|| class30_sub1_1.anInt1296 != i1)
				continue;
			class30_sub1 = class30_sub1_1;
			break;
		}

		if (class30_sub1 == null) {
			class30_sub1 = new Class30_Sub1();
			class30_sub1.anInt1295 = l1;
			class30_sub1.anInt1296 = i1;
			class30_sub1.anInt1297 = i2;
			class30_sub1.anInt1298 = j1;
			method89(class30_sub1);
			aClass19_1179.insertHead(class30_sub1);
		}
		class30_sub1.anInt1291 = k;
		class30_sub1.anInt1293 = k1;
		class30_sub1.anInt1292 = l;
		class30_sub1.anInt1302 = j2;
		class30_sub1.anInt1294 = j;
	}

	private boolean interfaceIsSelected(RSInterface class9) {
		if (class9.valueCompareType == null)
			return false;
		for (int i = 0; i < class9.valueCompareType.length; i++) {
			int j = extractInterfaceValues(class9, i);
			int k = class9.requiredValues[i];
			if (class9.valueCompareType[i] == 2) {
				if (j >= k)
					return false;
			} else if (class9.valueCompareType[i] == 3) {
				if (j <= k)
					return false;
			} else if (class9.valueCompareType[i] == 4) {
				if (j == k)
					return false;
			} else if (j != k)
				return false;
		}

		return true;
	}

	private void doFlamesDrawing() {
		char c = '\u0100';
		if (anInt1040 > 0) {
			for (int i = 0; i < 256; i++)
				if (anInt1040 > 768)
					anIntArray850[i] = method83(anIntArray851[i],
							anIntArray852[i], 1024 - anInt1040);
				else if (anInt1040 > 256)
					anIntArray850[i] = anIntArray852[i];
				else
					anIntArray850[i] = method83(anIntArray852[i],
							anIntArray851[i], 256 - anInt1040);

		} else if (anInt1041 > 0) {
			for (int j = 0; j < 256; j++)
				if (anInt1041 > 768)
					anIntArray850[j] = method83(anIntArray851[j],
							anIntArray853[j], 1024 - anInt1041);
				else if (anInt1041 > 256)
					anIntArray850[j] = anIntArray853[j];
				else
					anIntArray850[j] = method83(anIntArray853[j],
							anIntArray851[j], 256 - anInt1041);

		} else {
			System.arraycopy(anIntArray851, 0, anIntArray850, 0, 256);

		}
		System.arraycopy(aSprite_1201.myPixels, 0, leftSideFlame.anIntArray315,
				0, 33920);

		int i1 = 0;
		int j1 = 1152;
		for (int k1 = 1; k1 < c - 1; k1++) {
			int l1 = (anIntArray969[k1] * (c - k1)) / c;
			int j2 = 22 + l1;
			if (j2 < 0)
				j2 = 0;
			i1 += j2;
			for (int l2 = j2; l2 < 128; l2++) {
				int j3 = anIntArray828[i1++];
				if (j3 != 0) {
					int l3 = j3;
					int j4 = 256 - j3;
					j3 = anIntArray850[j3];
					int l4 = leftSideFlame.anIntArray315[j1];
					leftSideFlame.anIntArray315[j1++] = ((j3 & 0xff00ff) * l3
							+ (l4 & 0xff00ff) * j4 & 0xff00ff00)
							+ ((j3 & 0xff00) * l3 + (l4 & 0xff00) * j4 & 0xff0000) >> 8;
				} else {
					j1++;
				}
			}

			j1 += j2;
		}

		leftSideFlame.drawGraphics(0, super.graphics, 0);
		System.arraycopy(aSprite_1202.myPixels, 0,
				rightSideFlame.anIntArray315, 0, 33920);

		i1 = 0;
		j1 = 1176;
		for (int k2 = 1; k2 < c - 1; k2++) {
			int i3 = (anIntArray969[k2] * (c - k2)) / c;
			int k3 = 103 - i3;
			j1 += i3;
			for (int i4 = 0; i4 < k3; i4++) {
				int k4 = anIntArray828[i1++];
				if (k4 != 0) {
					int i5 = k4;
					int j5 = 256 - k4;
					k4 = anIntArray850[k4];
					int k5 = rightSideFlame.anIntArray315[j1];
					rightSideFlame.anIntArray315[j1++] = ((k4 & 0xff00ff) * i5
							+ (k5 & 0xff00ff) * j5 & 0xff00ff00)
							+ ((k4 & 0xff00) * i5 + (k5 & 0xff00) * j5 & 0xff0000) >> 8;
				} else {
					j1++;
				}
			}

			i1 += 128 - k3;
			j1 += 128 - k3 - i3;
		}

		rightSideFlame.drawGraphics(0, super.graphics, 637);
	}

	private void method134(Stream stream) {
		int j = stream.readBits(8);
		if (j < playerCount) {
			for (int k = j; k < playerCount; k++)
				anIntArray840[anInt839++] = playerIndices[k];

		}
		if (j > playerCount) {
			signlink.reporterror(myUsername + " Too many players");
			throw new RuntimeException("eek");
		}
		playerCount = 0;
		for (int l = 0; l < j; l++) {
			int i1 = playerIndices[l];
			Player player = playerArray[i1];
			int j1 = stream.readBits(1);
			if (j1 == 0) {
				playerIndices[playerCount++] = i1;
				player.anInt1537 = loopCycle;
			} else {
				int k1 = stream.readBits(2);
				if (k1 == 0) {
					playerIndices[playerCount++] = i1;
					player.anInt1537 = loopCycle;
					anIntArray894[anInt893++] = i1;
				} else if (k1 == 1) {
					playerIndices[playerCount++] = i1;
					player.anInt1537 = loopCycle;
					int l1 = stream.readBits(3);
					player.moveInDir(false, l1);
					int j2 = stream.readBits(1);
					if (j2 == 1)
						anIntArray894[anInt893++] = i1;
				} else if (k1 == 2) {
					playerIndices[playerCount++] = i1;
					player.anInt1537 = loopCycle;
					int i2 = stream.readBits(3);
					player.moveInDir(true, i2);
					int k2 = stream.readBits(3);
					player.moveInDir(true, k2);
					int l2 = stream.readBits(1);
					if (l2 == 1)
						anIntArray894[anInt893++] = i1;
				} else if (k1 == 3)
					anIntArray840[anInt839++] = i1;
			}
		}
	}

	public static void writeSettings() throws IOException {
		try {
			DataOutputStream out = new DataOutputStream(
					new BufferedOutputStream(new FileOutputStream(signlink
							.findcachedir() + "settings.dat")));
			out.writeUTF(myUsername);
			out.writeUTF(myPassword);
			out.close();
		} catch (Exception e) {
		}
	}

	public static void readSettings() throws IOException {
		try {
			DataInputStream in = new DataInputStream(new BufferedInputStream(
					new FileInputStream(signlink.findcachedir()
							+ "settings.dat")));
			myUsername = in.readUTF();
			myPassword = in.readUTF();
			in.close();
		} catch (Exception e) {
		}
	}

	private void drawLoginScreen(boolean flag) {
		if (normalLogin == true) {
			resetImageProducers();
		} else if (normalLogin == false) {
			if (!readRemember) {
				try {
					readSettings();
					readRemember = true;
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			resetImageProducers();
			loginScreenArea.initDrawingArea();
			byte abyte0[] = titleStreamLoader.getDataForName("title.dat");
			Sprite loginArea = new Sprite(abyte0, this);
			loginArea.drawSprite(0, 0);
			char c = '\u0168';
			if (loginScreenState == 0) {
				int i = 100;
				aTextDrawingArea_1271.method382(0x75a9a9, c / 190,
						onDemandFetcher.statusString, i, true); // Login
				if ((this.mouseX >= 300) && (this.mouseX <= 470)
						&& (this.mouseY >= 370) && (this.mouseY <= 408))
					this.loginHover.drawSprite(300, 369);
				if (this.RememberMe) {
					// smallText.method382(0xFF00FF, 277 ,"@gre@[X]", 340,
					// true);
					this.check.drawSprite(275, 334);
				}
				if (!this.RememberMe) {
					// smallText.method382(0xFF00FF, 277,"@red@[ ]", 340, true);
					// this.check.drawSprite(277, 340);
				}
				this.smallText.method382(16777215, 375, this.loginMessage1,
						243, true);
				this.smallText.method382(16777215, 375, this.loginMessage2,
						419, true);
				aTextDrawingArea_1271.method389(false, 282, 0xffffff,
						""
								+ (myUsername)
								+ ((loginScreenCursorPos == 0)
										& (loopCycle % 40 < 20) ? "@whi@|"
										: "@whi@"), 220);
				aTextDrawingArea_1271.method389(false, 282, 0xffffff,
						""
								+ TextClass.passwordAsterisks(myPassword)
								+ ((loginScreenCursorPos == 1)
										& (loopCycle % 40 < 20) ? "@whi@|"
										: "@whi@"), 305);
				loginScreenArea.drawGraphics(0, super.graphics, 0);
			}
		}
	}

	private void drawFlames() {
		if (normalLogin == true) {
			try {
				long l = System.currentTimeMillis();
				int i = 0;
				int j = 20;
				while (aBoolean831) {
					anInt1208++;
					if (normalLogin == true) {
						// calcFlamesPosition();
						// calcFlamesPosition();
					}
					doFlamesDrawing();
					if (++i > 10) {
						long l1 = System.currentTimeMillis();
						int k = (int) (l1 - l) / 10 - j;
						j = 40 - k;
						if (j < 5)
							j = 5;
						i = 0;
						l = l1;
					}
					try {
						Thread.sleep(j);
					} catch (Exception _ex) {
					}
				}
			} catch (Exception _ex) {
			}
			drawingFlames = false;
		} else if (normalLogin == false) {

		}
	}

	public void raiseWelcomeScreen() {
		welcomeScreenRaised = true;
	}

	private void method137(Stream stream, int j) {
		if (j == 84) {
			int k = stream.readUnsignedByte();
			int j3 = anInt1268 + (k >> 4 & 7);
			int i6 = anInt1269 + (k & 7);
			int l8 = stream.readUnsignedWord();
			int k11 = stream.readUnsignedWord();
			int l13 = stream.readUnsignedWord();
			if (j3 >= 0 && i6 >= 0 && j3 < 104 && i6 < 104) {
				NodeList class19_1 = groundArray[plane][j3][i6];
				if (class19_1 != null) {
					for (Item class30_sub2_sub4_sub2_3 = (Item) class19_1
							.reverseGetFirst(); class30_sub2_sub4_sub2_3 != null; class30_sub2_sub4_sub2_3 = (Item) class19_1
							.reverseGetNext()) {
						if (class30_sub2_sub4_sub2_3.ID != (l8 & 0x7fff)
								|| class30_sub2_sub4_sub2_3.anInt1559 != k11)
							continue;
						class30_sub2_sub4_sub2_3.anInt1559 = l13;
						break;
					}

					spawnGroundItem(j3, i6);
				}
			}
			return;
		}
		if (j == 105) {
			stream.readUnsignedByte();
			stream.readUnsignedWord();
			stream.readUnsignedByte();
		}
		if (j == 215) {
			int i1 = stream.method435();
			int l3 = stream.method428();
			int k6 = anInt1268 + (l3 >> 4 & 7);
			int j9 = anInt1269 + (l3 & 7);
			int i12 = stream.method435();
			int j14 = stream.readUnsignedWord();
			if (k6 >= 0 && j9 >= 0 && k6 < 104 && j9 < 104
					&& i12 != unknownInt10) {
				Item class30_sub2_sub4_sub2_2 = new Item();
				class30_sub2_sub4_sub2_2.ID = i1;
				class30_sub2_sub4_sub2_2.anInt1559 = j14;
				if (groundArray[plane][k6][j9] == null)
					groundArray[plane][k6][j9] = new NodeList();
				groundArray[plane][k6][j9].insertHead(class30_sub2_sub4_sub2_2);
				spawnGroundItem(k6, j9);
			}
			return;
		}
		if (j == 156) {
			int j1 = stream.method426();
			int i4 = anInt1268 + (j1 >> 4 & 7);
			int l6 = anInt1269 + (j1 & 7);
			int k9 = stream.readUnsignedWord();
			if (i4 >= 0 && l6 >= 0 && i4 < 104 && l6 < 104) {
				NodeList class19 = groundArray[plane][i4][l6];
				if (class19 != null) {
					for (Item item = (Item) class19.reverseGetFirst(); item != null; item = (Item) class19
							.reverseGetNext()) {
						if (item.ID != (k9 & 0x7fff))
							continue;
						item.unlink();
						break;
					}

					if (class19.reverseGetFirst() == null)
						groundArray[plane][i4][l6] = null;
					spawnGroundItem(i4, l6);
				}
			}
			return;
		}
		if (j == 160) {
			int k1 = stream.method428();
			int j4 = anInt1268 + (k1 >> 4 & 7);
			int i7 = anInt1269 + (k1 & 7);
			int l9 = stream.method428();
			int j12 = l9 >> 2;
			int k14 = l9 & 3;
			int j16 = anIntArray1177[j12];
			int j17 = stream.method435();
			if (j4 >= 0 && i7 >= 0 && j4 < 103 && i7 < 103) {
				int j18 = intGroundArray[plane][j4][i7];
				int i19 = intGroundArray[plane][j4 + 1][i7];
				int l19 = intGroundArray[plane][j4 + 1][i7 + 1];
				int k20 = intGroundArray[plane][j4][i7 + 1];
				if (j16 == 0) {
					Object1 class10 = worldController.method296(plane, j4, i7);
					if (class10 != null) {
						int k21 = class10.uid >> 14 & 0x7fff;
						if (j12 == 2) {
							class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
									k21, 4 + k14, 2, i19, l19, j18, k20, j17,
									false);
							class10.aClass30_Sub2_Sub4_279 = new Animable_Sub5(
									k21, k14 + 1 & 3, 2, i19, l19, j18, k20,
									j17, false);
						} else {
							class10.aClass30_Sub2_Sub4_278 = new Animable_Sub5(
									k21, k14, j12, i19, l19, j18, k20, j17,
									false);
						}
					}
				}
				if (j16 == 1) {
					Object2 class26 = worldController.method297(j4, i7, plane);
					if (class26 != null)
						class26.aClass30_Sub2_Sub4_504 = new Animable_Sub5(
								class26.uid >> 14 & 0x7fff, 0, 4, i19, l19,
								j18, k20, j17, false);
				}
				if (j16 == 2) {
					Object5 class28 = worldController.method298(j4, i7, plane);
					if (j12 == 11)
						j12 = 10;
					if (class28 != null)
						class28.aClass30_Sub2_Sub4_521 = new Animable_Sub5(
								class28.uid >> 14 & 0x7fff, k14, j12, i19, l19,
								j18, k20, j17, false);
				}
				if (j16 == 3) {
					Object3 class49 = worldController.method299(i7, j4, plane);
					if (class49 != null)
						class49.aClass30_Sub2_Sub4_814 = new Animable_Sub5(
								class49.uid >> 14 & 0x7fff, k14, 22, i19, l19,
								j18, k20, j17, false);
				}
			}
			return;
		}
		if (j == 147) {
			int l1 = stream.method428();
			int k4 = anInt1268 + (l1 >> 4 & 7);
			int j7 = anInt1269 + (l1 & 7);
			int i10 = stream.readUnsignedWord();
			byte byte0 = stream.method430();
			int l14 = stream.method434();
			byte byte1 = stream.method429();
			int k17 = stream.readUnsignedWord();
			int k18 = stream.method428();
			int j19 = k18 >> 2;
			int i20 = k18 & 3;
			int l20 = anIntArray1177[j19];
			byte byte2 = stream.readSignedByte();
			int l21 = stream.readUnsignedWord();
			byte byte3 = stream.method429();
			Player player;
			if (i10 == unknownInt10)
				player = myPlayer;
			else
				player = playerArray[i10];
			if (player != null) {
				ObjectDef class46 = ObjectDef.forID(l21);
				int i22 = intGroundArray[plane][k4][j7];
				int j22 = intGroundArray[plane][k4 + 1][j7];
				int k22 = intGroundArray[plane][k4 + 1][j7 + 1];
				int l22 = intGroundArray[plane][k4][j7 + 1];
				Model model = class46.method578(j19, i20, i22, j22, k22, l22,
						-1);
				if (model != null) {
					method130(k17 + 1, -1, 0, l20, j7, 0, plane, k4, l14 + 1);
					player.anInt1707 = l14 + loopCycle;
					player.anInt1708 = k17 + loopCycle;
					player.aModel_1714 = model;
					int i23 = class46.anInt744;
					int j23 = class46.anInt761;
					if (i20 == 1 || i20 == 3) {
						i23 = class46.anInt761;
						j23 = class46.anInt744;
					}
					player.anInt1711 = k4 * 128 + i23 * 64;
					player.anInt1713 = j7 * 128 + j23 * 64;
					player.anInt1712 = method42(plane, player.anInt1713,
							player.anInt1711);
					if (byte2 > byte0) {
						byte byte4 = byte2;
						byte2 = byte0;
						byte0 = byte4;
					}
					if (byte3 > byte1) {
						byte byte5 = byte3;
						byte3 = byte1;
						byte1 = byte5;
					}
					player.anInt1719 = k4 + byte2;
					player.anInt1721 = k4 + byte0;
					player.anInt1720 = j7 + byte3;
					player.anInt1722 = j7 + byte1;
				}
			}
		}
		if (j == 151) {
			int i2 = stream.method426();
			int l4 = anInt1268 + (i2 >> 4 & 7);
			int k7 = anInt1269 + (i2 & 7);
			int j10 = stream.method434();
			int k12 = stream.method428();
			int i15 = k12 >> 2;
			int k16 = k12 & 3;
			int l17 = anIntArray1177[i15];
			if (l4 >= 0 && k7 >= 0 && l4 < 104 && k7 < 104)
				method130(-1, j10, k16, l17, k7, i15, plane, l4, 0);
			return;
		}
		if (j == 4) {
			int j2 = stream.readUnsignedByte();
			int i5 = anInt1268 + (j2 >> 4 & 7);
			int l7 = anInt1269 + (j2 & 7);
			int k10 = stream.readUnsignedWord();
			int l12 = stream.readUnsignedByte();
			int j15 = stream.readUnsignedWord();
			if (i5 >= 0 && l7 >= 0 && i5 < 104 && l7 < 104) {
				i5 = i5 * 128 + 64;
				l7 = l7 * 128 + 64;
				Animable_Sub3 class30_sub2_sub4_sub3 = new Animable_Sub3(plane,
						loopCycle, j15, k10, method42(plane, l7, i5) - l12, l7,
						i5);
				aClass19_1056.insertHead(class30_sub2_sub4_sub3);
			}
			return;
		}
		if (j == 44) {
			int k2 = stream.method436();
			int j5 = stream.readUnsignedWord();
			int i8 = stream.readUnsignedByte();
			int l10 = anInt1268 + (i8 >> 4 & 7);
			int i13 = anInt1269 + (i8 & 7);
			if (l10 >= 0 && i13 >= 0 && l10 < 104 && i13 < 104) {
				Item class30_sub2_sub4_sub2_1 = new Item();
				class30_sub2_sub4_sub2_1.ID = k2;
				class30_sub2_sub4_sub2_1.anInt1559 = j5;
				if (groundArray[plane][l10][i13] == null)
					groundArray[plane][l10][i13] = new NodeList();
				groundArray[plane][l10][i13]
						.insertHead(class30_sub2_sub4_sub2_1);
				spawnGroundItem(l10, i13);
			}
			return;
		}
		if (j == 101) {
			int l2 = stream.method427();
			int k5 = l2 >> 2;
			int j8 = l2 & 3;
			int i11 = anIntArray1177[k5];
			int j13 = stream.readUnsignedByte();
			int k15 = anInt1268 + (j13 >> 4 & 7);
			int l16 = anInt1269 + (j13 & 7);
			if (k15 >= 0 && l16 >= 0 && k15 < 104 && l16 < 104)
				method130(-1, -1, j8, i11, l16, k5, plane, k15, 0);
			return;
		}
		if (j == 117) {
			int i3 = stream.readUnsignedByte();
			int l5 = anInt1268 + (i3 >> 4 & 7);
			int k8 = anInt1269 + (i3 & 7);
			int j11 = l5 + stream.readSignedByte();
			int k13 = k8 + stream.readSignedByte();
			int l15 = stream.readSignedWord();
			int i17 = stream.readUnsignedWord();
			int i18 = stream.readUnsignedByte() * 4;
			int l18 = stream.readUnsignedByte() * 4;
			int k19 = stream.readUnsignedWord();
			int j20 = stream.readUnsignedWord();
			int i21 = stream.readUnsignedByte();
			int j21 = stream.readUnsignedByte();
			if (l5 >= 0 && k8 >= 0 && l5 < 104 && k8 < 104 && j11 >= 0
					&& k13 >= 0 && j11 < 104 && k13 < 104 && i17 != 65535) {
				l5 = l5 * 128 + 64;
				k8 = k8 * 128 + 64;
				j11 = j11 * 128 + 64;
				k13 = k13 * 128 + 64;
				Animable_Sub4 class30_sub2_sub4_sub4 = new Animable_Sub4(i21,
						l18, k19 + loopCycle, j20 + loopCycle, j21, plane,
						method42(plane, k8, l5) - i18, k8, l5, l15, i17);
				class30_sub2_sub4_sub4.method455(k19 + loopCycle, k13,
						method42(plane, k13, j11) - l18, j11);
				aClass19_1013.insertHead(class30_sub2_sub4_sub4);
			}
		}
	}

	private void method139(Stream stream) {
		stream.initBitAccess();
		int k = stream.readBits(8);
		if (k < npcCount) {
			for (int l = k; l < npcCount; l++)
				anIntArray840[anInt839++] = npcIndices[l];

		}
		if (k > npcCount) {
			signlink.reporterror(myUsername + " Too many npcs");
			throw new RuntimeException("eek");
		}
		npcCount = 0;
		for (int i1 = 0; i1 < k; i1++) {
			int j1 = npcIndices[i1];
			NPC npc = npcArray[j1];
			int k1 = stream.readBits(1);
			if (k1 == 0) {
				npcIndices[npcCount++] = j1;
				npc.anInt1537 = loopCycle;
			} else {
				int l1 = stream.readBits(2);
				if (l1 == 0) {
					npcIndices[npcCount++] = j1;
					npc.anInt1537 = loopCycle;
					anIntArray894[anInt893++] = j1;
				} else if (l1 == 1) {
					npcIndices[npcCount++] = j1;
					npc.anInt1537 = loopCycle;
					int i2 = stream.readBits(3);
					npc.moveInDir(false, i2);
					int k2 = stream.readBits(1);
					if (k2 == 1)
						anIntArray894[anInt893++] = j1;
				} else if (l1 == 2) {
					npcIndices[npcCount++] = j1;
					npc.anInt1537 = loopCycle;
					int j2 = stream.readBits(3);
					npc.moveInDir(true, j2);
					int l2 = stream.readBits(3);
					npc.moveInDir(true, l2);
					int i3 = stream.readBits(1);
					if (i3 == 1)
						anIntArray894[anInt893++] = j1;
				} else if (l1 == 3)
					anIntArray840[anInt839++] = j1;
			}
		}

	}

	private void processLoginScreenInput() {
		if (normalLogin == true) {
			if (loginScreenState == 0) {
				int i = super.myWidth / 2 - 80;
				int l = super.myHeight / 2 + 20;
				l += 20;
				if (super.clickMode3 == 1 && super.saveClickX >= i - 75
						&& super.saveClickX <= i + 75
						&& super.saveClickY >= l - 20
						&& super.saveClickY <= l + 20) {
					loginScreenState = 3;
					loginScreenCursorPos = 0;
				}
				i = super.myWidth / 2 + 80;
				if (super.clickMode3 == 1 && super.saveClickX >= i - 75
						&& super.saveClickX <= i + 75
						&& super.saveClickY >= l - 20
						&& super.saveClickY <= l + 20) {
					loginMessage1 = "";
					loginMessage2 = "Enter your username & password.";
					loginScreenState = 2;
					loginScreenCursorPos = 0;
				}
			} else {
				if (loginScreenState == 2) {
					int j = super.myHeight / 2 - 40;
					j += 30;
					j += 25;
					if (super.clickMode3 == 1 && super.saveClickY >= j - 15
							&& super.saveClickY < j)
						loginScreenCursorPos = 0;
					j += 15;
					if (super.clickMode3 == 1 && super.saveClickY >= j - 15
							&& super.saveClickY < j)
						loginScreenCursorPos = 1;
					j += 15;
					int i1 = super.myWidth / 2 - 80;
					int k1 = super.myHeight / 2 + 50;
					k1 += 20;
					if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
							&& super.saveClickX <= i1 + 75
							&& super.saveClickY >= k1 - 20
							&& super.saveClickY <= k1 + 20) {
						loginFailures = 0;
						login(capitalize(myUsername), myPassword, false);
						if (loggedIn)
							return;
					}
					i1 = super.myWidth / 2 + 80;
					if (super.clickMode3 == 1 && super.saveClickX >= i1 - 75
							&& super.saveClickX <= i1 + 75
							&& super.saveClickY >= k1 - 20
							&& super.saveClickY <= k1 + 20) {
						loginScreenState = 0;
						myUsername = "";
						myPassword = "";
					}
					do {
						int l1 = readChar(-796);
						if (l1 == -1)
							break;
						boolean flag1 = false;
						for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
							if (l1 != validUserPassChars.charAt(i2))
								continue;
							flag1 = true;
							break;
						}
						if (loginScreenCursorPos == 0) {
							if (l1 == 8 && myUsername.length() > 0)
								myUsername = myUsername.substring(0,
										myUsername.length() - 1);
							if (l1 == 9 || l1 == 10 || l1 == 13)
								loginScreenCursorPos = 1;
							if (flag1)
								myUsername += (char) l1;
							if (myUsername.length() > 12)
								myUsername = capitalize(myUsername.substring(0,
										12));
						} else if (loginScreenCursorPos == 1) {
							if (l1 == 8 && myPassword.length() > 0)
								myPassword = myPassword.substring(0,
										myPassword.length() - 1);
							if (l1 == 9 || l1 == 10 || l1 == 13)
								loginScreenCursorPos = 0;
							if (flag1)
								myPassword += (char) l1;
							if (myPassword.length() > 20)
								myPassword = myPassword.substring(0, 20);
						}
					} while (true);
					return;
				}
				if (loginScreenState == 3) {
					int k = super.myWidth / 2;
					int j1 = super.myHeight / 2 + 50;
					j1 += 20;
					if (super.clickMode3 == 1 && super.saveClickX >= k - 75
							&& super.saveClickX <= k + 75
							&& super.saveClickY >= j1 - 20
							&& super.saveClickY <= j1 + 20)
						loginScreenState = 0;
				}
			}
		}
		if (normalLogin == false) {
			if (this.loginScreenState == 0) {
				int l = super.myHeight / 2 + 20;
				l += 20;
				int i = this.myHeight / 2 - 40;
				i += 30;
				i += 25;
				resetImageProducers();
				if (super.clickMode3 == 1 && super.saveClickX >= 279
						&& super.saveClickX <= 293 && super.saveClickY >= 336
						&& super.saveClickY <= 353) {
					if (RememberMe) {
						RememberMe = false;
					} else {
						RememberMe = true;
					}
				}
				if (super.clickMode3 == 1 && super.saveClickX >= 268
						&& super.saveClickX <= 490 && super.saveClickY >= 200
						&& super.saveClickY <= 234)
					loginScreenCursorPos = 0;
				if (super.clickMode3 == 1 && super.mouseX >= 268
						&& super.mouseX <= 488 && super.mouseY >= 284
						&& super.mouseY <= 316)
					loginScreenCursorPos = 1;
				if (super.clickMode3 == 1 && super.saveClickX >= 300
						&& super.saveClickX <= 471 && super.saveClickY >= 370
						&& super.saveClickY <= 409) { // MEOWMEOW
					loginFailures = 0;
					if ((myUsername.length() > 0) && (myPassword.length() > 0)) {
						login(myUsername, myPassword, false);
					} else {
						this.loginScreenCursorPos = 0;
						this.loginMessage1 = "Username & Password";
						this.loginMessage2 = "@red@Both must be more than 1 character!";
					}
					if (this.loggedIn)
						readRemember = false;
					return;
				}
				do {
					int l1 = readChar(-796);
					if (l1 == -1)
						break;
					boolean flag1 = false;
					for (int i2 = 0; i2 < validUserPassChars.length(); i2++) {
						if (l1 != validUserPassChars.charAt(i2))
							continue;
						flag1 = true;
						break;
					}

					if (loginScreenCursorPos == 0) {
						if (l1 == 8 && myUsername.length() > 0)
							myUsername = myUsername.substring(0,
									myUsername.length() - 1);
						if (l1 == 9 || l1 == 10 || l1 == 13)
							loginScreenCursorPos = 1;
						if (flag1)
							myUsername += (char) l1;
						if (myUsername.length() > 12)
							myUsername = myUsername.substring(0, 12);
					} else if (loginScreenCursorPos == 1) {
						if (l1 == 8 && myPassword.length() > 0)
							myPassword = myPassword.substring(0,
									myPassword.length() - 1);
						if (l1 == 9 || l1 == 10 || l1 == 13)
							login(myUsername, myPassword, false);
						if (flag1)
							myPassword += (char) l1;
						if (myPassword.length() > 20)
							myPassword = myPassword.substring(0, 20);
					}
				} while (true);
				return;
			}
			if (loginScreenState == 3) {
				int k = super.myWidth / 2;
				int j1 = super.myHeight / 2 + 50;
				j1 += 20;
				if (super.clickMode3 == 1 && super.saveClickX >= k - 75
						&& super.saveClickX <= k + 75
						&& super.saveClickY >= j1 - 20
						&& super.saveClickY <= j1 + 20)
					loginScreenState = 0;
			}
		}
	}

	public boolean mouseInArea(int xMin, int xMax, int yMin, int yMax) {
		return super.mouseX >= xMin && super.mouseX <= xMax
				&& super.mouseY >= yMin && super.mouseY <= yMax;
	}

	public boolean mouseLeftClickInArea(int xMin, int xMax, int yMin, int yMax) {
		return super.clickMode3 == 1 && super.saveClickX >= xMin
				&& super.saveClickX <= xMax && super.saveClickY >= yMin
				&& super.saveClickY <= yMax;
	}

	private void markMinimap(Sprite sprite, int i, int j, boolean flag) {
		int k = minimapInt1 + minimapInt2 & 0x7ff;
		int l = i * i + j * j;
		if (flag)
			return;
		if (l > 6400)
			return;
		int i1 = Model.modelIntArray1[k];
		int j1 = Model.modelIntArray2[k];
		i1 = (i1 * 256) / (minimapInt3 + 256);
		j1 = (j1 * 256) / (minimapInt3 + 256);
		int k1 = j * i1 + i * j1 >> 16;
		int l1 = j * j1 - i * i1 >> 16;
		if (is480 == true || is508 == true || is525 == true || is562 == true) {
			sprite.drawSprite(((106 + k1) - sprite.maxWidth / 2) + 4, 89 - l1
					- sprite.maxHeight / 2 - 4);
		} else {
			sprite.drawSprite(((122 + k1) - sprite.maxWidth / 2) + 4, 89 - l1
					- sprite.maxHeight / 2 - 4);
		}
		CustomMapback[getSpriteID()].drawSprite(0, 0);
	}

	public int flagPos = 72;
	public int runState = 1;
	public boolean logHover = false;
	public boolean xpHover = false;
	public boolean xpClicked = false;
	public boolean drawXpBar = false;
	public boolean drawFlag = false;
	public int xpToDraw = 0;
	public int testXp = 0;
	public Sprite[] globe = new Sprite[3];
	public Sprite[] ORBS = new Sprite[18];
	public Sprite[] LOGOUT = new Sprite[5];
	public Sprite xpOrb;
	public Sprite sprite1;
	public Sprite xpFlag;

	public static boolean globeState[] = { false, false };

	public void drawXpOrb() {
		if (super.mouseX >= 516 && super.mouseX <= 550 && super.mouseY >= 46
				&& super.mouseY <= 80) {
			xpHover = true;
		} else {
			xpHover = false;
		}
		if (super.clickMode3 == 1 && super.saveClickX >= 516
				&& super.saveClickX <= 550 && super.saveClickY >= 46
				&& super.saveClickY <= 80) {
			if (!xpClicked) {
				xpClicked = true;
				drawXpBar = true;
			} else {
				xpClicked = false;
				drawXpBar = false;
			}
		}
		if (!xpClicked) {
			if (!xpHover) {
				ORBS[17].drawSprite(0, 46);
			} else {
				ORBS[16].drawSprite(0, 46);
			}
		} else {
			if (!xpHover) {
				ORBS[17].drawSprite(0, 46);
			} else {
				ORBS[16].drawSprite(0, 46);
			}
		}
	}

	public void drawGlobe() {
		if (is508 == true || is525 == true || is562 == true) {
			if (super.clickMode3 == 1) {
				if (super.saveClickX >= 522 && super.saveClickX <= 558
						&& super.saveClickY >= 124 && super.saveClickY < 161) {
					if (globeState[0]) {
						globeState[0] = false;
					} else {
						globeState[0] = true;
					}
				}
			}
			if (super.mouseX >= 522 && super.mouseX <= 558
					&& super.mouseY >= 124 && super.mouseY < 161) {
				globeState[1] = true;
			} else {
				globeState[1] = false;
			}
		} else {
		}
	}

	public void drawLogout() {
		if (is508 || is525 || is562) {
			if (!logHover) {
				LOGOUT[0].drawSprite(226, 1);
			} else {
				LOGOUT[1].drawSprite(226, 1);
			}
			if (super.clickMode2 == 1 && super.mouseX >= 765 - 24
					&& super.mouseX <= 765 && super.mouseY >= 1
					&& super.mouseY <= 25) {
				LOGOUT[2].drawSprite(226, 1);
			}
		} else if (is480) {
			if (tabID == 14) {
				LOGOUT[4].drawSprite(226, 1);
			}
			if (tabID != 14) {
				LOGOUT[3].drawSprite(226, 1);
			}
		}
	}

	public void loadOrbs() {
		drawLogout();
		drawHP();
		if (is562) {
			drawXpOrb();
		}
		drawPrayer();
		drawRunOrb();
		if (is508 == true) {
			globe[0].drawSprite(10, 123);
		} else if (is525 == true || is562 == true) {
			drawGlobe();
			if (globeState[0] && globeState[1]) {
				globe[2].drawSprite(10, 123);
			} else if (globeState[1]) {
				globe[2].drawSprite(10, 123);
			} else if (globeState[0]) {
				globe[1].drawSprite(10, 123);
			} else {
				globe[1].drawSprite(10, 123);
			}
		}
	}

	public Sprite[] Black = new Sprite[5];

	public void loadExtraSprites() {
		magicAuto = new Sprite("Misc/magicAuto");
		sprite1 = new Sprite("Gameframe/sprite1");
		xpFlag = new Sprite("Gameframe/xpFlag");
		for (int i = 1; i <= 17; i++) {
			ORBS[i] = new Sprite("Gameframe/Orbs/ORBS " + i + "");
		}
		for (int i = 0; i <= 4; i++) {
			LOGOUT[i] = new Sprite("Gameframe/Orbs/X " + i + "");
		}
		for (int j3 = 0; j3 <= 26; j3++) {
			LOGIN[j3] = new Sprite("Login/Buttons/BUTTON " + j3 + "");
		}
		for (int i = 0; i <= 2; i++) {
			globe[i] = new Sprite("Gameframe/Globe " + i + "");
		}
		for (int i = 0; i <= 4; i++) {
			chatArea[i] = new Sprite("Gameframe/Gameframes/chatArea " + i + "");
		}
		for (int i = 0; i <= 4; i++) {
			tabArea[i] = new Sprite("Gameframe/Gameframes/tabArea " + i + "");
		}
		for (int i = 0; i <= 4; i++) {
			CustomMapback[i] = new Sprite("Gameframe/Gameframes/Mapback " + i
					+ "");
		}
		for (int i = 0; i <= 7; i++) {
			modIcons[i] = new Sprite("Player/MODICONS " + i + "");
		}
		for (int i = 0; i <= 7; i++) {
			chatImages[i] = new Sprite("Player/MODICONS " + i + "");
		}
		for (int i = 0; i <= 4; i++) {
			Black[i] = new Sprite("Gameframe/Gameframes/Black " + i + "");
		}
		for (int i4 = 0; i4 < 3; i4++) {
			hitMark[i4] = new Sprite("Player/Hits " + i4 + "");
		}
		qc = new Sprite("Gameframe/Quickchat");
	}

	public boolean restOrb = false;
	public boolean musicOrb = false;
	public boolean prayClicked = false;
	public boolean prayHover = false;
	public boolean runClicked = true;
	public boolean runHover = false;
	public Sprite magicAuto;
	public boolean Autocast = false;
	public int autocastId = 0;

	private void rightClickChatButtons() {
		if (is480 == true || is508 == true || is525 == true || is562 == true) {
			if (super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= 482
					&& super.mouseY <= 503) {
				menuActionName[1] = "View All";
				menuActionID[1] = 999;
				menuActionRow = 2;
			} else if (super.mouseX >= 62 && super.mouseX <= 117
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "View Game";
				menuActionID[1] = 998;
				menuActionRow = 2;
			} else if (super.mouseX >= 119 && super.mouseX <= 174
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Hide public";
				menuActionID[1] = 997;
				menuActionName[2] = "Off public";
				menuActionID[2] = 996;
				menuActionName[3] = "Friends public";
				menuActionID[3] = 995;
				menuActionName[4] = "On public";
				menuActionID[4] = 994;
				menuActionName[5] = "View public";
				menuActionID[5] = 993;
				menuActionRow = 6;
			} else if (super.mouseX >= 176 && super.mouseX <= 231
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Off private";
				menuActionID[1] = 992;
				menuActionName[2] = "Friends private";
				menuActionID[2] = 991;
				menuActionName[3] = "On private";
				menuActionID[3] = 990;
				menuActionName[4] = "View private";
				menuActionID[4] = 989;
				menuActionRow = 5;
			} else if (super.mouseX >= 233 && super.mouseX <= 288
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Off clan chat";
				menuActionID[1] = 1003;
				menuActionName[2] = "Friends clan chat";
				menuActionID[2] = 1002;
				menuActionName[3] = "On clan chat";
				menuActionID[3] = 1001;
				menuActionName[4] = "View clan chat";
				menuActionID[4] = 1000;
				menuActionRow = 5;
			} else if (super.mouseX >= 290 && super.mouseX <= 345
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Off trade";
				menuActionID[1] = 987;
				menuActionName[2] = "Friends trade";
				menuActionID[2] = 986;
				menuActionName[3] = "On trade";
				menuActionID[3] = 985;
				menuActionName[4] = "View trade";
				menuActionID[4] = 984;
				menuActionRow = 5;
			} else if (super.mouseX >= 347 && super.mouseX <= 402
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Off assist";
				menuActionID[1] = -1;
				menuActionName[2] = "Friends assist";
				menuActionID[2] = -1;
				menuActionName[3] = "On assist";
				menuActionID[3] = -1;
				menuActionName[4] = "View assist";
				menuActionID[4] = -1;
				menuActionRow = 5;
			} else if (super.mouseX >= 404 && super.mouseX <= 514
					&& super.mouseY >= 480 && super.mouseY <= 501) {
				menuActionName[1] = "Report Abuse";
				menuActionID[1] = 606;
				menuActionRow = 2;
			}
		} else if (is474) {
			if (super.mouseX >= 5 && super.mouseX <= 61 && super.mouseY >= 482
					&& super.mouseY <= 503) {
				menuActionName[1] = "View All";
				menuActionID[1] = 999;
				menuActionRow = 2;
			} else if (super.mouseX >= 71 && super.mouseX <= 127
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "View Game";
				menuActionID[1] = 998;
				menuActionRow = 2;
			} else if (super.mouseX >= 137 && super.mouseX <= 193
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Hide public";
				menuActionID[1] = 997;
				menuActionName[2] = "Off public";
				menuActionID[2] = 996;
				menuActionName[3] = "Friends public";
				menuActionID[3] = 995;
				menuActionName[4] = "On public";
				menuActionID[4] = 994;
				menuActionName[5] = "View public";
				menuActionID[5] = 993;
				menuActionRow = 6;
			} else if (super.mouseX >= 203 && super.mouseX <= 259
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Off private";
				menuActionID[1] = 992;
				menuActionName[2] = "Friends private";
				menuActionID[2] = 991;
				menuActionName[3] = "On private";
				menuActionID[3] = 990;
				menuActionName[4] = "View private";
				menuActionID[4] = 989;
				menuActionRow = 5;
			} else if (super.mouseX >= 269 && super.mouseX <= 325
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Off clan chat";
				menuActionID[1] = 1003;
				menuActionName[2] = "Friends clan chat";
				menuActionID[2] = 1002;
				menuActionName[3] = "On clan chat";
				menuActionID[3] = 1001;
				menuActionName[4] = "View clan chat";
				menuActionID[4] = 1000;
				menuActionRow = 5;
			} else if (super.mouseX >= 335 && super.mouseX <= 391
					&& super.mouseY >= 482 && super.mouseY <= 503) {
				menuActionName[1] = "Off trade";
				menuActionID[1] = 987;
				menuActionName[2] = "Friends trade";
				menuActionID[2] = 986;
				menuActionName[3] = "On trade";
				menuActionID[3] = 985;
				menuActionName[4] = "View trade";
				menuActionID[4] = 984;
				menuActionRow = 5;
			} else if (super.mouseX >= 404 && super.mouseX <= 514
					&& super.mouseY >= 480 && super.mouseY <= 501) {
				menuActionName[1] = "Report Abuse";
				menuActionID[1] = 606;
				menuActionRow = 2;
			}
		} else {

		}

	}

	public void determineTopTabs() {
		if (is474 || is480 || is508 || is525) {
			if (super.mouseX >= 522 && super.mouseX <= 559
					&& super.mouseY >= 168 && super.mouseY < 203) {
				menuActionName[1] = "Combat Options";
				menuActionID[1] = 1021;
				menuActionRow = 2;
			} else if (super.mouseX >= 560 && super.mouseX <= 592
					&& super.mouseY >= 168 && super.mouseY < 203) {
				menuActionName[1] = "Stats";
				menuActionID[1] = 1022;
				menuActionRow = 2;
			} else if (super.mouseX >= 593 && super.mouseX <= 625
					&& super.mouseY >= 168 && super.mouseY < 203) {
				menuActionName[1] = "Quest List";
				menuActionID[1] = 1023;
				menuActionRow = 2;
			} else if (super.mouseX >= 626 && super.mouseX <= 658
					&& super.mouseY >= 168 && super.mouseY < 203) {
				menuActionName[1] = "Inventory";
				menuActionID[1] = 1024;
				menuActionRow = 2;
			} else if (super.mouseX >= 659 && super.mouseX <= 691
					&& super.mouseY >= 168 && super.mouseY < 203) {
				menuActionName[1] = "Worn Equipment";
				menuActionID[1] = 1030;
				menuActionRow = 2;
			} else if (super.mouseX >= 692 && super.mouseX <= 724
					&& super.mouseY >= 168 && super.mouseY < 203) {
				menuActionName[1] = "Prayer";
				menuActionID[1] = 1026;
				menuActionRow = 2;
			} else if (super.mouseX >= 725 && super.mouseX <= 762
					&& super.mouseY >= 168 && super.mouseY < 203) {
				menuActionName[1] = "Magic";
				menuActionID[1] = 1027;
				menuActionRow = 2;
			}
		} else if (is562) {

		}
	}

	public void determineBottomTabs() {
		if (is480 || is508 || is525) {
			if (super.mouseX >= 522 && super.mouseX <= 559
					&& super.mouseY >= 466 && super.mouseY < 503) {
				menuActionName[1] = "Logout";
				menuActionID[1] = 1502;
				menuActionRow = 2;
			} else if (super.mouseX >= 626 && super.mouseX <= 658
					&& super.mouseY >= 466 && super.mouseY < 503) {
				menuActionName[1] = "Clan Chat";
				menuActionID[1] = 1008;
				menuActionRow = 2;
			} else if (super.mouseX >= 742 && super.mouseX <= 764
					&& super.mouseY >= 1 && super.mouseY <= 23) {
				menuActionName[1] = "Logout";
				menuActionID[1] = 1011;
				menuActionRow = 2;
			}
		} else if (is474 && !is562) {
			if (super.mouseX >= 522 && super.mouseX <= 559
					&& super.mouseY >= 466 && super.mouseY < 503) {
				menuActionName[1] = "Clan Chat";
				menuActionID[1] = 1008;
				menuActionRow = 2;
			} else if (super.mouseX >= 626 && super.mouseX <= 658
					&& super.mouseY >= 466 && super.mouseY < 503) {
				menuActionName[1] = "Logout";
				menuActionID[1] = 1011;
				menuActionRow = 2;
			}
		} else if (is562) {
			if (super.mouseX >= 521 && super.mouseX <= 550
					&& super.mouseY >= 169 && super.mouseY < 205) {
				tabHPos = 0;
				tabAreaAltered = true;
			} else if (super.mouseX >= 552 && super.mouseX <= 581
					&& super.mouseY >= 168 && super.mouseY < 205) {
				tabHPos = 1;
				tabAreaAltered = true;
			} else if (super.mouseX >= 582 && super.mouseX <= 611
					&& super.mouseY >= 168 && super.mouseY < 205) {
				tabHPos = 2;
				tabAreaAltered = true;
			} else if (super.mouseX >= 612 && super.mouseX <= 641
					&& super.mouseY >= 168 && super.mouseY < 203) {
				tabHPos = 3;
				tabAreaAltered = true;
			} else if (super.mouseX >= 642 && super.mouseX <= 671
					&& super.mouseY >= 168 && super.mouseY < 205) {
				tabHPos = 4;
				tabAreaAltered = true;
			} else if (super.mouseX >= 672 && super.mouseX <= 701
					&& super.mouseY >= 168 && super.mouseY < 205) {
				tabHPos = 5;
				tabAreaAltered = true;
			} else if (super.mouseX >= 702 && super.mouseX <= 731
					&& super.mouseY >= 169 && super.mouseY < 205) {
				tabHPos = 6;
				tabAreaAltered = true;
			} else if (super.mouseX >= 732 && super.mouseX <= 761
					&& super.mouseY >= 169 && super.mouseY < 205) {
				tabHPos = 7;
				tabAreaAltered = true;
			} else if (super.mouseX >= 522 && super.mouseX <= 551
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 15;
				tabAreaAltered = true;
			} else if (super.mouseX >= 552 && super.mouseX <= 581
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 8;
				tabAreaAltered = true;
			} else if (super.mouseX >= 582 && super.mouseX <= 611
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 9;
				tabAreaAltered = true;
			} else if (super.mouseX >= 612 && super.mouseX <= 641
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 10;
				tabAreaAltered = true;
			} else if (super.mouseX >= 642 && super.mouseX <= 671
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 11;
				tabAreaAltered = true;
			} else if (super.mouseX >= 672 && super.mouseX <= 701
					&& super.mouseY >= 466 && super.mouseY < 503) {
				tabHPos = 12;
				tabAreaAltered = true;
			} else if (super.mouseX >= 702 && super.mouseX <= 731
					&& super.mouseY >= 466 && super.mouseY < 502) {
				tabHPos = 13;
				tabAreaAltered = true;
			} else if (super.mouseX >= 732 && super.mouseX <= 761
					&& super.mouseY >= 466 && super.mouseY < 502) {
				tabHPos = 14;
				tabAreaAltered = true;
			} else {
				tabHPos = -1;
				tabAreaAltered = true;
			}
			if (super.clickMode3 == 1) {
				if (super.saveClickX >= 522 && super.saveClickX <= 551
						&& super.saveClickY >= 169 && super.saveClickY < 205
						&& tabInterfaceIDs[0] != -1) {
					tabID = 0;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 552 && super.saveClickX <= 581
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[1] != -1) {
					tabID = 1;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 582 && super.saveClickX <= 611
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[2] != -1) {
					tabID = 2;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 612 && super.saveClickX <= 641
						&& super.saveClickY >= 168 && super.saveClickY < 203
						&& tabInterfaceIDs[14] != -1) {
					tabID = 14;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 642 && super.saveClickX <= 671
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[3] != -1) {
					tabID = 3;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 672 && super.saveClickX <= 701
						&& super.saveClickY >= 168 && super.saveClickY < 205
						&& tabInterfaceIDs[4] != -1) {
					tabID = 4;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 702 && super.saveClickX <= 731
						&& super.saveClickY >= 169 && super.saveClickY < 205
						&& tabInterfaceIDs[5] != -1) {
					tabID = 5;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 732 && super.saveClickX <= 761
						&& super.saveClickY >= 169 && super.saveClickY < 205
						&& tabInterfaceIDs[6] != -1) {
					tabID = 6;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 522 && super.saveClickX <= 551
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[16] != -1) {
					tabID = 16;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 552 && super.saveClickX <= 581
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[8] != -1) {
					tabID = 8;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 582 && super.saveClickX <= 611
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[9] != -1) {
					tabID = 9;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 612 && super.saveClickX <= 641
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[7] != -1) {
					tabID = 7;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 642 && super.saveClickX <= 671
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[11] != -1) {
					tabID = 11;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 672 && super.saveClickX <= 701
						&& super.saveClickY >= 466 && super.saveClickY < 503
						&& tabInterfaceIDs[12] != -1) {
					tabID = 12;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 702 && super.saveClickX <= 731
						&& super.saveClickY >= 466 && super.saveClickY < 502
						&& tabInterfaceIDs[13] != -1) {
					tabID = 13;
					tabAreaAltered = true;
				} else if (super.saveClickX >= 732 && super.saveClickX <= 761
						&& super.saveClickY >= 466 && super.saveClickY < 502
						&& tabInterfaceIDs[15] != -1) {
					tabID = 15;
					tabAreaAltered = true;
				}
			}

		}
		if (is474 || is480 || is508 || is525) {
			if (super.mouseX >= 560 && super.mouseX <= 592
					&& super.mouseY >= 466 && super.mouseY < 503) {
				menuActionName[1] = "Friend List";
				menuActionID[1] = 1009;
				menuActionRow = 2;
			} else if (super.mouseX >= 593 && super.mouseX <= 625
					&& super.mouseY >= 466 && super.mouseY < 503) {
				menuActionName[1] = "Ignore List";
				menuActionID[1] = 1010;
				menuActionRow = 2;
			} else if (super.mouseX >= 659 && super.mouseX <= 691
					&& super.mouseY >= 466 && super.mouseY < 503) {
				menuActionName[1] = "Options";
				menuActionID[1] = 1012;
				menuActionRow = 2;
			} else if (super.mouseX >= 692 && super.mouseX <= 724
					&& super.mouseY >= 466 && super.mouseY < 503) {
				menuActionName[1] = "Emotes";
				menuActionID[1] = 1013;
				menuActionRow = 2;
			}
		}
	}

	private void processMinimapActions() {

		if (is508 == true || is525 == true || is562 == true) {
			if (super.mouseX >= 527 && super.mouseX <= 560
					&& super.mouseY >= 126 && super.mouseY <= 159) {
				menuActionName[1] = "Forums";
				menuActionID[1] = 1005;
				menuActionRow = 2;
			}
			if (super.mouseX >= 706 && super.mouseX <= 762
					&& super.mouseY >= 95 && super.mouseY < 128) {
				if (!runClicked) {
					menuActionName[2] = "Toggle Run-Mode On";
				} else if (runClicked) {
					menuActionName[2] = "Toggle Run-Mode Off";
				}
				menuActionID[2] = 1050;
				menuActionRow = 2;
				menuActionName[1] = "Rest";
				menuActionID[1] = 1501;
				menuActionRow = 3;
			}
			if (super.mouseX >= 516 && super.mouseX <= 550
					&& super.mouseY >= 46 && super.mouseY < 80) {
				menuActionName[2] = "Toggle XP Total";
				menuActionID[2] = 1503;
				menuActionRow = 2;
				menuActionName[1] = "Reset XP Total";
				menuActionID[1] = 1504;
				menuActionRow = 3;
			}
			if (super.mouseX >= 706 && super.mouseX <= 762
					&& super.mouseY >= 52 && super.mouseY < 87) {
				if (!prayClicked) {
					menuActionName[1] = "Toggle Quick-Prayers On";
				} else if (prayClicked) {
					menuActionName[1] = "Toggle Quick-Prayers Off";
				}
				menuActionID[1] = 1500;
				menuActionRow = 2;
			}
			if ((this.myPrivilege >= 5) && (this.myPrivilege <= 8)
					&& (this.StaffTabInUse) && (openInterfaceID == -1)) {
				if (mouseInArea(484, 515, 0, 35)) {
					this.menuActionName[1] = "Toggle staff options";
					this.menuActionID[1] = 1900;
					this.menuActionRow = 2;
				}
				if ((mouseInArea(363, 477, 9, 30)) && (this.staffTabOpen)) {
					this.menuActionName[1] = "Enter name";
					this.menuActionID[1] = 1901;
					this.menuActionRow = 2;
				}
				if ((mouseInArea(430, 490, 182, 213))
						&& (this.StaffTabSelected != -1)) {
					this.menuActionName[1] = "Send action";
					this.menuActionID[1] = 1912;
					this.menuActionRow = 2;
				}
				if ((!this.showedName.equals("Error!"))
						&& (!this.showedName.equals(""))) {
					if (mouseInArea(355, 418, 54, 71)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1902;
						this.menuActionRow = 2;
					} else if (mouseInArea(355, 418, 77, 94)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1903;
						this.menuActionRow = 2;
					} else if (mouseInArea(355, 418, 100, 117)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1904;
						this.menuActionRow = 2;
					} else if (mouseInArea(355, 418, 123, 140)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1905;
						this.menuActionRow = 2;
					} else if (mouseInArea(355, 418, 146, 163)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1906;
						this.menuActionRow = 2;
					} else if (mouseInArea(421, 496, 54, 71)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1907;
						this.menuActionRow = 2;
					} else if (mouseInArea(421, 496, 77, 94)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1908;
						this.menuActionRow = 2;
					} else if (mouseInArea(421, 496, 100, 117)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1909;
						this.menuActionRow = 2;
					} else if (mouseInArea(421, 496, 123, 140)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1910;
						this.menuActionRow = 2;
					} else if (mouseInArea(421, 496, 146, 163)) {
						this.menuActionName[1] = "Select";
						this.menuActionID[1] = 1911;
						this.menuActionRow = 2;
					}

				}

			}
			if (super.mouseX >= 706 && super.mouseX <= 762
					&& super.mouseY >= 52 && super.mouseY < 87) {
				if (!prayClicked) {
					menuActionName[1] = "Toggle Quick-Prayers On";
				} else if (prayClicked) {
					menuActionName[1] = "Toggle Quick-Prayers Off";
				}
				menuActionID[1] = 1500;
				menuActionRow = 2;
			}
		}
	}

	public int getOrbTextColor(int statusInt) {
		if (statusInt >= 75 && statusInt <= 100) {
			return 0x00FF00;
		} else if (statusInt >= 50 && statusInt <= 74) {
			return 0xFFFF00;
		} else if (statusInt >= 25 && statusInt <= 49) {
			return 0xFF981F;
		} else {
			return 0xFF0000;
		}
	}

	public int getOrbFill(int statusInt) {
		if (statusInt <= 100 && statusInt >= 97) {
			return 0;
		} else if (statusInt <= 96 && statusInt >= 93) {
			return 1;
		} else if (statusInt <= 92 && statusInt >= 89) {
			return 2;
		} else if (statusInt <= 88 && statusInt >= 85) {
			return 3;
		} else if (statusInt <= 84 && statusInt >= 81) {
			return 4;
		} else if (statusInt <= 80 && statusInt >= 77) {
			return 5;
		} else if (statusInt <= 76 && statusInt >= 73) {
			return 6;
		} else if (statusInt <= 72 && statusInt >= 69) {
			return 7;
		} else if (statusInt <= 68 && statusInt >= 65) {
			return 8;
		} else if (statusInt <= 64 && statusInt >= 61) {
			return 9;
		} else if (statusInt <= 60 && statusInt >= 57) {
			return 10;
		} else if (statusInt <= 56 && statusInt >= 53) {
			return 11;
		} else if (statusInt <= 52 && statusInt >= 49) {
			return 12;
		} else if (statusInt <= 48 && statusInt >= 45) {
			return 13;
		} else if (statusInt <= 44 && statusInt >= 41) {
			return 14;
		} else if (statusInt <= 40 && statusInt >= 37) {
			return 15;
		} else if (statusInt <= 36 && statusInt >= 33) {
			return 16;
		} else if (statusInt <= 32 && statusInt >= 29) {
			return 17;
		} else if (statusInt <= 28 && statusInt >= 25) {
			return 18;
		} else if (statusInt <= 24 && statusInt >= 21) {
			return 19;
		} else if (statusInt <= 20 && statusInt >= 17) {
			return 20;
		} else if (statusInt <= 16 && statusInt >= 13) {
			return 21;
		} else if (statusInt <= 12 && statusInt >= 9) {
			return 22;
		} else if (statusInt <= 8 && statusInt >= 7) {
			return 23;
		} else if (statusInt <= 6 && statusInt >= 5) {
			return 24;
		} else if (statusInt <= 4 && statusInt >= 3) {
			return 25;
		} else if (statusInt <= 2 && statusInt >= 1) {
			return 26;
		} else if (statusInt <= 0) {
			return 27;
		}
		return 0;
	}

	public void drawHP() {
		int health;
		String OrbDirectory = signlink.findcachedir()
				+ "/Sprites/Gameframe/Orbs/";
		String cHP = RSInterface.interfaceCache[7175].disabledMessage;
		cHP = cHP.replaceAll("%", "");
		int currentHP = Integer.parseInt(cHP);
		String mHP = RSInterface.interfaceCache[7176].disabledMessage;
		mHP = mHP.replaceAll("%", "");
		int maxHP2 = Integer.parseInt(mHP);
		health = (int) (((double) currentHP / (double) maxHP2) * 100D);
		ORBS[0] = new Sprite(OrbDirectory + "ORBS 0.PNG", 27,
				getOrbFill(health));
		if (is480) {
			ORBS[14].drawSprite(174, 14);
		} else {
			ORBS[1].drawSprite(174, 14);
		}
		ORBS[2].drawSprite(177, 17);
		ORBS[0].drawSprite(177, 17);
		if (health <= 20) {
			if (loopCycle % 20 < 10) {
				ORBS[3].drawSprite(183, 25);
			}
		} else {
			ORBS[3].drawSprite(183, 25);
		}
		int Y = 40;
		if (is480) {
			Y = 43;
		}
		smallText
				.method382(getOrbTextColor(health), 218,
						RSInterface.interfaceCache[7175].disabledMessage + "0",
						Y, true);
	}

	public void drawPrayer() {
		int prayer;
		String OD = signlink.findcachedir() + "/Sprites/Gameframe/Orbs/";
		String cPR = RSInterface.interfaceCache[7167].disabledMessage;
		int currentPR = Integer.parseInt(cPR);
		String mPR = RSInterface.interfaceCache[7168].disabledMessage;
		int maxPR2 = Integer.parseInt(mPR);
		prayer = (int) (((double) currentPR / (double) maxPR2) * 100D);
		ORBS[0] = new Sprite(OD + "ORBS 0.PNG", 27, getOrbFill(prayer));
		if (!prayClicked) {
			if (!is480) {
				if (prayHover) {
					ORBS[7].drawSprite(190, 53);
				} else if (!prayHover) {
					ORBS[1].drawSprite(190, 53);
				}
			} else {
				if (prayHover) {
					ORBS[15].drawSprite(190, 53);
				} else {
					ORBS[14].drawSprite(190, 53);
				}
			}
			ORBS[4].drawSprite(193, 56);
		} else if (prayClicked) {
			if (!is480) {
				if (prayHover) {
					ORBS[7].drawSprite(190, 53);
				} else if (!prayHover) {
					ORBS[1].drawSprite(190, 53);
				}
			} else {
				if (prayHover) {
					ORBS[15].drawSprite(190, 53);
				} else {
					ORBS[14].drawSprite(190, 53);
				}
			}
			ORBS[5].drawSprite(193, 56);
		}
		ORBS[0].drawSprite(194, 56);
		if (prayer <= 25) {
			if (loopCycle % 20 < 10) {
				ORBS[6].drawSprite(197, 60);
			}
		} else {
			ORBS[6].drawSprite(197, 60);
		}
		int Y = 79;
		if (is480) {
			Y = 82;
		}
		smallText.method382(getOrbTextColor(prayer), 234,
				RSInterface.interfaceCache[7167].disabledMessage, Y, true);
	}

	public void drawRunOrb() {
		String OD = signlink.findcachedir() + "/Sprites/Gameframe/Orbs/";
		String cEn = RSInterface.interfaceCache[149].disabledMessage;
		cEn = cEn.replaceAll("%", "");
		int currentEner = Integer.parseInt(cEn);
		energy = (int) (((double) currentEner / 100) * 100D);
		ORBS[0] = new Sprite(OD + "ORBS 0.PNG", 27, getOrbFill(energy));
		if (!runClicked) {
			if (!is480) {
				if (runHover) {
					ORBS[7].drawSprite(190, 92);
				} else {
					ORBS[1].drawSprite(190, 92);
				}
			} else {
				ORBS[14].drawSprite(190, 92);
			}
			ORBS[10].drawSprite(193, 95);
			if (energy != 100) {
				ORBS[0].drawSprite(193, 95);
			}
			ORBS[8].drawSprite(199, 100);
		} else {
			if (!is480) {
				if (runHover) {
					ORBS[7].drawSprite(190, 92);
				} else {
					ORBS[1].drawSprite(190, 92);
				}
			} else {
				ORBS[14].drawSprite(190, 92);
			}
			ORBS[11].drawSprite(193, 95);
			if (energy != 100) {
				ORBS[0].drawSprite(193, 95);
			}
			ORBS[9].drawSprite(199, 100);
		}
		int Y = 117;
		if (is480) {
			Y = 120;
		}
		smallText.method382(getOrbTextColor(energy), 234, "" + energy, Y, true);
	}

	private void method142(int i, int j, int k, int l, int i1, int j1, int k1) {
		if (i1 >= 1 && i >= 1 && i1 <= 102 && i <= 102) {
			if (lowMem && j != plane)
				return;
			int i2 = 0;
			if (j1 == 0)
				i2 = worldController.method300(j, i1, i);
			if (j1 == 1)
				i2 = worldController.method301(j, i1, i);
			if (j1 == 2)
				i2 = worldController.method302(j, i1, i);
			if (j1 == 3)
				i2 = worldController.method303(j, i1, i);
			if (i2 != 0) {
				int i3 = worldController.method304(j, i1, i, i2);
				int j2 = i2 >> 14 & 0x7fff;
				int k2 = i3 & 0x1f;
				int l2 = i3 >> 6;
				if (j1 == 0) {
					worldController.method291(i1, j, i, (byte) -119);
					ObjectDef class46 = ObjectDef.forID(j2);
					if (class46.aBoolean767)
						aClass11Array1230[j].method215(l2, k2,
								class46.aBoolean757, i1, i);
				}
				if (j1 == 1)
					worldController.method292(i, j, i1);
				if (j1 == 2) {
					worldController.method293(j, i1, i);
					ObjectDef class46_1 = ObjectDef.forID(j2);
					if (i1 + class46_1.anInt744 > 103
							|| i + class46_1.anInt744 > 103
							|| i1 + class46_1.anInt761 > 103
							|| i + class46_1.anInt761 > 103)
						return;
					if (class46_1.aBoolean767)
						aClass11Array1230[j].method216(l2, class46_1.anInt744,
								i1, i, class46_1.anInt761,
								class46_1.aBoolean757);
				}
				if (j1 == 3) {
					worldController.method294(j, i, i1);
					ObjectDef class46_2 = ObjectDef.forID(j2);
					if (class46_2.aBoolean767 && class46_2.hasActions)
						aClass11Array1230[j].method218(i, i1);
				}
			}
			if (k1 >= 0) {
				int j3 = j;
				if (j3 < 3 && (byteGroundArray[1][i1][i] & 2) == 2)
					j3++;
				ObjectManager.method188(worldController, k, i, l, j3,
						aClass11Array1230[j], intGroundArray, i1, k1, j);
			}
		}
	}

	private void updatePlayers(int i, Stream stream) {
		anInt839 = 0;
		anInt893 = 0;
		method117(stream);
		method134(stream);
		method91(stream, i);
		method49(stream);
		for (int k = 0; k < anInt839; k++) {
			int l = anIntArray840[k];
			if (playerArray[l].anInt1537 != loopCycle)
				playerArray[l] = null;
		}

		if (stream.currentOffset != i) {
			signlink.reporterror("Error packet size mismatch in getplayer pos:"
					+ stream.currentOffset + " psize:" + i);
			throw new RuntimeException("eek");
		}
		for (int i1 = 0; i1 < playerCount; i1++)
			if (playerArray[playerIndices[i1]] == null) {
				signlink.reporterror(myUsername
						+ " null entry in pl list - pos:" + i1 + " size:"
						+ playerCount);
				throw new RuntimeException("eek");
			}

	}

	private void setCameraPos(int j, int k, int l, int i1, int j1, int k1) {
		int l1 = 2048 - k & 0x7ff;
		int i2 = 2048 - j1 & 0x7ff;
		int j2 = 0;
		int k2 = 0;
		int l2 = j;
		if (l1 != 0) {
			int i3 = Model.modelIntArray1[l1];
			int k3 = Model.modelIntArray2[l1];
			int i4 = k2 * k3 - l2 * i3 >> 16;
			l2 = k2 * i3 + l2 * k3 >> 16;
			k2 = i4;
		}
		if (i2 != 0) {
			/*
			 * xxx if(cameratoggle){ if(zoom == 0) zoom = k2; if(lftrit == 0)
			 * lftrit = j2; if(fwdbwd == 0) fwdbwd = l2; k2 = zoom; j2 = lftrit;
			 * l2 = fwdbwd; }
			 */
			int j3 = Model.modelIntArray1[i2];
			int l3 = Model.modelIntArray2[i2];
			int j4 = l2 * j3 + j2 * l3 >> 16;
			l2 = l2 * l3 - j2 * j3 >> 16;
			j2 = j4;
		}
		xCameraPos = l - j2;
		zCameraPos = i1 - k2;
		yCameraPos = k1 - l2;
		yCameraCurve = k;
		xCameraCurve = j1;
	}

	public void updateStrings(String str, int i) {
		switch (i) {
		case 1675:
			sendFrame126(str, 17508);
			break;// Stab
		case 1676:
			sendFrame126(str, 17509);
			break;// Slash
		case 1677:
			sendFrame126(str, 17510);
			break;// Cursh
		case 1678:
			sendFrame126(str, 17511);
			break;// Magic
		case 1679:
			sendFrame126(str, 17512);
			break;// Range
		case 1680:
			sendFrame126(str, 17513);
			break;// Stab
		case 1681:
			sendFrame126(str, 17514);
			break;// Slash
		case 1682:
			sendFrame126(str, 17515);
			break;// Crush
		case 1683:
			sendFrame126(str, 17516);
			break;// Magic
		case 1684:
			sendFrame126(str, 17517);
			break;// Range
		case 1686:
			sendFrame126(str, 17518);
			break;// Strength
		case 1687:
			sendFrame126(str, 17519);
			break;// Prayer
		}
	}

	public void sendFrame126(String str, int i) {
		RSInterface.interfaceCache[i].disabledMessage = str;
		if (RSInterface.interfaceCache[i].parentID == tabInterfaceIDs[tabID]) {
		}
	}

	public void sendString(int identifier, String text) {
		text = identifier + "," + text;
		stream.createFrame(127);
		stream.writeWordBigEndian(text.length() + 1);
		stream.writeString(text);
	}

	public void sendPacket185(int button, int toggle, int interfaceType) {
		System.out.println("button: " + button + ", type: " + interfaceType);
		switch (interfaceType) {
		case 135:
			RSInterface class9 = RSInterface.interfaceCache[button];
			boolean flag8 = true;
			if (class9.contentType > 0)
				flag8 = promptUserForInput(class9);
			if (flag8) {
				stream.createFrame(185);
				stream.writeWord(button);
			}
			break;
		case 646:
			stream.createFrame(185);
			stream.writeWord(button);
			RSInterface class9_2 = RSInterface.interfaceCache[button];
			if (class9_2.valueIndexArray != null
					&& class9_2.valueIndexArray[0][0] == 5) {
				toggle = class9_2.valueIndexArray[0][1];
				if (variousSettings[toggle] != class9_2.requiredValues[0]) {
					variousSettings[toggle] = class9_2.requiredValues[0];
					method33(toggle);
				}
			}
			switch (button) {
			// clan chat
			case 50001:
				if (RSInterface.interfaceCache[50007].disabledMessage
						.toLowerCase().contains("join")) {
					inputTaken = true;
					inputDialogState = 0;
					messagePromptRaised = true;
					promptInput = "";
					friendsListAction = 6;
					aString1121 = "Enter the name of the chat you wish to join";
				} else {
					sendString(0, "");
				}
				break;
			case 50004:
				openInterfaceID = 18300;
				break;
			case 18526:
				inputTaken = true;
				inputDialogState = 0;
				messagePromptRaised = true;
				promptInput = "";
				friendsListAction = 9;
				aString1121 = "Enter a name to add";
				break;
			case 18527:
				inputTaken = true;
				inputDialogState = 0;
				messagePromptRaised = true;
				promptInput = "";
				friendsListAction = 10;
				aString1121 = "Enter a name to add";
				break;
			case 22762:
				openInterfaceID = 23471;// Pouch interface
				break;
			case 23475:
				openInterfaceID = 22760;// Scroll interface
				break;
			}
			break;
		case 169:
			stream.createFrame(185);
			stream.writeWord(button);
			RSInterface class9_3 = RSInterface.interfaceCache[button];
			if (class9_3.valueIndexArray != null
					&& class9_3.valueIndexArray[0][0] == 5) {
				variousSettings[toggle] = 1 - variousSettings[toggle];
				method33(toggle);
			}
			switch (button) {
			case 19136:
				System.out.println("toggle = " + toggle);
				if (toggle == 0)
					sendFrame36(173, toggle);
				if (toggle == 1)
					sendPacket185(153, 173, 646);
				break;
			}
			break;
		}
	}

	public void sendFrame36(int id, int state) {
		anIntArray1045[id] = state;
		if (variousSettings[id] != state) {
			variousSettings[id] = state;
			method33(id);
			if (dialogID != -1)
				inputTaken = true;
		}
	}

	public void sendFrame219() {

		if (invOverlayInterfaceID != -1) {
			invOverlayInterfaceID = -1;
			tabAreaAltered = true;
		}
		if (backDialogID != -1) {
			backDialogID = -1;
			inputTaken = true;
		}
		if (inputDialogState != 0) {
			inputDialogState = 0;
			inputTaken = true;
		}
		openInterfaceID = -1;
		aBoolean1149 = false;
	}

	public void sendFrame248(int interfaceID, int sideInterfaceID) {
		if (backDialogID != -1) {
			backDialogID = -1;
			inputTaken = true;
		}
		if (inputDialogState != 0) {
			inputDialogState = 0;
			inputTaken = true;
		}
		openInterfaceID = interfaceID;
		invOverlayInterfaceID = sideInterfaceID;
		tabAreaAltered = true;
		aBoolean1149 = false;
	}

	private boolean parsePacket() {

		if (socketStream == null)
			return false;
		try {
			int i = socketStream.available();
			if (i == 0)
				return false;
			if (pktType == -1) {
				socketStream.flushInputStream(inStream.buffer, 1);
				pktType = inStream.buffer[0] & 0xff;
				if (encryption != null)
					pktType = pktType - encryption.getNextKey() & 0xff;
				pktSize = SizeConstants.packetSizes[pktType];
				i--;
			}
			if (pktSize == -1)
				if (i > 0) {
					socketStream.flushInputStream(inStream.buffer, 1);
					pktSize = inStream.buffer[0] & 0xff;
					i--;
				} else {
					return false;
				}
			if (pktSize == -2)
				if (i > 1) {
					socketStream.flushInputStream(inStream.buffer, 2);
					inStream.currentOffset = 0;
					pktSize = inStream.readUnsignedWord();
					i -= 2;
				} else {
					return false;
				}
			if (i < pktSize)
				return false;
			inStream.currentOffset = 0;
			socketStream.flushInputStream(inStream.buffer, pktSize);
			anInt1009 = 0;
			anInt843 = anInt842;
			anInt842 = anInt841;
			anInt841 = pktType;
			switch (pktType) {
			case 81:
				updatePlayers(pktSize, inStream);
				aBoolean1080 = false;
				pktType = -1;
				return true;

			case 176:
				daysSinceRecovChange = inStream.method427();
				unreadMessages = inStream.method435();
				membersInt = inStream.readUnsignedByte();
				anInt1193 = inStream.method440();
				daysSinceLastLogin = inStream.readUnsignedWord();
				if (anInt1193 != 0 && openInterfaceID == -1) {
					signlink.dnslookup(TextClass.method586(anInt1193));
					clearTopInterfaces();
					char c = '\u028A';
					if (daysSinceRecovChange != 201 || membersInt == 1)
						c = '\u028F';
					reportAbuseInput = "";
					canMute = false;
					for (int k9 = 0; k9 < RSInterface.interfaceCache.length; k9++) {
						if (RSInterface.interfaceCache[k9] == null
								|| RSInterface.interfaceCache[k9].contentType != c)
							continue;
						openInterfaceID = RSInterface.interfaceCache[k9].parentID;

					}
				}
				pktType = -1;
				return true;

			case 64:
				anInt1268 = inStream.method427();
				anInt1269 = inStream.method428();
				for (int j = anInt1268; j < anInt1268 + 8; j++) {
					for (int l9 = anInt1269; l9 < anInt1269 + 8; l9++)
						if (groundArray[plane][j][l9] != null) {
							groundArray[plane][j][l9] = null;
							spawnGroundItem(j, l9);
						}
				}
				for (Class30_Sub1 class30_sub1 = (Class30_Sub1) aClass19_1179
						.reverseGetFirst(); class30_sub1 != null; class30_sub1 = (Class30_Sub1) aClass19_1179
						.reverseGetNext())
					if (class30_sub1.anInt1297 >= anInt1268
							&& class30_sub1.anInt1297 < anInt1268 + 8
							&& class30_sub1.anInt1298 >= anInt1269
							&& class30_sub1.anInt1298 < anInt1269 + 8
							&& class30_sub1.anInt1295 == plane)
						class30_sub1.anInt1294 = 0;
				pktType = -1;
				return true;

			case 185:
				int k = inStream.method436();
				RSInterface.interfaceCache[k].disabledMediaType = 3;
				if (myPlayer.desc == null)
					RSInterface.interfaceCache[k].disabledMediaID = (myPlayer.anIntArray1700[0] << 25)
							+ (myPlayer.anIntArray1700[4] << 20)
							+ (myPlayer.equipment[0] << 15)
							+ (myPlayer.equipment[8] << 10)
							+ (myPlayer.equipment[11] << 5)
							+ myPlayer.equipment[1];
				else
					RSInterface.interfaceCache[k].disabledMediaID = (int) (0x12345678L + myPlayer.desc.type);
				pktType = -1;
				return true;

				/* Clan chat packet */
			case 217:
				try {
					inputTaken = true;
					name = inStream.readString();
					disabledMessage = TextInput.processText(inStream
							.readString());
					clanname = inStream.readString();
					rights = inStream.readUnsignedWord();
					pushMessage(disabledMessage, 16, name);
				} catch (Exception e) {
					e.printStackTrace();
				}
				pktType = -1;
				return true;

			case 107:
				aBoolean1160 = false;
				for (int l = 0; l < 5; l++)
					aBooleanArray876[l] = false;
				pktType = -1;
				return true;

			case 72:
				int i1 = inStream.method434();
				RSInterface class9 = RSInterface.interfaceCache[i1];
				for (int k15 = 0; k15 < class9.inventory.length; k15++) {
					class9.inventory[k15] = -1;
					class9.inventory[k15] = 0;
				}
				pktType = -1;
				return true;

			case 214:
				ignoreCount = pktSize / 8;
				for (int j1 = 0; j1 < ignoreCount; j1++)
					ignoreListAsLongs[j1] = inStream.readQWord();
				pktType = -1;
				return true;

			case 166:
				aBoolean1160 = true;
				anInt1098 = inStream.readUnsignedByte();
				anInt1099 = inStream.readUnsignedByte();
				anInt1100 = inStream.readUnsignedWord();
				anInt1101 = inStream.readUnsignedByte();
				anInt1102 = inStream.readUnsignedByte();
				if (anInt1102 >= 100) {
					xCameraPos = anInt1098 * 128 + 64;
					yCameraPos = anInt1099 * 128 + 64;
					zCameraPos = method42(plane, yCameraPos, xCameraPos)
							- anInt1100;
				}
				pktType = -1;
				return true;

			case 134:
				int k1 = inStream.readUnsignedByte();
				int i10 = inStream.method439();
				int l15 = inStream.readUnsignedByte();
				int oldXp = currentExp[k1];
				if (drawXpBar) {
					drawFlag = true;
				}
				currentExp[k1] = i10;
				currentStats[k1] = l15;
				maxStats[k1] = 1;
				testXp += i10 - oldXp;
				xpToDraw += i10 - oldXp;
				if (testXp == currentExp[k1]) {
					testXp = 0;
					xpToDraw = 0;
				}
				for (int k20 = 0; k20 < 98; k20++)
					if (i10 >= anIntArray1019[k20])
						maxStats[k1] = k20 + 2;
				pktType = -1;
				return true;

			case 71:
				int l1 = inStream.readUnsignedWord();
				int j10 = inStream.method426();
				if (l1 == 65535)
					l1 = -1;
				tabInterfaceIDs[j10] = l1;
				tabAreaAltered = true;
				pktType = -1;
				return true;

			case 74:
				int i2 = inStream.method434();
				if (i2 == 65535)
					i2 = -1;

				pktType = -1;
				return true;

			case 121:
				inStream.method436();
				inStream.method435();
				pktType = -1;
				return true;

			case 109:
				resetLogout();
				pktType = -1;
				return false;

			case 70:
				int k2 = inStream.readSignedWord();
				int l10 = inStream.method437();
				int i16 = inStream.method434();
				RSInterface class9_5 = RSInterface.interfaceCache[i16];
				class9_5.xOffset = k2;
				class9_5.yOffset = l10;
				pktType = -1;
				return true;

			case 73:
			case 241:
				int l2 = anInt1069;
				int i11 = anInt1070;
				if (pktType == 73) {
					l2 = inStream.method435();
					i11 = inStream.readUnsignedWord();
					aBoolean1159 = false;
				}
				if (pktType == 241) {
					i11 = inStream.method435();
					inStream.initBitAccess();
					for (int j16 = 0; j16 < 4; j16++) {
						for (int l20 = 0; l20 < 13; l20++) {
							for (int j23 = 0; j23 < 13; j23++) {
								int i26 = inStream.readBits(1);
								if (i26 == 1)
									anIntArrayArrayArray1129[j16][l20][j23] = inStream
											.readBits(26);
								else
									anIntArrayArrayArray1129[j16][l20][j23] = -1;
							}
						}
					}
					inStream.finishBitAccess();
					l2 = inStream.readUnsignedWord();
					aBoolean1159 = true;
				}
				if (anInt1069 == l2 && anInt1070 == i11 && loadingStage == 2) {
					pktType = -1;
					return true;
				}
				anInt1069 = l2;
				anInt1070 = i11;
				baseX = (anInt1069 - 6) * 8;
				baseY = (anInt1070 - 6) * 8;
				aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49)
						&& anInt1070 / 8 == 48;
				if (anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
					aBoolean1141 = true;
				loadingStage = 1;
				aLong824 = System.currentTimeMillis();
				inGameScreen.initDrawingArea();
				loadingPleaseWait.drawSprite(8, 9);
				;
				inGameScreen.drawGraphics(4, super.graphics, 4);
				if (pktType == 73) {
					int k16 = 0;
					for (int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
						for (int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
							k16++;
					}
					aByteArrayArray1183 = new byte[k16][];
					aByteArrayArray1247 = new byte[k16][];
					anIntArray1234 = new int[k16];
					anIntArray1235 = new int[k16];
					anIntArray1236 = new int[k16];
					k16 = 0;
					for (int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
						for (int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
							anIntArray1234[k16] = (l23 << 8) + j26;
							if (aBoolean1141
									&& (j26 == 49 || j26 == 149 || j26 == 147
											|| l23 == 50 || l23 == 49
											&& j26 == 47)) {
								anIntArray1235[k16] = -1;
								anIntArray1236[k16] = -1;
								k16++;
							} else {
								int k28 = anIntArray1235[k16] = onDemandFetcher
										.method562(0, j26, l23);
								if (k28 != -1)
									onDemandFetcher.method558(3, k28);
								int j30 = anIntArray1236[k16] = onDemandFetcher
										.method562(1, j26, l23);
								if (j30 != -1)
									onDemandFetcher.method558(3, j30);
								k16++;
							}
						}
					}
				}
				if (pktType == 241) {
					int l16 = 0;
					int ai[] = new int[676];
					for (int i24 = 0; i24 < 4; i24++) {
						for (int k26 = 0; k26 < 13; k26++) {
							for (int l28 = 0; l28 < 13; l28++) {
								int k30 = anIntArrayArrayArray1129[i24][k26][l28];
								if (k30 != -1) {
									int k31 = k30 >> 14 & 0x3ff;
									int i32 = k30 >> 3 & 0x7ff;
									int k32 = (k31 / 8 << 8) + i32 / 8;
									for (int j33 = 0; j33 < l16; j33++) {
										if (ai[j33] != k32)
											continue;
										k32 = -1;

									}
									if (k32 != -1)
										ai[l16++] = k32;
								}
							}
						}
					}
					aByteArrayArray1183 = new byte[l16][];
					aByteArrayArray1247 = new byte[l16][];
					anIntArray1234 = new int[l16];
					anIntArray1235 = new int[l16];
					anIntArray1236 = new int[l16];
					for (int l26 = 0; l26 < l16; l26++) {
						int i29 = anIntArray1234[l26] = ai[l26];
						int l30 = i29 >> 8 & 0xff;
						int l31 = i29 & 0xff;
						int j32 = anIntArray1235[l26] = onDemandFetcher
								.method562(0, l31, l30);
						if (j32 != -1)
							onDemandFetcher.method558(3, j32);
						int i33 = anIntArray1236[l26] = onDemandFetcher
								.method562(1, l31, l30);
						if (i33 != -1)
							onDemandFetcher.method558(3, i33);
					}
				}
				int i17 = baseX - anInt1036;
				int j21 = baseY - anInt1037;
				anInt1036 = baseX;
				anInt1037 = baseY;
				for (int j24 = 0; j24 < 16384; j24++) {
					NPC npc = npcArray[j24];
					if (npc != null) {
						for (int j29 = 0; j29 < 10; j29++) {
							npc.smallX[j29] -= i17;
							npc.smallY[j29] -= j21;
						}
						npc.x -= i17 * 128;
						npc.y -= j21 * 128;
					}
				}
				for (int i27 = 0; i27 < maxPlayers; i27++) {
					Player player = playerArray[i27];
					if (player != null) {
						for (int i31 = 0; i31 < 10; i31++) {
							player.smallX[i31] -= i17;
							player.smallY[i31] -= j21;
						}
						player.x -= i17 * 128;
						player.y -= j21 * 128;
					}
				}
				aBoolean1080 = true;
				byte byte1 = 0;
				byte byte2 = 104;
				byte byte3 = 1;
				if (i17 < 0) {
					byte1 = 103;
					byte2 = -1;
					byte3 = -1;
				}
				byte byte4 = 0;
				byte byte5 = 104;
				byte byte6 = 1;
				if (j21 < 0) {
					byte4 = 103;
					byte5 = -1;
					byte6 = -1;
				}
				for (int k33 = byte1; k33 != byte2; k33 += byte3) {
					for (int l33 = byte4; l33 != byte5; l33 += byte6) {
						int i34 = k33 + i17;
						int j34 = l33 + j21;
						for (int k34 = 0; k34 < 4; k34++)
							if (i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
								groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
							else
								groundArray[k34][k33][l33] = null;
					}
				}
				for (Class30_Sub1 class30_sub1_1 = (Class30_Sub1) aClass19_1179
						.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (Class30_Sub1) aClass19_1179
						.reverseGetNext()) {
					class30_sub1_1.anInt1297 -= i17;
					class30_sub1_1.anInt1298 -= j21;
					if (class30_sub1_1.anInt1297 < 0
							|| class30_sub1_1.anInt1298 < 0
							|| class30_sub1_1.anInt1297 >= 104
							|| class30_sub1_1.anInt1298 >= 104)
						class30_sub1_1.unlink();
				}
				if (destX != 0) {
					destX -= i17;
					destY -= j21;
				}
				aBoolean1160 = false;
				pktType = -1;
				return true;

			case 208:
				int i3 = inStream.method437();
				if (i3 >= 0)
					method60(i3);
				anInt1018 = i3;
				pktType = -1;
				return true;

			case 99:
				/*
				 * Black map, mape state 2, causes blackness
				 */
				anInt1021 = inStream.readUnsignedByte();
				pktType = -1;
				return true;

			case 75:
				int j3 = inStream.method436();
				int j11 = inStream.method436();
				RSInterface.interfaceCache[j11].disabledMediaType = 2;
				RSInterface.interfaceCache[j11].disabledMediaID = j3;
				pktType = -1;
				return true;

			case 114:
				anInt1104 = inStream.method434() * 30;
				pktType = -1;
				return true;

			case 60:
				anInt1269 = inStream.readUnsignedByte();
				anInt1268 = inStream.method427();
				while (inStream.currentOffset < pktSize) {
					int k3 = inStream.readUnsignedByte();
					method137(inStream, k3);
				}
				pktType = -1;
				return true;

			case 35:
				int l3 = inStream.readUnsignedByte();
				int k11 = inStream.readUnsignedByte();
				int j17 = inStream.readUnsignedByte();
				int k21 = inStream.readUnsignedByte();
				aBooleanArray876[l3] = true;
				anIntArray873[l3] = k11;
				anIntArray1203[l3] = j17;
				anIntArray928[l3] = k21;
				anIntArray1030[l3] = 0;
				pktType = -1;
				return true;

			case 174:

				/* Empty Following Packet */
				followPlayer = 0;
				followNPC = 0;
				int l11z = inStream.readUnsignedWord();
				int iq = inStream.readUnsignedByte();
				followDistance = inStream.readUnsignedWord();
				if (iq == 0) {
					followNPC = l11z;
				} else if (iq == 1) {
					followPlayer = l11z;
				}
				pktType = -1;
				return true;

			case 104:
				int j4 = inStream.method427();
				int i12 = inStream.method426();
				String s6 = inStream.readString();
				if (j4 >= 1 && j4 <= 5) {
					if (s6.equalsIgnoreCase("null"))
						s6 = null;
					atPlayerActions[j4 - 1] = s6;
					atPlayerArray[j4 - 1] = i12 == 0;
				}
				pktType = -1;
				return true;

			case 78:
				destX = 0;
				pktType = -1;
				return true;

			case 253:
				String s = inStream.readString();
				if (s.startsWith("Alert##")) {
					String[] args = s.split("##");
					if (args.length == 3) {
						alertHandler.alert = new Alert("Notification", args[1],
								args[2]);
					} else if (args.length == 4) {
						alertHandler.alert = new Alert(args[1], args[2],
								args[3]);
					}
					pktType = -1;
					return true;
				}
				if (s.endsWith(":tradereq:")) {
					String s3 = s.substring(0, s.indexOf(":"));
					long l17 = TextClass.longForName(s3);
					boolean flag2 = false;
					for (int j27 = 0; j27 < ignoreCount; j27++) {
						if (ignoreListAsLongs[j27] != l17)
							continue;
						flag2 = true;
					}
					if (!flag2 && anInt1251 == 0)
						pushMessage("wants to trade with you.", 4, s3);
				} else if (s.endsWith(":clan:")) {
					String s4 = s.substring(0, s.indexOf(":"));
					TextClass.longForName(s4);
					pushMessage("Clan: ", 8, s4);
				} else if (s.endsWith("#url#")) {
					String text = s.substring(0, s.indexOf("-"));
					s = s.substring(text.length() + 1).trim();
					String link = s.substring(0, s.indexOf("#"));
					pushMessage(text, 9, link);
				} else if (s.endsWith(":resetautocast:")) {
					Autocast = false;
					autocastId = 0;
					magicAuto.drawSprite(1000, 1000);
				} else if (s.endsWith(":duelreq:")) {
					String s4 = s.substring(0, s.indexOf(":"));
					long l18 = TextClass.longForName(s4);
					boolean flag3 = false;
					for (int k27 = 0; k27 < ignoreCount; k27++) {
						if (ignoreListAsLongs[k27] != l18)
							continue;
						flag3 = true;

					}
					if (!flag3 && anInt1251 == 0)
						pushMessage("wishes to duel with you.", 8, s4);
				} else if (s.endsWith(":chalreq:")) {
					String s5 = s.substring(0, s.indexOf(":"));
					long l19 = TextClass.longForName(s5);
					boolean flag4 = false;
					for (int l27 = 0; l27 < ignoreCount; l27++) {
						if (ignoreListAsLongs[l27] != l19)
							continue;
						flag4 = true;

					}
					if (!flag4 && anInt1251 == 0) {
						String s8 = s.substring(s.indexOf(":") + 1,
								s.length() - 9);
						pushMessage(s8, 8, s5);
					}
				} else if (s.startsWith("shops:")) {
					final String[] split = s.substring(7).split(",");
					int count = 0;
					int lapse = 0;
					for (final String shop : split) {
						if (count == 9) {
							count = 0;
							lapse++;
						}
						shops[lapse][count++] = shop;
					}
					pktType = -1;
					return true;
				} else if (s.startsWith("welcome:")) {
					final String[] split = s.substring(8).split(":");
					welcomeName = split[0];
					welcomeText = split[1];
					pktType = -1;
				} else {
					pushMessage(s, 0, "");
				}
				pktType = -1;
				return true;

			case 1:
				for (int k4 = 0; k4 < playerArray.length; k4++)
					if (playerArray[k4] != null)
						playerArray[k4].anim = -1;
				for (int j12 = 0; j12 < npcArray.length; j12++)
					if (npcArray[j12] != null)
						npcArray[j12].anim = -1;
				pktType = -1;
				return true;

			case 50:
				long l4 = inStream.readQWord();
				int i18 = inStream.readUnsignedByte();
				String s7 = TextClass.fixName(TextClass.nameForLong(l4));
				for (int k24 = 0; k24 < friendsCount; k24++) {
					if (l4 != friendsListAsLongs[k24])
						continue;
					if (friendsNodeIDs[k24] != i18) {
						friendsNodeIDs[k24] = i18;
						if (i18 >= 2) {
							pushMessage(s7 + " just logged in.", 5, "");
						}
						if (i18 <= 1) {
							pushMessage(s7 + " just logged out.", 5, "");
						}
					}
					s7 = null;

				}
				if (s7 != null && friendsCount < 200) {
					friendsListAsLongs[friendsCount] = l4;
					friendsList[friendsCount] = s7;
					friendsNodeIDs[friendsCount] = i18;
					friendsCount++;
				}
				for (boolean flag6 = false; !flag6;) {
					flag6 = true;
					for (int index = 0; index < friendsCount - 1; index++)
						if (friendsNodeIDs[index] != nodeID
								&& friendsNodeIDs[index + 1] == nodeID
								|| friendsNodeIDs[index] == 0
								&& friendsNodeIDs[index + 1] != 0) {
							int j31 = friendsNodeIDs[index];
							friendsNodeIDs[index] = friendsNodeIDs[index + 1];
							friendsNodeIDs[index + 1] = j31;
							String s10 = friendsList[index];
							friendsList[index] = friendsList[index + 1];
							friendsList[index + 1] = s10;
							long l32 = friendsListAsLongs[index];
							friendsListAsLongs[index] = friendsListAsLongs[index + 1];
							friendsListAsLongs[index + 1] = l32;
							flag6 = false;
						}
				}// friends list sorting
				pktType = -1;
				return true;

			case 110:
				if (tabID == 12) {
				}
				energy = inStream.readUnsignedByte();
				pktType = -1;
				return true;

			case 254:
				anInt855 = inStream.readUnsignedByte();
				if (anInt855 == 1)
					anInt1222 = inStream.readUnsignedWord();
				if (anInt855 >= 2 && anInt855 <= 6) {
					if (anInt855 == 2) {
						anInt937 = 64;
						anInt938 = 64;
					}
					if (anInt855 == 3) {
						anInt937 = 0;
						anInt938 = 64;
					}
					if (anInt855 == 4) {
						anInt937 = 128;
						anInt938 = 64;
					}
					if (anInt855 == 5) {
						anInt937 = 64;
						anInt938 = 0;
					}
					if (anInt855 == 6) {
						anInt937 = 64;
						anInt938 = 128;
					}
					anInt855 = 2;
					anInt934 = inStream.readUnsignedWord();
					anInt935 = inStream.readUnsignedWord();
					anInt936 = inStream.readUnsignedByte();
				}
				if (anInt855 == 10)
					anInt933 = inStream.readUnsignedWord();
				pktType = -1;
				return true;

			case 248:
				int i5 = inStream.method435();
				int k12 = inStream.readUnsignedWord();
				if (backDialogID != -1) {
					backDialogID = -1;
					inputTaken = true;
				}
				if (inputDialogState != 0) {
					inputDialogState = 0;
					inputTaken = true;
				}
				openInterfaceID = i5;
				invOverlayInterfaceID = k12;
				tabAreaAltered = true;
				aBoolean1149 = false;
				pktType = -1;
				return true;

			case 79:
				int j5 = inStream.method434();
				int l12 = inStream.method435();
				RSInterface class9_3 = RSInterface.interfaceCache[j5];
				if (class9_3 != null && class9_3.interfaceType == 0) {
					if (l12 < 0)
						l12 = 0;
					if (l12 > class9_3.scrollMax - class9_3.height)
						l12 = class9_3.scrollMax - class9_3.height;
					class9_3.scrollPosition = l12;
				}
				pktType = -1;
				return true;

			case 68:
				for (int k5 = 0; k5 < variousSettings.length; k5++)
					if (variousSettings[k5] != anIntArray1045[k5]) {
						variousSettings[k5] = anIntArray1045[k5];
						method33(k5);
					}
				pktType = -1;
				return true;

			case 196:
				long l5 = inStream.readQWord();
				int j18 = inStream.readDWord();
				int l21 = inStream.readUnsignedByte();
				boolean flag5 = false;
				for (int i28 = 0; i28 < 100; i28++) {
					if (anIntArray1240[i28] != j18)
						continue;
					flag5 = true;

				}
				if (l21 <= 1) {
					for (int l29 = 0; l29 < ignoreCount; l29++) {
						if (ignoreListAsLongs[l29] != l5)
							continue;
						flag5 = true;

					}
				}
				if (!flag5 && anInt1251 == 0)
					try {
						anIntArray1240[anInt1169] = j18;
						anInt1169 = (anInt1169 + 1) % 100;
						String s9 = TextInput.method525(pktSize - 13, inStream);
						// if(l21 != 3)
						// s9 = Censor.doCensor(s9);
						switch (l21) {
						case 1:
							pushMessage(
									s9,
									7,
									"@cr0@"
											+ TextClass.fixName(TextClass
													.nameForLong(l5)));
							break;
						case 2:
							pushMessage(
									s9,
									7,
									"@cr1@"
											+ TextClass.fixName(TextClass
													.nameForLong(l5)));
							break;
						case 3:
							pushMessage(
									s9,
									7,
									"@cr2@"
											+ TextClass.fixName(TextClass
													.nameForLong(l5)));
							break;
						case 4:
							pushMessage(
									s9,
									7,
									"@cr3@"
											+ TextClass.fixName(TextClass
													.nameForLong(l5)));
							break;
						case 5:
							pushMessage(
									s9,
									7,
									"@cr4@"
											+ TextClass.fixName(TextClass
													.nameForLong(l5)));
							break;
						case 6:
							pushMessage(
									s9,
									7,
									"@cr5@"
											+ TextClass.fixName(TextClass
													.nameForLong(l5)));
							break;
						case 7:
							pushMessage(
									s9,
									7,
									"@cr6@"
											+ TextClass.fixName(TextClass
													.nameForLong(l5)));
							break;
						case 8:
							pushMessage(
									s9,
									7,
									"@cr7@"
											+ TextClass.fixName(TextClass
													.nameForLong(l5)));
							break;
						default:
							pushMessage(s9, 3, TextClass.fixName(TextClass
									.nameForLong(l5)));
							break;
						}
						/***
						 * if(l21 == 4) { pushMessage(s9, 7, "@cr0@" +
						 * TextClass.fixName(TextClass.nameForLong(l5))); } else
						 * if(l21 == 3) { pushMessage(s9, 7, "@cr3@" +
						 * TextClass.fixName(TextClass.nameForLong(l5))); } else
						 * if(l21 == 2) { pushMessage(s9, 7, "@cr2@" +
						 * TextClass.fixName(TextClass.nameForLong(l5))); } else
						 * if(l21 == 1) { pushMessage(s9, 7, "@cr1@" +
						 * TextClass.fixName(TextClass.nameForLong(l5))); } else
						 * { pushMessage(s9, 3,
						 * TextClass.fixName(TextClass.nameForLong(l5))); }
						 ***/
					} catch (Exception exception1) {
						signlink.reporterror("cde1");
					}
				pktType = -1;
				return true;

			case 85:
				anInt1269 = inStream.method427();
				anInt1268 = inStream.method427();
				pktType = -1;
				return true;

			case 24:
				anInt1054 = inStream.method428();
				if (anInt1054 == tabID) {
					if (anInt1054 == 3)
						tabID = 1;
					else
						tabID = 3;
				}
				pktType = -1;
				return true;

			case 246:
				int i6 = inStream.method434();
				int i13 = inStream.readUnsignedWord();
				int k18 = inStream.readUnsignedWord();
				if (k18 == 65535) {
					RSInterface.interfaceCache[i6].disabledMediaType = 0;
					pktType = -1;
					return true;
				} else {
					ItemDef itemDef = ItemDef.forID(k18);
					RSInterface.interfaceCache[i6].disabledMediaType = 4;
					RSInterface.interfaceCache[i6].disabledMediaID = k18;
					RSInterface.interfaceCache[i6].modelRotationY = itemDef.modelRotation1;
					RSInterface.interfaceCache[i6].modelRotationX = itemDef.modelRotation2;
					RSInterface.interfaceCache[i6].modelZoom = (itemDef.modelZoom * 100)
							/ i13;
					pktType = -1;
					return true;
				}

			case 171:
				boolean flag1 = inStream.readUnsignedByte() == 1;
				int j13 = inStream.readUnsignedWord();
				RSInterface.interfaceCache[j13].interfaceShown = flag1;
				pktType = -1;
				return true;

			case 142:
				int j6 = inStream.method434();
				method60(j6);
				if (backDialogID != -1) {
					backDialogID = -1;
					inputTaken = true;
				}
				if (inputDialogState != 0) {
					inputDialogState = 0;
					inputTaken = true;
				}
				invOverlayInterfaceID = j6;
				tabAreaAltered = true;
				openInterfaceID = -1;
				aBoolean1149 = false;
				pktType = -1;
				return true;

			case 126:
				String text = inStream.readString();
				int frame = inStream.method435();
				if (text.startsWith("www.")) {
					launchURL(text);
					pktType = -1;
					return true;
				}
				updateStrings(text, frame);
				sendFrame126(text, frame);
				if (frame >= 50017 && frame <= 50117) {
					clanList[frame - 50017] = text;
				}
				pktType = -1;
				return true;

			case 206:
				publicChatMode = inStream.readUnsignedByte();
				privateChatMode = inStream.readUnsignedByte();
				tradeMode = inStream.readUnsignedByte();
				inputTaken = true;
				pktType = -1;
				return true;

			case 240:
				if (tabID == 12) {
				}
				weight = inStream.readSignedWord();
				pktType = -1;
				return true;

			case 8:
				int k6 = inStream.method436();
				int l13 = inStream.readUnsignedWord();
				RSInterface.interfaceCache[k6].disabledMediaType = 1;
				RSInterface.interfaceCache[k6].disabledMediaID = l13;
				pktType = -1;
				return true;

			case 122:
				int l6 = inStream.method436();
				int i14 = inStream.method436();
				int i19 = i14 >> 10 & 0x1f;
				int i22 = i14 >> 5 & 0x1f;
				int l24 = i14 & 0x1f;
				RSInterface.interfaceCache[l6].disabledColor = (i19 << 19)
						+ (i22 << 11) + (l24 << 3);
				pktType = -1;
				return true;

			case 53:
				int i7 = inStream.readUnsignedWord();
				RSInterface class9_1 = RSInterface.interfaceCache[i7];
				int j19 = inStream.readUnsignedWord();
				for (int j22 = 0; j22 < j19; j22++) {
					int i25 = inStream.readUnsignedByte();
					if (i25 == 255)
						i25 = inStream.method440();
					class9_1.inventory[j22] = inStream.method436();
					class9_1.inventoryValue[j22] = i25;
				}
				for (int j25 = j19; j25 < class9_1.inventory.length; j25++) {
					class9_1.inventory[j25] = 0;
					class9_1.inventoryValue[j25] = 0;
				}
				pktType = -1;
				return true;

			case 230:
				int j7 = inStream.method435();
				int j14 = inStream.readUnsignedWord();
				int k19 = inStream.readUnsignedWord();
				int k22 = inStream.method436();
				RSInterface.interfaceCache[j14].modelRotationY = k19;
				RSInterface.interfaceCache[j14].modelRotationX = k22;
				RSInterface.interfaceCache[j14].modelZoom = j7;
				pktType = -1;
				return true;

			case 221:
				anInt900 = inStream.readUnsignedByte();
				pktType = -1;
				return true;

			case 177:
				aBoolean1160 = true;
				anInt995 = inStream.readUnsignedByte();
				anInt996 = inStream.readUnsignedByte();
				anInt997 = inStream.readUnsignedWord();
				anInt998 = inStream.readUnsignedByte();
				anInt999 = inStream.readUnsignedByte();
				if (anInt999 >= 100) {
					int k7 = anInt995 * 128 + 64;
					int k14 = anInt996 * 128 + 64;
					int i20 = method42(plane, k14, k7) - anInt997;
					int l22 = k7 - xCameraPos;
					int k25 = i20 - zCameraPos;
					int j28 = k14 - yCameraPos;
					int i30 = (int) Math.sqrt(l22 * l22 + j28 * j28);
					yCameraCurve = (int) (Math.atan2(k25, i30) * 325.94900000000001D) & 0x7ff;
					xCameraCurve = (int) (Math.atan2(l22, j28) * -325.94900000000001D) & 0x7ff;
					if (yCameraCurve < 128)
						yCameraCurve = 128;
					if (yCameraCurve > 383)
						yCameraCurve = 383;
				}
				pktType = -1;
				return true;

			case 249:
				anInt1046 = inStream.method426();
				unknownInt10 = inStream.method436();
				pktType = -1;
				return true;

			case 65:
				updateNPCs(inStream, pktSize);
				pktType = -1;
				return true;

			case 27:
				messagePromptRaised = false;
				inputDialogState = 1;
				amountOrNameInput = "";
				inputTaken = true;
				pktType = -1;
				return true;

			case 187:
				messagePromptRaised = false;
				inputDialogState = 2;
				amountOrNameInput = "";
				inputTaken = true;
				pktType = -1;
				return true;
			case 97:
				int l7 = inStream.readUnsignedWord();
				method60(l7);
				if (invOverlayInterfaceID != -1) {
					invOverlayInterfaceID = -1;
					tabAreaAltered = true;
				}
				if (backDialogID != -1) {
					backDialogID = -1;
					inputTaken = true;
				}
				if (inputDialogState != 0) {
					inputDialogState = 0;
					inputTaken = true;
				}
				// 17511 = Question Type
				// 15819 = Christmas Type
				// 15812 = Security Type
				// 15801 = Item Scam Type
				// 15791 = Password Safety ?
				// 15774 = Good/Bad Password
				// 15767 = Drama Type ????
				if (l7 == 15244) {
					openInterfaceID = 15774;
					fullscreenInterfaceID = 15244;
				} else {
					openInterfaceID = l7;
				}
				aBoolean1149 = false;
				pktType = -1;
				return true;
			case 218:
				int i8 = inStream.method438();
				dialogID = i8;
				inputTaken = true;
				pktType = -1;
				return true;

			case 87:
				int j8 = inStream.method434();
				int l14 = inStream.method439();
				anIntArray1045[j8] = l14;
				if (variousSettings[j8] != l14) {
					variousSettings[j8] = l14;
					method33(j8);
					if (dialogID != -1)
						inputTaken = true;
				}
				pktType = -1;
				return true;

			case 36:
				int k8 = inStream.method434();
				byte byte0 = inStream.readSignedByte();
				anIntArray1045[k8] = byte0;
				if (variousSettings[k8] != byte0) {
					variousSettings[k8] = byte0;
					method33(k8);
					if (dialogID != -1)
						inputTaken = true;
				}
				pktType = -1;
				return true;

			case 61:
				anInt1055 = inStream.readUnsignedByte();
				pktType = -1;
				return true;

			case 200:
				int l8 = inStream.readUnsignedWord();
				int i15 = inStream.readSignedWord();
				RSInterface class9_4 = RSInterface.interfaceCache[l8];
				class9_4.disabledAnimation = i15;
				class9_4.modelZoom = 1600;
				if (i15 == -1) {
					class9_4.animationLength = 0;
					class9_4.animationDelay = 0;
				}
				pktType = -1;
				return true;

			case 219:
				if (invOverlayInterfaceID != -1) {
					invOverlayInterfaceID = -1;
					tabAreaAltered = true;
				}
				if (backDialogID != -1) {
					backDialogID = -1;
					inputTaken = true;
				}
				if (inputDialogState != 0) {
					inputDialogState = 0;
					inputTaken = true;
				}
				openInterfaceID = -1;
				aBoolean1149 = false;
				pktType = -1;
				return true;

			case 34:
				int i9 = inStream.readUnsignedWord();
				RSInterface class9_2 = RSInterface.interfaceCache[i9];
				while (inStream.currentOffset < pktSize) {
					int j20 = inStream.method422();
					int i23 = inStream.readUnsignedWord();
					int l25 = inStream.readUnsignedByte();
					if (l25 == 255)
						l25 = inStream.readDWord();
					if (j20 >= 0 && j20 < class9_2.inventory.length) {
						class9_2.inventory[j20] = i23;
						class9_2.inventoryValue[j20] = l25;
					}
				}
				pktType = -1;
				return true;

			case 4:
			case 44:
			case 84:
			case 101:
			case 105:
			case 117:
			case 147:
			case 151:
			case 156:
			case 160:
			case 215:
				method137(inStream, pktType);
				pktType = -1;
				return true;

			case 106:
				tabID = inStream.method427();
				tabAreaAltered = true;
				pktType = -1;
				return true;

			case 164:
				int j9 = inStream.method434();
				method60(j9);
				if (invOverlayInterfaceID != -1) {
					invOverlayInterfaceID = -1;
					tabAreaAltered = true;
				}
				backDialogID = j9;
				inputTaken = true;
				openInterfaceID = -1;
				aBoolean1149 = false;
				pktType = -1;
				return true;

			}
			// signlink.reporterror("T1 - " + pktType + "," + pktSize + " - " +
			// anInt842 + "," + anInt843);
			// resetLogout();
		} catch (IOException _ex) {
			dropClient();
		} catch (Exception exception) {
			String s2 = "T2 - " + pktType + "," + anInt842 + "," + anInt843
					+ " - " + pktSize + "," + (baseX + myPlayer.smallX[0])
					+ "," + (baseY + myPlayer.smallY[0]) + " - ";
			for (int j15 = 0; j15 < pktSize && j15 < 50; j15++)
				s2 = s2 + inStream.buffer[j15] + ",";
			// signlink.reporterror(s2);
			// resetLogout();
		}
		pktType = -1;
		return true;
	}

	private void method146() {

		anInt1265++;
		method47(true);
		method26(true);
		method47(false);
		method26(false);
		method55();
		method104();
		if (!aBoolean1160) {
			int i = anInt1184;
			if (anInt984 / 256 > i)
				i = anInt984 / 256;
			if (aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
				i = anIntArray1203[4] + 128;
			int k = minimapInt1 + anInt896 & 0x7ff;
			setCameraPos(600 + i * 3, i, anInt1014,
					method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);

		}
		int j;
		if (!aBoolean1160)
			j = method120();
		else
			j = method121();
		int l = xCameraPos;
		int i1 = zCameraPos;
		int j1 = yCameraPos;
		int k1 = yCameraCurve;
		int l1 = xCameraCurve;
		for (int i2 = 0; i2 < 5; i2++)
			if (aBooleanArray876[i2]) {
				int j2 = (int) ((Math.random()
						* (double) (anIntArray873[i2] * 2 + 1) - (double) anIntArray873[i2]) + Math
						.sin((double) anIntArray1030[i2]
								* ((double) anIntArray928[i2] / 100D))
						* (double) anIntArray1203[i2]);
				if (i2 == 0)
					xCameraPos += j2;
				if (i2 == 1)
					zCameraPos += j2;
				if (i2 == 2)
					yCameraPos += j2;
				if (i2 == 3)
					xCameraCurve = xCameraCurve + j2 & 0x7ff;
				if (i2 == 4) {
					yCameraCurve += j2;
					if (yCameraCurve < 128)
						yCameraCurve = 128;
					if (yCameraCurve > 383)
						yCameraCurve = 383;
				}
			}
		int k2 = Texture.anInt1481;
		Model.aBoolean1684 = true;
		Model.anInt1687 = 0;
		Model.anInt1685 = super.mouseX - 4;
		Model.anInt1686 = super.mouseY - 4;
		DrawingArea.setAllPixelsToZero();
		worldController.method313(xCameraPos, yCameraPos, xCameraCurve,
				zCameraPos, j, yCameraCurve);
		worldController.clearObj5Cache();
		updateEntities();
		drawHeadIcon();
		method37(k2);
		draw3dScreen();
		if (drawFlag) {
			if (xpToDraw != 0) {
				if (flagPos < 125) {
					if (flagPos < 100) {
						flagPos += 2;
					} else {
						flagPos += 1;
					}
					xpFlag.drawSprite(423, flagPos);
					newSmallFont.drawBasicString("" + xpToDraw + "xp", 470,
							flagPos + 20, 0xCC6600, 1);
				} else {
				}
				if (flagPos >= 125) {
					drawFlag = false;
					flagPos = 72;
					xpToDraw = 0;
				}
			}
		}
		if (drawXpBar) {
			String text = "" + testXp;
			int txtWidth = newRegularFont.getTextWidth(text);
			int drawX = 505 - txtWidth;
			sprite1.drawSprite(419, 51);
			newRegularFont.drawBasicString("XP:", 421, 64, 0xFFFFFD, 0);
			newRegularFont.drawBasicString(text, drawX, 64, 0xFFFFFD, 0);
		}
		inGameScreen.drawGraphics(4, super.graphics, 4);
		xCameraPos = l;
		zCameraPos = i1;
		yCameraPos = j1;
		yCameraCurve = k1;
		xCameraCurve = l1;
	}

	/* Packets that opens interfaces */
	public void sendFrame97(int interfaceID) {
		method60(interfaceID);
		if (invOverlayInterfaceID != -1) {
			invOverlayInterfaceID = -1;
			tabAreaAltered = true;
		}
		if (backDialogID != -1) {
			backDialogID = -1;
			inputTaken = true;
		}
		if (inputDialogState != 0) {
			inputDialogState = 0;
			inputTaken = true;
		}
		openInterfaceID = interfaceID;
		aBoolean1149 = false;
	}

	public void clearTopInterfaces() {

		stream.createFrame(130);
		if (invOverlayInterfaceID != -1) {
			invOverlayInterfaceID = -1;
			aBoolean1149 = false;
			tabAreaAltered = true;
		}
		if (backDialogID != -1) {
			backDialogID = -1;
			inputTaken = true;
			aBoolean1149 = false;
		}
		openInterfaceID = -1;
		fullscreenInterfaceID = -1;
	}

	public client() {
		tabHPos = -1;
		alertHandler = new AlertHandler(this);
		fullscreenInterfaceID = -1;
		chatRights = new int[500];
		clanTitles = new String[500];
		chatTypeView = 0;
		clanChatMode = 0;
		cButtonHPos = -1;
		cButtonCPos = 0;
		anIntArrayArray825 = new int[104][104];
		friendsNodeIDs = new int[200];
		groundArray = new NodeList[4][104][104];
		aBoolean831 = false;
		aStream_834 = new Stream(new byte[17000]);
		npcArray = new NPC[16384];
		npcIndices = new int[16384];
		anIntArray840 = new int[1000];
		aStream_847 = Stream.create();
		openInterfaceID = -1;
		currentExp = new int[Skills.skillsCount];
		anIntArray873 = new int[5];
		aBooleanArray876 = new boolean[5];
		drawFlames = false;
		reportAbuseInput = "";
		unknownInt10 = -1;
		menuOpen = false;
		inputString = "";
		maxPlayers = 2048;
		myPlayerIndex = 2047;
		playerArray = new Player[maxPlayers];
		playerIndices = new int[maxPlayers];
		anIntArray894 = new int[maxPlayers];
		aStreamArray895s = new Stream[maxPlayers];
		anInt897 = 1;
		anIntArrayArray901 = new int[104][104];
		anInt902 = 0x766654;
		aByteArray912 = new byte[16384];
		currentStats = new int[Skills.skillsCount];
		ignoreListAsLongs = new long[100];
		loadingError = false;
		anInt927 = 0x332d25;
		anIntArray928 = new int[5];
		anIntArrayArray929 = new int[104][104];
		chatTypes = new int[500];
		chatNames = new String[500];
		chatMessages = new String[500];
		chatButtons = new Sprite[4];
		sideIcons = new Sprite[14];
		sIcons483 = new Sprite[14];
		newSideIcons = new Sprite[16];
		sIcons459 = new Sprite[13];

		redStones = new Sprite[16];
		aBoolean954 = true;
		friendsListAsLongs = new long[200];
		drawingFlames = false;
		spriteDrawX = -1;
		spriteDrawY = -1;
		anIntArray968 = new int[33];
		anIntArray969 = new int[256];
		decompressors = new Decompressor[5];
		variousSettings = new int[2000];
		aBoolean972 = false;
		anInt975 = 50;
		anIntArray976 = new int[anInt975];
		anIntArray977 = new int[anInt975];
		anIntArray978 = new int[anInt975];
		anIntArray979 = new int[anInt975];
		anIntArray980 = new int[anInt975];
		anIntArray981 = new int[anInt975];
		anIntArray982 = new int[anInt975];
		aStringArray983 = new String[anInt975];
		anInt985 = -1;
		hitMarks = new Sprite[24];
		hitMark = new Sprite[4];
		anIntArray990 = new int[5];
		aBoolean994 = false;
		anInt1002 = 0x23201b;
		amountOrNameInput = "";
		aClass19_1013 = new NodeList();
		aBoolean1017 = false;
		anInt1018 = -1;
		anIntArray1030 = new int[5];
		aBoolean1031 = false;
		mapFunctions = new Sprite[100];
		dialogID = -1;
		applyTrans = 0;
		maxStats = new int[Skills.skillsCount];
		anIntArray1045 = new int[2000];
		aBoolean1047 = true;
		anIntArray1052 = new int[152];// map
		anInt1054 = -1;
		aClass19_1056 = new NodeList();
		anIntArray1057 = new int[33];
		aClass9_1059 = new RSInterface();
		mapScenes = new Background[100];
		barFillColor = 0x4d4233;
		anIntArray1065 = new int[7];
		anIntArray1072 = new int[1000];
		anIntArray1073 = new int[1000];
		aBoolean1080 = false;
		friendsList = new String[200];
		inStream = Stream.create();
		expectedCRCs = new int[9];
		menuActionCmd2 = new int[500];
		menuActionCmd3 = new int[500];
		menuActionCmd4 = new int[500];
		menuActionID = new int[500];
		menuActionCmd1 = new int[500];
		headIcons = new Sprite[29];
		skullIcons = new Sprite[20];
		headIconsHint = new Sprite[20];
		tabAreaAltered = false;
		aString1121 = "";
		atPlayerActions = new String[5];
		atPlayerArray = new boolean[5];
		anIntArrayArrayArray1129 = new int[4][13][13];
		anInt1132 = 2;
		aSpriteArray1140 = new Sprite[1000];
		aBoolean1141 = false;
		aBoolean1149 = false;
		crosses = new Sprite[8];
		loggedIn = false;
		canMute = false;
		aBoolean1159 = false;
		aBoolean1160 = false;
		anInt1171 = 1;
		myUsername = "";
		myPassword = "";
		genericLoadingError = false;
		reportAbuseInterfaceID = -1;
		aClass19_1179 = new NodeList();
		anInt1184 = 128;
		invOverlayInterfaceID = -1;
		stream = Stream.create();
		menuActionName = new String[500];
		anIntArray1203 = new int[5];
		anIntArray1207 = new int[50];
		anInt1210 = 2;
		anInt1211 = 78;
		promptInput = "";
		// modIcons = new Background[2];
		modIcons = new Sprite[8];
		chatImages = new Sprite[8];
		tabID = 3;
		inputTaken = false;
		anIntArray1229 = new int[152];// map
		aClass11Array1230 = new Class11[4];
		anIntArray1240 = new int[100];
		anIntArray1241 = new int[50];
		aBoolean1242 = false;
		anIntArray1250 = new int[50];
		rsAlreadyLoaded = false;
		welcomeScreenRaised = true;
		messagePromptRaised = false;
		loginMessage1 = "";
		loginMessage2 = "";
		backDialogID = -1;
		anInt1279 = 2;
		bigX = new int[4000];
		bigY = new int[4000];
	}

	public int rights;

	public String name;
	public String disabledMessage;
	public String clanname;
	private final int[] chatRights;
	private final String[] clanTitles;
	public int chatTypeView;
	public int clanChatMode;
	public int duelMode;
	/* Declare custom sprites */
	// private Sprite chatArea;
	private Sprite loadingPleaseWait;
	private Sprite reestablish;
	private Sprite[] chatButtons;
	private Sprite tabHover;
	private Sprite tabClicked;
	private Sprite[] newSideIcons;
	// private Sprite CustomMapback;
	public Sprite[] CustomMapback = new Sprite[5];
	public Sprite[] chatArea = new Sprite[5];
	public Sprite[] tabArea = new Sprite[5];
	// public Sprite[] mapArea = new Sprite[3];
	/**/
	private RSImageProducer leftFrame;
	private RSImageProducer topFrame;
	private int ignoreCount;
	private long aLong824;
	private int[][] anIntArrayArray825;
	private int[] friendsNodeIDs;
	private NodeList[][][] groundArray;
	private int[] anIntArray828;
	private volatile boolean aBoolean831;
	private int loginScreenState;
	private Stream aStream_834;
	private NPC[] npcArray;
	private int npcCount;
	private int[] npcIndices;
	private int anInt839;
	private int[] anIntArray840;
	private int anInt841;
	private int anInt842;
	private int anInt843;
	private String aString844;
	private int privateChatMode;
	private Stream aStream_847;
	private static int anInt849;
	private int[] anIntArray850;
	private int[] anIntArray851;
	private int[] anIntArray852;
	private int[] anIntArray853;
	private static int anInt854;
	private int anInt855;
	private int openInterfaceID;
	private int xCameraPos;
	private int zCameraPos;
	private int yCameraPos;
	private int yCameraCurve;
	private int xCameraCurve;
	public int myPrivilege;
	private final int[] currentExp;
	private Sprite[] redStones;
	private Sprite mapFlag;
	private Sprite mapMarker;
	private final int[] anIntArray873;
	private final boolean[] aBooleanArray876;
	private int weight;
	private MouseDetection mouseDetection;
	private volatile boolean drawFlames;
	private String reportAbuseInput;
	private int unknownInt10;
	private boolean menuOpen;
	private int anInt886;
	private String inputString;
	private final int maxPlayers;
	private final int myPlayerIndex;
	private Player[] playerArray;
	private int playerCount;
	private int[] playerIndices;
	private int anInt893;
	private int[] anIntArray894;
	private Stream[] aStreamArray895s;
	private int anInt896;
	private int anInt897;
	private int friendsCount;
	private int anInt900;
	private int[][] anIntArrayArray901;
	private final int anInt902;
	private byte[] aByteArray912;
	private int anInt913;
	private int crossX;
	private int crossY;
	private int crossIndex;
	private int crossType;
	private int plane;
	private final int[] currentStats;
	private static int anInt924;
	private final long[] ignoreListAsLongs;
	private boolean loadingError;
	private final int anInt927;
	private final int[] anIntArray928;
	private int[][] anIntArrayArray929;
	private Sprite aSprite_931;
	private Sprite aSprite_932;
	private int anInt933;
	private int anInt934;
	private int anInt935;
	private int anInt936;
	private int anInt937;
	private int anInt938;
	private final int[] chatTypes;
	private final String[] chatNames;
	private final String[] chatMessages;
	private int anInt945;
	private WorldController worldController;
	private Sprite[] sideIcons;
	private Sprite[] sIcons483;
	private Sprite[] sIcons459;
	private int menuScreenArea;
	private int menuOffsetX;
	private int menuOffsetY;
	private int menuWidth;
	private int menuHeight;
	private long aLong953;
	private boolean aBoolean954;
	private long[] friendsListAsLongs;
	private String[] clanList = new String[100];
	private static int nodeID = 10;
	static int portOff;
	static boolean clientData;
	private static boolean isMembers = true;
	private static boolean lowMem;
	private volatile boolean drawingFlames;
	private int spriteDrawX;
	private int spriteDrawY;
	private final int[] anIntArray965 = { 0xffff00, 0xff0000, 65280, 65535,
			0xff00ff, 0xffffff };
	private Sprite titleBox;
	public Sprite titleBox1;
	private Background titleButton;
	private final int[] anIntArray968;
	private final int[] anIntArray969;
	final Decompressor[] decompressors;
	public int variousSettings[];
	private boolean aBoolean972;
	private final int anInt975;
	private final int[] anIntArray976;
	private final int[] anIntArray977;
	private final int[] anIntArray978;
	private final int[] anIntArray979;
	private final int[] anIntArray980;
	private final int[] anIntArray981;
	private final int[] anIntArray982;
	private final String[] aStringArray983;
	private int anInt984;
	private int anInt985;
	private static int anInt986;
	private Sprite[] hitMarks;
	private Sprite[] hitMark;
	private int anInt988;
	private int anInt989;
	private final int[] anIntArray990;
	private final boolean aBoolean994;
	private int anInt995;
	private int anInt996;
	private int anInt997;
	private int anInt998;
	private int anInt999;
	private ISAACRandomGen encryption;
	private Sprite mapEdge;
	private Sprite multiOverlay;
	private final int anInt1002;
	static final int[][] anIntArrayArray1003 = {
			{ 6798, 107, 10283, 16, 4797, 7744, 5799, 4634, 33697, 22433, 2983,
					54193 },
			{ 8741, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094, 10153,
					56621, 4783, 1341, 16578, 35003, 25239 },
			{ 25238, 8742, 12, 64030, 43162, 7735, 8404, 1701, 38430, 24094,
					10153, 56621, 4783, 1341, 16578, 35003 },
			{ 4626, 11146, 6439, 12, 4758, 10270 },
			{ 4550, 20165, 43678, 16895, 28416, 12231, 947, 60359, 32433 } };
	private String amountOrNameInput;
	private static int anInt1005;
	private int daysSinceLastLogin;
	private int pktSize;
	private int pktType;
	private int anInt1009;
	private int anInt1010;
	private int anInt1011;
	private NodeList aClass19_1013;
	private int anInt1014;
	private int anInt1015;
	private int anInt1016;
	private boolean aBoolean1017;
	private int anInt1018;
	private static final int[] anIntArray1019;
	private int anInt1021;
	private int anInt1022;
	private int loadingStage;
	private Sprite scrollBar1;
	private Sprite scrollBar2;
	private Sprite scrollBar3;
	private Sprite scrollBar4;
	private int anInt1026;
	private final int[] anIntArray1030;
	private boolean aBoolean1031;
	private Sprite[] mapFunctions;
	private int baseX;
	private int baseY;
	private int anInt1036;
	private int anInt1037;
	private int loginFailures;
	private int anInt1039;
	private int anInt1040;
	private int anInt1041;
	private int dialogID;
	private final int[] maxStats;
	private final int[] anIntArray1045;
	private int anInt1046;
	private boolean aBoolean1047;
	private int anInt1048;
	private String aString1049;
	private static int anInt1051;
	private final int[] anIntArray1052;
	private NamedArchive titleStreamLoader;
	private int anInt1054;
	private int anInt1055;
	private NodeList aClass19_1056;
	private final int[] anIntArray1057;
	public final RSInterface aClass9_1059;
	private Background[] mapScenes;
	private static int anInt1061;
	private int anInt1062;
	private final int barFillColor;
	private int friendsListAction;
	private final int[] anIntArray1065;
	private int mouseInvInterfaceIndex;
	private int lastActiveInvInterface;
	public OnDemandFetcher onDemandFetcher;
	private int anInt1069;
	private int anInt1070;
	private int anInt1071;
	private int[] anIntArray1072;
	private int[] anIntArray1073;
	private Sprite mapDotItem;
	private Sprite mapDotNPC;
	private Sprite mapDotPlayer;
	private Sprite mapDotFriend;
	private Sprite mapDotTeam;
	private Sprite mapDotClan;
	private int anInt1079;
	private boolean aBoolean1080;
	private String[] friendsList;
	private Stream inStream;
	private int anInt1084;
	private int anInt1085;
	private int activeInterfaceType;
	private int anInt1087;
	private int anInt1088;
	public static int anInt1089;
	private final int[] expectedCRCs;
	public int[] menuActionCmd2;
	public int[] menuActionCmd3;
	public int[] menuActionCmd4;
	public int[] menuActionID;
	public int[] menuActionCmd1;
	private Sprite[] headIcons;
	private Sprite[] skullIcons;
	private Sprite[] headIconsHint;
	private static int anInt1097;
	private int anInt1098;
	private int anInt1099;
	private int anInt1100;
	private int anInt1101;
	private int anInt1102;
	private static boolean tabAreaAltered;
	private int anInt1104;
	private RSImageProducer aRSImageProducer_1107;
	private RSImageProducer aRSImageProducer_1108;
	private RSImageProducer loginScreenArea;
	private RSImageProducer leftSideFlame;
	private RSImageProducer rightSideFlame;
	private RSImageProducer gameLogo;
	private RSImageProducer aRSImageProducer_1113;
	private RSImageProducer aRSImageProducer_1114;
	private RSImageProducer aRSImageProducer_1115;
	private static int anInt1117;
	private int membersInt;
	private String aString1121;
	private Sprite compass;
	private RSImageProducer aRSImageProducer_1125;
	public static Player myPlayer;
	private final String[] atPlayerActions;
	private final boolean[] atPlayerArray;
	private final int[][][] anIntArrayArrayArray1129;
	private final int[] tabInterfaceIDs = { -1, -1, -1, -1, -1, -1, -1, -1, -1,
			-1, -1, -1, -1, -1, -1, -1, -1 };
	private int anInt1131;
	private int anInt1132;
	public int menuActionRow;
	private static int anInt1134;
	private int spellSelected;
	private int anInt1137;
	private int spellUsableOn;
	private String spellTooltip;
	private Sprite[] aSpriteArray1140;
	private boolean aBoolean1141;
	private static int anInt1142;
	public int energy;
	private boolean aBoolean1149;
	private Sprite[] crosses;
	private Background[] aBackgroundArray1152s;
	private int unreadMessages;
	private static int anInt1155;
	private static boolean fpsOn;
	public boolean loggedIn;
	private boolean canMute;
	private boolean aBoolean1159;
	private boolean aBoolean1160;
	static int loopCycle;
	private static final String validUserPassChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"\243$%^&*()-_=+[{]};:'@#~,<.>/?\\| ";
	private RSImageProducer inventoryBackImage;
	private RSImageProducer mapBackImage;
	private RSImageProducer inGameScreen;
	private RSImageProducer chatBackImage;
	private int daysSinceRecovChange;
	private RSSocket socketStream;
	private int anInt1169;
	public int applyTrans;
	private int minimapInt3;
	private int anInt1171;
	private static String myUsername;
	private static String myPassword;
	private static int anInt1175;
	private boolean genericLoadingError;
	private final int[] anIntArray1177 = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2,
			2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3 };
	private int reportAbuseInterfaceID;
	private NodeList aClass19_1179;
	private int[] anIntArray1180;
	private int[] anIntArray1181;
	private int[] anIntArray1182;
	private byte[][] aByteArrayArray1183;
	private int anInt1184;
	private int minimapInt1;
	private int anInt1186;
	private int anInt1187;
	private static int anInt1188;
	private int invOverlayInterfaceID;
	private int[] anIntArray1190;
	private int[] anIntArray1191;
	public Stream stream;
	private int anInt1193;
	private int splitPrivateChat;
	private Background mapBack;
	public String[] menuActionName;
	private Sprite aSprite_1201;
	private Sprite aSprite_1202;
	private final int[] anIntArray1203;
	static final int[] anIntArray1204 = { 9104, 10275, 7595, 3610, 7975, 8526,
			918, 38802, 24466, 10145, 58654, 5027, 1457, 16565, 34991, 25486 };
	private static boolean flagged;
	private final int[] anIntArray1207;
	private int anInt1208;
	private int minimapInt2;
	private int anInt1210;
	private int anInt1211;
	private String promptInput;
	private int anInt1213;
	private int[][][] intGroundArray;
	private long aLong1215;
	private int loginScreenCursorPos;
	// private final Background[] modIcons;
	public final Sprite[] modIcons;
	private long aLong1220;
	private static int tabID;
	private int anInt1222;
	public static boolean inputTaken;
	public int inputDialogState;
	private static int anInt1226;
	private final int[] anIntArray1229;
	private Class11[] aClass11Array1230;
	public static int anIntArray1232[];
	private int[] anIntArray1234;
	private int[] anIntArray1235;
	private int[] anIntArray1236;
	private int anInt1237;
	private int anInt1238;
	public final int anInt1239 = 100;
	private final int[] anIntArray1240;
	private final int[] anIntArray1241;
	private boolean aBoolean1242;
	private int atInventoryLoopCycle;
	private int atInventoryInterface;
	private int atInventoryIndex;
	private int atInventoryInterfaceType;
	private byte[][] aByteArrayArray1247;
	private int tradeMode;
	private int anInt1249;
	private final int[] anIntArray1250;
	private int anInt1251;
	private final boolean rsAlreadyLoaded;
	private int anInt1253;
	private int anInt1254;
	private boolean welcomeScreenRaised;
	private boolean messagePromptRaised;
	private byte[][][] byteGroundArray;
	private int destX;
	private int destY;
	private Sprite aSprite_1263;
	private int anInt1264;
	private int anInt1265;
	private String loginMessage1;
	private String loginMessage2;
	private int anInt1268;
	private int anInt1269;
	public RSFont smallText;
	public RSFont aTextDrawingArea_1271;
	private RSFont chatTextDrawingArea;
	private int backDialogID;
	private int anInt1278;
	private int anInt1279;
	private int[] bigX;
	private int[] bigY;
	private int itemSelected;
	private int anInt1283;
	private int anInt1284;
	private int anInt1285;
	private Sprite StaffToggle;
	private Sprite StaffType;
	private Sprite StaffSelectBg;
	private Sprite StaffSelect;
	private Sprite StaffSelectH;
	private Sprite StaffSelected;
	private Sprite StaffSend;
	private Sprite StaffError;
	private String selectedItemName;
	private int publicChatMode;
	private static int anInt1288;
	public static int anInt1290;
	public static String server = "127.0.0.1";
	// public static String server = "162.218.48.26";
	public int drawCount;
	public int fullscreenInterfaceID;
	public int anInt1044;// 377
	public int anInt1129;// 377
	public int anInt1315;// 377
	public int anInt1500;// 377
	public int anInt1501;// 377
	public int[] fullScreenTextureArray;

	public void resetAllImageProducers() {
		if (super.fullGameScreen != null) {
			return;
		}
		chatBackImage = null;
		mapBackImage = null;
		inventoryBackImage = null;
		inGameScreen = null;
		aRSImageProducer_1125 = null;
		aRSImageProducer_1107 = null;
		aRSImageProducer_1108 = null;
		loginScreenArea = null;
		leftSideFlame = null;
		rightSideFlame = null;
		gameLogo = null;
		aRSImageProducer_1113 = null;
		aRSImageProducer_1114 = null;
		aRSImageProducer_1115 = null;
		super.fullGameScreen = new RSImageProducer(765, 503, getGameComponent());
		welcomeScreenRaised = true;
	}

	public boolean spriteChanged = false;

	public int getSpriteID() {
		spriteChanged = true;
		if (is562)
			return 4;
		if (is459)
			return 3;
		if (is480)
			return 2;
		if (is508 || is525)
			return 1;
		if (is474)
			return 0;
		else
			return 0;
	}

	public void launchURL(String url) {
		String osName = System.getProperty("os.name");
		try {
			if (osName.startsWith("Mac OS")) {
				Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
				Method openURL = fileMgr.getDeclaredMethod("openURL",
						new Class[] { String.class });
				openURL.invoke(null, new Object[] { url });
			} else if (osName.startsWith("Windows"))
				Runtime.getRuntime().exec(
						"rundll32 url.dll,FileProtocolHandler " + url);
			else { // assume Unix or Linux
				String[] browsers = { "firefox", "opera", "konqueror",
						"epiphany", "mozilla", "netscape", "safari" };
				String browser = null;
				for (int count = 0; count < browsers.length && browser == null; count++)
					if (Runtime.getRuntime()
							.exec(new String[] { "which", browsers[count] })
							.waitFor() == 0)
						browser = browsers[count];
				if (browser == null) {
					throw new Exception("Could not find web browser");
				} else
					Runtime.getRuntime().exec(new String[] { browser, url });
			}
		} catch (Exception e) {
			pushMessage("Failed to open URL.", 0, "");
		}
	}

	static {
		anIntArray1019 = new int[99];
		int i = 0;
		for (int j = 0; j < 99; j++) {
			int l = j + 1;
			int i1 = (int) ((double) l + 300D * Math.pow(2D, (double) l / 7D));
			i += i1;
			anIntArray1019[j] = i / 4;
		}
		anIntArray1232 = new int[32];
		i = 2;
		for (int k = 0; k < 32; k++) {
			anIntArray1232[k] = i - 1;
			i += i;
		}
	}
}